Remove |EC_POINT_add|, |EC_POINT_dbl|, and |EC_POINT_invert|.

This commit is contained in:
Brian Smith 2015-10-07 19:44:00 -10:00
parent 2dbc92ff41
commit 9b5b758f02
4 changed files with 13 additions and 56 deletions

View File

@ -582,34 +582,6 @@ int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *point,
return ec_GFp_simple_point_set_affine_coordinates(group, point, x, y, ctx);
}
int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
const EC_POINT *b, BN_CTX *ctx) {
if ((group->meth != r->meth) || (r->meth != a->meth) ||
(a->meth != b->meth)) {
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
return ec_GFp_simple_add(group, r, a, b, ctx);
}
int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
BN_CTX *ctx) {
if ((group->meth != r->meth) || (r->meth != a->meth)) {
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
return ec_GFp_simple_dbl(group, r, a, ctx);
}
int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx) {
if (group->meth != a->meth) {
OPENSSL_PUT_ERROR(EC, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
return ec_GFp_simple_invert(group, a, ctx);
}
int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) {

View File

@ -407,7 +407,7 @@ int ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
int ret = 0;
if (a == b) {
return EC_POINT_dbl(group, r, a, ctx);
return ec_GFp_simple_dbl(group, r, a, ctx);
}
if (EC_POINT_is_at_infinity(group, a)) {
return EC_POINT_copy(r, b);
@ -498,7 +498,7 @@ int ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
if (BN_is_zero(n6)) {
/* a is the same point as b */
BN_CTX_end(ctx);
ret = EC_POINT_dbl(group, r, a, ctx);
ret = ec_GFp_simple_dbl(group, r, a, ctx);
ctx = NULL;
goto end;
} else {

View File

@ -551,11 +551,12 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
}
if (wsize[i] > 1) {
if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx)) {
if (!ec_GFp_simple_dbl(group, tmp, val_sub[i][0], ctx)) {
goto err;
}
for (j = 1; j < ((size_t)1 << (wsize[i] - 1)); j++) {
if (!EC_POINT_add(group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx)) {
if (!ec_GFp_simple_add(group, val_sub[i][j], val_sub[i][j - 1], tmp,
ctx)) {
goto err;
}
}
@ -571,7 +572,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
r_is_at_infinity = 1;
for (k = max_len - 1; k >= 0; k--) {
if (!r_is_at_infinity && !EC_POINT_dbl(group, r, r, ctx)) {
if (!r_is_at_infinity && !ec_GFp_simple_dbl(group, r, r, ctx)) {
goto err;
}
@ -588,7 +589,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
}
if (is_neg != r_is_inverted) {
if (!r_is_at_infinity && !EC_POINT_invert(group, r, ctx)) {
if (!r_is_at_infinity && !ec_GFp_simple_invert(group, r, ctx)) {
goto err;
}
r_is_inverted = !r_is_inverted;
@ -602,7 +603,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
}
r_is_at_infinity = 0;
} else {
if (!EC_POINT_add(group, r, r, val_sub[i][digit >> 1], ctx)) {
if (!ec_GFp_simple_add(group, r, r, val_sub[i][digit >> 1], ctx)) {
goto err;
}
}
@ -615,7 +616,7 @@ int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
if (!EC_POINT_set_to_infinity(group, r)) {
goto err;
}
} else if (r_is_inverted && !EC_POINT_invert(group, r, ctx)) {
} else if (r_is_inverted && !ec_GFp_simple_invert(group, r, ctx)) {
goto err;
}
@ -765,7 +766,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) {
for (i = 0; i < numblocks; i++) {
size_t j;
if (!EC_POINT_dbl(group, tmp_point, base, ctx)) {
if (!ec_GFp_simple_dbl(group, tmp_point, base, ctx)) {
goto err;
}
@ -775,7 +776,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) {
for (j = 1; j < pre_points_per_block; j++, var++) {
/* calculate odd multiples of the current base point */
if (!EC_POINT_add(group, *var, tmp_point, *(var - 1), ctx)) {
if (!ec_GFp_simple_add(group, *var, tmp_point, *(var - 1), ctx)) {
goto err;
}
}
@ -789,11 +790,11 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) {
goto err;
}
if (!EC_POINT_dbl(group, base, tmp_point, ctx)) {
if (!ec_GFp_simple_dbl(group, base, tmp_point, ctx)) {
goto err;
}
for (k = 2; k < blocksize; k++) {
if (!EC_POINT_dbl(group, base, base, ctx)) {
if (!ec_GFp_simple_dbl(group, base, base, ctx)) {
goto err;
}
}

View File

@ -226,22 +226,6 @@ OPENSSL_EXPORT int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
/* Group operations. */
/* EC_POINT_add sets |r| equal to |a| plus |b|. It returns one on success and
* zero otherwise. If |ctx| is not NULL, it may be used. */
OPENSSL_EXPORT int EC_POINT_add(const EC_GROUP *group, EC_POINT *r,
const EC_POINT *a, const EC_POINT *b,
BN_CTX *ctx);
/* EC_POINT_dbl sets |r| equal to |a| plus |a|. It returns one on success and
* zero otherwise. If |ctx| is not NULL, it may be used. */
OPENSSL_EXPORT int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r,
const EC_POINT *a, BN_CTX *ctx);
/* EC_POINT_invert sets |a| equal to minus |a|. It returns one on success and zero
* otherwise. If |ctx| is not NULL, it may be used. */
OPENSSL_EXPORT int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a,
BN_CTX *ctx);
/* EC_POINT_mul sets r = generator*n + q*m. It returns one on success and zero
* otherwise. If |ctx| is not NULL, it may be used. */
OPENSSL_EXPORT int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r,