diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2017-03-24 09:03:54 +0100 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2017-03-25 11:12:18 +0100 |
commit | 1b6f5a4d3b8cdb02e0bba6878a2b70c850522440 (patch) | |
tree | 7881252724e8e9786abecc27fae80d5616f4a6d8 /crypto/evp/e_aes_cbc_hmac_sha256.c | |
parent | 643a3580423c8774c08aed7e377495800b7e7266 (diff) |
Don't access memory before checking the correct length in aesni_cbc_hmac_sha256_ctrl in case EVP_CTRL_AEAD_TLS1_AAD.
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3023)
Diffstat (limited to 'crypto/evp/e_aes_cbc_hmac_sha256.c')
-rw-r--r-- | crypto/evp/e_aes_cbc_hmac_sha256.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/evp/e_aes_cbc_hmac_sha256.c b/crypto/evp/e_aes_cbc_hmac_sha256.c index 4830c00648..bef603a3a5 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha256.c +++ b/crypto/evp/e_aes_cbc_hmac_sha256.c @@ -777,11 +777,13 @@ static int aesni_cbc_hmac_sha256_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, case EVP_CTRL_AEAD_TLS1_AAD: { unsigned char *p = ptr; - unsigned int len = p[arg - 2] << 8 | p[arg - 1]; + unsigned int len; if (arg != EVP_AEAD_TLS1_AAD_LEN) return -1; + len = p[arg - 2] << 8 | p[arg - 1]; + if (EVP_CIPHER_CTX_encrypting(ctx)) { key->payload_length = len; if ((key->aux.tls_ver = |