Skip to content

Commit 761e784

Browse files
Jordan Crouseherbertx
authored andcommitted
[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>
1 parent 4598c95 commit 761e784

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎drivers/crypto/geode-aes.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,15 @@ geode_aes_crypt(struct geode_aes_op *op)
102102
u32 flags = 0;
103103
unsigned long iflags;
104104

105-
if (op->len == 0 || op->src == op->dst)
105+
if (op->len == 0)
106106
return 0;
107107

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)
109114
flags |= (AES_CTRL_DCA | AES_CTRL_SCA);
110115

111116
if (op->dir == AES_DIR_ENCRYPT)
@@ -120,7 +125,7 @@ geode_aes_crypt(struct geode_aes_op *op)
120125
_writefield(AES_WRITEIV0_REG, op->iv);
121126
}
122127

123-
if (op->flags & AES_FLAGS_USRKEY) {
128+
if (!(op->flags & AES_FLAGS_HIDDENKEY)) {
124129
flags |= AES_CTRL_WRKEY;
125130
_writefield(AES_WRITEKEY0_REG, op->key);
126131
}
@@ -289,6 +294,7 @@ static struct crypto_alg geode_cbc_alg = {
289294
.setkey = geode_setkey,
290295
.encrypt = geode_cbc_encrypt,
291296
.decrypt = geode_cbc_decrypt,
297+
.ivsize = AES_IV_LENGTH,
292298
}
293299
}
294300
};

‎drivers/crypto/geode-aes.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
#define AES_DIR_DECRYPT 0
2121
#define AES_DIR_ENCRYPT 1
2222

23-
#define AES_FLAGS_USRKEY (1 << 0)
24-
#define AES_FLAGS_COHERENT (1 << 1)
23+
#define AES_FLAGS_HIDDENKEY (1 << 0)
2524

2625
struct geode_aes_op {
2726

0 commit comments

Comments
 (0)