]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: chacha20 - fix handling of chunked input
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 14 Aug 2017 13:28:14 +0000 (14:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 7 Sep 2017 06:37:14 +0000 (08:37 +0200)
commit6fb972d037512f59e4a9fffffe89ce59e815d8c4
tree77d473962664a9968b10ceb3ff1a74232b31a6b9
parent6b31ae8707a7b988ad9d56059b57cb361041bdbc
crypto: chacha20 - fix handling of chunked input

commit 4de437265eaac18f880d827f8e105b10de9b87a3 upstream.

Commit 9ae433bc79f9 ("crypto: chacha20 - convert generic and x86 versions
to skcipher") ported the existing chacha20 code to use the new skcipher
API, and introduced a bug along the way. Unfortunately, the tcrypt tests
did not catch the error, and it was only found recently by Tobias.

Stefan kindly diagnosed the error, and proposed a fix which is similar
to the one below, with the exception that 'walk.stride' is used rather
than the hardcoded block size. This does not actually matter in this
case, but it's a better example of how to use the skcipher walk API.

Fixes: 9ae433bc79f9 ("crypto: chacha20 - convert generic and x86 ...")
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Reported-by: Tobias Brunner <tobias@strongswan.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
crypto/chacha20_generic.c