-
Notifications
You must be signed in to change notification settings - Fork 86
Check that Y is a root of Y^2 in point decompression routine #113
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
Comments
Note that alpha = Y^2; square root in a prime field where p % 4 = 3 is performed by doing Z^1/2 = Z^((p+1)/4), which happens on line 148 |
Notes here for later reference: Given For As such, regardless of We need to add a check that [1] https://github.com/aws/aws-encryption-sdk-python/blob/master/src/aws_encryption_sdk/internal/crypto/elliptic_curve.py#L140 |
Resolving this in favor of the related issue on the spec repo. Our plan is to track compliance with the specification with a new mechanism. |
The point decompression routine at https://github.com/aws/aws-encryption-sdk-python/blob/master/src/aws_encryption_sdk/internal/crypto/elliptic_curve.py#L109 computes Y by taking the root of Y^2, but does not verify that the resulting Y does in fact give that original Y^2 upon squaring. In the general case, this check is necessary to avoid invalid point attacks, where the value of X^3 + A*X + B does not have a root in the field.
Fortunately, in our use case, because we're only using this for an ECDSA verify operation, an attacker with control of the public key point would already have the ability to construct a valid signature, so this is not a security issue with the code as it stands today. However, we should fix this to avoid problems if this function is someday reused for point decompression of ECDH shares, or some other similar operation.
Tagging @SalusaSecondus for visibility.
The text was updated successfully, but these errors were encountered: