]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] GEODE-AES: Allow in-place operations [CVE-2007-2451]
authorJordan Crouse <jordan.crouse@amd.com>
Thu, 24 May 2007 11:36:35 +0000 (21:36 +1000)
committerChris Wright <chrisw@sous-sol.org>
Thu, 24 May 2007 21:20:43 +0000 (14:20 -0700)
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>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
drivers/crypto/geode-aes.c
drivers/crypto/geode-aes.h

index 43a68398656f57f5c208897229de8249a557bc8e..9dbb218e43ba91e667b60fbc4f43c0cb515d75b3 100644 (file)
@@ -104,10 +104,15 @@ geode_aes_crypt(struct geode_aes_op *op)
        u32 flags = 0;
        int 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)
@@ -122,7 +127,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);
        }
@@ -291,6 +296,7 @@ static struct crypto_alg geode_cbc_alg = {
                        .setkey                 =       geode_setkey,
                        .encrypt                =       geode_cbc_encrypt,
                        .decrypt                =       geode_cbc_decrypt,
+                       .ivsize                 =       AES_IV_LENGTH,
                }
        }
 };
index 8003a36f3a83de6a37e2d45d5b21dd059f992366..f47968671ae7cfede80dacbfbda8c1b236014d75 100644 (file)
@@ -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 {