NISTZ256: use EC_POINT API and check errors.
Reviewed-by: Rich Salz <rsalz@openssl.org>
(cherry picked from commit 6038354cf8
)
This commit is contained in:
parent
c7e78b6bed
commit
07977739f0
1 changed files with 18 additions and 11 deletions
|
@ -834,19 +834,26 @@ static int ecp_nistz256_mult_precompute(EC_GROUP *group, BN_CTX *ctx)
|
||||||
goto err;
|
goto err;
|
||||||
for (j = 0; j < 37; j++) {
|
for (j = 0; j < 37; j++) {
|
||||||
/*
|
/*
|
||||||
* It would be faster to use
|
* It would be faster to use EC_POINTs_make_affine and
|
||||||
* ec_GFp_simple_points_make_affine and make multiple
|
* make multiple points affine at the same time.
|
||||||
* points affine at the same time.
|
|
||||||
*/
|
*/
|
||||||
ec_GFp_simple_make_affine(group, P, ctx);
|
if (!EC_POINT_make_affine(group, P, ctx))
|
||||||
ecp_nistz256_bignum_to_field_elem(preComputedTable[j]
|
goto err;
|
||||||
[k].X, &P->X);
|
if (!ecp_nistz256_bignum_to_field_elem(preComputedTable[j][k].X,
|
||||||
ecp_nistz256_bignum_to_field_elem(preComputedTable[j]
|
&P->X) ||
|
||||||
[k].Y, &P->Y);
|
!ecp_nistz256_bignum_to_field_elem(preComputedTable[j][k].Y,
|
||||||
for (i = 0; i < 7; i++)
|
&P->Y)) {
|
||||||
ec_GFp_simple_dbl(group, P, P, ctx);
|
ECerr(EC_F_ECP_NISTZ256_MULT_PRECOMPUTE,
|
||||||
|
EC_R_COORDINATES_OUT_OF_RANGE);
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
ec_GFp_simple_add(group, T, T, generator, ctx);
|
for (i = 0; i < 7; i++) {
|
||||||
|
if (!EC_POINT_dbl(group, P, P, ctx))
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!EC_POINT_add(group, T, T, generator, ctx))
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre_comp->group = group;
|
pre_comp->group = group;
|
||||||
|
|
Loading…
Reference in a new issue