crypto: vmx - fix copy-paste error in CTR mode
authorDaniel Axtens <dja@axtens.net>
Fri, 15 Mar 2019 02:09:01 +0000 (13:09 +1100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 22 Mar 2019 12:57:28 +0000 (20:57 +0800)
commitdcf7b48212c0fab7df69e84fab22d6cb7c8c0fb9
treea670b1274696717035b1ad7582ffc2ec4a8a2098
parent5db46ac29a6797541943d3c4081821747e342732
crypto: vmx - fix copy-paste error in CTR mode

The original assembly imported from OpenSSL has two copy-paste
errors in handling CTR mode. When dealing with a 2 or 3 block tail,
the code branches to the CBC decryption exit path, rather than to
the CTR exit path.

This leads to corruption of the IV, which leads to subsequent blocks
being corrupted.

This can be detected with libkcapi test suite, which is available at
https://github.com/smuellerDD/libkcapi

Reported-by: Ondrej Mosnáček <omosnacek@gmail.com>
Fixes: 5c380d623ed3 ("crypto: vmx - Add support for VMS instructions by ASM")
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Axtens <dja@axtens.net>
Tested-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Ondrej Mosnacek <omosnacek@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/vmx/aesp8-ppc.pl