]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
evp: fix Coverity 1485669 improper use of negative value
authorPauli <pauli@openssl.org>
Sun, 6 Jun 2021 23:45:40 +0000 (09:45 +1000)
committerPauli <pauli@openssl.org>
Tue, 8 Jun 2021 09:32:25 +0000 (19:32 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15635)

crypto/evp/ctrl_params_translate.c

index e289c7df7b27faad72f1cd30505d6573f054b4d3..6998dcc6fc1679edb27dfde34d4477429577b13c 100644 (file)
@@ -1704,6 +1704,10 @@ static int get_ec_decoded_from_explicit_params(enum state state,
 #ifndef OPENSSL_NO_EC
     case EVP_PKEY_EC:
         val = EC_KEY_decoded_from_explicit_params(EVP_PKEY_get0_EC_KEY(pkey));
+        if (val < 0) {
+            ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_KEY);
+            return 0;
+        }
         break;
 #endif
     default: