summaryrefslogtreecommitdiff
path: root/crypto/chacha20_generic.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2017-09-24 22:41:55 -0700
committerJames Morris <james.l.morris@oracle.com>2017-09-24 22:41:55 -0700
commitfe6ec4634c4b41ea65f055ea709a6f3d5bf67bec (patch)
tree9ba289bdd8831b061743a8d48b13e6128306b8f1 /crypto/chacha20_generic.c
parentf960b5ebd9ed09bc12e10c712bce82ab58ef0435 (diff)
parent508f8d23a372beae647185ce896a0c1109406b83 (diff)
downloadlinux-crypto-fe6ec4634c4b41ea65f055ea709a6f3d5bf67bec.tar.gz
linux-crypto-fe6ec4634c4b41ea65f055ea709a6f3d5bf67bec.zip
Merge tag 'v4.14-rc2' into next-general
Linux 4.14-rc2 Sync to v4.14-rc2 for security subsystem developers to track.
Diffstat (limited to 'crypto/chacha20_generic.c')
-rw-r--r--crypto/chacha20_generic.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/chacha20_generic.c b/crypto/chacha20_generic.c
index 8b3c04d6..4a45fa48 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;