From 0a4b6d88d0367b5cd24171285810f42cfa5bb87c Mon Sep 17 00:00:00 2001 From: Agathiyan Bragadeesh Date: Wed, 2 Aug 2023 15:05:57 +0100 Subject: [PATCH] Alter conditions on hexstring output dn_gets Signed-off-by: Agathiyan Bragadeesh --- library/x509.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/x509.c b/library/x509.c index 82b5af3aa..ee1dc704e 100644 --- a/library/x509.c +++ b/library/x509.c @@ -854,8 +854,9 @@ int mbedtls_x509_dn_gets(char *buf, size_t size, const mbedtls_x509_name *dn) MBEDTLS_X509_SAFE_SNPRINTF; } - print_hexstring = (name->val.tag == MBEDTLS_ASN1_BIT_STRING) || - (name->val.tag == MBEDTLS_ASN1_OCTET_STRING); + print_hexstring = (name->val.tag != MBEDTLS_ASN1_UTF8_STRING) && + (name->val.tag != MBEDTLS_ASN1_PRINTABLE_STRING) && + (name->val.tag != MBEDTLS_ASN1_IA5_STRING); if ((ret = mbedtls_oid_get_attr_short_name(&name->oid, &short_name)) == 0) { ret = mbedtls_snprintf(p, n, "%s=", short_name);