evp: fix Coverity 1485669 improper use of negative value

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15635)
This commit is contained in:
Pauli 2021-06-07 09:45:40 +10:00
parent dacb0d8f79
commit 3f617061ec
1 changed files with 4 additions and 0 deletions

View 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: