From 118a859ea4c28f8b6ffd00540de9e1b511925ae7 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Tue, 13 Oct 2015 15:25:18 +0000 Subject: Convert ECParameters_dup() from a macro that uses ASN1_dup_of() into an actual function. This removes the last ASN1_dup_of usage from the tree. Feedback from doug@ and miod@ --- src/lib/libcrypto/ec/ec_lib.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/lib/libcrypto/ec/ec_lib.c') diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index c28ab18fc0..2b5abbd4bb 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_lib.c,v 1.19 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: ec_lib.c,v 1.20 2015/10/13 15:25:18 jsing Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -1102,3 +1102,19 @@ EC_GROUP_have_precompute_mult(const EC_GROUP * group) return 0; /* cannot tell whether precomputation has * been performed */ } + +EC_KEY * +ECParameters_dup(EC_KEY *key) +{ + unsigned char *p = NULL; + EC_KEY *k = NULL; + int len; + + if (key == NULL) + return (NULL); + + if ((len = i2d_ECParameters(key, &p)) > 0) + k = d2i_ECParameters(NULL, (const unsigned char **)&p, len); + + return (k); +} -- cgit v1.2.3-55-g6feb