From 371c95bd20fe7e9fa658fbe00b43edd117b77336 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 17 Apr 2024 13:49:18 +0000 Subject: Turn ecdh_cms_encrypt() into single exit Also use ret instead of rv. ok jsing --- src/lib/libcrypto/ec/ec_ameth.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index 739297346c..9bcda79b3e 100644 --- a/src/lib/libcrypto/ec/ec_ameth.c +++ b/src/lib/libcrypto/ec/ec_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_ameth.c,v 1.54 2024/04/17 13:47:18 tb Exp $ */ +/* $OpenBSD: ec_ameth.c,v 1.55 2024/04/17 13:49:18 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -924,11 +924,10 @@ ecdh_cms_encrypt(CMS_RecipientInfo *ri) int penclen; int ecdh_nid, kdf_type, kdf_nid, wrap_nid; const EVP_MD *kdf_md; - int rv = 0; + int ret = 0; - pctx = CMS_RecipientInfo_get0_pkey_ctx(ri); - if (!pctx) - return 0; + if ((pctx = CMS_RecipientInfo_get0_pkey_ctx(ri)) == NULL) + goto err; /* Get ephemeral key */ pkey = EVP_PKEY_CTX_get0_pkey(pctx); if (!CMS_RecipientInfo_kari_get0_orig_id(ri, &talg, &pubkey, @@ -1043,12 +1042,13 @@ ecdh_cms_encrypt(CMS_RecipientInfo *ri) penc = NULL; X509_ALGOR_set0(talg, OBJ_nid2obj(kdf_nid), V_ASN1_SEQUENCE, wrap_str); - rv = 1; + ret = 1; err: free(penc); X509_ALGOR_free(wrap_alg); - return rv; + + return ret; } #endif -- cgit v1.2.3-55-g6feb