mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-28 19:13:28 +00:00
Refactor reading AttributeValue in dn gets
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
This commit is contained in:
parent
022f86f108
commit
4606bf3f38
@ -273,14 +273,23 @@ int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *nam
|
||||
}
|
||||
|
||||
if (!in_attr_type && ((*c == ',' && *(c-1) != '\\') || c == end)) {
|
||||
if (*s == '#') {
|
||||
#if defined(MBEDTLS_ASN1_PARSE_C)
|
||||
if ((parse_ret =
|
||||
parse_attribute_value_der_encoded(s, (int) (c - s), data, &data_len,
|
||||
&tag)) != 0) {
|
||||
if (numericoid) {
|
||||
if ((parse_ret =
|
||||
parse_attribute_value_der_encoded(s, (int) (c - s), data, &data_len,
|
||||
&tag)) != 0) {
|
||||
mbedtls_free(oid.p);
|
||||
return MBEDTLS_ERR_X509_INVALID_NAME;
|
||||
} else {
|
||||
}
|
||||
#else
|
||||
return MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE
|
||||
#endif
|
||||
} else {
|
||||
if(numericoid) {
|
||||
mbedtls_free(oid.p);
|
||||
return MBEDTLS_ERR_X509_INVALID_NAME;
|
||||
}
|
||||
else {
|
||||
if ((parse_ret =
|
||||
parse_attribute_value_string(s, (int) (c - s), data,
|
||||
&data_len)) != 0) {
|
||||
@ -290,20 +299,7 @@ int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *nam
|
||||
tag = attr_descr->default_tag;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!numericoid) {
|
||||
if ((parse_ret =
|
||||
parse_attribute_value_string(s, (int) (c - s), data, &data_len)) != 0) {
|
||||
mbedtls_free(oid);
|
||||
return parse_ret;
|
||||
}
|
||||
tag = attr_descr->default_tag;
|
||||
}
|
||||
if (numericoid) {
|
||||
mbedtls_free(oid);
|
||||
return MBEDTLS_ERR_X509_INVALID_NAME;
|
||||
}
|
||||
#endif
|
||||
|
||||
mbedtls_asn1_named_data *cur =
|
||||
mbedtls_asn1_store_named_data(head, (char *) oid.p, oid.len,
|
||||
(unsigned char *) data,
|
||||
|
Loading…
x
Reference in New Issue
Block a user