diff options
author | raja-ashok <rashok.svks@gmail.com> | 2020-05-08 15:47:21 +0200 |
---|---|---|
committer | Benjamin Kaduk <kaduk@mit.edu> | 2020-05-15 21:31:15 +0200 |
commit | 2e1a4f6aeb5a9935e3055f61740381e17a31fc9a (patch) | |
tree | 3cc7935c94a0f9856eb89e5b65dbf3af963051bf /ssl | |
parent | Fix all MD036 (emphasis used instead of heading) (diff) | |
download | openssl-2e1a4f6aeb5a9935e3055f61740381e17a31fc9a.tar.xz openssl-2e1a4f6aeb5a9935e3055f61740381e17a31fc9a.zip |
Fix crash in early data send with out-of-band PSK using AES CCM
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/11785)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/tls13_enc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ssl/tls13_enc.c b/ssl/tls13_enc.c index e81f3656ee..1775152eeb 100644 --- a/ssl/tls13_enc.c +++ b/ssl/tls13_enc.c @@ -436,11 +436,18 @@ static int derive_secret_key_and_iv(SSL *s, int sending, const EVP_MD *md, uint32_t algenc; ivlen = EVP_CCM_TLS_IV_LEN; - if (s->s3.tmp.new_cipher == NULL) { + if (s->s3.tmp.new_cipher != NULL) { + algenc = s->s3.tmp.new_cipher->algorithm_enc; + } else if (s->session->cipher != NULL) { /* We've not selected a cipher yet - we must be doing early data */ algenc = s->session->cipher->algorithm_enc; + } else if (s->psksession != NULL && s->psksession->cipher != NULL) { + /* We must be doing early data with out-of-band PSK */ + algenc = s->psksession->cipher->algorithm_enc; } else { - algenc = s->s3.tmp.new_cipher->algorithm_enc; + SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_DERIVE_SECRET_KEY_AND_IV, + ERR_R_EVP_LIB); + goto err; } if (algenc & (SSL_AES128CCM8 | SSL_AES256CCM8)) taglen = EVP_CCM8_TLS_TAG_LEN; |