Skip to content

Commit

Permalink
Adding test cases for BundleEID Other Name
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianSipos committed Jan 10, 2025
1 parent 998df5b commit 236b376
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion framework
4 changes: 4 additions & 0 deletions tests/suites/test_suite_x509parse.data
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ X509 SAN parsing otherName
depends_on:PSA_HAVE_ALG_SOME_ECDSA:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
x509_parse_san:"../framework/data_files/parse_input/server5-othername.crt.der":"type \: 0\notherName \: hardware module name \: hardware type \: 1.3.6.1.4.1.17.3, hardware serial number \: 313233343536\n":0

X509 SAN parsing BP EID otherName
depends_on:PSA_HAVE_ALG_SOME_ECDSA:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
x509_parse_san:"../framework/data_files/parse_input/server5-bp_eid.crt.der":"type \: 0\notherName \: BundleEID \: ipn\:977000.100.0\n":0

X509 SAN parsing binary otherName
depends_on:PSA_HAVE_ALG_SOME_ECDSA:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
x509_parse_san:"../framework/data_files/parse_input/server5-nonprintable_othername.crt.der":"type \: 0\notherName \: hardware module name \: hardware type \: 1.3.6.1.4.1.17.3, hardware serial number \: 3132338081008180333231\n":0
Expand Down
14 changes: 13 additions & 1 deletion tests/suites/test_suite_x509parse.function
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,19 @@ static int verify_parse_san(mbedtls_x509_subject_alternative_name *san,
san->san.other_name.value.hardware_module_name.val.p[i]);
MBEDTLS_X509_SAFE_SNPRINTF;
}
}
}/* MBEDTLS_OID_ON_HW_MODULE_NAME */
else if (MBEDTLS_OID_CMP(MBEDTLS_OID_ON_BUNDLE_EID,
&san->san.other_name.type_id) == 0) {
int len = 0;
const char *str = NULL;
if (san->san.other_name.value.raw.tag == MBEDTLS_ASN1_IA5_STRING) {
len = san->san.other_name.value.raw.len;
str = (char*)san->san.other_name.value.raw.p;
}

ret = mbedtls_snprintf(p, n, " BundleEID : %.*s", len, str);
MBEDTLS_X509_SAFE_SNPRINTF;
}/* MBEDTLS_OID_ON_BUNDLE_EID */
else {
ret = mbedtls_snprintf(p, n, " raw :");
MBEDTLS_X509_SAFE_SNPRINTF;
Expand Down

0 comments on commit 236b376

Please sign in to comment.