summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/crypto
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-04-13 01:33:12 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2019-04-18 10:15:04 -0400
commit626ddb2fbe7931a2996bd7fe88bd1ffd5daf7143 (patch)
tree132a14ae7204569d22896438fda6204af098a1e1 /arch/powerpc/crypto
parent0edf8593eb0985c88aa668b00befcdc1183d004d (diff)
crypto: powerpc - convert to use crypto_simd_usable()
Replace all calls to in_interrupt() in the PowerPC crypto code with !crypto_simd_usable(). This causes the crypto self-tests to test the no-SIMD code paths when CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y. The p8_ghash algorithm is currently failing and needs to be fixed, as it produces the wrong digest when no-SIMD updates are mixed with SIMD ones. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/powerpc/crypto')
-rw-r--r--arch/powerpc/crypto/crc32c-vpmsum_glue.c4
-rw-r--r--arch/powerpc/crypto/crct10dif-vpmsum_glue.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/arch/powerpc/crypto/crc32c-vpmsum_glue.c b/arch/powerpc/crypto/crc32c-vpmsum_glue.c
index fd1d6c83f0c0..c4fa242dd652 100644
--- a/arch/powerpc/crypto/crc32c-vpmsum_glue.c
+++ b/arch/powerpc/crypto/crc32c-vpmsum_glue.c
@@ -1,10 +1,12 @@
1#include <linux/crc32.h> 1#include <linux/crc32.h>
2#include <crypto/internal/hash.h> 2#include <crypto/internal/hash.h>
3#include <crypto/internal/simd.h>
3#include <linux/init.h> 4#include <linux/init.h>
4#include <linux/module.h> 5#include <linux/module.h>
5#include <linux/string.h> 6#include <linux/string.h>
6#include <linux/kernel.h> 7#include <linux/kernel.h>
7#include <linux/cpufeature.h> 8#include <linux/cpufeature.h>
9#include <asm/simd.h>
8#include <asm/switch_to.h> 10#include <asm/switch_to.h>
9 11
10#define CHKSUM_BLOCK_SIZE 1 12#define CHKSUM_BLOCK_SIZE 1
@@ -22,7 +24,7 @@ static u32 crc32c_vpmsum(u32 crc, unsigned char const *p, size_t len)
22 unsigned int prealign; 24 unsigned int prealign;
23 unsigned int tail; 25 unsigned int tail;
24 26
25 if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || in_interrupt()) 27 if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || !crypto_simd_usable())
26 return __crc32c_le(crc, p, len); 28 return __crc32c_le(crc, p, len);
27 29
28 if ((unsigned long)p & VMX_ALIGN_MASK) { 30 if ((unsigned long)p & VMX_ALIGN_MASK) {
diff --git a/arch/powerpc/crypto/crct10dif-vpmsum_glue.c b/arch/powerpc/crypto/crct10dif-vpmsum_glue.c
index 02ea277863d1..e27ff16573b5 100644
--- a/arch/powerpc/crypto/crct10dif-vpmsum_glue.c
+++ b/arch/powerpc/crypto/crct10dif-vpmsum_glue.c
@@ -12,11 +12,13 @@
12 12
13#include <linux/crc-t10dif.h> 13#include <linux/crc-t10dif.h>
14#include <crypto/internal/hash.h> 14#include <crypto/internal/hash.h>
15#include <crypto/internal/simd.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/string.h> 18#include <linux/string.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/cpufeature.h> 20#include <linux/cpufeature.h>
21#include <asm/simd.h>
20#include <asm/switch_to.h> 22#include <asm/switch_to.h>
21 23
22#define VMX_ALIGN 16 24#define VMX_ALIGN 16
@@ -32,7 +34,7 @@ static u16 crct10dif_vpmsum(u16 crci, unsigned char const *p, size_t len)
32 unsigned int tail; 34 unsigned int tail;
33 u32 crc = crci; 35 u32 crc = crci;
34 36
35 if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || in_interrupt()) 37 if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || !crypto_simd_usable())
36 return crc_t10dif_generic(crc, p, len); 38 return crc_t10dif_generic(crc, p, len);
37 39
38 if ((unsigned long)p & VMX_ALIGN_MASK) { 40 if ((unsigned long)p & VMX_ALIGN_MASK) {