aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec
diff options
context:
space:
mode:
authorNils Larsch <nils@openssl.org>2005-05-17 12:23:16 +0000
committerNils Larsch <nils@openssl.org>2005-05-17 12:23:16 +0000
commit8712009778af8430150401d5bee4e94d547f1f2d (patch)
tree9afb5307069c2ce1809a2121952d43ec61cf2706 /crypto/ec
parentb8994f44e7ac57a9b73827d47ce9ec734b1000e2 (diff)
downloadopenssl-8712009778af8430150401d5bee4e94d547f1f2d.tar.gz
simplify EC_KEY_dup
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/ec_key.c38
1 files changed, 4 insertions, 34 deletions
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index 66d9c8dd82..3d6c900b95 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -201,46 +201,16 @@ EC_KEY *EC_KEY_copy(EC_KEY *dest, const EC_KEY *src)
return dest;
}
-EC_KEY *EC_KEY_dup(const EC_KEY *eckey)
+EC_KEY *EC_KEY_dup(const EC_KEY *ec_key)
{
- EC_KEY *ret = NULL;
- int ok = 1;
-
- ret = EC_KEY_new();
+ EC_KEY *ret = EC_KEY_new();
if (ret == NULL)
return NULL;
- /* copy the parameters */
- if (eckey->group)
- {
- ret->group = EC_GROUP_dup(eckey->group);
- if (ret->group == NULL)
- ok = 0;
- }
- /* copy the public key */
- if (eckey->pub_key && eckey->group)
- {
- ret->pub_key = EC_POINT_dup(eckey->pub_key, eckey->group);
- if (ret->pub_key == NULL)
- ok = 0;
- }
- /* copy the private key */
- if (eckey->priv_key)
- {
- ret->priv_key = BN_dup(eckey->priv_key);
- if (ret->priv_key == NULL)
- ok = 0;
- }
- /* copy the rest */
- ret->enc_flag = eckey->enc_flag;
- ret->conv_form = eckey->conv_form;
- ret->version = eckey->version;
-
- if (!ok)
+ if (EC_KEY_copy(ret, ec_key) == NULL)
{
EC_KEY_free(ret);
- ret = NULL;
+ return NULL;
}
-
return ret;
}