aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-07-24 03:26:15 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-07-24 03:26:15 -0400
commitab300465676b0c0559af62d57ec9a902f5680b03 (patch)
treefde296526e6563ac8d11662d431eb2168d031614 /include/crypto
parent0b767b4df360bd442434d9d40b8a495e64202254 (diff)
crypto: api - Fix aligned ctx helper
The aligned ctx helper was using a bogus alignment value thas was one off the correct value. Fortunately the current users do not require anything beyond the natural alignment of the platform so this hasn't caused a problem. This patch fixes that and also removes the unnecessary minimum check since if the alignment is less than the natural alignment then the subsequent ALIGN operation should be a noop. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/algapi.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h
index 9de6c38f4069..3f388146a914 100644
--- a/include/crypto/algapi.h
+++ b/include/crypto/algapi.h
@@ -175,12 +175,8 @@ int blkcipher_walk_virt_block(struct blkcipher_desc *desc,
175 175
176static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm) 176static inline void *crypto_tfm_ctx_aligned(struct crypto_tfm *tfm)
177{ 177{
178 unsigned long addr = (unsigned long)crypto_tfm_ctx(tfm); 178 return PTR_ALIGN(crypto_tfm_ctx(tfm),
179 unsigned long align = crypto_tfm_alg_alignmask(tfm); 179 crypto_tfm_alg_alignmask(tfm) + 1);
180
181 if (align <= crypto_tfm_ctx_alignment())
182 align = 1;
183 return (void *)ALIGN(addr, align);
184} 180}
185 181
186static inline struct crypto_instance *crypto_tfm_alg_instance( 182static inline struct crypto_instance *crypto_tfm_alg_instance(