mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-29 22:20:30 +00:00
Check values in tests
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
2568d47916
commit
0ad1006606
@ -3303,27 +3303,27 @@ x509_accessor_ext_types:MBEDTLS_X509_EXT_KEY_USAGE:MBEDTLS_X509_EXT_SUBJECT_ALT_
|
||||
|
||||
X509 CRT parse Subject Key Id - Correct Subject Key ID
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1:MBEDTLS_RSA_C
|
||||
x509_crt_parse_subjectkeyid:"data_files/authorityKeyId_subjectKeyId.crt.der":20:0
|
||||
x509_crt_parse_subjectkeyid:"data_files/authorityKeyId_subjectKeyId.crt.der":"5061A58FD407D9D782010CE5657F8C6346A713BE":0
|
||||
|
||||
X509 CRT parse Subject Key Id - Wrong OCTET_STRING tag
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1:MBEDTLS_RSA_C
|
||||
x509_crt_parse_subjectkeyid:"data_files/authorityKeyId_subjectKeyId_tag_malformed.crt.der":0:MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
x509_crt_parse_subjectkeyid:"data_files/authorityKeyId_subjectKeyId_tag_malformed.crt.der":"5061A58FD407D9D782010CE5657F8C6346A713BE":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
X509 CRT parse Authority Key Id - Correct Authority Key ID
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId.crt.der":20:"NL/PolarSSL/PolarSSL Test CA/":20:0
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId.crt.der":"5061A58FD407D9D782010CE5657F8C6346A713BE":"NL/PolarSSL/PolarSSL Test CA/":"3960EFDE5674DE1F7B761699CF8E5C024E209452":0
|
||||
|
||||
X509 CRT parse Authority Key Id - Wrong Length
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_length_malformed.crt.der":0:"":0:MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_length_malformed.crt.der":"":"":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_LENGTH_MISMATCH
|
||||
|
||||
X509 CRT parse Authority Key Id - Wrong Sequence tag
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_sequence_tag_malformed.crt.der":0:"":0:MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_sequence_tag_malformed.crt.der":"":"":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
X509 CRT parse Authority Key Id - Wrong KeyId Tag
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_keyid_tag_malformed.crt.der":0:"":0:MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_keyid_tag_malformed.crt.der":"":"":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
X509 CRT parse Authority Key Id - Wrong KeyId Tag Length
|
||||
depends_on:MBEDTLS_MD_CAN_SHA256:MBEDTLS_RSA_C
|
||||
@ -3331,11 +3331,11 @@ x509_crt_parse_authoritykeyid:"3082039F30820287A00302010202142121EA5121F25E38DF2
|
||||
|
||||
X509 CRT parse Authority Key Id - Wrong Issuer Tag 1
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_issuer_tag1_malformed.crt.der":0:"":0:MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
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
|
||||
depends_on:MBEDTLS_MD_CAN_SHA1:MBEDTLS_RSA_C
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_issuer_tag2_malformed.crt.der":0:"":0:MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
x509_crt_parse_authoritykeyid:"data_files/authorityKeyId_subjectKeyId_issuer_tag2_malformed.crt.der":"":"":"":MBEDTLS_ERR_X509_INVALID_EXTENSIONS+MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
|
||||
|
||||
# clusterfuzz-testcase-minimized-fuzz_x509crt-6666050834661376: test for bad sequence of names in authorityCertIssuer
|
||||
X509 CRT parse Authority Key Id - Wrong Issuer sequence
|
||||
|
@ -1550,7 +1550,7 @@ exit:
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C */
|
||||
void x509_crt_parse_subjectkeyid(char *file, int subjectKeyIdLength, int ref_ret)
|
||||
void x509_crt_parse_subjectkeyid(char *file, data_t *subjectKeyId, int ref_ret)
|
||||
{
|
||||
size_t subjectKeyIdLength = subjectKeyIdLength_arg;
|
||||
mbedtls_x509_crt crt;
|
||||
@ -1561,7 +1561,8 @@ void x509_crt_parse_subjectkeyid(char *file, int subjectKeyIdLength, int ref_ret
|
||||
|
||||
if (ref_ret == 0) {
|
||||
TEST_ASSERT(crt.subject_key_id.tag == MBEDTLS_ASN1_OCTET_STRING);
|
||||
TEST_ASSERT(crt.subject_key_id.len == subjectKeyIdLength);
|
||||
TEST_ASSERT(memcmp(crt.subject_key_id.p, subjectKeyId->x, subjectKeyId->len) == 0);
|
||||
TEST_ASSERT(crt.subject_key_id.len == subjectKeyId->len);
|
||||
} else {
|
||||
TEST_ASSERT(crt.subject_key_id.tag == 0);
|
||||
TEST_ASSERT(crt.subject_key_id.len == 0);
|
||||
@ -1574,9 +1575,9 @@ exit:
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C */
|
||||
void x509_crt_parse_authoritykeyid(char *file,
|
||||
int keyIdLength,
|
||||
data_t* keyId,
|
||||
char *authorityKeyId_issuer,
|
||||
int serialLength_arg,
|
||||
data_t* serial,
|
||||
int ref_ret)
|
||||
{
|
||||
mbedtls_x509_crt crt;
|
||||
@ -1595,7 +1596,8 @@ void x509_crt_parse_authoritykeyid(char *file,
|
||||
if (ref_ret == 0) {
|
||||
/* KeyId test */
|
||||
TEST_ASSERT(crt.authority_key_id.keyIdentifier.tag == MBEDTLS_ASN1_OCTET_STRING);
|
||||
TEST_ASSERT(crt.authority_key_id.keyIdentifier.len == keyIdLength);
|
||||
TEST_ASSERT(memcmp(crt.authority_key_id.keyIdentifier.p, keyId->x, keyId->len) == 0);
|
||||
TEST_ASSERT(crt.authority_key_id.keyIdentifier.len == keyId->len);
|
||||
|
||||
/* Issuer test */
|
||||
mbedtls_x509_sequence *issuerPtr = &crt.authority_key_id.authorityCertIssuer;
|
||||
@ -1618,7 +1620,10 @@ void x509_crt_parse_authoritykeyid(char *file,
|
||||
/* Serial test */
|
||||
TEST_ASSERT(crt.authority_key_id.authorityCertSerialNumber.tag ==
|
||||
MBEDTLS_ASN1_INTEGER);
|
||||
TEST_ASSERT(crt.authority_key_id.authorityCertSerialNumber.len == serialLength);
|
||||
TEST_ASSERT(memcmp(crt.authority_key_id.authorityCertSerialNumber.p,
|
||||
serial->x, serial->len) == 0);
|
||||
TEST_ASSERT(crt.authority_key_id.authorityCertSerialNumber.len == serial->len);
|
||||
|
||||
} else {
|
||||
TEST_ASSERT(crt.authority_key_id.keyIdentifier.tag == 0);
|
||||
TEST_ASSERT(crt.authority_key_id.keyIdentifier.len == 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user