1 From dcf7b48212c0fab7df69e84fab22d6cb7c8c0fb9 Mon Sep 17 00:00:00 2001
2 From: Daniel Axtens <dja@axtens.net>
3 Date: Fri, 15 Mar 2019 13:09:01 +1100
4 Subject: crypto: vmx - fix copy-paste error in CTR mode
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 From: Daniel Axtens <dja@axtens.net>
11 commit dcf7b48212c0fab7df69e84fab22d6cb7c8c0fb9 upstream.
13 The original assembly imported from OpenSSL has two copy-paste
14 errors in handling CTR mode. When dealing with a 2 or 3 block tail,
15 the code branches to the CBC decryption exit path, rather than to
18 This leads to corruption of the IV, which leads to subsequent blocks
21 This can be detected with libkcapi test suite, which is available at
22 https://github.com/smuellerDD/libkcapi
24 Reported-by: Ondrej Mosnáček <omosnacek@gmail.com>
25 Fixes: 5c380d623ed3 ("crypto: vmx - Add support for VMS instructions by ASM")
26 Cc: stable@vger.kernel.org
27 Signed-off-by: Daniel Axtens <dja@axtens.net>
28 Tested-by: Michael Ellerman <mpe@ellerman.id.au>
29 Tested-by: Ondrej Mosnacek <omosnacek@gmail.com>
30 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
31 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34 drivers/crypto/vmx/aesp8-ppc.pl | 4 ++--
35 1 file changed, 2 insertions(+), 2 deletions(-)
37 --- a/drivers/crypto/vmx/aesp8-ppc.pl
38 +++ b/drivers/crypto/vmx/aesp8-ppc.pl
39 @@ -1795,7 +1795,7 @@ Lctr32_enc8x_three:
40 stvx_u $out1,$x10,$out
41 stvx_u $out2,$x20,$out
48 @@ -1807,7 +1807,7 @@ Lctr32_enc8x_two:
49 stvx_u $out0,$x00,$out
50 stvx_u $out1,$x10,$out