diff options
author | Rich Salz <rsalz@openssl.org> | 2017-04-24 11:19:56 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-04-24 11:19:56 -0400 |
commit | a68d35057ba2676bc9b9a16f4952791eef4b9905 (patch) | |
tree | cee147a6cb868831059255f154b43ae24c3859b7 /crypto | |
parent | 8af91fd9d08487e0dffb6ccac5f42633c964f3f0 (diff) | |
download | openssl-a68d35057ba2676bc9b9a16f4952791eef4b9905.tar.gz |
check length sanity before correcting in EVP_CTRL_AEAD_TLS1_AAD
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3289)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/evp/e_aes_cbc_hmac_sha1.c | 2 | ||||
-rw-r--r-- | crypto/evp/e_aes_cbc_hmac_sha256.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/crypto/evp/e_aes_cbc_hmac_sha1.c b/crypto/evp/e_aes_cbc_hmac_sha1.c index a3c8951f5c..3721751c80 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha1.c +++ b/crypto/evp/e_aes_cbc_hmac_sha1.c @@ -809,6 +809,8 @@ static int aesni_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, key->payload_length = len; if ((key->aux.tls_ver = p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) { + if (len < AES_BLOCK_SIZE) + return 0; len -= AES_BLOCK_SIZE; p[arg - 2] = len >> 8; p[arg - 1] = len; diff --git a/crypto/evp/e_aes_cbc_hmac_sha256.c b/crypto/evp/e_aes_cbc_hmac_sha256.c index bef603a3a5..daae825ee1 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha256.c +++ b/crypto/evp/e_aes_cbc_hmac_sha256.c @@ -788,6 +788,8 @@ static int aesni_cbc_hmac_sha256_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, key->payload_length = len; if ((key->aux.tls_ver = p[arg - 4] << 8 | p[arg - 3]) >= TLS1_1_VERSION) { + if (len < AES_BLOCK_SIZE) + return 0; len -= AES_BLOCK_SIZE; p[arg - 2] = len >> 8; p[arg - 1] = len; |