mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-22 13:20:50 +00:00
Further test improvements
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
9a1c428966
commit
05d5c3e734
@ -556,8 +556,8 @@ authorityKeyId_subjectKeyId.crt.der:
|
||||
authorityKeyId_no_keyid.crt.der:
|
||||
$(OPENSSL) req -x509 -nodes -days 7300 -key server2.key -outform DER -out $@ -config authorityKeyId_subjectKeyId.conf -extensions 'v3_req_authorityKeyId_no_keyid'
|
||||
|
||||
authorityKeyId_no_issuer_serial.crt.der:
|
||||
$(OPENSSL) req -x509 -nodes -days 7300 -key server2.key -outform DER -out $@ -config authorityKeyId_subjectKeyId.conf -extensions 'v3_req_authorityKeyId_no_issuer_serial'
|
||||
authorityKeyId_no_authorityKeyId.crt.der:
|
||||
$(OPENSSL) req -x509 -nodes -days 7300 -key server2.key -outform DER -out $@ -config authorityKeyId_subjectKeyId.conf -extensions 'v3_req_no_authorityKeyId'
|
||||
|
||||
authorityKeyId_empty.crt.der:
|
||||
$(OPENSSL) req -x509 -nodes -days 7300 -key server2.key -outform DER -out $@ -config authorityKeyId_subjectKeyId.conf -extensions 'v3_req_authorityKeyId_empty'
|
||||
|
BIN
tests/data_files/authorityKeyId_no_authorityKeyId.crt.der
Normal file
BIN
tests/data_files/authorityKeyId_no_authorityKeyId.crt.der
Normal file
Binary file not shown.
Binary file not shown.
@ -12,7 +12,7 @@ authorityKeyIdentifier = keyid:always,issuer:always
|
||||
[v3_req_authorityKeyId_no_keyid]
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = issuer:always
|
||||
[v3_req_authorityKeyId_no_issuer_serial]
|
||||
[v3_req_no_authorityKeyId]
|
||||
subjectKeyIdentifier = hash
|
||||
[v3_req_authorityKeyId_empty]
|
||||
subjectKeyIdentifier = hash
|
||||
|
@ -3309,7 +3309,7 @@ X509 CRT parse Subject Key Id - Wrong OCTET_STRING tag
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
x509_crt_parse_subjectkeyid:"data_files/authorityKeyId_subjectKeyId_tag_malformed.crt.der":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
X509 CRT parse Subject Key Id - Wrong OCTET_STRING tag
|
||||
X509 CRT parse Subject Key Id - Wrong OCTET_STRING length
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
x509_crt_parse_subjectkeyid:"data_files/authorityKeyId_subjectKeyId_tag_len_malformed.crt.der":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
|
||||
@ -3321,9 +3321,9 @@ X509 CRT parse Authority Key Id - Correct Authority Key ID (no keyid)
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_no_keyid.crt.der":"":"NL/PolarSSL/PolarSSL Test CA/":"7581F2D168FE33F964F0AE5FE884FAD3C55F24DA":0
|
||||
|
||||
X509 CRT parse Authority Key Id - Correct Authority Key ID (no issuer and serial)
|
||||
X509 CRT parse Authority Key Id - no Authority Key ID
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_no_issuer_serial.crt.der":"A505E864B8DCDF600F50124D60A864AF4D8B4393":"":"":0
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_no_authorityKeyId.crt.der":"":"":"":0
|
||||
|
||||
X509 CRT parse Authority Key Id - Correct Authority Key ID (empty)
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
@ -3345,11 +3345,11 @@ X509 CRT parse Authority Key Id - Wrong KeyId Tag Length
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_keyid_tag_len_malformed.crt.der":"":"":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_INVALID_LENGTH
|
||||
|
||||
X509 CRT parse Authority Key Id - Wrong Issuer Tag 1
|
||||
X509 CRT parse Authority Key Id - Wrong Issuer Tag
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_issuer_tag1_malformed.crt.der":"":"":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
X509 CRT parse Authority Key Id - Wrong Issuer Tag 2
|
||||
X509 CRT parse Authority Key Id - Wrong DirectoryName tag in issuer field
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_issuer_tag2_malformed.crt.der":"":"":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
|
@ -1549,7 +1549,7 @@ exit:
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_FS_IO */
|
||||
void x509_crt_parse_subjectkeyid(char *file, data_t *subjectKeyId, int ref_ret)
|
||||
{
|
||||
mbedtls_x509_crt crt;
|
||||
@ -1572,7 +1572,7 @@ exit:
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C */
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:MBEDTLS_FS_IO */
|
||||
void x509_crt_parse_authoritykeyid(char *file,
|
||||
data_t* keyId,
|
||||
char *authorityKeyId_issuer,
|
||||
@ -1592,15 +1592,19 @@ void x509_crt_parse_authoritykeyid(char *file,
|
||||
|
||||
if (ref_ret == 0) {
|
||||
/* KeyId test */
|
||||
if (crt.authority_key_id.keyIdentifier.len > 0)
|
||||
if (keyId->len > 0)
|
||||
{
|
||||
TEST_EQUAL(crt.authority_key_id.keyIdentifier.tag, MBEDTLS_ASN1_OCTET_STRING);
|
||||
TEST_EQUAL(memcmp(crt.authority_key_id.keyIdentifier.p, keyId->x, keyId->len), 0);
|
||||
TEST_EQUAL(crt.authority_key_id.keyIdentifier.len, keyId->len);
|
||||
} else {
|
||||
TEST_EQUAL(crt.authority_key_id.keyIdentifier.tag, 0);
|
||||
TEST_EQUAL(crt.authority_key_id.keyIdentifier.len, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Issuer test */
|
||||
if (crt.authority_key_id.authorityCertIssuer.buf.len > 0)
|
||||
if (strlen(authorityKeyId_issuer) > 0)
|
||||
{
|
||||
mbedtls_x509_sequence *issuerPtr = &crt.authority_key_id.authorityCertIssuer;
|
||||
|
||||
@ -1621,13 +1625,16 @@ void x509_crt_parse_authoritykeyid(char *file,
|
||||
}
|
||||
|
||||
/* Serial test */
|
||||
if (crt.authority_key_id.authorityCertSerialNumber.len > 0)
|
||||
if (serial->len > 0)
|
||||
{
|
||||
TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.tag,
|
||||
MBEDTLS_ASN1_INTEGER);
|
||||
TEST_EQUAL(memcmp(crt.authority_key_id.authorityCertSerialNumber.p,
|
||||
serial->x, serial->len), 0);
|
||||
TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.len, serial->len);
|
||||
} else {
|
||||
TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.tag, 0);
|
||||
TEST_EQUAL(crt.authority_key_id.authorityCertSerialNumber.len, 0);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user