Skip to content

Preserve in-place message on signing failure#1222

Closed
fegge wants to merge 1 commit into
pq-code-package:mainfrom
trailofbits:fix/sign-inplace-failure-wipes-message
Closed

Preserve in-place message on signing failure#1222
fegge wants to merge 1 commit into
pq-code-package:mainfrom
trailofbits:fix/sign-inplace-failure-wipes-message

Conversation

@fegge

@fegge fegge commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • Preserve the caller's in-place message buffer when crypto_sign fails before producing a signature.
  • Document the failure behavior for signed-message APIs.
  • Add regression coverage for in-place signing failure and RNG-failure paths.

Validation

  • clang-format -i mldsa/src/sign.c mldsa/src/sign.h mldsa/mldsa_native.h test/src/test_mldsa.c test/src/test_rng_fail.c: passed
  • git diff --check -- mldsa/src/sign.c mldsa/src/sign.h mldsa/mldsa_native.h test/src/test_mldsa.c test/src/test_rng_fail.c: passed
  • make run_func run_rng_fail -j4: passed
  • Not run: ./scripts/format because nixpkgs-fmt is not installed in this local environment
  • Not run: ./scripts/lint because shfmt is not installed in this local environment

Fixes #1217


This work was completed by Trail of Bits as part of the Patch The Planet project in collaboration with OpenAI. The issue was identified primarily by the Codex coding agent, and manually reviewed before submission.

@fegge

fegge commented Jun 26, 2026

Copy link
Copy Markdown
Author

Reopened from an upstream repository branch with DCO-signed commits so full CI can run: #1230

@fegge fegge closed this Jun 26, 2026
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.

In-place signing failure wipes the input message

1 participant