In EC_KEY_set_public_key_affine_coordinates include explicit check to see passed components do not exceed field order
This commit is contained in:
parent
9eca2399f1
commit
901b9b5c36
@ -511,10 +511,12 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y)
|
|||||||
tx, ty, ctx))
|
tx, ty, ctx))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
/* Check if retrieved coordinates match originals: if not values
|
/* Check if retrieved coordinates match originals and are less than
|
||||||
* are out of range.
|
* field order: if not values are out of range.
|
||||||
*/
|
*/
|
||||||
if (BN_cmp(x, tx) || BN_cmp(y, ty))
|
if (BN_cmp(x, tx) || BN_cmp(y, ty)
|
||||||
|
|| (BN_cmp(x, &key->group->field) >= 0)
|
||||||
|
|| (BN_cmp(y, &key->group->field) >= 0))
|
||||||
{
|
{
|
||||||
ECerr(EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES,
|
ECerr(EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES,
|
||||||
EC_R_COORDINATES_OUT_OF_RANGE);
|
EC_R_COORDINATES_OUT_OF_RANGE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user