summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Ebbert <cebbert@redhat.com>2009-11-03 10:32:03 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-08 10:22:35 -0800
commitc089a8dcd8a99f8c6505a539d45a754a9f84c9dd (patch)
tree331ade026903583c7442428962a6deb85ec6ffb0
parent4a72cdf3871e086db051c70ade06c0570ac4d5b5 (diff)
crypto: padlock-aes - Use the correct mask when checking whether copying is required
commit e8edb3cbd7dd8acf6c748a02d06ec1d82c4124ea upstream. Masking with PAGE_SIZE is just wrong... Signed-off-by: Chuck Ebbert <cebbert@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/crypto/padlock-aes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index a9952b1236b0..84c51e177269 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,
/* Padlock in ECB mode fetches at least ecb_fetch_bytes of data.
* We could avoid some copying here but it's probably not worth it.
*/
- if (unlikely(((unsigned long)in & PAGE_SIZE) + ecb_fetch_bytes > PAGE_SIZE)) {
+ if (unlikely(((unsigned long)in & ~PAGE_MASK) + ecb_fetch_bytes > PAGE_SIZE)) {
ecb_crypt_copy(in, out, key, cword, count);
return;
}
@@ -248,7 +248,7 @@ static inline u8 *cbc_crypt(const u8 *in, u8 *out, u32 *key,
u8 *iv, struct cword *cword, int count)
{
/* Padlock in CBC mode fetches at least cbc_fetch_bytes of data. */
- if (unlikely(((unsigned long)in & PAGE_SIZE) + cbc_fetch_bytes > PAGE_SIZE))
+ if (unlikely(((unsigned long)in & ~PAGE_MASK) + cbc_fetch_bytes > PAGE_SIZE))
return cbc_crypt_copy(in, out, key, iv, cword, count);
return rep_xcrypt_cbc(in, out, key, iv, cword, count);