Skip to content

Commit

Permalink
crypto: vmx - Fixing GHASH Key issue on little endian
Browse files Browse the repository at this point in the history
GHASH table algorithm is using a big endian key.
In little endian machines key will be LE ordered.
After a lxvd2x instruction key is loaded as it is,
LE/BE order, in first case it'll generate a wrong
table resulting in wrong hashes from the algorithm.

Bug affects only LE machines.
In order to fix it we do a swap for loaded key.

Cc: stable@vger.kernel.org
Signed-off-by: Leonidas S Barbosa <leosilva@linux.vnet.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Leonidas Da Silva Barbosa authored and Herbert Xu committed Aug 18, 2015
1 parent 1d4aa0b commit 3c5f0ed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/crypto/vmx/ghashp8-ppc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
mtspr 256,r0
li r10,0x30
lvx_u $H,0,r4 # load H
le?xor r7,r7,r7
le?addi r7,r7,0x8 # need a vperm start with 08
le?lvsr 5,0,r7
le?vspltisb 6,0x0f
le?vxor 5,5,6 # set a b-endian mask
le?vperm $H,$H,$H,5
vspltisb $xC2,-16 # 0xf0
vspltisb $t0,1 # one
Expand Down

0 comments on commit 3c5f0ed

Please sign in to comment.