[DRAFT] Support ML-DSA context strings in signing and verification#1084
Draft
[DRAFT] Support ML-DSA context strings in signing and verification#1084
Conversation
Add sign_with_context and verify_sig_with_context methods to PqdsaKeyPair and PqdsaVerificationAlgorithm respectively, allowing callers to specify FIPS 204 context strings (up to 255 bytes) for ML-DSA operations. These methods use the existing EVP_PKEY_CTX_set_signature_context FFI binding (already available in aws-lc-sys) via the EVP_PKEY_CTX_consumer closure pattern. Empty contexts are equivalent to the existing context-free sign/verify methods. Update the mldsa_sigver_test macro to exercise verify_sig_with_context with test vector context strings. Add dedicated test covering round-trip sign+verify with context, mismatched context failure, empty context backward compatibility, >255 byte rejection, and max-length (255 byte) acceptance. Depends on aws/aws-lc#3135.
Contributor
|
Thanks for the PR! Since this functionality won't be available in the upcoming "FIPS module 4.0", we'll need to think about how to expose this in our API. It will likely need to be locked behind our |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues:
Resolves: #1079
Depends on aws/aws-lc#3135.
Description of changes:
Add
sign_with_contextandverify_sig_with_contextmethods toPqdsaKeyPairandPqdsaVerificationAlgorithmrespectively, allowing callers to specify FIPS 204 context strings (up to 255 bytes) for ML-DSA operations.These methods use the existing
EVP_PKEY_CTX_set_signature_contextFFI binding (already available in aws-lc-sys) via theEVP_PKEY_CTX_consumerclosure pattern. Empty contexts are equivalent to the existing context-free sign/verify methods.Testing:
Update the
mldsa_sigver_testmacro to exerciseverify_sig_with_contextwith test vector context strings. Add dedicated test covering round-trip sign+verify with context, mismatched context failure, empty context backward compatibility, >255 byte rejection, and max-length (255 byte) acceptance.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.