Fix regressions (fast math MAX_ENCODED_SIG_SZ; DTLS export IV buffer size)#10229
Merged
SparkiDev merged 2 commits intowolfSSL:masterfrom Apr 15, 2026
Merged
Fix regressions (fast math MAX_ENCODED_SIG_SZ; DTLS export IV buffer size)#10229SparkiDev merged 2 commits intowolfSSL:masterfrom
SparkiDev merged 2 commits intowolfSSL:masterfrom
Conversation
FP_MAX_BITS is the largest possible size of any intermediate operand. RSA requires multiplying together integers with the size of signatures (N), resulting in a size of 2N. So we must assume FP_MAX_BITS is 2N, not N (in bits: 16N, not 8N).
ExportKeyState was writing ssl->specs.iv_size bytes from keys->aead_enc_imp_IV (always sized AEAD_MAX_IMP_SZ). ssl->specs.iv_size carries a different meaning depending on the cipher suite: in AEAD suites it's the implicit IV / nonce size, but in CBC it's the block cipher's IV size (16). In CBC this overran the size of aead_enc_imp_IV (12).
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes two regressions affecting (1) fastmath builds’ computed maximum encoded signature size and (2) DTLS/TLS session export when exporting implicit IV material.
Changes:
- Adjust
MAX_ENCODED_SIG_SZforUSE_FAST_MATH && FP_MAX_BITSto match the effective max key size (FP_MAX_BITS/2) rather than the rawFP_MAX_BITS. - Clamp exported implicit-IV length to
AEAD_MAX_IMP_SZto prevent exporting/importing an implicit-IV size larger than the backing buffers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
wolfssl/wolfcrypt/types.h |
Corrects fastmath-derived MAX_ENCODED_SIG_SZ to align with the library’s “FP supports up to FP_MAX_BITS/2 bits” convention. |
src/internal.c |
Prevents session-export implicit IV serialization from exceeding AEAD_MAX_IMP_SZ (and from producing exports that the importer would reject). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10229
Scan targets checked: wolfssl-bugs, wolfssl-compliance, wolfssl-consttime, wolfssl-defaults, wolfssl-mutation, wolfssl-proptest, wolfssl-src, wolfssl-zeroize
No new issues found in the changed files. ✅
SparkiDev
approved these changes
Apr 15, 2026
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
(see commit messages)
Fixes zd#21621
Testing