summaryrefslogtreecommitdiffstats
path: root/crypto/skcipher.c
diff options
context:
space:
mode:
authorOndrej Mosnáček <omosnacek@gmail.com>2017-11-23 07:49:06 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2017-11-24 19:08:52 -0500
commitc14ca8386539a298c1c19b003fe55e37d0f0e89c (patch)
tree558d318d729b104aeb115ed15362ee986f4b2e14 /crypto/skcipher.c
parent7d2c3f54e6f646887d019faa45f35d6fe9fe82ce (diff)
crypto: skcipher - Fix skcipher_walk_aead_common
The skcipher_walk_aead_common function calls scatterwalk_copychunks on the input and output walks to skip the associated data. If the AD end at an SG list entry boundary, then after these calls the walks will still be pointing to the end of the skipped region. These offsets are later checked for alignment in skcipher_walk_next, so the skcipher_walk may detect the alignment incorrectly. This patch fixes it by calling scatterwalk_done after the copychunks calls to ensure that the offsets refer to the right SG list entry. Fixes: b286d8b1a690 ("crypto: skcipher - Add skcipher walk interface") Cc: <stable@vger.kernel.org> Signed-off-by: Ondrej Mosnacek <omosnacek@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/skcipher.c')
-rw-r--r--crypto/skcipher.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 4faa0fd53b0c..6c45ed536664 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -517,6 +517,9 @@ static int skcipher_walk_aead_common(struct skcipher_walk *walk,
517 scatterwalk_copychunks(NULL, &walk->in, req->assoclen, 2); 517 scatterwalk_copychunks(NULL, &walk->in, req->assoclen, 2);
518 scatterwalk_copychunks(NULL, &walk->out, req->assoclen, 2); 518 scatterwalk_copychunks(NULL, &walk->out, req->assoclen, 2);
519 519
520 scatterwalk_done(&walk->in, 0, walk->total);
521 scatterwalk_done(&walk->out, 0, walk->total);
522
520 walk->iv = req->iv; 523 walk->iv = req->iv;
521 walk->oiv = req->iv; 524 walk->oiv = req->iv;
522 525