Skip to content

Reject ML-DSA hashBuf with no signed attributes - #12007

Open
rlm2002 wants to merge 2 commits into
wolfSSL:masterfrom
rlm2002:f16254
Open

rlm2002 wants to merge 2 commits into
wolfSSL:masterfrom
rlm2002:f16254

Conversation

@rlm2002

@rlm2002 rlm2002 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

wc_PKCS7_SignedDataVerifySignature()'s ML-DSA case verifies the complete message (RFC 9882 pure mode), not a digest. When a bundle has no signed attributes,hashBuf was never checked against anything wc_PKCS7_VerifySignedData_ex(), and would silently ignore. Reject hashBuf outright in that case instead.

Fixes F-16254

Testing

./configure --enable-pkcs7 --enable-mldsa && ./wolfcrypt/test/testwolfcrypt

Checklist

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

@rlm2002 rlm2002 self-assigned this Nov 5, 2026
Copilot AI balanced review requested due to automatic review settings November 5, 2026 00:11

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.

🟡 Changes recommended

The regression test passes even without the fix in a supported hash configuration because it supplies the wrong digest length, triggering BAD_FUNC_ARG before reaching the new guard.

1 open issue
What changed in this PR

Addresses F-16254 in wolfCrypt’s PKCS#7 verification by rejecting caller-supplied hashes for pure-mode ML-DSA signatures without signed attributes, rather than silently ignoring them.

Changes:

  • Return BAD_FUNC_ARG for unsupported hash input in the ML-DSA verification path.
  • Add a negative regression test for SignedData without signed attributes.
File Description
wolfcrypt/​test/​test.c Adds a regression test expecting caller-supplied hash rejection.
wolfcrypt/​src/​pkcs7.c Rejects hash input for ML-DSA verification without signed attributes.

Review effort: Balanced

Comment thread wolfcrypt/test/test.c Resolved
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

@rlm2002 rlm2002 changed the title F16254 Reject ML-DSA hashBuf with no signed attributes Nov 5, 2026
@rlm2002
rlm2002 force-pushed the f16254 branch 2 times, most recently from 2e258f8 to 4792d8f Compare November 5, 2026 17:46
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.

2 participants