summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec2_smpl.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-04-30 21:37:06 -0400
committerRich Salz <rsalz@openssl.org>2015-04-30 21:37:06 -0400
commit23a1d5e97cd543d2b8e1b01dbf0f619b2e5ce540 (patch)
tree2d9372864fc2b34939d21b3706768ec225c9548f /crypto/ec/ec2_smpl.c
parent34166d41892643a36ad2d1f53cc0025e2edc2a39 (diff)
free NULL cleanup 7
This gets BN_.*free: BN_BLINDING_free BN_CTX_free BN_FLG_FREE BN_GENCB_free BN_MONT_CTX_free BN_RECP_CTX_free BN_clear_free BN_free BUF_MEM_free Also fix a call to DSA_SIG_free to ccgost engine and remove some #ifdef'd dead code in engines/e_ubsec. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/ec/ec2_smpl.c')
-rw-r--r--crypto/ec/ec2_smpl.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/crypto/ec/ec2_smpl.c b/crypto/ec/ec2_smpl.c
index c1fb63d94d..d6a41a46bf 100644
--- a/crypto/ec/ec2_smpl.c
+++ b/crypto/ec/ec2_smpl.c
@@ -135,12 +135,9 @@ int ec_GF2m_simple_group_init(EC_GROUP *group)
group->b = BN_new();
if (!group->field || !group->a || !group->b) {
- if (group->field)
- BN_free(group->field);
- if (group->a)
- BN_free(group->a);
- if (group->b)
- BN_free(group->b);
+ BN_free(group->field);
+ BN_free(group->a);
+ BN_free(group->b);
return 0;
}
return 1;
@@ -318,8 +315,7 @@ int ec_GF2m_simple_group_check_discriminant(const EC_GROUP *group,
err:
if (ctx != NULL)
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
@@ -331,12 +327,9 @@ int ec_GF2m_simple_point_init(EC_POINT *point)
point->Z = BN_new();
if (!point->X || !point->Y || !point->Z) {
- if (point->X)
- BN_free(point->X);
- if (point->Y)
- BN_free(point->Y);
- if (point->Z)
- BN_free(point->Z);
+ BN_free(point->X);
+ BN_free(point->Y);
+ BN_free(point->Z);
return 0;
}
return 1;
@@ -569,8 +562,7 @@ int ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
err:
BN_CTX_end(ctx);
- if (new_ctx != NULL)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
@@ -663,8 +655,7 @@ int ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
@@ -716,8 +707,7 @@ int ec_GF2m_simple_cmp(const EC_GROUP *group, const EC_POINT *a,
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}
@@ -758,8 +748,7 @@ int ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point,
err:
if (ctx)
BN_CTX_end(ctx);
- if (new_ctx)
- BN_CTX_free(new_ctx);
+ BN_CTX_free(new_ctx);
return ret;
}