summaryrefslogtreecommitdiff
path: root/crypto/internal.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-07-09 14:49:42 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-21 11:41:02 +1000
commit6747dd4093f7bac44c55c994048bb7e8a64b5600 (patch)
tree9ea354906c6abf913d89997e1c02c2e08885f77c /crypto/internal.h
parentbb21071e97b5cda4d8c7ba3a58a6faaf9e663ea6 (diff)
downloadlinux-crypto-6747dd4093f7bac44c55c994048bb7e8a64b5600.tar.gz
linux-crypto-6747dd4093f7bac44c55c994048bb7e8a64b5600.zip
[CRYPTO] digest: Store temporary digest in tfm
When the final result location is unaligned, we store the digest in a temporary buffer before copying it to the final location. Currently that buffer sits on the stack. This patch moves it to an area in the tfm, just like the CBC IV buffer. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/internal.h')
-rw-r--r--crypto/internal.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/internal.h b/crypto/internal.h
index 03c00b0e..b110b979 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -99,7 +99,14 @@ static inline void crypto_exit_proc(void)
static inline unsigned int crypto_digest_ctxsize(struct crypto_alg *alg,
int flags)
{
- return alg->cra_ctxsize;
+ unsigned int len = alg->cra_ctxsize;
+
+ if (alg->cra_alignmask) {
+ len = ALIGN(len, (unsigned long)alg->cra_alignmask + 1);
+ len += alg->cra_digest.dia_digestsize;
+ }
+
+ return len;
}
static inline unsigned int crypto_cipher_ctxsize(struct crypto_alg *alg,