Refactor code in cert_write.c

This way is more robust.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
Andrzej Kurek 2023-06-02 05:10:17 -04:00
parent 7c86974d6d
commit f994bc51ad

View file

@ -622,7 +622,9 @@ usage:
goto usage;
}
if (strcmp(q, "IP") != 0 && strcmp(q, "DN") != 0) {
if (cur->node.type == MBEDTLS_X509_SAN_RFC822_NAME ||
cur->node.type == MBEDTLS_X509_SAN_UNIFORM_RESOURCE_IDENTIFIER ||
cur->node.type == MBEDTLS_X509_SAN_DNS_NAME) {
cur->node.san.unstructured_name.p = (unsigned char *) subtype_value;
cur->node.san.unstructured_name.len = strlen(subtype_value);
}