From: Aki Tuomi Date: Mon, 21 Aug 2023 06:59:49 +0000 (+0300) Subject: lib-dcrypt: Fix error handling in load_jwk_ec_key X-Git-Tag: 2.4.0~2618 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4fc8147226d7c799ccfac4023e1401ae0fe5c6b6;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: Fix error handling in load_jwk_ec_key Avoid clobbering error. --- diff --git a/src/lib-dcrypt/dcrypt-openssl3.c b/src/lib-dcrypt/dcrypt-openssl3.c index 6b5f26428a..86fdea9cb0 100644 --- a/src/lib-dcrypt/dcrypt-openssl3.c +++ b/src/lib-dcrypt/dcrypt-openssl3.c @@ -1600,7 +1600,7 @@ static bool load_jwk_ec_key(EVP_PKEY **key_r, bool want_private_key, ERR_raise_data(ERR_R_EC_LIB, ERR_R_INVALID_PROPERTY_DEFINITION, "Private key did not match with public key"); EVP_PKEY_free(pkey); - res = FALSE; + res = dcrypt_openssl_error(error_r); } BN_free(cx); BN_free(cy); @@ -1616,10 +1616,9 @@ static bool load_jwk_ec_key(EVP_PKEY **key_r, bool want_private_key, BN_free(px); BN_free(py); - if (!res) - return dcrypt_openssl_error(error_r); - *key_r = pkey; - return TRUE; + if (res == TRUE) + *key_r = pkey; + return res; } /* Loads both public and private key */