Remove unused |ec_GFp_simple_group_check_discriminant|.

Change-Id: I995a445fea1de7f85ec917694abb8273a82339d3
Reviewed-on: https://boringssl-review.googlesource.com/7092
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
Brian Smith 2016-02-05 14:18:26 -10:00 committed by David Benjamin
parent 4862b3b93c
commit b121a26736
2 changed files with 0 additions and 71 deletions

View File

@ -174,7 +174,6 @@ int ec_GFp_simple_group_set_curve(EC_GROUP *, const BIGNUM *p, const BIGNUM *a,
int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a, int ec_GFp_simple_group_get_curve(const EC_GROUP *, BIGNUM *p, BIGNUM *a,
BIGNUM *b, BN_CTX *); BIGNUM *b, BN_CTX *);
unsigned ec_GFp_simple_group_get_degree(const EC_GROUP *); unsigned ec_GFp_simple_group_get_degree(const EC_GROUP *);
int ec_GFp_simple_group_check_discriminant(const EC_GROUP *, BN_CTX *);
int ec_GFp_simple_point_init(EC_POINT *); int ec_GFp_simple_point_init(EC_POINT *);
void ec_GFp_simple_point_finish(EC_POINT *); void ec_GFp_simple_point_finish(EC_POINT *);
void ec_GFp_simple_point_clear_finish(EC_POINT *); void ec_GFp_simple_point_clear_finish(EC_POINT *);

View File

@ -224,76 +224,6 @@ unsigned ec_GFp_simple_group_get_degree(const EC_GROUP *group) {
return BN_num_bits(&group->field); return BN_num_bits(&group->field);
} }
int ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) {
int ret = 0;
BIGNUM *a, *b, *order, *tmp_1, *tmp_2;
const BIGNUM *p = &group->field;
BN_CTX *new_ctx = NULL;
if (ctx == NULL) {
ctx = new_ctx = BN_CTX_new();
if (ctx == NULL) {
OPENSSL_PUT_ERROR(EC, ERR_R_MALLOC_FAILURE);
goto err;
}
}
BN_CTX_start(ctx);
a = BN_CTX_get(ctx);
b = BN_CTX_get(ctx);
tmp_1 = BN_CTX_get(ctx);
tmp_2 = BN_CTX_get(ctx);
order = BN_CTX_get(ctx);
if (order == NULL) {
goto err;
}
if (group->meth->field_decode) {
if (!group->meth->field_decode(group, a, &group->a, ctx) ||
!group->meth->field_decode(group, b, &group->b, ctx)) {
goto err;
}
} else {
if (!BN_copy(a, &group->a) || !BN_copy(b, &group->b)) {
goto err;
}
}
/* check the discriminant:
* y^2 = x^3 + a*x + b is an elliptic curve <=> 4*a^3 + 27*b^2 != 0 (mod p)
* 0 =< a, b < p */
if (BN_is_zero(a)) {
if (BN_is_zero(b)) {
goto err;
}
} else if (!BN_is_zero(b)) {
if (!BN_mod_sqr(tmp_1, a, p, ctx) ||
!BN_mod_mul(tmp_2, tmp_1, a, p, ctx) ||
!BN_lshift(tmp_1, tmp_2, 2)) {
goto err;
}
/* tmp_1 = 4*a^3 */
if (!BN_mod_sqr(tmp_2, b, p, ctx) ||
!BN_mul_word(tmp_2, 27)) {
goto err;
}
/* tmp_2 = 27*b^2 */
if (!BN_mod_add(a, tmp_1, tmp_2, p, ctx) ||
BN_is_zero(a)) {
goto err;
}
}
ret = 1;
err:
if (ctx != NULL) {
BN_CTX_end(ctx);
}
BN_CTX_free(new_ctx);
return ret;
}
int ec_GFp_simple_point_init(EC_POINT *point) { int ec_GFp_simple_point_init(EC_POINT *point) {
BN_init(&point->X); BN_init(&point->X);
BN_init(&point->Y); BN_init(&point->Y);