Remove Z = 1 special-case in generic point_get_affine.
As the point may be the output of some private key operation, whether Z accidentally hit one is secret. Bug: 239 Change-Id: I7db34cd3b5dd5ca4b96980e8993a9b4eda49eb88 Reviewed-on: https://boringssl-review.googlesource.com/27664 Reviewed-by: Adam Langley <alangley@gmail.com>
This commit is contained in:
parent
f5858ca008
commit
5c0e0cec83
@ -184,15 +184,6 @@ static int ec_GFp_mont_point_get_affine_coordinates(const EC_GROUP *group,
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
|
||||
if (BN_cmp(&point->Z, &group->one) == 0) {
|
||||
// |point| is already affine.
|
||||
if (x != NULL && !BN_from_montgomery(x, &point->X, group->mont, ctx)) {
|
||||
goto err;
|
||||
}
|
||||
if (y != NULL && !BN_from_montgomery(y, &point->Y, group->mont, ctx)) {
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
// transform (X, Y, Z) into (x, y) := (X/Z^2, Y/Z^3)
|
||||
|
||||
BIGNUM *Z_1 = BN_CTX_get(ctx);
|
||||
@ -246,7 +237,6 @@ static int ec_GFp_mont_point_get_affine_coordinates(const EC_GROUP *group,
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user