]> nv-tegra.nvidia Code Review - linux-3.10.git/commitdiff
[CRYPTO] geode: do not copy the IV too often
authorSebastian Siewior <sebastian@breakpoint.cc>
Fri, 30 Nov 2007 05:36:57 +0000 (16:36 +1100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 10 Jan 2008 21:16:26 +0000 (08:16 +1100)
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>
drivers/crypto/geode-aes.c
drivers/crypto/geode-aes.h

index 0ca92d414667b27da1e03110935ad2f4cd5f72c1..68be7d08aeb34de17b506856da68718810a65f64 100644 (file)
@@ -315,7 +315,7 @@ geode_cbc_decrypt(struct blkcipher_desc *desc,
 
        blkcipher_walk_init(&walk, dst, src, nbytes);
        err = blkcipher_walk_virt(desc, &walk);
 
        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,
 
        while((nbytes = walk.nbytes)) {
                op->src = walk.src.virt.addr,
@@ -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,
 
        blkcipher_walk_init(&walk, dst, src, nbytes);
        err = blkcipher_walk_virt(desc, &walk);
 
        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,
 
        while((nbytes = walk.nbytes)) {
                op->src = walk.src.virt.addr,
@@ -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;
 }
 
index 14cc763da1e443a90340e257d7dcaf58ef83eb0f..f1855b50da48d53cbc3e1f2d6d953529e56252d5 100644 (file)
@@ -65,7 +65,7 @@ struct geode_aes_op {
        int len;
 
        u8 key[AES_KEY_LENGTH];
        int len;
 
        u8 key[AES_KEY_LENGTH];
-       u8 iv[AES_IV_LENGTH];
+       u8 *iv;
 
        union {
                struct crypto_blkcipher *blk;
 
        union {
                struct crypto_blkcipher *blk;