diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-01 10:30:03 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-01 10:30:03 -0700 |
commit | a1c516a60a702630347e27c7beb7f2f44ca7a8b5 (patch) | |
tree | bfb6c8d70457ff7596ebdba8f0d9c1233bffa93f /crypto/chacha20_generic.c | |
parent | e89ce1f89f62c7e527db3850a91dab3389772af3 (diff) | |
parent | 445a582738de6802669aeed9c33ca406c23c3b1f (diff) | |
download | linux-stericsson-a1c516a60a702630347e27c7beb7f2f44ca7a8b5.tar.gz |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu:
"This fixes the following issues:
- Regression in chacha20 handling of chunked input
- Crash in algif_skcipher when used with async io
- Potential bogus pointer dereference in lib/mpi"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: algif_skcipher - only call put_page on referenced and used pages
crypto: testmgr - add chunked test cases for chacha20
crypto: chacha20 - fix handling of chunked input
lib/mpi: kunmap after finishing accessing buffer
Diffstat (limited to 'crypto/chacha20_generic.c')
-rw-r--r-- | crypto/chacha20_generic.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/chacha20_generic.c b/crypto/chacha20_generic.c index 8b3c04d625c3..4a45fa4890c0 100644 --- a/crypto/chacha20_generic.c +++ b/crypto/chacha20_generic.c @@ -91,9 +91,14 @@ int crypto_chacha20_crypt(struct skcipher_request *req) crypto_chacha20_init(state, ctx, walk.iv); while (walk.nbytes > 0) { + unsigned int nbytes = walk.nbytes; + + if (nbytes < walk.total) + nbytes = round_down(nbytes, walk.stride); + chacha20_docrypt(state, walk.dst.virt.addr, walk.src.virt.addr, - walk.nbytes); - err = skcipher_walk_done(&walk, 0); + nbytes); + err = skcipher_walk_done(&walk, walk.nbytes - nbytes); } return err; |