Skip to content

ML-KEM/ML-DSA: harden against fault attacks#9734

Merged
douzzer merged 1 commit intowolfSSL:masterfrom
SparkiDev:mlkem_mldsa_harden
Mar 6, 2026
Merged

ML-KEM/ML-DSA: harden against fault attacks#9734
douzzer merged 1 commit intowolfSSL:masterfrom
SparkiDev:mlkem_mldsa_harden

Conversation

@SparkiDev
Copy link
Contributor

Description

ML-DSA: check pointer to the y parameter has not be faulted.
ML-KEM: to harden against faultiong, use a different buffer for private seed, sigma, and add a check that the buffer was copied correctly.
SHA-3: fix size of check variables.

Fixes zd#21108

Testing

./configure --disable-shared --enable-mlkem --enable-mldsa --enable-faultharden

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@SparkiDev SparkiDev self-assigned this Feb 3, 2026
@SparkiDev
Copy link
Contributor Author

Jenkins retest this please

Nodes went down.

@SparkiDev SparkiDev assigned wolfSSL-Bot and unassigned SparkiDev Mar 2, 2026
@SparkiDev SparkiDev requested a review from wolfSSL-Bot March 2, 2026 11:41
JacobBarthelmeh
JacobBarthelmeh previously approved these changes Mar 3, 2026
Copy link
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

This PR hardens post-quantum ML-KEM (Kyber) and ML-DSA (Dilithium) implementations against fault-injection attacks and updates SHA-3 fault-hardening checks, controlled via the --enable-faultharden configure option.

Changes:

  • ML-KEM: use a separate sigma buffer under fault hardening and validate the copy.
  • ML-DSA: add pointer-integrity checks to detect faulted y/yt pointers during signing.
  • SHA-3: rename/standardize the fault-hardening macro and widen check counters to avoid overflow.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
wolfcrypt/src/wc_mlkem.c Adds WC_MLKEM_FAULT_HARDEN path with separate sigma buffer and verification checks.
wolfcrypt/src/sha3.c Renames hardening macro to WC_SHA3_FAULT_HARDEN and widens check variables used for fault detection.
wolfcrypt/src/dilithium.c Adds WC_MLDSA_FAULT_HARDEN pointer-integrity checks during signing to detect faulted pointers.
configure.ac Extends --enable-faultharden to define the new SHA-3/ML-KEM/ML-DSA fault-hardening macros.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SparkiDev SparkiDev added the For This Release Release version 5.9.0 label Mar 4, 2026
@douzzer douzzer added the Staged Staged for merge pending final test results and review label Mar 5, 2026
Copy link
Contributor

@douzzer douzzer left a comment

Choose a reason for hiding this comment

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

The Copilot recommendations here seem substantive.

@douzzer douzzer removed the Staged Staged for merge pending final test results and review label Mar 5, 2026
ML-DSA: check pointer to the y parameter has not be faulted.
ML-KEM: to harden against faultiong, use a different buffer for private
seed, sigma, and add a check that the buffer was copied correctly.
SHA-3: fix size of check variables.
@douzzer douzzer added the Staged Staged for merge pending final test results and review label Mar 6, 2026
@douzzer
Copy link
Contributor

douzzer commented Mar 6, 2026

retest this please

@douzzer
Copy link
Contributor

douzzer commented Mar 6, 2026

retest this please
(tooling error on FIPS test(s))

@douzzer douzzer merged commit cc2fdda into wolfSSL:master Mar 6, 2026
450 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For This Release Release version 5.9.0 Staged Staged for merge pending final test results and review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants