Skip to content

Commit

Permalink
[CRYPTO] geode: do not copy the IV too often
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sebastianas authored and herbertx committed Jan 10, 2008
1 parent 9617d6e commit d2456c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions drivers/crypto/geode-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ geode_cbc_decrypt(struct blkcipher_desc *desc,

blkcipher_walk_init(&walk, dst, src, nbytes);
err = blkcipher_walk_virt(desc, &walk);
memcpy(op->iv, walk.iv, AES_IV_LENGTH);
op->iv = walk.iv;

while((nbytes = walk.nbytes)) {
op->src = walk.src.virt.addr,
Expand All @@ -330,7 +330,6 @@ geode_cbc_decrypt(struct blkcipher_desc *desc,
err = blkcipher_walk_done(desc, &walk, nbytes);
}

memcpy(walk.iv, op->iv, AES_IV_LENGTH);
return err;
}

Expand All @@ -348,7 +347,7 @@ geode_cbc_encrypt(struct blkcipher_desc *desc,

blkcipher_walk_init(&walk, dst, src, nbytes);
err = blkcipher_walk_virt(desc, &walk);
memcpy(op->iv, walk.iv, AES_IV_LENGTH);
op->iv = walk.iv;

while((nbytes = walk.nbytes)) {
op->src = walk.src.virt.addr,
Expand All @@ -362,7 +361,6 @@ geode_cbc_encrypt(struct blkcipher_desc *desc,
err = blkcipher_walk_done(desc, &walk, nbytes);
}

memcpy(walk.iv, op->iv, AES_IV_LENGTH);
return err;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/crypto/geode-aes.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct geode_aes_op {
int len;

u8 key[AES_KEY_LENGTH];
u8 iv[AES_IV_LENGTH];
u8 *iv;

union {
struct crypto_blkcipher *blk;
Expand Down

0 comments on commit d2456c6

Please sign in to comment.