2012-09-19 11:25:00

by Jussi Kivilinna

[permalink] [raw]
Subject: [PATCH] crypto: cast5/avx - fix storing of new IV in CBC encryption

cast5/avx incorrectly XORs new IV over old IV at end of CBC encryption
function when it should store. This causes CBC encryption to give
incorrect output on multi-page encryption requests.

Signed-off-by: Jussi Kivilinna <[email protected]>
---
arch/x86/crypto/cast5_avx_glue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/crypto/cast5_avx_glue.c b/arch/x86/crypto/cast5_avx_glue.c
index 445aab0..e0ea14f 100644
--- a/arch/x86/crypto/cast5_avx_glue.c
+++ b/arch/x86/crypto/cast5_avx_glue.c
@@ -165,7 +165,7 @@ static unsigned int __cbc_encrypt(struct blkcipher_desc *desc,
nbytes -= bsize;
} while (nbytes >= bsize);

- *(u64 *)walk->iv ^= *iv;
+ *(u64 *)walk->iv = *iv;
return nbytes;
}



2012-09-27 05:45:07

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: cast5/avx - fix storing of new IV in CBC encryption

On Wed, Sep 19, 2012 at 02:24:57PM +0300, Jussi Kivilinna wrote:
> cast5/avx incorrectly XORs new IV over old IV at end of CBC encryption
> function when it should store. This causes CBC encryption to give
> incorrect output on multi-page encryption requests.
>
> Signed-off-by: Jussi Kivilinna <[email protected]>

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt