Commit e6efaa02 authored by Huang Ying's avatar Huang Ying Committed by Herbert Xu

crypto: aes-ni - Fix cbc mode IV saving

Original implementation of aesni_cbc_dec do not save IV if input
length % 4 == 0. This will make decryption of next block failed.
Signed-off-by: default avatarHuang Ying <ying.huang@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 8d8409f7
...@@ -845,7 +845,7 @@ ENTRY(aesni_cbc_enc) ...@@ -845,7 +845,7 @@ ENTRY(aesni_cbc_enc)
*/ */
ENTRY(aesni_cbc_dec) ENTRY(aesni_cbc_dec)
cmp $16, LEN cmp $16, LEN
jb .Lcbc_dec_ret jb .Lcbc_dec_just_ret
mov 480(KEYP), KLEN mov 480(KEYP), KLEN
add $240, KEYP add $240, KEYP
movups (IVP), IV movups (IVP), IV
...@@ -891,6 +891,7 @@ ENTRY(aesni_cbc_dec) ...@@ -891,6 +891,7 @@ ENTRY(aesni_cbc_dec)
add $16, OUTP add $16, OUTP
cmp $16, LEN cmp $16, LEN
jge .Lcbc_dec_loop1 jge .Lcbc_dec_loop1
movups IV, (IVP)
.Lcbc_dec_ret: .Lcbc_dec_ret:
movups IV, (IVP)
.Lcbc_dec_just_ret:
ret ret
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment