Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When comparing subject names, do not worry about case. #7420

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -12266,6 +12266,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);
Expand Down