Commit d2456c66 authored by Sebastian Siewior's avatar Sebastian Siewior Committed by Herbert Xu

[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: default avatarSebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 9617d6ef
...@@ -315,7 +315,7 @@ geode_cbc_decrypt(struct blkcipher_desc *desc, ...@@ -315,7 +315,7 @@ geode_cbc_decrypt(struct blkcipher_desc *desc,
blkcipher_walk_init(&walk, dst, src, nbytes); blkcipher_walk_init(&walk, dst, src, nbytes);
err = blkcipher_walk_virt(desc, &walk); err = blkcipher_walk_virt(desc, &walk);
memcpy(op->iv, walk.iv, AES_IV_LENGTH); op->iv = walk.iv;
while((nbytes = walk.nbytes)) { while((nbytes = walk.nbytes)) {
op->src = walk.src.virt.addr, op->src = walk.src.virt.addr,
...@@ -330,7 +330,6 @@ geode_cbc_decrypt(struct blkcipher_desc *desc, ...@@ -330,7 +330,6 @@ geode_cbc_decrypt(struct blkcipher_desc *desc,
err = blkcipher_walk_done(desc, &walk, nbytes); err = blkcipher_walk_done(desc, &walk, nbytes);
} }
memcpy(walk.iv, op->iv, AES_IV_LENGTH);
return err; return err;
} }
...@@ -348,7 +347,7 @@ geode_cbc_encrypt(struct blkcipher_desc *desc, ...@@ -348,7 +347,7 @@ geode_cbc_encrypt(struct blkcipher_desc *desc,
blkcipher_walk_init(&walk, dst, src, nbytes); blkcipher_walk_init(&walk, dst, src, nbytes);
err = blkcipher_walk_virt(desc, &walk); err = blkcipher_walk_virt(desc, &walk);
memcpy(op->iv, walk.iv, AES_IV_LENGTH); op->iv = walk.iv;
while((nbytes = walk.nbytes)) { while((nbytes = walk.nbytes)) {
op->src = walk.src.virt.addr, op->src = walk.src.virt.addr,
...@@ -362,7 +361,6 @@ geode_cbc_encrypt(struct blkcipher_desc *desc, ...@@ -362,7 +361,6 @@ geode_cbc_encrypt(struct blkcipher_desc *desc,
err = blkcipher_walk_done(desc, &walk, nbytes); err = blkcipher_walk_done(desc, &walk, nbytes);
} }
memcpy(walk.iv, op->iv, AES_IV_LENGTH);
return err; return err;
} }
......
...@@ -65,7 +65,7 @@ struct geode_aes_op { ...@@ -65,7 +65,7 @@ struct geode_aes_op {
int len; int len;
u8 key[AES_KEY_LENGTH]; u8 key[AES_KEY_LENGTH];
u8 iv[AES_IV_LENGTH]; u8 *iv;
union { union {
struct crypto_blkcipher *blk; struct crypto_blkcipher *blk;
......
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