Skip to content

Commit 4ddba7a

Browse files
committed
When comparing subject names, do not worry about case.
1 parent f18633a commit 4ddba7a

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/x509.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11159,7 +11159,7 @@ int wolfSSL_i2d_X509_NAME(WOLFSSL_X509_NAME* name, unsigned char** out)
1115911159
_x = (x->name && *x->name) ? x->name : x->staticName;
1116011160
_y = (y->name && *y->name) ? y->name : y->staticName;
1116111161

11162-
return XSTRNCMP(_x, _y, x->sz); /* y sz is the same */
11162+
return XSTRNCASECMP(_x, _y, x->sz); /* y sz is the same */
1116311163
}
1116411164

1116511165
#ifndef NO_BIO

tests/api.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12266,6 +12266,16 @@ static int test_wolfSSL_PKCS12(void)
1226612266
ExpectIntEQ(wolfSSL_X509_NAME_cmp((const WOLFSSL_X509_NAME*)subject,
1226712267
(const WOLFSSL_X509_NAME*)wolfSSL_X509_get_subject_name(x509)), 0);
1226812268

12269+
/* modify case and compare subject from certificate in ca to expected.
12270+
* The first bit of the name is:
12271+
* /C=US/ST=Washington
12272+
* So we'll change subject->name[1] to 'c' (lower case) */
12273+
if (subject != NULL) {
12274+
subject->name[1] = 'c';
12275+
ExpectIntEQ(wolfSSL_X509_NAME_cmp((const WOLFSSL_X509_NAME*)subject,
12276+
(const WOLFSSL_X509_NAME*)wolfSSL_X509_get_subject_name(x509)), 0);
12277+
}
12278+
1226912279
EVP_PKEY_free(pkey);
1227012280
pkey = NULL;
1227112281
X509_free(x509);

0 commit comments

Comments
 (0)