diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-11-16 17:28:11 +0400 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-11-16 17:28:11 +0400 |
commit | 901b9b5c367ed81f2ce7879082a6ec600cb818d9 (patch) | |
tree | 57bf4f481e6546e2681b89856d2e0723380b7d37 | |
parent | 9eca2399f1f5ab45527f33147ee5180df4c035a2 (diff) |
In EC_KEY_set_public_key_affine_coordinates include explicit check to see passed components do not exceed field order
-rw-r--r-- | crypto/ec/ec_key.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c index f3331e1ce5..24ae707560 100644 --- a/crypto/ec/ec_key.c +++ b/crypto/ec/ec_key.c @@ -511,10 +511,12 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y) tx, ty, ctx)) goto err; } - /* Check if retrieved coordinates match originals: if not values - * are out of range. + /* Check if retrieved coordinates match originals and are less than + * 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, EC_R_COORDINATES_OUT_OF_RANGE); |