Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Critical buffer-sizing and regression-coverage issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes TLS 1.2 (EC)DHE-PSK pre-master-secret buffer sizing and adds a maximum-size regression test.
Changes:
- Accounts for both 2-byte length prefixes in
ENCRYPT_LEN. - Adds and registers maximum-size DHE-PSK test coverage.
File summaries
| File | Summary | Review status |
|---|---|---|
wolfssl/internal.h |
Adjusts pre-master-secret buffer sizing. | Critical: May underallocate for 16384-bit DH configurations. |
tests/api/test_tls.h |
Declares and registers the regression test. | Reviewed. |
tests/api/test_tls.c |
Implements maximum-size DHE-PSK coverage. | Critical: Test is skipped for supported maximum sizes beyond the listed fixtures. |
Review details
Suppressed comments (1)
tests/api/test_tls.c:652
TEST_TLS12_DHE_PSK_DH_FILEenables code that calls file-based DH setup, the client/server TLS 1.2 method APIs, and the default RSA certificate fixture. Its current definition is not gated forNO_FILESYSTEM/NO_CERTS/PEM-disabled, client/server-disabled, orNO_RSAbuilds, so reduced configurations can fail to compile, link, or initialize this test. Gate the fixture macro on those prerequisites (or provide buffer-based fixtures).
#if MAX_DHKEY_SZ == 512
#define TEST_TLS12_DHE_PSK_DH_FILE "./certs/dh4096.pem"
#elif MAX_DHKEY_SZ == 384
#define TEST_TLS12_DHE_PSK_DH_FILE "./certs/dh3072.pem"
#elif MAX_DHKEY_SZ == 256
#define TEST_TLS12_DHE_PSK_DH_FILE "./certs/dh2048.pem"
#endif
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
gasbytes
force-pushed
the
dhe-psk-premaster-fix
branch
from
September 17, 2026 12:04
b2dbf81 to
60eaf09
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ENCRYPT_LEN covers both 2-byte length prefixes, so a max-size DH prime plus a max-length PSK fits the buffer.
Thanks to Anthropic for the report.
Testing
Added associated regression test (
test_tls12_dhe_psk_max_pms).Checklist