diff options
author | Sebastian Siewior <sebastian@breakpoint.cc> | 2007-11-30 00:36:57 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2008-01-10 16:16:26 -0500 |
commit | d2456c66236c15d6462f1ac751cdbd48a34e9704 (patch) | |
tree | 0d221b08d0c1d4942881ad138c142c4163d19717 /drivers | |
parent | 9617d6ef6278edd04070ae404c871f65a466c6d2 (diff) |
[CRYPTO] geode: do not copy the IV too often
There is no reason to keep the IV in the private structre. Instead keep
just a pointer to make the patch smaller :)
This also remove a few memcpy()s
Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/crypto/geode-aes.c | 6 | ||||
-rw-r--r-- | drivers/crypto/geode-aes.h | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c index 0ca92d414667..68be7d08aeb3 100644 --- a/drivers/crypto/geode-aes.c +++ b/drivers/crypto/geode-aes.c | |||
@@ -315,7 +315,7 @@ geode_cbc_decrypt(struct blkcipher_desc *desc, | |||
315 | 315 | ||
316 | blkcipher_walk_init(&walk, dst, src, nbytes); | 316 | blkcipher_walk_init(&walk, dst, src, nbytes); |
317 | err = blkcipher_walk_virt(desc, &walk); | 317 | err = blkcipher_walk_virt(desc, &walk); |
318 | memcpy(op->iv, walk.iv, AES_IV_LENGTH); | 318 | op->iv = walk.iv; |
319 | 319 | ||
320 | while((nbytes = walk.nbytes)) { | 320 | while((nbytes = walk.nbytes)) { |
321 | op->src = walk.src.virt.addr, | 321 | op->src = walk.src.virt.addr, |
@@ -330,7 +330,6 @@ geode_cbc_decrypt(struct blkcipher_desc *desc, | |||
330 | err = blkcipher_walk_done(desc, &walk, nbytes); | 330 | err = blkcipher_walk_done(desc, &walk, nbytes); |
331 | } | 331 | } |
332 | 332 | ||
333 | memcpy(walk.iv, op->iv, AES_IV_LENGTH); | ||
334 | return err; | 333 | return err; |
335 | } | 334 | } |
336 | 335 | ||
@@ -348,7 +347,7 @@ geode_cbc_encrypt(struct blkcipher_desc *desc, | |||
348 | 347 | ||
349 | blkcipher_walk_init(&walk, dst, src, nbytes); | 348 | blkcipher_walk_init(&walk, dst, src, nbytes); |
350 | err = blkcipher_walk_virt(desc, &walk); | 349 | err = blkcipher_walk_virt(desc, &walk); |
351 | memcpy(op->iv, walk.iv, AES_IV_LENGTH); | 350 | op->iv = walk.iv; |
352 | 351 | ||
353 | while((nbytes = walk.nbytes)) { | 352 | while((nbytes = walk.nbytes)) { |
354 | op->src = walk.src.virt.addr, | 353 | op->src = walk.src.virt.addr, |
@@ -362,7 +361,6 @@ geode_cbc_encrypt(struct blkcipher_desc *desc, | |||
362 | err = blkcipher_walk_done(desc, &walk, nbytes); | 361 | err = blkcipher_walk_done(desc, &walk, nbytes); |
363 | } | 362 | } |
364 | 363 | ||
365 | memcpy(walk.iv, op->iv, AES_IV_LENGTH); | ||
366 | return err; | 364 | return err; |
367 | } | 365 | } |
368 | 366 | ||
diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h index 14cc763da1e4..f1855b50da48 100644 --- a/drivers/crypto/geode-aes.h +++ b/drivers/crypto/geode-aes.h | |||
@@ -65,7 +65,7 @@ struct geode_aes_op { | |||
65 | int len; | 65 | int len; |
66 | 66 | ||
67 | u8 key[AES_KEY_LENGTH]; | 67 | u8 key[AES_KEY_LENGTH]; |
68 | u8 iv[AES_IV_LENGTH]; | 68 | u8 *iv; |
69 | 69 | ||
70 | union { | 70 | union { |
71 | struct crypto_blkcipher *blk; | 71 | struct crypto_blkcipher *blk; |