diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2009-11-23 12:34:58 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-11-23 12:34:58 -0500 |
commit | 9b8b317d58084b9a44f6f33b355c4278d9f841fb (patch) | |
tree | e0df89800bf4301c4017db3cdf04a2056ec1a852 /drivers/crypto/padlock-sha.c | |
parent | 78c210efdefe07131f91ed512a3308b15bb14e2f (diff) | |
parent | 648f4e3e50c4793d9dbf9a09afa193631f76fa26 (diff) |
Merge commit 'v2.6.32-rc8' into HEAD
Diffstat (limited to 'drivers/crypto/padlock-sha.c')
-rw-r--r-- | drivers/crypto/padlock-sha.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index 76cb6b345e7b..0af80577dc7b 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -24,6 +24,12 @@ | |||
24 | #include <asm/i387.h> | 24 | #include <asm/i387.h> |
25 | #include "padlock.h" | 25 | #include "padlock.h" |
26 | 26 | ||
27 | #ifdef CONFIG_64BIT | ||
28 | #define STACK_ALIGN 16 | ||
29 | #else | ||
30 | #define STACK_ALIGN 4 | ||
31 | #endif | ||
32 | |||
27 | struct padlock_sha_desc { | 33 | struct padlock_sha_desc { |
28 | struct shash_desc fallback; | 34 | struct shash_desc fallback; |
29 | }; | 35 | }; |
@@ -64,7 +70,9 @@ static int padlock_sha1_finup(struct shash_desc *desc, const u8 *in, | |||
64 | /* We can't store directly to *out as it may be unaligned. */ | 70 | /* We can't store directly to *out as it may be unaligned. */ |
65 | /* BTW Don't reduce the buffer size below 128 Bytes! | 71 | /* BTW Don't reduce the buffer size below 128 Bytes! |
66 | * PadLock microcode needs it that big. */ | 72 | * PadLock microcode needs it that big. */ |
67 | char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); | 73 | char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__ |
74 | ((aligned(STACK_ALIGN))); | ||
75 | char *result = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT); | ||
68 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); | 76 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); |
69 | struct sha1_state state; | 77 | struct sha1_state state; |
70 | unsigned int space; | 78 | unsigned int space; |
@@ -128,7 +136,9 @@ static int padlock_sha256_finup(struct shash_desc *desc, const u8 *in, | |||
128 | /* We can't store directly to *out as it may be unaligned. */ | 136 | /* We can't store directly to *out as it may be unaligned. */ |
129 | /* BTW Don't reduce the buffer size below 128 Bytes! | 137 | /* BTW Don't reduce the buffer size below 128 Bytes! |
130 | * PadLock microcode needs it that big. */ | 138 | * PadLock microcode needs it that big. */ |
131 | char result[128] __attribute__ ((aligned(PADLOCK_ALIGNMENT))); | 139 | char buf[128 + PADLOCK_ALIGNMENT - STACK_ALIGN] __attribute__ |
140 | ((aligned(STACK_ALIGN))); | ||
141 | char *result = PTR_ALIGN(&buf[0], PADLOCK_ALIGNMENT); | ||
132 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); | 142 | struct padlock_sha_desc *dctx = shash_desc_ctx(desc); |
133 | struct sha256_state state; | 143 | struct sha256_state state; |
134 | unsigned int space; | 144 | unsigned int space; |