aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/crypto/geode-aes.c12
-rw-r--r--drivers/crypto/geode-aes.h3
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index 6d3840e629de..6a86958b577f 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)
102 u32 flags = 0; 102 u32 flags = 0;
103 unsigned long iflags; 103 unsigned long iflags;
104 104
105 if (op->len == 0 || op->src == op->dst) 105 if (op->len == 0)
106 return 0; 106 return 0;
107 107
108 if (op->flags & AES_FLAGS_COHERENT) 108 /* If the source and destination is the same, then
109 * we need to turn on the coherent flags, otherwise
110 * we don't need to worry
111 */
112
113 if (op->src == op->dst)
109 flags |= (AES_CTRL_DCA | AES_CTRL_SCA); 114 flags |= (AES_CTRL_DCA | AES_CTRL_SCA);
110 115
111 if (op->dir == AES_DIR_ENCRYPT) 116 if (op->dir == AES_DIR_ENCRYPT)
@@ -120,7 +125,7 @@ geode_aes_crypt(struct geode_aes_op *op)
120 _writefield(AES_WRITEIV0_REG, op->iv); 125 _writefield(AES_WRITEIV0_REG, op->iv);
121 } 126 }
122 127
123 if (op->flags & AES_FLAGS_USRKEY) { 128 if (!(op->flags & AES_FLAGS_HIDDENKEY)) {
124 flags |= AES_CTRL_WRKEY; 129 flags |= AES_CTRL_WRKEY;
125 _writefield(AES_WRITEKEY0_REG, op->key); 130 _writefield(AES_WRITEKEY0_REG, op->key);
126 } 131 }
@@ -289,6 +294,7 @@ static struct crypto_alg geode_cbc_alg = {
289 .setkey = geode_setkey, 294 .setkey = geode_setkey,
290 .encrypt = geode_cbc_encrypt, 295 .encrypt = geode_cbc_encrypt,
291 .decrypt = geode_cbc_decrypt, 296 .decrypt = geode_cbc_decrypt,
297 .ivsize = AES_IV_LENGTH,
292 } 298 }
293 } 299 }
294}; 300};
diff --git a/drivers/crypto/geode-aes.h b/drivers/crypto/geode-aes.h
index 8003a36f3a83..f47968671ae7 100644
--- a/drivers/crypto/geode-aes.h
+++ b/drivers/crypto/geode-aes.h
@@ -20,8 +20,7 @@
20#define AES_DIR_DECRYPT 0 20#define AES_DIR_DECRYPT 0
21#define AES_DIR_ENCRYPT 1 21#define AES_DIR_ENCRYPT 1
22 22
23#define AES_FLAGS_USRKEY (1 << 0) 23#define AES_FLAGS_HIDDENKEY (1 << 0)
24#define AES_FLAGS_COHERENT (1 << 1)
25 24
26struct geode_aes_op { 25struct geode_aes_op {
27 26