Open
Conversation
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.
Goal
Validate the ML-DSA key type matches the key parameter of an ML-DSA signature
Why
When verifying a CertificateVerify message signed by an ML-DSA key, s2n-tls only enforces the signatures type (i.e. ML-DSA), not the key type (44/65/87). As the
cnsa2policy added by #5760 only allows ML-DSA-87 for signing, we need to distinguish the differences and assert the correct key type is being used.How
Invoke the
EVP_PKEY_pqdsa_get_type()API to parse the ML-DSA key type (parameter size) fromevp_keyand compare with the one indicated by the signature scheme.s2n_tls13_cert_verify_recv()should fail the handshake if the public key does not match the signature scheme.Callouts
I bumped the expected
AWSLC_API_VERSIONof the sanity check ins2n_mldsa_testas this PR changed the ML-DSA feature probe. I checked the CodeBuild logs and confirmed the ML-DSA feature flag was set to true after upgrading the AWS-LC versions in nix and Docker:The current
AWSLC_API_VERSIONis 35. The CI should continue to pass when it is bumped to 36.Testing
I added a unit test where the client is configured with the
cnsa_2policy and the server sends an ML-DSA-87 signature with an ML-DSA-44 cert key.s2n_tls13_cert_verify_recv()succeeded before my changes and failed properly after enforcing the key type validation.ML-DSA is only supported by TLS 1.3, which calls the same handler (
s2n_tls13_cert_verify_recv) for receiving CertVerify on both server side and client side. There also exists an mTLS test case for ECDSA signatures, so I did not add the mTLS case for the ML-DSA test. Let me know if it is worth adding one.Related
resolves #5740
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.