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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 May 2019 16:50:14 +0000 (18:50 +0200)
commita387b7e4c9be6075805b0e9fceea3db287efd8a6
treec39d14a63b8ae47b216323717c6944e08fcf2909
parent559c1730fedcb1a5dc8056600a0eb43f1cd12201
crypto: vmx - fix copy-paste error in CTR mode

commit dcf7b48212c0fab7df69e84fab22d6cb7c8c0fb9 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/vmx/aesp8-ppc.pl