diff options
author | Jordan Crouse <jordan.crouse@amd.com> | 2007-05-24 21:23:24 +1000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2007-05-24 21:23:24 +1000 |
commit | 761e784673d79c8ea9befdad31e30c65e0d20b82 (patch) | |
tree | 88576a4ce275d7f73ff2b4d6b6c69180e45865d7 /drivers | |
parent | 4598c95514f9a50b49626e1e5d1f292180b643fa (diff) | |
download | linux-3.10-761e784673d79c8ea9befdad31e30c65e0d20b82.tar.gz linux-3.10-761e784673d79c8ea9befdad31e30c65e0d20b82.tar.bz2 linux-3.10-761e784673d79c8ea9befdad31e30c65e0d20b82.zip |
[CRYPTO] geode: Fix in-place operations and set key
Allow in-place crypto operations. Also remove the coherent user flag
(we use it automagically now), and by default use the user written
key rather then the HW hidden key - this makes crypto just work without
any special considerations, and thats OK, since its our only usage
model.
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/crypto/geode-aes.c | 12 | ||||
-rw-r--r-- | drivers/crypto/geode-aes.h | 3 |
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c index 6d3840e629d..6a86958b577 100644 --- a/drivers/crypto/geode-aes.c +++ b/drivers/crypto/geode-aes.c @@ -102,10 +102,15 @@ geode_aes_crypt(struct geode_aes_op *op) u32 flags = 0; unsigned long iflags; - if (op->len == 0 || op->src == op->dst) + if (op->len == 0) return 0; - if (op->flags & AES_FLAGS_COHERENT) + /* If the source and destination is the same, then + * we need to turn on the coherent flags, otherwise + * we don't need to worry + */ + + if (op->src == op->dst) flags |= (AES_CTRL_DCA | AES_CTRL_SCA); if (op->dir == AES_DIR_ENCRYPT) @@ -120,7 +125,7 @@ geode_aes_crypt(struct geode_aes_op *op) _writefield(AES_WRITEIV0_REG, op->iv); } - if (op->flags & AES_FLAGS_USRKEY) { + if (!(op->flags & AES_FLAGS_HIDDENKEY)) { flags |= AES_CTRL_WRKEY; _writefield(AES_WRITEKEY0_REG, op->key); } @@ -289,6 +294,7 @@ static struct crypto_alg geode_cbc_alg = { .setkey = geode_setkey, .encrypt = geode_cbc_encrypt, .decrypt = geode_cbc_decrypt, + .ivsize = AES_IV_LENGTH, } } }; diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h index 8003a36f3a8..f47968671ae 100644 --- a/drivers/crypto/geode-aes.h +++ b/drivers/crypto/geode-aes.h @@ -20,8 +20,7 @@ #define AES_DIR_DECRYPT 0 #define AES_DIR_ENCRYPT 1 -#define AES_FLAGS_USRKEY (1 << 0) -#define AES_FLAGS_COHERENT (1 << 1) +#define AES_FLAGS_HIDDENKEY (1 << 0) struct geode_aes_op { |