-
Notifications
You must be signed in to change notification settings - Fork 959
Address bug fixes sent in by ZD 21534 #10168
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
base: master
Are you sure you want to change the base?
Changes from all commits
e31abd8
13af706
ae3c00f
cf5da7b
939f978
5003c03
b067686
7d38e9c
307d3ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1672,7 +1672,7 @@ static int ProcessBufferCertPublicKey(WOLFSSL_CTX* ctx, WOLFSSL* ssl, | |
| ECC_KEY_SIZE_E); | ||
| } | ||
| break; | ||
| #endif /* HAVE_ED25519 */ | ||
| #endif /* WOLFSSL_SM2 && WOLFSSL_SM3 */ | ||
| #ifdef HAVE_ED25519 | ||
| case ED25519k: | ||
| keyType = ed25519_sa_algo; | ||
|
|
@@ -1882,7 +1882,7 @@ static int ProcessBufferCertAltPublicKey(WOLFSSL_CTX* ctx, WOLFSSL* ssl, | |
| ECC_KEY_SIZE_E); | ||
| } | ||
| break; | ||
| #endif /* HAVE_ED25519 */ | ||
| #endif /* WOLFSSL_SM2 && WOLFSSL_SM3 */ | ||
| #ifdef HAVE_ED25519 | ||
| case ED25519k: | ||
| keyType = ed25519_sa_algo; | ||
|
|
@@ -4684,7 +4684,7 @@ int wolfSSL_use_AltPrivateKey_Id(WOLFSSL* ssl, const unsigned char* id, long sz, | |
| #endif | ||
| } | ||
| if (AllocDer(&ssl->buffers.altKey, (word32)sz, ALT_PRIVATEKEY_TYPE, | ||
| ssl->heap) == 0) { | ||
| ssl->heap) != 0) { | ||
| ret = 0; | ||
| } | ||
| } | ||
|
|
@@ -4732,7 +4732,7 @@ int wolfSSL_use_AltPrivateKey_Label(WOLFSSL* ssl, const char* label, int devId) | |
| #endif | ||
| } | ||
| if (AllocDer(&ssl->buffers.altKey, (word32)sz, ALT_PRIVATEKEY_TYPE, | ||
| ssl->heap) == 0) { | ||
| ssl->heap) != 0) { | ||
| ret = 0; | ||
| } | ||
| } | ||
|
|
@@ -5202,7 +5202,7 @@ int wolfSSL_add1_chain_cert(WOLFSSL* ssl, WOLFSSL_X509* x509) | |
| } | ||
|
|
||
| /* Increase reference count on X509 object before adding. */ | ||
| if ((ret == 1) && ((ret == wolfSSL_X509_up_ref(x509)) == 1)) { | ||
| if ((ret == 1) && ((ret = wolfSSL_X509_up_ref(x509)) == 1)) { | ||
| /* Add this to the chain. */ | ||
| if ((ret = wolfSSL_add0_chain_cert(ssl, x509)) != 1) { | ||
| /* Decrease reference count on error as not stored. */ | ||
|
|
@@ -5864,7 +5864,7 @@ long wolfSSL_CTX_set_tmp_dh(WOLFSSL_CTX* ctx, WOLFSSL_DH* dh) | |
| pSz = wolfSSL_BN_bn2bin(dh->p, p); | ||
| gSz = wolfSSL_BN_bn2bin(dh->g, g); | ||
| /* Check encoding worked. */ | ||
| if ((pSz < 0) && (gSz < 0)) { | ||
| if ((pSz <= 0) || (gSz <= 0)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 [Medium] No regression test for wolfSSL_CTX_set_tmp_dh operator fix The fix changes Recommendation: Consider adding a test that triggers the single-operand failure or zero-length case to guard against regression of the — Skoll automated review via openclaw |
||
| ret = WOLFSSL_FATAL_ERROR; | ||
| } | ||
| } | ||
|
|
@@ -5930,12 +5930,10 @@ static int ws_ctx_ssl_set_tmp_dh(WOLFSSL_CTX* ctx, WOLFSSL* ssl, | |
|
|
||
| /* PemToDer allocates its own DER buffer. */ | ||
| if ((res == 1) && (format != WOLFSSL_FILETYPE_PEM)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 [Medium] ws_ctx_ssl_set_tmp_dh fix could benefit from a targeted test for the ASN1 path The fix replaces a dangerous cast-away-const + zero-size AllocDer pattern with a proper sized allocation + Recommendation: Consider adding a test that calls — Skoll automated review via openclaw |
||
| /* Create an empty DER buffer. */ | ||
| ret = AllocDer(&der, 0, DH_PARAM_TYPE, heap); | ||
| /* Create a DER buffer and copy in the encoded DH parameters. */ | ||
| ret = AllocDer(&der, (word32)sz, DH_PARAM_TYPE, heap); | ||
| if (ret == 0) { | ||
| /* Assign encoded DH parameters to DER buffer. */ | ||
| der->buffer = (byte*)buf; | ||
| der->length = (word32)sz; | ||
| XMEMCPY(der->buffer, buf, (word32)sz); | ||
| } | ||
| else { | ||
| res = ret; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 [Medium] No regression test for wolfSSL_add1_chain_cert comparison-to-assignment fix
💡 SUGGEST
testThe fix changes
ret == wolfSSL_X509_up_ref(x509)toret = wolfSSL_X509_up_ref(x509). While there is an existingtest_wolfSSL_CTX_add1_chain_certthat exerciseswolfSSL_add1_chain_cert, no new test was added specifically to catch this regression. The old bug was masked becausewolfSSL_X509_up_refnormally returns 1 andretwas already 1, making the comparison accidentally true. A test that forceswolfSSL_X509_up_refto fail (e.g., by corrupting the ref count mutex or testing error propagation) would guard against future regressions of this type. The PR description acknowledges the bug but no dedicated test was added, unlike the AltPrivateKey fixes which got regression tests.Recommendation: Consider adding a targeted regression test or at minimum a comment in the existing test noting which code path validates this fix.
— Skoll automated review via openclaw