summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-05-10 10:24:13 +1000
committerPauli <pauli@openssl.org>2021-05-12 11:11:53 +1000
commit4885ecffc7857a3eb4ef580763b1200cbaf9f45e (patch)
tree41f193ddfbd0b05a77fc8190b283e55e74fa0996 /crypto
parent54e1c14a29ef338a60ef180e213ffaeb3010f798 (diff)
downloadopenssl-new-4885ecffc7857a3eb4ef580763b1200cbaf9f45e.tar.gz
coverity: fix 1484542 dereference after null check
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/15208)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/evp/evp_lib.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index dfc4059d76..e2ac6af895 100644
--- a/crypto/evp/evp_lib.c
+++ b/crypto/evp/evp_lib.c
@@ -358,7 +358,7 @@ int evp_cipher_cache_constants(EVP_CIPHER *cipher)
params[7] = OSSL_PARAM_construct_int(OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK,
&multiblock);
params[8] = OSSL_PARAM_construct_end();
- ok = evp_do_ciph_getparams(cipher, params);
+ ok = evp_do_ciph_getparams(cipher, params) > 0;
if (ok) {
cipher->block_size = blksz;
cipher->iv_len = ivlen;
@@ -372,10 +372,8 @@ int evp_cipher_cache_constants(EVP_CIPHER *cipher)
cipher->flags |= EVP_CIPH_FLAG_CTS;
if (multiblock)
cipher->flags |= EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK;
- /* Provided implementations may have a custom cipher_cipher */
- if (cipher->prov != NULL && cipher->ccipher != NULL)
+ if (cipher->ccipher != NULL)
cipher->flags |= EVP_CIPH_FLAG_CUSTOM_CIPHER;
- /* Provided implementations may also have custom ASN1 algorithm parameters */
if (OSSL_PARAM_locate_const(EVP_CIPHER_gettable_ctx_params(cipher),
OSSL_CIPHER_PARAM_ALGORITHM_ID_PARAMS))
cipher->flags |= EVP_CIPH_FLAG_CUSTOM_ASN1;