-
Notifications
You must be signed in to change notification settings - Fork 29
Add missing secret key coefficient validation #807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add missing secret key coefficient validation #807
Conversation
2a22c5d to
d93c482
Compare
Signed-off-by: Sanketh Menda <[email protected]>
d93c482 to
649b860
Compare
|
Thank you @sgmenda for raising this! I see that in aws/aws-lc#2874 you added the check to It seems to depend on the assumptions we make on the input. If we assume a valid SK, then the check is not needed. If we don't assume a valid SK, then why do we only surface the validity issue in a Does the spec say something about this check? EDIT: Oh well, I should have read our own documentation first. It clearly says that |
|
@hanno-becker yep, exactly. mldsa-native/mldsa/mldsa_native.h Lines 672 to 685 in b7e9a26
|
Signed-off-by: sanketh <[email protected]>
d025ad6 to
90c2778
Compare
Signed-off-by: sanketh <[email protected]>
Signed-off-by: sanketh <[email protected]>
|
Thank you for this! In my mind, my first thought was to modify the function In my mind, the fundamental issue is this function: https://github.com/pq-code-package/mldsa-native/blob/main/mldsa/src/polyvec.h#L666-L685 Should not be bound to Essentially, what I feel the crux of this PR is getting at, is changing the above decision for The current approach in this PR solves the issue in a way I hadn't first considered, and I just want to know the pros/cons of this over allowing This all came to me when creating the CBMC contract for the |
Issues:
crypto_sign_pk_from_skwas not verifying that s1 and s2 polynomial coefficients were within the valid range [-η, η].Description of changes:
Implements missing validation in
crypto_sign_pk_from_skto verify that s1 and s2 polynomial coefficients are within the valid range [-η, η].Motivated by aws/aws-lc#2874 where we discovered, via a Wycheproof test vector, that AWS-LC's MLDSA implementation was accepting secret keys with out-of-bounds s1/s2 coefficients.
Call-outs:
Testing:
The new functional tests and the existing tests all pass.
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.