diff options
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/hifn_795x.c | 2 | ||||
-rw-r--r-- | drivers/crypto/padlock-aes.c | 4 | ||||
-rw-r--r-- | drivers/crypto/padlock-sha.c | 14 |
3 files changed, 15 insertions, 5 deletions
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c index 5f753fc08730..09ad9154d86c 100644 --- a/drivers/crypto/hifn_795x.c +++ b/drivers/crypto/hifn_795x.c | |||
@@ -863,7 +863,7 @@ static int hifn_init_pubrng(struct hifn_device *dev) | |||
863 | dev->dmareg |= HIFN_DMAIER_PUBDONE; | 863 | dev->dmareg |= HIFN_DMAIER_PUBDONE; |
864 | hifn_write_1(dev, HIFN_1_DMA_IER, dev->dmareg); | 864 | hifn_write_1(dev, HIFN_1_DMA_IER, dev->dmareg); |
865 | 865 | ||
866 | dprintk("Chip %s: Public key engine has been sucessfully " | 866 | dprintk("Chip %s: Public key engine has been successfully " |
867 | "initialised.\n", dev->name); | 867 | "initialised.\n", dev->name); |
868 | } | 868 | } |
869 | 869 | ||
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index 721d004a0235..8c2f3703ec85 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -236,7 +236,7 @@ static inline void ecb_crypt(const u8 *in, u8 *out, u32 *key, | |||
236 | /* Padlock in ECB mode fetches at least ecb_fetch_bytes of data. | 236 | /* Padlock in ECB mode fetches at least ecb_fetch_bytes of data. |
237 | * We could avoid some copying here but it's probably not worth it. | 237 | * We could avoid some copying here but it's probably not worth it. |
238 | */ | 238 | */ |
239 | if (unlikely(((unsigned long)in & PAGE_SIZE) + ecb_fetch_bytes > PAGE_SIZE)) { | 239 | if (unlikely(((unsigned long)in & ~PAGE_MASK) + ecb_fetch_bytes > PAGE_SIZE)) { |
240 | ecb_crypt_copy(in, out, key, cword, count); | 240 | ecb_crypt_copy(in, out, key, cword, count); |
241 | return; | 241 | return; |
242 | } | 242 | } |
@@ -248,7 +248,7 @@ static inline u8 *cbc_crypt(const u8 *in, u8 *out, u32 *key, | |||
248 | u8 *iv, struct cword *cword, int count) | 248 | u8 *iv, struct cword *cword, int count) |
249 | { | 249 | { |
250 | /* Padlock in CBC mode fetches at least cbc_fetch_bytes of data. */ | 250 | /* Padlock in CBC mode fetches at least cbc_fetch_bytes of data. */ |
251 | if (unlikely(((unsigned long)in & PAGE_SIZE) + cbc_fetch_bytes > PAGE_SIZE)) | 251 | if (unlikely(((unsigned long)in & ~PAGE_MASK) + cbc_fetch_bytes > PAGE_SIZE)) |
252 | return cbc_crypt_copy(in, out, key, iv, cword, count); | 252 | return cbc_crypt_copy(in, out, key, iv, cword, count); |
253 | 253 | ||
254 | return rep_xcrypt_cbc(in, out, key, iv, cword, count); | 254 | return rep_xcrypt_cbc(in, out, key, iv, cword, count); |
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; |