Skip to content

v7.0.0-user-space: EMS refusal in wc_PRF, hybrid group constants, RAND_load_file single reseed, -209 comment - #12249

Merged
kaleb-himes merged 6 commits into
wolfSSL:v7.0.0-user-spacefrom
jackctj117:v7-followups
Nov 25, 2026
Merged

kaleb-himes merged 6 commits into
wolfSSL:v7.0.0-user-spacefrom
jackctj117:v7-followups

Conversation

@jackctj117

@jackctj117 jackctj117 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups from the #12170 review.

  • EMS refusal: under FIPS v7, wc_PRF() refuses a "master secret" derivation (BAD_FUNC_ARG) instead of the module flagging it not-approved. It only does this once the module's fips.h defines WC_FIPS_TLS12_EMS_ONLY, which comes with wolfSSL/fips#442. The TLS-layer refusal is unchanged.
  • Hybrid group constants: WC_SECP256R1MLKEM768, WC_X25519MLKEM768 and WC_SECP384R1MLKEM1024 in kdf.h replace the bare 4587/4588/4589 in kdf.c and its tests.
  • RAND_load_file: without stir (FIPS v7), it hashes the file as it reads and reseeds once, instead of a full reseed per 256-byte chunk. RAND_egd is compiled out under FIPS.
  • -208/-209: reworded the comments: -208 (DRBG self-test failure) leaves the DRBG refused with the module degraded; -209 (health-test failure) fails the whole module. Both last until reload.

Testing: make check passes (--enable-all). A FIPS v7 build with wolfSSL/fips#442 starts, passes its self-test and make check, and refuses the master secret.

Merge this before wolfSSL/fips#442.

Copilot AI balanced review requested due to automatic review settings November 24, 2026 16:25
@jackctj117
jackctj117 marked this pull request as draft November 24, 2026 16:27
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m0plus

  • FLASH: .text +44 B (+0.1%, 71,891 B / 262,144 B, total: 27% used)

gcc-arm-cortex-m3

  • FLASH: .text +628 B (+0.5%, 133,501 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4

  • FLASH: .text +640 B (+0.3%, 210,856 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +640 B (+0.9%, 75,311 B / 262,144 B, total: 29% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .text +704 B (+0.4%, 184,210 B / 262,144 B, total: 70% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .text +704 B (+0.4%, 198,624 B / 1,048,576 B, total: 19% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata +136 B, .text +1,088 B (+0.2%, 807,372 B / 1,048,576 B, total: 77% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +704 B (+0.3%, 225,447 B / 262,144 B, total: 86% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +832 B (+0.3%, 316,720 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +704 B (+0.2%, 346,792 B / 1,048,576 B, total: 33% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +640 B (+0.5%, 134,281 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +768 B (+0.3%, 253,314 B / 262,144 B, total: 97% used)

gcc-arm-cortex-m7

  • FLASH: .text +640 B (+0.3%, 210,856 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m7-pq

  • FLASH: .text +832 B (+0.3%, 317,552 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .text +768 B (+0.3%, 253,314 B / 262,144 B, total: 97% used)

stm32-sim-stm32h753

  • FLASH: .text +8 B (+0.0%, 209,196 B / 2,097,152 B, total: 10% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The inaccessible companion FIPS change leaves the coordinated EMS CAST/wrapper updates and real FIPS v7 self-tests unverified, requiring maintainer review.

No open issues 🎉

What changed in this PR

This PR follows up on #12170 by tightening FIPS v7 key derivation, centralizing hybrid-group identifiers, and reducing reseeding overhead in the OpenSSL compatibility layer.

Changes:

  • Refuses non-extended master-secret derivation in the v7 PRF and updates test expectations.
  • Adds named wolfCrypt hybrid-group constants and checks their agreement with TLS identifiers.
  • Hashes file contents before a single no-stir reseed, adds portable file-reading tests, and clarifies DRBG error comments.
File Description
wolfssl/​wolfcrypt/​kdf.h Defines three ML-KEM hybrid-group constants.
wolfssl/​wolfcrypt/​error-crypt.h Clarifies self-test and health-test failure comments; no behavior change.
wolfcrypt/​test/​test.c Updates v7 refusal expectations and uses hybrid constants.
wolfcrypt/​src/​kdf.c Adds master-secret refusal and replaces numeric group identifiers.
tests/​api/​test_ossl_rand.c Adds multi-chunk regular-file read cases.
tests/​api/​test_kdf.c Uses wolfCrypt constants in hybrid-secret tests.
tests/​api/​test_curve25519.c Uses named constants in X25519 hybrid tests.
src/​tls.c Statically checks TLS and wolfCrypt group identifiers agree.
src/​ssl_crypto.c Accumulates file data through hashing for one no-stir reseed.

Review effort: Balanced

@jackctj117

Copy link
Copy Markdown
Contributor Author

@claude review

Comment thread src/tls.c Resolved
Comment thread wolfcrypt/src/kdf.c Resolved
wolfSSL-Fenrir-bot

This comment was marked as resolved.

@jackctj117

Copy link
Copy Markdown
Contributor Author

@claude review

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #12249

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-src, wolfssl-bugs
Coverage: 2 of 3 in-scope changed file(s) opened by the reviewer; not opened: src/tls.c

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed their stale review November 24, 2026 19:40

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the follow-up commits. They address both of my earlier comments, and this pass found no new bugs. A human should still sign off, because this changes FIPS v7 KDF behavior and DRBG reseeding, and an earlier changes-requested review is still open.

What was reviewed:

  • The tls.c static asserts are now guarded by WOLFSSL_HAVE_TLS13_HYBRID_SECRET, so a FIPS bundle with an older kdf.h skips them.
  • The master-secret refusal in wc_PRF and the matching tls12_kdf_test branches now only apply when the module defines WC_FIPS_TLS12_EMS_ONLY. Without it, the old not-approved flag behavior stays.
  • In RAND_load_file without stir, I checked the hash init/update/final flow, the single locked reseed, and the cleanup. The hash is freed only after init, and the hash state and digest are zeroed on every exit path after allocation.
Extended reasoning...

The change touches FIPS v7 crypto paths: the TLS 1.2 PRF in wolfcrypt/src/kdf.c, global DRBG reseeding in src/ssl_crypto.c, and the hybrid ML-KEM group constants in kdf.h and tls.c. Commits 07584e0 and 856cfdd fix the two configuration problems raised in the earlier review. wolfSSL-Fenrir-bot left a changes-requested review on tls.c, and its review state was never updated. The author replied and pushed commits later, but this run cannot confirm that review is cleared. Because the changes are crypto/FIPS-sensitive and that review is still open, this is a defer rather than an approval.

@jackctj117
jackctj117 marked this pull request as ready for review November 24, 2026 20:01

@kaleb-himes kaleb-himes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Jack, nice work! I only have one request on the call to wc_HashFree since it can error, can we just make sure we're checking the return code there please?

Comment thread src/ssl_crypto.c Resolved
Comment thread wolfssl/wolfcrypt/error-crypt.h Resolved
Comment thread src/ssl_crypto.c Resolved

@kaleb-himes kaleb-himes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @jackctj117

@kaleb-himes
kaleb-himes merged commit 283a73d into wolfSSL:v7.0.0-user-space Nov 25, 2026
456 of 462 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.

4 participants