Skip to content

Commit 2a539fe

Browse files
author
Lealem Amedie
committed
Cleanup
1 parent fdc95f9 commit 2a539fe

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

src/x509.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5795,6 +5795,7 @@ static int X509PrintSubjAltName(WOLFSSL_BIO* bio, WOLFSSL_X509* x509,
57955795
break;
57965796
}
57975797
}
5798+
#if defined(OPENSSL_ALL)
57985799
else if (entry->type == ASN_RID_TYPE) {
57995800
len = XSNPRINTF(scratch, MAX_WIDTH, "Registered ID:%s",
58005801
entry->ridString);
@@ -5803,6 +5804,7 @@ static int X509PrintSubjAltName(WOLFSSL_BIO* bio, WOLFSSL_X509* x509,
58035804
break;
58045805
}
58055806
}
5807+
#endif
58065808
else if (entry->type == ASN_OTHER_TYPE) {
58075809
len = XSNPRINTF(scratch, MAX_WIDTH,
58085810
"othername <unsupported>");

wolfcrypt/src/asn.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12340,7 +12340,7 @@ static int GenerateDNSEntryIPString(DNS_entry* entry, void* heap)
1234012340
}
1234112341
#endif /* OPENSSL_ALL || WOLFSSL_IP_ALT_NAME */
1234212342

12343-
#if defined(OPENSSL_ALL)
12343+
#if defined(OPENSSL_ALL) && defined(WOLFSSL_ASN_TEMPLATE)
1234412344
/* used to set the human readable string for the registeredID with an
1234512345
* ASN_RID_TYPE DNS entry
1234612346
* return 0 on success
@@ -12363,9 +12363,14 @@ static int GenerateDNSEntryRIDString(DNS_entry* entry, void* heap)
1236312363
}
1236412364
rid = entry->name;
1236512365

12366+
#if defined(HAVE_OID_DECODING) || defined(WOLFSSL_ASN_PRINT)
1236612367
/* Decode OBJECT_ID into dotted form array. */
1236712368
ret = DecodeObjectId((const byte*)(rid),(word32)entry->len, tmpName,
1236812369
(word32*)&tmpSize);
12370+
#else
12371+
ret = NOT_COMPILED_IN;
12372+
#endif
12373+
1236912374
if (ret == 0) {
1237012375
j = 0;
1237112376
/* Append each number of dotted form. */
@@ -12398,7 +12403,7 @@ static int GenerateDNSEntryRIDString(DNS_entry* entry, void* heap)
1239812403

1239912404
return ret;
1240012405
}
12401-
#endif /* OPENSSL_ALL */
12406+
#endif /* OPENSSL_ALL && WOLFSSL_ASN_TEMPLATE */
1240212407

1240312408
#ifdef WOLFSSL_ASN_TEMPLATE
1240412409

@@ -12478,17 +12483,19 @@ static int SetDNSEntry(DecodedCert* cert, const char* str, int strLen,
1247812483
XMEMCPY(dnsEntry->name, str, (size_t)strLen);
1247912484
dnsEntry->name[strLen] = '\0';
1248012485

12481-
#if defined(OPENSSL_ALL) || defined(WOLFSSL_IP_ALT_NAME)
12482-
/* store IP addresses as a string */
12483-
if (type == ASN_IP_TYPE) {
12484-
if ((ret = GenerateDNSEntryIPString(dnsEntry, cert->heap)) != 0) {
12486+
#if defined(OPENSSL_ALL)
12487+
/* store registeredID as a string */
12488+
if (type == ASN_RID_TYPE) {
12489+
if ((ret = GenerateDNSEntryRIDString(dnsEntry, cert->heap)) != 0) {
1248512490
XFREE(dnsEntry->name, cert->heap, DYNAMIC_TYPE_ALTNAME);
1248612491
XFREE(dnsEntry, cert->heap, DYNAMIC_TYPE_ALTNAME);
1248712492
}
1248812493
}
12489-
/* store registeredID as a string */
12490-
else if (type == ASN_RID_TYPE) {
12491-
if ((ret = GenerateDNSEntryRIDString(dnsEntry, cert->heap)) != 0) {
12494+
#endif
12495+
#if defined(OPENSSL_ALL) || defined(WOLFSSL_IP_ALT_NAME)
12496+
/* store IP addresses as a string */
12497+
if (type == ASN_IP_TYPE) {
12498+
if ((ret = GenerateDNSEntryIPString(dnsEntry, cert->heap)) != 0) {
1249212499
XFREE(dnsEntry->name, cert->heap, DYNAMIC_TYPE_ALTNAME);
1249312500
XFREE(dnsEntry, cert->heap, DYNAMIC_TYPE_ALTNAME);
1249412501
}

0 commit comments

Comments
 (0)