summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-08-19 12:28:42 +0200
committerTomas Mraz <tomas@openssl.org>2022-08-23 12:27:23 +0200
commit35bcac131ce5605c504d48a077f33f69660b660c (patch)
tree8f6147a9dd8ce39278c6639cc3385a64669330b9 /ssl
parent7b7ad9e578470fe2b20db230638cfc20e3acf252 (diff)
rl->enc_ctx must be non-NULL and cipher must be set
Otherwise ssl3_cipher() cannot work properly. Fixes Coverity CID 1509401 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19027)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/record/methods/ssl3_meth.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ssl/record/methods/ssl3_meth.c b/ssl/record/methods/ssl3_meth.c
index 254e8cf147..f1fd1f4203 100644
--- a/ssl/record/methods/ssl3_meth.c
+++ b/ssl/record/methods/ssl3_meth.c
@@ -98,10 +98,8 @@ static int ssl3_cipher(OSSL_RECORD_LAYER *rl, SSL3_RECORD *inrecs, size_t n_recs
return 0;
ds = rl->enc_ctx;
- if (rl->enc_ctx == NULL)
- enc = NULL;
- else
- enc = EVP_CIPHER_CTX_get0_cipher(rl->enc_ctx);
+ if (ds == NULL || (enc = EVP_CIPHER_CTX_get0_cipher(ds)) == NULL)
+ return 0;
provided = (EVP_CIPHER_get0_provider(enc) != NULL);