From a2a28e5c4f04b7d4fb6eedf5b5f02a3bc9100876 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 29 Sep 2007 21:24:23 +0800 Subject: [PATCH] --- yaml --- r: 67031 b: refs/heads/master c: 70613783fc0f6e37b442d79e8417f71a2b71ed93 h: refs/heads/master i: 67029: dc834e3b245da2385283c5876c5e1039f7e85b21 67027: 991d2f84256a50f00c16e5aed4d97e47736c79c2 67023: 2aa3560294ae0d86236064afee8515c2fe5ae2e4 v: v3 --- [refs] | 2 +- trunk/crypto/algapi.c | 3 --- trunk/crypto/blkcipher.c | 13 ++++++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index b66bbf4b588d..0552c6627756 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e4c5c6c9b0d04a7dac19027260f7421305a34856 +refs/heads/master: 70613783fc0f6e37b442d79e8417f71a2b71ed93 diff --git a/trunk/crypto/algapi.c b/trunk/crypto/algapi.c index d891f56f0e8c..58cc19164801 100644 --- a/trunk/crypto/algapi.c +++ b/trunk/crypto/algapi.c @@ -63,9 +63,6 @@ static int crypto_check_alg(struct crypto_alg *alg) if (alg->cra_alignmask & (alg->cra_alignmask + 1)) return -EINVAL; - if (alg->cra_alignmask & alg->cra_blocksize) - return -EINVAL; - if (alg->cra_blocksize > PAGE_SIZE / 8) return -EINVAL; diff --git a/trunk/crypto/blkcipher.c b/trunk/crypto/blkcipher.c index 9c49770837c2..a3c87da23f1e 100644 --- a/trunk/crypto/blkcipher.c +++ b/trunk/crypto/blkcipher.c @@ -149,6 +149,7 @@ static inline int blkcipher_next_slow(struct blkcipher_desc *desc, unsigned int alignmask) { unsigned int n; + unsigned aligned_bsize = ALIGN(bsize, alignmask + 1); if (walk->buffer) goto ok; @@ -167,8 +168,8 @@ static inline int blkcipher_next_slow(struct blkcipher_desc *desc, walk->dst.virt.addr = (u8 *)ALIGN((unsigned long)walk->buffer, alignmask + 1); walk->dst.virt.addr = blkcipher_get_spot(walk->dst.virt.addr, bsize); - walk->src.virt.addr = blkcipher_get_spot(walk->dst.virt.addr + bsize, - bsize); + walk->src.virt.addr = blkcipher_get_spot(walk->dst.virt.addr + + aligned_bsize, bsize); scatterwalk_copychunks(walk->src.virt.addr, &walk->in, bsize, 0); @@ -278,7 +279,9 @@ static inline int blkcipher_copy_iv(struct blkcipher_walk *walk, { unsigned bs = crypto_blkcipher_blocksize(tfm); unsigned int ivsize = crypto_blkcipher_ivsize(tfm); - unsigned int size = bs * 2 + ivsize + max(bs, ivsize) - (alignmask + 1); + unsigned aligned_bs = ALIGN(bs, alignmask + 1); + unsigned int size = aligned_bs * 2 + ivsize + max(aligned_bs, ivsize) - + (alignmask + 1); u8 *iv; size += alignmask & ~(crypto_tfm_ctx_alignment() - 1); @@ -287,8 +290,8 @@ static inline int blkcipher_copy_iv(struct blkcipher_walk *walk, return -ENOMEM; iv = (u8 *)ALIGN((unsigned long)walk->buffer, alignmask + 1); - iv = blkcipher_get_spot(iv, bs) + bs; - iv = blkcipher_get_spot(iv, bs) + bs; + iv = blkcipher_get_spot(iv, bs) + aligned_bs; + iv = blkcipher_get_spot(iv, bs) + aligned_bs; iv = blkcipher_get_spot(iv, ivsize); walk->iv = memcpy(iv, walk->iv, ivsize);