Skip to content

Fix regressions (fast math MAX_ENCODED_SIG_SZ; DTLS export IV buffer size)#10229

Merged
SparkiDev merged 2 commits intowolfSSL:masterfrom
mattia-moffa:20260415-zd21621
Apr 15, 2026
Merged

Fix regressions (fast math MAX_ENCODED_SIG_SZ; DTLS export IV buffer size)#10229
SparkiDev merged 2 commits intowolfSSL:masterfrom
mattia-moffa:20260415-zd21621

Conversation

@mattia-moffa
Copy link
Copy Markdown
Contributor

Description

(see commit messages)

Fixes zd#21621

Testing

./configure --enable-dtls --enable-sessionexport --enable-fastmath CFLAGS="-DFP_MAX_BITS=8192"
make check

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).
Copilot AI review requested due to automatic review settings April 15, 2026 10:52
@mattia-moffa mattia-moffa self-assigned this Apr 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_SZ for USE_FAST_MATH && FP_MAX_BITS to match the effective max key size (FP_MAX_BITS/2) rather than the raw FP_MAX_BITS.
  • Clamp exported implicit-IV length to AEAD_MAX_IMP_SZ to 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.

Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. ✅

@github-actions
Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@SparkiDev SparkiDev merged commit 0c93bf9 into wolfSSL:master Apr 15, 2026
542 of 545 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants