Skip to content

Commit 5f231f6

Browse files
authored
Merge pull request #166 from JacobBarthelmeh/fixes
fix for change to OBJ sn2nid behavior in wolfSSL
2 parents 665adb3 + b583221 commit 5f231f6

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/tools/clu_funcs.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,8 +1221,7 @@ WOLFSSL_X509_NAME* wolfCLU_ParseX509NameString(const char* n, int nSz)
12211221
break;
12221222
}
12231223

1224-
tagSz = tagSz + 1; /* include the '=' char */
1225-
if (tagSz + 2 > (int)sizeof(tag)) { /* +2 for '/' and '\0' chars */
1224+
if (tagSz + 1 > (int)sizeof(tag)) { /* +1 for null terminator */
12261225
wolfCLU_LogError("found a tag that was too large!");
12271226
wolfSSL_X509_NAME_free(ret);
12281227
ret = NULL;
@@ -1235,12 +1234,12 @@ WOLFSSL_X509_NAME* wolfCLU_ParseX509NameString(const char* n, int nSz)
12351234
break;
12361235
}
12371236
else {
1238-
XMEMCPY(tag + 1, word, tagSz);
1239-
tag[tagSz + 1] = '\0'; /* append terminating character */
1237+
XMEMCPY(tag, word, tagSz);
1238+
tag[tagSz] = '\0'; /* append terminating character */
12401239
}
12411240

12421241
if (ret != NULL) {
1243-
entry = &word[tagSz];
1242+
entry = &word[tagSz+1];
12441243
nid = wolfSSL_OBJ_sn2nid(tag);
12451244
if (nid == NID_countryName) {
12461245
encoding = CTC_PRINTABLE;

tests/x509/x509-ca-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ EOF
174174
touch index.txt
175175
run_success "ca -h"
176176
run_success "ca -help"
177-
run_success "req -key ./certs/server-key.pem -subj O=wolfSSL/C=US/ST=MT/L=Bozeman/CN=wolfSSL/OU=org-unit -out tmp-ca.csr"
177+
run_success "req -key ./certs/server-key.pem -subj /O=wolfSSL/C=US/ST=MT/L=Bozeman/CN=wolfSSL/OU=org-unit -out tmp-ca.csr"
178178

179179
# testing reading bad conf file
180180
run_fail "ca -config ca-example.conf -in tmp-ca.csr -out tmp.pem -md sha256 -selfsign -keyfile ./certs/ca-key.pem"

0 commit comments

Comments
 (0)