Add test case for root with max_pathlen=0

This was already working but not tested so far

(Test case from previous commit still failing.)

Test certificates generated with:

programs/pkey/gen_key type=ec ec_curve=secp256r1 filename=cert91.key
programs/pkey/gen_key type=ec ec_curve=secp256r1 filename=cert92.key

programs/x509/cert_write serial=91 output_file=cert91.crt is_ca=1 \
    issuer_key=cert91.key issuer_name="CN=Root 9,O=mbed TLS,C=UK" \
    selfsign=1 max_pathlen=0
programs/x509/cert_write serial=92 output_file=cert92.crt \
    issuer_key=cert91.key issuer_name="CN=Root 9,O=mbed TLS,C=UK" \
    subject_key=cert92.key subject_name="CN=EE 92,O=mbed TLS,C=UK"
This commit is contained in:
Manuel Pégourié-Gonnard 2015-12-03 09:49:57 +01:00
parent cec3289659
commit d7d0b0118c
4 changed files with 70 additions and 1 deletions

View File

@ -40,3 +40,8 @@ cert71.crt (max_pathlen=1) -> cert72.crt -> cert73.crt (self signed) -> cert74.c
``` ```
cert81.crt -> cert82.crt (max_pathlen=0) -> cert83.crt cert81.crt -> cert82.crt (max_pathlen=0) -> cert83.crt
``` ```
9. zero pathlen constraint on trusted root (valid)
```
cert91.crt (max_pathlen=0) -> cert92.crt
```

View File

@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIFMDCCAxigAwIBAgIBWzANBgkqhkiG9w0BAQsFADAxMQ8wDQYDVQQDEwZSb290
IDkxETAPBgNVBAoTCG1iZWQgVExTMQswCQYDVQQGEwJVSzAeFw0wMTAxMDEwMDAw
MDBaFw0zMDEyMzEyMzU5NTlaMDExDzANBgNVBAMTBlJvb3QgOTERMA8GA1UEChMI
bWJlZCBUTFMxCzAJBgNVBAYTAlVLMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC
CgKCAgEAriINpPI+qGnaHxP+bRU3ZkkoaVBIckbrVY+KBa2BMyqXnbY4cmXUUxQY
Su0JqfVt20e/z8ydIgyIe3j9dGsLAxDgc443NPb2v6Y3Deyn1CS75XpKskiy4Fzk
eB3o2UzZFZP0hEIfgKvxHH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hgToGWy86aybvShCCc=
-----END CERTIFICATE-----

View File

@ -390,10 +390,14 @@ X509 CRT verify chain #8 (self signed maxpathlen root)
depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA2_C depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA2_C
x509_crt_verify_chain:"data_files/dir4/cert61.crt data_files/dir4/cert63.crt data_files/dir4/cert62.crt":"data_files/dir4/cert61.crt":0 x509_crt_verify_chain:"data_files/dir4/cert61.crt data_files/dir4/cert63.crt data_files/dir4/cert62.crt":"data_files/dir4/cert61.crt":0
X509 CRT verify chain #9 (self signed maxpathlen root) X509 CRT verify chain #9 (zero pathlen first intermediate, valid)
depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA2_C depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA2_C
x509_crt_verify_chain:"data_files/dir4/cert83.crt data_files/dir4/cert82.crt":"data_files/dir4/cert81.crt":0 x509_crt_verify_chain:"data_files/dir4/cert83.crt data_files/dir4/cert82.crt":"data_files/dir4/cert81.crt":0
X509 CRT verify chain #10 (zero pathlen root, valid)
depends_on:POLARSSL_PEM_C:POLARSSL_FS_IO:POLARSSL_SHA2_C
x509_crt_verify_chain:"data_files/dir4/cert92.crt":"data_files/dir4/cert91.crt":0
X509 Parse Selftest X509 Parse Selftest
depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_SELF_TEST depends_on:POLARSSL_MD5_C:POLARSSL_PEM_C:POLARSSL_SELF_TEST
x509_selftest: x509_selftest: