summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ecp_smpl.c
diff options
context:
space:
mode:
authorbeck <>2017-01-29 17:49:23 +0000
committerbeck <>2017-01-29 17:49:23 +0000
commit957b11334a7afb14537322f0e4795b2e368b3f59 (patch)
tree1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/ec/ecp_smpl.c
parentdf96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff)
downloadopenbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2
openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_smpl.c')
-rw-r--r--src/lib/libcrypto/ec/ecp_smpl.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c
index f497657463..ddba49c693 100644
--- a/src/lib/libcrypto/ec/ecp_smpl.c
+++ b/src/lib/libcrypto/ec/ecp_smpl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_smpl.c,v 1.16 2017/01/21 11:00:47 beck Exp $ */ 1/* $OpenBSD: ecp_smpl.c,v 1.17 2017/01/29 17:49:23 beck Exp $ */
2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> 2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
3 * for the OpenSSL project. 3 * for the OpenSSL project.
4 * Includes code written by Bodo Moeller for the OpenSSL project. 4 * Includes code written by Bodo Moeller for the OpenSSL project.
@@ -180,7 +180,7 @@ ec_GFp_simple_group_set_curve(EC_GROUP * group,
180 180
181 /* p must be a prime > 3 */ 181 /* p must be a prime > 3 */
182 if (BN_num_bits(p) <= 2 || !BN_is_odd(p)) { 182 if (BN_num_bits(p) <= 2 || !BN_is_odd(p)) {
183 ECerr(EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE, EC_R_INVALID_FIELD); 183 ECerror(EC_R_INVALID_FIELD);
184 return 0; 184 return 0;
185 } 185 }
186 if (ctx == NULL) { 186 if (ctx == NULL) {
@@ -289,7 +289,7 @@ ec_GFp_simple_group_check_discriminant(const EC_GROUP * group, BN_CTX * ctx)
289 if (ctx == NULL) { 289 if (ctx == NULL) {
290 ctx = new_ctx = BN_CTX_new(); 290 ctx = new_ctx = BN_CTX_new();
291 if (ctx == NULL) { 291 if (ctx == NULL) {
292 ECerr(EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT, ERR_R_MALLOC_FAILURE); 292 ECerror(ERR_R_MALLOC_FAILURE);
293 goto err; 293 goto err;
294 } 294 }
295 } 295 }
@@ -516,7 +516,7 @@ ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP * group, EC_POINT * po
516{ 516{
517 if (x == NULL || y == NULL) { 517 if (x == NULL || y == NULL) {
518 /* unlike for projective coordinates, we do not tolerate this */ 518 /* unlike for projective coordinates, we do not tolerate this */
519 ECerr(EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES, ERR_R_PASSED_NULL_PARAMETER); 519 ECerror(ERR_R_PASSED_NULL_PARAMETER);
520 return 0; 520 return 0;
521 } 521 }
522 return EC_POINT_set_Jprojective_coordinates_GFp(group, point, x, y, BN_value_one(), ctx); 522 return EC_POINT_set_Jprojective_coordinates_GFp(group, point, x, y, BN_value_one(), ctx);
@@ -533,7 +533,7 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POIN
533 int ret = 0; 533 int ret = 0;
534 534
535 if (EC_POINT_is_at_infinity(group, point) > 0) { 535 if (EC_POINT_is_at_infinity(group, point) > 0) {
536 ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); 536 ECerror(EC_R_POINT_AT_INFINITY);
537 return 0; 537 return 0;
538 } 538 }
539 if (ctx == NULL) { 539 if (ctx == NULL) {
@@ -583,7 +583,7 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POIN
583 } 583 }
584 } else { 584 } else {
585 if (!BN_mod_inverse_ct(Z_1, Z_, &group->field, ctx)) { 585 if (!BN_mod_inverse_ct(Z_1, Z_, &group->field, ctx)) {
586 ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, ERR_R_BN_LIB); 586 ECerror(ERR_R_BN_LIB);
587 goto err; 587 goto err;
588 } 588 }
589 if (group->meth->field_encode == 0) { 589 if (group->meth->field_encode == 0) {
@@ -1210,7 +1210,7 @@ ec_GFp_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx
1210 if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx)) 1210 if (!EC_POINT_set_affine_coordinates_GFp(group, point, x, y, ctx))
1211 goto err; 1211 goto err;
1212 if (!point->Z_is_one) { 1212 if (!point->Z_is_one) {
1213 ECerr(EC_F_EC_GFP_SIMPLE_MAKE_AFFINE, ERR_R_INTERNAL_ERROR); 1213 ECerror(ERR_R_INTERNAL_ERROR);
1214 goto err; 1214 goto err;
1215 } 1215 }
1216 ret = 1; 1216 ret = 1;
@@ -1313,7 +1313,7 @@ ec_GFp_simple_points_make_affine(const EC_GROUP * group, size_t num, EC_POINT *
1313 /* invert heap[1] */ 1313 /* invert heap[1] */
1314 if (!BN_is_zero(heap[1])) { 1314 if (!BN_is_zero(heap[1])) {
1315 if (!BN_mod_inverse_ct(heap[1], heap[1], &group->field, ctx)) { 1315 if (!BN_mod_inverse_ct(heap[1], heap[1], &group->field, ctx)) {
1316 ECerr(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE, ERR_R_BN_LIB); 1316 ECerror(ERR_R_BN_LIB);
1317 goto err; 1317 goto err;
1318 } 1318 }
1319 } 1319 }