summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/ec/ec_ameth.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c
index 2b3b3db63d..e6fe8bd370 100644
--- a/src/lib/libcrypto/ec/ec_ameth.c
+++ b/src/lib/libcrypto/ec/ec_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_ameth.c,v 1.47 2023/12/29 18:46:24 tb Exp $ */ 1/* $OpenBSD: ec_ameth.c,v 1.48 2023/12/29 18:47:47 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -551,16 +551,23 @@ do_EC_KEY_print(BIO *bp, const EC_KEY *x, int off, int ktype)
551} 551}
552 552
553static int 553static int
554eckey_param_decode(EVP_PKEY *pkey, 554eckey_param_decode(EVP_PKEY *pkey, const unsigned char **param, int param_len)
555 const unsigned char **pder, int derlen)
556{ 555{
557 EC_KEY *eckey; 556 EC_KEY *eckey;
558 if (!(eckey = d2i_ECParameters(NULL, pder, derlen))) { 557 int ret = 0;
559 ECerror(ERR_R_EC_LIB); 558
560 return 0; 559 if ((eckey = d2i_ECParameters(NULL, param, param_len)) == NULL)
561 } 560 goto err;
562 EVP_PKEY_assign_EC_KEY(pkey, eckey); 561 if (!EVP_PKEY_assign_EC_KEY(pkey, eckey))
563 return 1; 562 goto err;
563 eckey = NULL;
564
565 ret = 1;
566
567 err:
568 EC_KEY_free(eckey);
569
570 return ret;
564} 571}
565 572
566static int 573static int