summaryrefslogtreecommitdiff
path: root/lib/libcrypto/ec/ec_lib.c
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-04-13 06:48:19 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-04-13 06:48:19 +0000
commit3200cd59afa1dee575495a977d7139968b40525b (patch)
treec6438f22c1fd3078e6d22fddb666c5353680a810 /lib/libcrypto/ec/ec_lib.c
parentf8a8b2d4ca18e1f3bd7ec5c00ac3b783bd58cc64 (diff)
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 'lib/libcrypto/ec/ec_lib.c')
-rw-r--r--lib/libcrypto/ec/ec_lib.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/libcrypto/ec/ec_lib.c b/lib/libcrypto/ec/ec_lib.c
index bc472b73b77..f4e621954e5 100644
--- a/lib/libcrypto/ec/ec_lib.c
+++ b/lib/libcrypto/ec/ec_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ec_lib.c,v 1.53 2023/04/11 18:58:20 jsing Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.54 2023/04/13 06:48:18 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
@@ -524,7 +524,7 @@ EC_GROUP_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b,
if (group->meth->group_get_curve == NULL) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
+ goto err;
}
ret = group->meth->group_get_curve(group, p, a, b, ctx);
@@ -587,11 +587,11 @@ EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx_in)
if (ctx == NULL)
goto err;
- if (group->meth->group_check_discriminant == 0) {
+ if (group->meth->group_check_discriminant == NULL) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
+ goto err;
}
- return group->meth->group_check_discriminant(group, ctx);
+ ret = group->meth->group_check_discriminant(group, ctx);
err:
if (ctx != ctx_in)
@@ -1095,11 +1095,11 @@ EC_POINT_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point,
if (group->meth->point_get_affine_coordinates == NULL) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
+ goto err;
}
if (group->meth != point->meth) {
ECerror(EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
+ goto err;
}
ret = group->meth->point_get_affine_coordinates(group, point, x, y, ctx);
@@ -1170,11 +1170,11 @@ EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
if (group->meth->dbl == NULL) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
+ goto err;
}
if (group->meth != r->meth || r->meth != a->meth) {
ECerror(EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
+ goto err;
}
ret = group->meth->dbl(group, r, a, ctx);
@@ -1196,15 +1196,15 @@ EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx_in)
if (ctx == NULL)
goto err;
- if (group->meth->invert == 0) {
+ if (group->meth->invert == NULL) {
ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
- return 0;
+ goto err;
}
if (group->meth != a->meth) {
ECerror(EC_R_INCOMPATIBLE_OBJECTS);
- return 0;
+ goto err;
}
- return group->meth->invert(group, a, ctx);
+ ret = group->meth->invert(group, a, ctx);
err:
if (ctx != ctx_in)