Skip to contentSkip to conversation

crypto: Fix AES-NI cbc mode IV saving

PATCH In review Huang Ying 2 participants 2 messages Jun 15, 2009 – Jun 18, 2009

Subsystems (2)
lore
Share & tools
lore

Huang Ying

author
#0 lore raw

PATCH 1/3 crypto: Fix AES-NI 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.

---
 arch/x86/crypto/aesni-intel_asm.S |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/x86/crypto/aesni-intel_asm.S +3 -2
@@ -845,7 +845,7 @@ ENTRY(aesni_cbc_enc)
  */
 ENTRY(aesni_cbc_dec)
 	cmp $16, LEN
-	jb .Lcbc_dec_ret
+	jb .Lcbc_dec_just_ret
 	mov 480(KEYP), KLEN
 	add $240, KEYP
 	movups (IVP), IV
@@ -891,6 +891,7 @@ ENTRY(aesni_cbc_dec)
 	add $16, OUTP
 	cmp $16, LEN
 	jge .Lcbc_dec_loop1
-	movups IV, (IVP)
 .Lcbc_dec_ret:
+	movups IV, (IVP)
+.Lcbc_dec_just_ret:
 	ret
maintainer
#1 lore raw
Quoted 4 lines · Huang Ying

Original implementation of aesni_cbc_dec do not save IV if input length % 4 == 0. This will make decryption of next block failed.

All three patches applied to crypto-2.6.

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt