summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_check.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/ec_check.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/ec_check.c')
-rw-r--r--src/lib/libcrypto/ec/ec_check.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/ec/ec_check.c b/src/lib/libcrypto/ec/ec_check.c
index 21072305d5..bbb03498ac 100644
--- a/src/lib/libcrypto/ec/ec_check.c
+++ b/src/lib/libcrypto/ec/ec_check.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_check.c,v 1.5 2015/02/08 22:25:03 miod Exp $ */ 1/* $OpenBSD: ec_check.c,v 1.6 2017/01/29 17:49:23 beck Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -67,7 +67,7 @@ EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx)
67 if (ctx == NULL) { 67 if (ctx == NULL) {
68 ctx = new_ctx = BN_CTX_new(); 68 ctx = new_ctx = BN_CTX_new();
69 if (ctx == NULL) { 69 if (ctx == NULL) {
70 ECerr(EC_F_EC_GROUP_CHECK, ERR_R_MALLOC_FAILURE); 70 ECerror(ERR_R_MALLOC_FAILURE);
71 goto err; 71 goto err;
72 } 72 }
73 } 73 }
@@ -77,16 +77,16 @@ EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx)
77 77
78 /* check the discriminant */ 78 /* check the discriminant */
79 if (!EC_GROUP_check_discriminant(group, ctx)) { 79 if (!EC_GROUP_check_discriminant(group, ctx)) {
80 ECerr(EC_F_EC_GROUP_CHECK, EC_R_DISCRIMINANT_IS_ZERO); 80 ECerror(EC_R_DISCRIMINANT_IS_ZERO);
81 goto err; 81 goto err;
82 } 82 }
83 /* check the generator */ 83 /* check the generator */
84 if (group->generator == NULL) { 84 if (group->generator == NULL) {
85 ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_GENERATOR); 85 ECerror(EC_R_UNDEFINED_GENERATOR);
86 goto err; 86 goto err;
87 } 87 }
88 if (EC_POINT_is_on_curve(group, group->generator, ctx) <= 0) { 88 if (EC_POINT_is_on_curve(group, group->generator, ctx) <= 0) {
89 ECerr(EC_F_EC_GROUP_CHECK, EC_R_POINT_IS_NOT_ON_CURVE); 89 ECerror(EC_R_POINT_IS_NOT_ON_CURVE);
90 goto err; 90 goto err;
91 } 91 }
92 /* check the order of the generator */ 92 /* check the order of the generator */
@@ -95,13 +95,13 @@ EC_GROUP_check(const EC_GROUP * group, BN_CTX * ctx)
95 if (!EC_GROUP_get_order(group, order, ctx)) 95 if (!EC_GROUP_get_order(group, order, ctx))
96 goto err; 96 goto err;
97 if (BN_is_zero(order)) { 97 if (BN_is_zero(order)) {
98 ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_ORDER); 98 ECerror(EC_R_UNDEFINED_ORDER);
99 goto err; 99 goto err;
100 } 100 }
101 if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) 101 if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx))
102 goto err; 102 goto err;
103 if (EC_POINT_is_at_infinity(group, point) <= 0) { 103 if (EC_POINT_is_at_infinity(group, point) <= 0) {
104 ECerr(EC_F_EC_GROUP_CHECK, EC_R_INVALID_GROUP_ORDER); 104 ECerror(EC_R_INVALID_GROUP_ORDER);
105 goto err; 105 goto err;
106 } 106 }
107 ret = 1; 107 ret = 1;