Address review comments.

This commit is contained in:
Anthony Hu
2023-07-14 12:09:14 -04:00
parent 4ccd6dfbe1
commit 31a02f194e
2 changed files with 15 additions and 1 deletions

View File

@ -4860,8 +4860,10 @@ void wolfSSL_GENERAL_NAME_set0_value(WOLFSSL_GENERAL_NAME *a, int type,
wolfSSL_GENERAL_NAME_type_free(a);
a->type = type;
if (type == GEN_DNS) {
a->d.dNSName = value;
}
}
/* Frees GENERAL_NAME objects.
*/

View File

@ -41889,6 +41889,7 @@ static int test_wolfSSL_GENERAL_NAME_print(void)
X509_EXTENSION* ext = NULL;
AUTHORITY_INFO_ACCESS* aia = NULL;
ACCESS_DESCRIPTION* ad = NULL;
ASN1_IA5STRING *dnsname = NULL;
const unsigned char v4Addr[] = {192,168,53,1};
const unsigned char v6Addr[] =
@ -41943,6 +41944,17 @@ static int test_wolfSSL_GENERAL_NAME_print(void)
X509_free(x509);
x509 = NULL;
/* Lets test for setting as well. */
ExpectNotNull(gn = GENERAL_NAME_new());
ExpectNotNull(dnsname = ASN1_IA5STRING_new());
ExpectIntEQ(ASN1_STRING_set(dnsname, "example.com", -1), 1);
GENERAL_NAME_set0_value(gn, GEN_DNS, dnsname);
dnsname = NULL;
ExpectIntEQ(GENERAL_NAME_print(out, gn), 1);
XMEMSET(outbuf, 0, sizeof(outbuf));
ExpectIntGT(BIO_read(out, outbuf, sizeof(outbuf)), 0);
ExpectIntEQ(XSTRNCMP((const char*)outbuf, dnsStr, XSTRLEN(dnsStr)), 0);
/* test for GEN_URI */
ExpectTrue((f = XFOPEN("./certs/ocsp/root-ca-cert.pem", "rb")) != XBADFILE);