summaryrefslogtreecommitdiffstats
path: root/crypto/ec
diff options
context:
space:
mode:
authorEmilia Kasper <emilia@openssl.org>2015-04-27 18:49:43 +0200
committerEmilia Kasper <emilia@openssl.org>2015-04-27 19:50:19 +0200
commit07977739f0eaa1dd6845518b590932ba5cbf75d1 (patch)
treeada4f05f8584bb0cf051ef8db24c05a433f7559c /crypto/ec
parentc7e78b6bed84534ca864545d7a58aaae22f187cf (diff)
NISTZ256: use EC_POINT API and check errors.
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 6038354cf8ca0792420c1ac0ce50d6d2f0aedebf)
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/ecp_nistz256.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c
index bd09312206..ca44d0aaee 100644
--- a/crypto/ec/ecp_nistz256.c
+++ b/crypto/ec/ecp_nistz256.c
@@ -834,19 +834,26 @@ static int ecp_nistz256_mult_precompute(EC_GROUP *group, BN_CTX *ctx)
goto err;
for (j = 0; j < 37; j++) {
/*
- * It would be faster to use
- * ec_GFp_simple_points_make_affine and make multiple
- * points affine at the same time.
+ * It would be faster to use EC_POINTs_make_affine and
+ * make multiple points affine at the same time.
*/
- ec_GFp_simple_make_affine(group, P, ctx);
- ecp_nistz256_bignum_to_field_elem(preComputedTable[j]
- [k].X, &P->X);
- ecp_nistz256_bignum_to_field_elem(preComputedTable[j]
- [k].Y, &P->Y);
- for (i = 0; i < 7; i++)
- ec_GFp_simple_dbl(group, P, P, ctx);
+ if (!EC_POINT_make_affine(group, P, ctx))
+ goto err;
+ if (!ecp_nistz256_bignum_to_field_elem(preComputedTable[j][k].X,
+ &P->X) ||
+ !ecp_nistz256_bignum_to_field_elem(preComputedTable[j][k].Y,
+ &P->Y)) {
+ ECerr(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE,
+ EC_R_COORDINATES_OUT_OF_RANGE);
+ goto err;
+ }
+ for (i = 0; i < 7; i++) {
+ if (!EC_POINT_dbl(group, P, P, ctx))
+ goto err;
+ }
}
- ec_GFp_simple_add(group, T, T, generator, ctx);
+ if (!EC_POINT_add(group, T, T, generator, ctx))
+ goto err;
}
pre_comp->group = group;