diff options
author | Andy Polyakov <appro@openssl.org> | 2013-03-18 19:29:41 +0100 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2013-03-18 19:35:20 +0100 |
commit | dd1e4fbcc05cf83062946e43ec5b814e48d09615 (patch) | |
tree | c629876379eb600b5d987465c0fec90259332d1b | |
parent | 3f84d34c3729a6db7d9908219ab2b53f052e6d08 (diff) |
e_aes_cbc_hmac_sha1.c: fix rare bad record mac on AES-NI plaforms.
PR: 3002
(cherry picked from commit 5c60046553716fcf160718f59160493194f212dc)
-rw-r--r-- | crypto/evp/e_aes_cbc_hmac_sha1.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/evp/e_aes_cbc_hmac_sha1.c b/crypto/evp/e_aes_cbc_hmac_sha1.c index 483e04b605..fb2c884a78 100644 --- a/crypto/evp/e_aes_cbc_hmac_sha1.c +++ b/crypto/evp/e_aes_cbc_hmac_sha1.c @@ -328,10 +328,11 @@ static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, if (res!=SHA_CBLOCK) continue; - mask = 0-((inp_len+8-j)>>(sizeof(j)*8-1)); + /* j is not incremented yet */ + mask = 0-((inp_len+7-j)>>(sizeof(j)*8-1)); data->u[SHA_LBLOCK-1] |= bitlen&mask; sha1_block_data_order(&key->md,data,1); - mask &= 0-((j-inp_len-73)>>(sizeof(j)*8-1)); + mask &= 0-((j-inp_len-72)>>(sizeof(j)*8-1)); pmac->u[0] |= key->md.h0 & mask; pmac->u[1] |= key->md.h1 & mask; pmac->u[2] |= key->md.h2 & mask; |