diff --git a/src/x509.c b/src/x509.c index 79b543193d..42e34153ad 100644 --- a/src/x509.c +++ b/src/x509.c @@ -11159,7 +11159,7 @@ int wolfSSL_i2d_X509_NAME(WOLFSSL_X509_NAME* name, unsigned char** out) _x = (x->name && *x->name) ? x->name : x->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 diff --git a/tests/api.c b/tests/api.c index d72b23a6ed..7d2be356b6 100644 --- a/tests/api.c +++ b/tests/api.c @@ -12374,6 +12374,16 @@ static int test_wolfSSL_PKCS12(void) ExpectIntEQ(wolfSSL_X509_NAME_cmp((const WOLFSSL_X509_NAME*)subject, (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); pkey = NULL; X509_free(x509);