-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
ECDSA verification fails when the payload is all-bits-zero #1792
Comments
I agree. I think this could be easily solved by special-casing d == 0 in The root of the issue is that in this corner-case of ECDSA, |
ARM Internal Ref: IOTSSL-2377 |
mbedtls_ecdsa_verify fails when the input is all-bits-zero (mbedtls issue #1792). Use a different input.
There's no fix available. ca45c35 is a workaround, not a fix. |
Please, assign this task to me. |
Fix function mbedtls_ecp_mul_shortcuts() to skip multiplication when m is 0 and simply assignt 0 to R. Additionally fix ecjpake_zkp_read() to return MBEDTLS_ERR_ECP_INVALID_KEY when the above condintion is met. Fix Mbed-TLS#1792
Fix function mbedtls_ecp_mul_shortcuts() to skip multiplication when m is 0 and simply assignt 0 to R. Additionally fix ecjpake_zkp_read() to return MBEDTLS_ERR_ECP_INVALID_KEY when the above condintion is met. Fix Mbed-TLS#1792 Signed-off-by: TRodziewicz <[email protected]>
ECDSA verification (
mbedtls_ecdsa_verify
ormbedtls_ecdsa_read_signature
) returnsMBEDTLS_ERR_ECP_INVALID_KEY
when the payload (which should be a hash) is all-bits zero. The curve is a short Weierstrass curve.This is a corner case that shouldn't happen if the function is used properly, but I don't think it's right. I expect verification to succeed when the signature is the output of a signature generation with the matching private key.
The error is triggered with the following call stack:
In
mbedtls_ecdsa_verify
,u1
is zero, which causesmbedtls_ecp_muladd( grp, &R, &u1, &grp->G, &u2, Q )
to fail.Code to reproduce, tested with Mbed TLS 2.11:
The text was updated successfully, but these errors were encountered: