diff options
Diffstat (limited to 'crypto/ec')
-rw-r--r-- | crypto/ec/ec_asn1.c | 22 | ||||
-rw-r--r-- | crypto/ec/ec_lib.c | 7 | ||||
-rw-r--r-- | crypto/ec/ec_mult.c | 3 |
3 files changed, 10 insertions, 22 deletions
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c index c86f22e7d1..638f849c16 100644 --- a/crypto/ec/ec_asn1.c +++ b/crypto/ec/ec_asn1.c @@ -994,7 +994,6 @@ int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out) EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len) { - int ok = 0; EC_KEY *ret = NULL; EC_PRIVATEKEY *priv_key = NULL; @@ -1075,18 +1074,14 @@ EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len) if (a) *a = ret; - ok = 1; - err: - if (!ok) { - if (a == NULL || *a != ret) - EC_KEY_free(ret); - ret = NULL; - } - - if (priv_key) - EC_PRIVATEKEY_free(priv_key); - + EC_PRIVATEKEY_free(priv_key); return (ret); + + err: + if (a == NULL || *a != ret) + EC_KEY_free(ret); + EC_PRIVATEKEY_free(priv_key); + return NULL; } int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) @@ -1190,8 +1185,7 @@ int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) ok = 1; err: OPENSSL_free(buffer); - if (priv_key) - EC_PRIVATEKEY_free(priv_key); + EC_PRIVATEKEY_free(priv_key); return (ok ? ret : 0); } diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index 02de91da91..628e8799d4 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -132,16 +132,11 @@ void EC_GROUP_free(EC_GROUP *group) group->meth->group_finish(group); EC_EX_DATA_free_all_data(&group->extra_data); - BN_MONT_CTX_free(group->mont_data); - EC_POINT_free(group->generator); BN_free(group->order); BN_free(group->cofactor); - - if (group->seed) - OPENSSL_free(group->seed); - + OPENSSL_free(group->seed); OPENSSL_free(group); } diff --git a/crypto/ec/ec_mult.c b/crypto/ec/ec_mult.c index 115bc4258b..bd99c82516 100644 --- a/crypto/ec/ec_mult.c +++ b/crypto/ec/ec_mult.c @@ -742,8 +742,7 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) if (ctx != NULL) BN_CTX_end(ctx); BN_CTX_free(new_ctx); - if (pre_comp) - ec_pre_comp_free(pre_comp); + ec_pre_comp_free(pre_comp); if (points) { EC_POINT **p; |