aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto/geode-aes.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/crypto/geode-aes.c')
-rw-r--r--drivers/crypto/geode-aes.c12
1 files changed, 9 insertions, 3 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};