-
Notifications
You must be signed in to change notification settings - Fork 835
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
[Bug]: sc448_reduce and sc448_muladd only weakly reduce the scalars #8237
Comments
@SparkiDev will you please review this report? Thank you |
Hi @aCinal , Thank you again for the report. I wanted to let you know we are looking into this. Thanks, |
Hi @aCinal , Can you tell us about your project and use of ED448? I'm curious what is driving your choice for using ED448. If you'd like to keep the response confidential please email support at wolfssl dot com. Thanks, |
Hi @aCinal, Thank you for the report and the reproduction steps; I was able to reproduce this. We will work on this. Best, |
Looks good to me. Maybe it is worth documenting in the code (comments) that Regards, |
Hi Adrian, Thanks for confirming the fix! I've update the comments on the implementation of sc448_reduce and added a comment in the header file. Sean |
Contact Details
[email protected]
Version
5.7.4
Description
All implementations of
sc448_reduce
andsc448_muladd
inwolfcrypt/src/ge_448.c
(three of each) fail to fully reduce the scalar before returning, i.e., bring it into the canonical range[0, L)
whereL
is the group order. Instead, only weak reduction is performed which brings the scalar into the[0, 2L)
range. This can lead to WolfSSL producing invalid Ed448 signatures, as canonicity of the response scalar (returned directly fromsc448_muladd
) is checked during signature verification (see, e.g.,ed448_verify_msg_final_with_sha
inwolfcrypt/src/ed448.c
).A missing step at the end of both
sc448_reduce
andsc448_muladd
is checking for canonicity of the result and, if not canonical, subtractingL
from it. Importantly, this conditional subtraction must be performed in constant-time so as to not leak information about the input values via a side channel (the response, for example, is computed from the secret key and the secret ephemeral value).This is most easily reproduced with
L
itself as input.sc448_reduce
leaves it unchanged, even thoughL = 0 (mod L)
. Forsc448_muladd
, try computing, e.g.,1 * L + 0
or2 * L + L
.Reproduction steps
Relevant log output
No response
The text was updated successfully, but these errors were encountered: