summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-04-13 06:48:18 +0000
committertb <>2023-04-13 06:48:18 +0000
commitc344a5d55a22e1291d8bd210896c845201df5cc7 (patch)
tree1158c1177e98ec82f8a03d6e9b606c3914e93ea6 /src
parentae408965edfcc73a96b5aa5b519a4d94c35e6560 (diff)
downloadopenbsd-c344a5d55a22e1291d8bd210896c845201df5cc7.tar.gz
openbsd-c344a5d55a22e1291d8bd210896c845201df5cc7.tar.bz2
openbsd-c344a5d55a22e1291d8bd210896c845201df5cc7.zip
Fix various early return issues spotted by coverity
A large mechanical diff led to sloppy review and gave coverity an opportunity to be right for once. First time in a good many weeks. same diff/ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index bc472b73b7..f4e621954e 100644
--- a/src/lib/libcrypto/ec/ec_lib.c
+++ b/src/lib/libcrypto/ec/ec_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_lib.c,v 1.53 2023/04/11 18:58:20 jsing Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.54 2023/04/13 06:48:18 tb Exp $ */
2/* 2/*
3 * Originally written by Bodo Moeller for the OpenSSL project. 3 * Originally written by Bodo Moeller for the OpenSSL project.
4 */ 4 */
@@ -524,7 +524,7 @@ EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
524 524
525 if (group->meth->group_get_curve == NULL) { 525 if (group->meth->group_get_curve == NULL) {
526 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 526 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
527 return 0; 527 goto err;
528 } 528 }
529 ret = group->meth->group_get_curve(group, p, a, b, ctx); 529 ret = group->meth->group_get_curve(group, p, a, b, ctx);
530 530
@@ -587,11 +587,11 @@ EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx_in)
587 if (ctx == NULL) 587 if (ctx == NULL)
588 goto err; 588 goto err;
589 589
590 if (group->meth->group_check_discriminant == 0) { 590 if (group->meth->group_check_discriminant == NULL) {
591 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 591 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
592 return 0; 592 goto err;
593 } 593 }
594 return group->meth->group_check_discriminant(group, ctx); 594 ret = group->meth->group_check_discriminant(group, ctx);
595 595
596 err: 596 err:
597 if (ctx != ctx_in) 597 if (ctx != ctx_in)
@@ -1095,11 +1095,11 @@ EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point,
1095 1095
1096 if (group->meth->point_get_affine_coordinates == NULL) { 1096 if (group->meth->point_get_affine_coordinates == NULL) {
1097 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 1097 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
1098 return 0; 1098 goto err;
1099 } 1099 }
1100 if (group->meth != point->meth) { 1100 if (group->meth != point->meth) {
1101 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 1101 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
1102 return 0; 1102 goto err;
1103 } 1103 }
1104 ret = group->meth->point_get_affine_coordinates(group, point, x, y, ctx); 1104 ret = group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
1105 1105
@@ -1170,11 +1170,11 @@ EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
1170 1170
1171 if (group->meth->dbl == NULL) { 1171 if (group->meth->dbl == NULL) {
1172 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 1172 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
1173 return 0; 1173 goto err;
1174 } 1174 }
1175 if (group->meth != r->meth || r->meth != a->meth) { 1175 if (group->meth != r->meth || r->meth != a->meth) {
1176 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 1176 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
1177 return 0; 1177 goto err;
1178 } 1178 }
1179 ret = group->meth->dbl(group, r, a, ctx); 1179 ret = group->meth->dbl(group, r, a, ctx);
1180 1180
@@ -1196,15 +1196,15 @@ EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx_in)
1196 if (ctx == NULL) 1196 if (ctx == NULL)
1197 goto err; 1197 goto err;
1198 1198
1199 if (group->meth->invert == 0) { 1199 if (group->meth->invert == NULL) {
1200 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 1200 ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
1201 return 0; 1201 goto err;
1202 } 1202 }
1203 if (group->meth != a->meth) { 1203 if (group->meth != a->meth) {
1204 ECerror(EC_R_INCOMPATIBLE_OBJECTS); 1204 ECerror(EC_R_INCOMPATIBLE_OBJECTS);
1205 return 0; 1205 goto err;
1206 } 1206 }
1207 return group->meth->invert(group, a, ctx); 1207 ret = group->meth->invert(group, a, ctx);
1208 1208
1209 err: 1209 err:
1210 if (ctx != ctx_in) 1210 if (ctx != ctx_in)