Subject: [PATCH] [crypto] Geode: Copy the IV back for chaining support

This is required for one or two crypto users in tree which
chain the IV.

Signed-off-by: Sebastian Siewior <[email protected]>
---
drivers/crypto/geode-aes.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index c7d5ed0..ff3d770 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -195,6 +195,9 @@ static int fallback_blk_dec(struct blkcipher_desc *desc,

ret = crypto_blkcipher_decrypt(desc, dst, src, nbytes);

+ memcpy(desc->info, crypto_blkcipher_crt(op->fallback.blk)->iv,
+ AES_BLOCK_SIZE);
+
desc->tfm = tfm;
return ret;
}
@@ -214,6 +217,9 @@ static int fallback_blk_enc(struct blkcipher_desc *desc,

ret = crypto_blkcipher_encrypt(desc, dst, src, nbytes);

+ memcpy(desc->info, crypto_blkcipher_crt(op->fallback.blk)->iv,
+ AES_BLOCK_SIZE);
+
desc->tfm = tfm;
return ret;
}
--
1.5.3.4


Subject: Re: [PATCH] [crypto] Geode: Copy the IV back for chaining support

* Sebastian Siewior | 2007-12-07 19:24:47 [+0100]:

>This is required for one or two crypto users in tree which
>chain the IV.

Snippets from tcrypt mode=200, before the patch:
| testing speed of cbc(aes) encryption
| test 5 (192 bit key, 16 byte blocks): 1 operation in 3109 cycles (16 bytes)
| test 9 (192 bit key, 8192 byte blocks): 1 operation in 680945 cycles (8192 bytes)
| test 10 (256 bit key, 16 byte blocks): 1 operation in 2143 cycles (16 bytes)
| test 14 (256 bit key, 8192 byte blocks): 1 operation in 757506 cycles (8192 bytes)
|
| testing speed of cbc(aes) decryption
| test 5 (192 bit key, 16 byte blocks): 1 operation in 3222 cycles (16 bytes)
| test 9 (192 bit key, 8192 byte blocks): 1 operation in 706132 cycles (8192 bytes)
| test 10 (256 bit key, 16 byte blocks): 1 operation in 2279 cycles (16 bytes)
| test 14 (256 bit key, 8192 byte blocks): 1 operation in 781974 cycles (8192 bytes)

and after:

| testing speed of cbc(aes) encryption
| test 5 (192 bit key, 16 byte blocks): 1 operation in 3401 cycles (16 bytes)
| test 9 (192 bit key, 8192 byte blocks): 1 operation in 680604 cycles (8192 bytes)
| test 10 (256 bit key, 16 byte blocks): 1 operation in 2177 cycles (16 bytes)
| test 14 (256 bit key, 8192 byte blocks): 1 operation in 756906 cycles (8192 bytes)
|
| testing speed of cbc(aes) decryption
| test 5 (192 bit key, 16 byte blocks): 1 operation in 3567 cycles (16 bytes)
| test 9 (192 bit key, 8192 byte blocks): 1 operation in 705889 cycles (8192 bytes)
| test 10 (256 bit key, 16 byte blocks): 1 operation in 2317 cycles (16 bytes)
| test 14 (256 bit key, 8192 byte blocks): 1 operation in 781241 cycles (8192 bytes)

it is about 9% slower for test 5, the others are less than three percent.

Sebastian