diff options
author | Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com> | 2015-08-14 09:14:16 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-08-17 22:30:36 -0400 |
commit | 3c5f0ed78e976be705218cad62acf6a68e9d121e (patch) | |
tree | c6095373c863c1da23a2b316bbb8bfa7daf3b02a | |
parent | 1d4aa0b4c1816e8ca92a6aadb0d8f6b43c56c0d0 (diff) |
crypto: vmx - Fixing GHASH Key issue on little endian
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>
-rw-r--r-- | drivers/crypto/vmx/ghashp8-ppc.pl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/crypto/vmx/ghashp8-ppc.pl b/drivers/crypto/vmx/ghashp8-ppc.pl index 0a6f899839dd..d8429cb71f02 100644 --- a/drivers/crypto/vmx/ghashp8-ppc.pl +++ b/drivers/crypto/vmx/ghashp8-ppc.pl | |||
@@ -61,6 +61,12 @@ $code=<<___; | |||
61 | mtspr 256,r0 | 61 | mtspr 256,r0 |
62 | li r10,0x30 | 62 | li r10,0x30 |
63 | lvx_u $H,0,r4 # load H | 63 | lvx_u $H,0,r4 # load H |
64 | le?xor r7,r7,r7 | ||
65 | le?addi r7,r7,0x8 # need a vperm start with 08 | ||
66 | le?lvsr 5,0,r7 | ||
67 | le?vspltisb 6,0x0f | ||
68 | le?vxor 5,5,6 # set a b-endian mask | ||
69 | le?vperm $H,$H,$H,5 | ||
64 | 70 | ||
65 | vspltisb $xC2,-16 # 0xf0 | 71 | vspltisb $xC2,-16 # 0xf0 |
66 | vspltisb $t0,1 # one | 72 | vspltisb $t0,1 # one |