]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: Fix error handling in load_jwk_ec_key
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 21 Aug 2023 06:59:49 +0000 (09:59 +0300)
committermarkus.valentin <markus.valentin@open-xchange.com>
Wed, 23 Aug 2023 15:06:20 +0000 (15:06 +0000)
Avoid clobbering error.

src/lib-dcrypt/dcrypt-openssl3.c

index 6b5f26428a1bbe33d36ec8b7ca669fea1183412e..86fdea9cb04e54f97f28f1e33b166790c8f38760 100644 (file)
@@ -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 */