]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: skcipher - Fix skcipher_walk_aead_common
authorOndrej Mosnáček <omosnacek@gmail.com>
Thu, 23 Nov 2017 12:49:06 +0000 (13:49 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 25 Nov 2017 00:08:52 +0000 (08:08 +0800)
commit716b1ac32bdcac5a3a3d9429bfe412ac7a0a242a
tree558d318d729b104aeb115ed15362ee986f4b2e14
parente37259b31c75f292b1c4ee09ebb0c44828882ef3
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: cf3776222c0f ("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>
crypto/skcipher.c