]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.21.3/geode-aes-allow-in-place-operations.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 2.6.21.3 / geode-aes-allow-in-place-operations.patch
1 From stable-bounces@linux.kernel.org Thu May 24 04:36:51 2007
2 Date: Thu, 24 May 2007 21:36:35 +1000
3 From: Herbert Xu <herbert@gondor.apana.org.au>
4 To: stable@kernel.org
5 Message-ID: <20070524113635.GA9924@gondor.apana.org.au>
6 Subject: GEODE-AES: Allow in-place operations [CVE-2007-2451]
7
8 From: Jordan Crouse <jordan.crouse@amd.com>
9
10 Allow in-place crypto operations. Also remove the coherent user flag
11 (we use it automagically now), and by default use the user written
12 key rather then the HW hidden key - this makes crypto just work without
13 any special considerations, and thats OK, since its our only usage
14 model.
15
16 Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
17 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
18 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
19 ---
20
21 drivers/crypto/geode-aes.c | 12 +++++++++---
22 drivers/crypto/geode-aes.h | 3 +--
23 2 files changed, 10 insertions(+), 5 deletions(-)
24
25 --- linux-2.6.21.2.orig/drivers/crypto/geode-aes.c
26 +++ linux-2.6.21.2/drivers/crypto/geode-aes.c
27 @@ -102,10 +102,15 @@ geode_aes_crypt(struct geode_aes_op *op)
28 u32 flags = 0;
29 unsigned long iflags;
30
31 - if (op->len == 0 || op->src == op->dst)
32 + if (op->len == 0)
33 return 0;
34
35 - if (op->flags & AES_FLAGS_COHERENT)
36 + /* If the source and destination is the same, then
37 + * we need to turn on the coherent flags, otherwise
38 + * we don't need to worry
39 + */
40 +
41 + if (op->src == op->dst)
42 flags |= (AES_CTRL_DCA | AES_CTRL_SCA);
43
44 if (op->dir == AES_DIR_ENCRYPT)
45 @@ -120,7 +125,7 @@ geode_aes_crypt(struct geode_aes_op *op)
46 _writefield(AES_WRITEIV0_REG, op->iv);
47 }
48
49 - if (op->flags & AES_FLAGS_USRKEY) {
50 + if (!(op->flags & AES_FLAGS_HIDDENKEY)) {
51 flags |= AES_CTRL_WRKEY;
52 _writefield(AES_WRITEKEY0_REG, op->key);
53 }
54 @@ -289,6 +294,7 @@ static struct crypto_alg geode_cbc_alg =
55 .setkey = geode_setkey,
56 .encrypt = geode_cbc_encrypt,
57 .decrypt = geode_cbc_decrypt,
58 + .ivsize = AES_IV_LENGTH,
59 }
60 }
61 };
62 --- linux-2.6.21.2.orig/drivers/crypto/geode-aes.h
63 +++ linux-2.6.21.2/drivers/crypto/geode-aes.h
64 @@ -20,8 +20,7 @@
65 #define AES_DIR_DECRYPT 0
66 #define AES_DIR_ENCRYPT 1
67
68 -#define AES_FLAGS_USRKEY (1 << 0)
69 -#define AES_FLAGS_COHERENT (1 << 1)
70 +#define AES_FLAGS_HIDDENKEY (1 << 0)
71
72 struct geode_aes_op {
73