Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Jordan Crouse and committed by
Herbert Xu
761e7846 4598c955

+10 -5
+9 -3
drivers/crypto/geode-aes.c
··· 102 102 u32 flags = 0; 103 103 unsigned long iflags; 104 104 105 - if (op->len == 0 || op->src == op->dst) 105 + if (op->len == 0) 106 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 114 flags |= (AES_CTRL_DCA | AES_CTRL_SCA); 110 115 111 116 if (op->dir == AES_DIR_ENCRYPT) ··· 125 120 _writefield(AES_WRITEIV0_REG, op->iv); 126 121 } 127 122 128 - if (op->flags & AES_FLAGS_USRKEY) { 123 + if (!(op->flags & AES_FLAGS_HIDDENKEY)) { 129 124 flags |= AES_CTRL_WRKEY; 130 125 _writefield(AES_WRITEKEY0_REG, op->key); 131 126 } ··· 294 289 .setkey = geode_setkey, 295 290 .encrypt = geode_cbc_encrypt, 296 291 .decrypt = geode_cbc_decrypt, 292 + .ivsize = AES_IV_LENGTH, 297 293 } 298 294 } 299 295 };
+1 -2
drivers/crypto/geode-aes.h
··· 20 20 #define AES_DIR_DECRYPT 0 21 21 #define AES_DIR_ENCRYPT 1 22 22 23 - #define AES_FLAGS_USRKEY (1 << 0) 24 - #define AES_FLAGS_COHERENT (1 << 1) 23 + #define AES_FLAGS_HIDDENKEY (1 << 0) 25 24 26 25 struct geode_aes_op { 27 26