Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crypto/fipsmodule/ml_dsa/ml_dsa_ref/sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -205,6 +205,10 @@ int ml_dsa_sign_internal(ml_dsa_params *params,
SHAKE_Final(mu, &state, ML_DSA_CRHBYTES);
Copy link
Contributor

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

OPENSSL_EXPORT int SHA1_Final(uint8_t out[SHA_DIGEST_LENGTH], SHA_CTX *sha);
                   ^

Copy link
Contributor

Choose a reason for hiding this comment

The 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll skip the destruction of intermediate values with this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, great spot, added in 2185013

}
OPENSSL_memcpy(mu, m, mlen);
}

Expand Down Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, great spot, added in 2185013

}
OPENSSL_memcpy(mu, m, mlen);
}

Expand Down
Loading