summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-12-29 18:48:25 +0000
committertb <>2023-12-29 18:48:25 +0000
commit541e2532eb84a03856260e1807f761fafdd982fc (patch)
tree53ce55d71dcb4df35ef85a3d51414edc41914052
parente0b291582b497c9fa0cadaa90ec797d6517b2959 (diff)
downloadopenbsd-541e2532eb84a03856260e1807f761fafdd982fc.tar.gz
openbsd-541e2532eb84a03856260e1807f761fafdd982fc.tar.bz2
openbsd-541e2532eb84a03856260e1807f761fafdd982fc.zip
Clean up old_ec_priv_decode()
As per usual. Stylistic adjustments and missing error check. ok jsing
-rw-r--r--src/lib/libcrypto/ec/ec_ameth.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c
index e6fe8bd370..660e5bffd1 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.48 2023/12/29 18:47:47 tb Exp $ */ 1/* $OpenBSD: ec_ameth.c,v 1.49 2023/12/29 18:48:25 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 */
@@ -599,16 +599,23 @@ eckey_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
599} 599}
600 600
601static int 601static int
602old_ec_priv_decode(EVP_PKEY *pkey, 602old_ec_priv_decode(EVP_PKEY *pkey, const unsigned char **priv, int priv_len)
603 const unsigned char **pder, int derlen)
604{ 603{
605 EC_KEY *ec; 604 EC_KEY *eckey;
606 if (!(ec = d2i_ECPrivateKey(NULL, pder, derlen))) { 605 int ret = 0;
607 ECerror(EC_R_DECODE_ERROR); 606
608 return 0; 607 if ((eckey = d2i_ECPrivateKey(NULL, priv, priv_len)) == NULL)
609 } 608 goto err;
610 EVP_PKEY_assign_EC_KEY(pkey, ec); 609 if (!EVP_PKEY_assign_EC_KEY(pkey, eckey))
611 return 1; 610 goto err;
611 eckey = NULL;
612
613 ret = 1;
614
615 err:
616 EC_KEY_free(eckey);
617
618 return ret;
612} 619}
613 620
614static int 621static int