-
Notifications
You must be signed in to change notification settings - Fork 154
Verify size of mlen in ML-DSA external mu mode #2841
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?
Changes from 1 commit
1a27be3
2185013
0d23bd5
5b1c5a5
405486d
ff7fbb9
f4128f8
eaa6bae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,7 +161,7 @@ int ml_dsa_keypair(ml_dsa_params *params, uint8_t *pk, uint8_t *sk, uint8_t *see | |
| * - uint8_t *sk: pointer to bit-packed secret key | ||
| * - int external_mu: indicates input message m is to be processed as mu | ||
| * | ||
| * Returns 0 (success) or -1 (context string too long) | ||
| * Returns 0 (success) or -1 (context string or message too long) | ||
| **************************************************/ | ||
| int ml_dsa_sign_internal(ml_dsa_params *params, | ||
| uint8_t *sig, | ||
|
|
@@ -205,6 +205,10 @@ int ml_dsa_sign_internal(ml_dsa_params *params, | |
| SHAKE_Final(mu, &state, ML_DSA_CRHBYTES); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: use of undeclared identifier 'state' [clang-diagnostic-error] SHAKE_Final(mu, &state, ML_DSA_CRHBYTES);
^ |
||
| } | ||
| else { | ||
| // When external_mu is true, m is expected to be exactly ML_DSA_CRHBYTES | ||
| if (mlen != ML_DSA_CRHBYTES) { | ||
| return -1; | ||
|
||
| } | ||
| OPENSSL_memcpy(mu, m, mlen); | ||
| } | ||
|
|
||
|
|
@@ -492,6 +496,10 @@ int ml_dsa_verify_internal(ml_dsa_params *params, | |
| SHAKE_Final(mu, &state, ML_DSA_CRHBYTES); | ||
| } | ||
| else { | ||
| // When external_mu is true, m is expected to be exactly ML_DSA_CRHBYTES | ||
| if (mlen != ML_DSA_CRHBYTES) { | ||
| return -1; | ||
|
||
| } | ||
| OPENSSL_memcpy(mu, m, mlen); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: call to undeclared function 'SHAKE_Final'; ISO C99 and later do not support implicit function declarations [clang-diagnostic-implicit-function-declaration]
SHAKE_Final(mu, &state, ML_DSA_CRHBYTES); ^Additional context
crypto/fipsmodule/ml_dsa/ml_dsa_ref/sign.c:204: did you mean 'SHA1_Final'?
SHAKE_Final(mu, &state, ML_DSA_CRHBYTES); ^include/openssl/sha.h:84: 'SHA1_Final' declared here