diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2005-11-29 22:04:41 +1100 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-09 14:15:49 -0800 |
commit | 827c3911d8551842900f44c9a139382bcae68e6e (patch) | |
tree | 94a273158e4e343ac71cab555ff32477dad61431 /crypto/cipher.c | |
parent | fa9b98fdab5b57ecb4dd3d6c2489e262af458c44 (diff) | |
download | linux-3.10-827c3911d8551842900f44c9a139382bcae68e6e.tar.gz linux-3.10-827c3911d8551842900f44c9a139382bcae68e6e.tar.bz2 linux-3.10-827c3911d8551842900f44c9a139382bcae68e6e.zip |
[CRYPTO] cipher: Align temporary buffer in cbc_process_decrypt
Since the temporary buffer is used as an argument to cia_decrypt, it must be
aligned by cra_alignmask. This bug was found by linux@horizon.com.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/cipher.c')
-rw-r--r-- | crypto/cipher.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/cipher.c b/crypto/cipher.c index dfd4bcfc597..65bcea0cd17 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c @@ -212,9 +212,10 @@ static unsigned int cbc_process_decrypt(const struct cipher_desc *desc, struct crypto_tfm *tfm = desc->tfm; void (*xor)(u8 *, const u8 *) = tfm->crt_u.cipher.cit_xor_block; int bsize = crypto_tfm_alg_blocksize(tfm); + unsigned long alignmask = crypto_tfm_alg_alignmask(desc->tfm); - u8 stack[src == dst ? bsize : 0]; - u8 *buf = stack; + u8 stack[src == dst ? bsize + alignmask : 0]; + u8 *buf = (u8 *)ALIGN((unsigned long)stack, alignmask + 1); u8 **dst_p = src == dst ? &buf : &dst; void (*fn)(void *, u8 *, const u8 *) = desc->crfn; |