When comparing subject names, do not worry about case.

This commit is contained in:
Anthony Hu
2024-04-12 17:14:22 -04:00
parent f18633a000
commit 4ddba7ac8a
2 changed files with 11 additions and 1 deletions

View File

@ -11159,7 +11159,7 @@ cleanup:
_x = (x->name && *x->name) ? x->name : x->staticName; _x = (x->name && *x->name) ? x->name : x->staticName;
_y = (y->name && *y->name) ? y->name : y->staticName; _y = (y->name && *y->name) ? y->name : y->staticName;
return XSTRNCMP(_x, _y, x->sz); /* y sz is the same */ return XSTRNCASECMP(_x, _y, x->sz); /* y sz is the same */
} }
#ifndef NO_BIO #ifndef NO_BIO

View File

@ -12266,6 +12266,16 @@ static int test_wolfSSL_PKCS12(void)
ExpectIntEQ(wolfSSL_X509_NAME_cmp((const WOLFSSL_X509_NAME*)subject, ExpectIntEQ(wolfSSL_X509_NAME_cmp((const WOLFSSL_X509_NAME*)subject,
(const WOLFSSL_X509_NAME*)wolfSSL_X509_get_subject_name(x509)), 0); (const WOLFSSL_X509_NAME*)wolfSSL_X509_get_subject_name(x509)), 0);
/* modify case and compare subject from certificate in ca to expected.
* The first bit of the name is:
* /C=US/ST=Washington
* So we'll change subject->name[1] to 'c' (lower case) */
if (subject != NULL) {
subject->name[1] = 'c';
ExpectIntEQ(wolfSSL_X509_NAME_cmp((const WOLFSSL_X509_NAME*)subject,
(const WOLFSSL_X509_NAME*)wolfSSL_X509_get_subject_name(x509)), 0);
}
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
pkey = NULL; pkey = NULL;
X509_free(x509); X509_free(x509);