From: Sebastian Siewior <linux-crypto@ml.breakpoint.cc>
To: Herbert Xu <herbert@gondor.apana.org.au>, linux-crypto@vger.kernel.org
Subject: [PATCH] [crypto] geode: do not copy the IV too often
Date: Tue, 27 Nov 2007 20:33:58 +0100 [thread overview]
Message-ID: <20071127193358.GB3506@Chamillionaire.breakpoint.cc> (raw)
In-Reply-To: <20071126094226.GA18532@Chamillionaire.breakpoint.cc>
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>
---
drivers/crypto/geode-aes.c | 6 ++----
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 0ca92d4..68be7d0 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -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,
@@ -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;
}
@@ -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,
@@ -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;
}
diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h
index 14cc763..f1855b5 100644
--- a/drivers/crypto/geode-aes.h
+++ b/drivers/crypto/geode-aes.h
@@ -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;
--
1.5.3.4
next prev parent reply other threads:[~2007-11-27 19:33 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-13 23:11 IV copy strategy Sebastian Siewior
2007-11-14 14:22 ` Herbert Xu
2007-11-15 21:10 ` Sebastian Siewior
2007-11-16 2:08 ` Herbert Xu
2007-11-16 8:19 ` Sebastian Siewior
2007-11-16 9:30 ` Herbert Xu
2007-11-16 11:11 ` Evgeniy Polyakov
2007-11-16 11:25 ` Herbert Xu
2007-11-16 11:42 ` Evgeniy Polyakov
2007-11-16 13:47 ` Herbert Xu
2007-11-18 6:52 ` Herbert Xu
2007-11-18 6:53 ` Herbert Xu
2007-11-19 10:38 ` Evgeniy Polyakov
2007-11-19 11:56 ` Herbert Xu
2007-11-20 14:23 ` Evgeniy Polyakov
2007-11-26 9:10 ` Sebastian Siewior
2007-11-15 21:23 ` [PATCH] [crypto] geode: do not copy the IV too often Sebastian Siewior
2007-11-18 13:41 ` Herbert Xu
2007-11-26 9:25 ` Sebastian Siewior
2007-11-26 9:28 ` Herbert Xu
2007-11-26 9:42 ` Sebastian Siewior
2007-11-27 19:33 ` Sebastian Siewior [this message]
2007-11-30 5:37 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071127193358.GB3506@Chamillionaire.breakpoint.cc \
--to=linux-crypto@ml.breakpoint.cc \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).