Skip to content

Commit

Permalink
crypto: vmx - fix copy-paste error in CTR mode
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 5c380d6 ("crypto: vmx - Add support for VMS instructions by ASM")
Cc: [email protected]
Signed-off-by: Daniel Axtens <[email protected]>
Tested-by: Michael Ellerman <[email protected]>
Tested-by: Ondrej Mosnacek <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
daxtens authored and herbertx committed Mar 22, 2019
1 parent 5db46ac commit dcf7b48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/crypto/vmx/aesp8-ppc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ ()
stvx_u $out1,$x10,$out
stvx_u $out2,$x20,$out
addi $out,$out,0x30
b Lcbc_dec8x_done
b Lctr32_enc8x_done
.align 5
Lctr32_enc8x_two:
Expand All @@ -1866,7 +1866,7 @@ ()
stvx_u $out0,$x00,$out
stvx_u $out1,$x10,$out
addi $out,$out,0x20
b Lcbc_dec8x_done
b Lctr32_enc8x_done
.align 5
Lctr32_enc8x_one:
Expand Down

0 comments on commit dcf7b48

Please sign in to comment.