aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crypto/zinc/curve25519/curve25519-arm-glue.h10
-rw-r--r--src/crypto/zinc/poly1305/poly1305-arm-glue.h15
2 files changed, 16 insertions, 9 deletions
diff --git a/src/crypto/zinc/curve25519/curve25519-arm-glue.h b/src/crypto/zinc/curve25519/curve25519-arm-glue.h
index 27d387e..e9496b0 100644
--- a/src/crypto/zinc/curve25519/curve25519-arm-glue.h
+++ b/src/crypto/zinc/curve25519/curve25519-arm-glue.h
@@ -7,8 +7,12 @@
#include <asm/neon.h>
#include <asm/simd.h>
-#if IS_ENABLED(CONFIG_KERNEL_MODE_NEON) && __LINUX_ARM_ARCH__ == 7
-#define ARM_USE_NEON
+#define ARM_USE_NEON (defined(CONFIG_KERNEL_MODE_NEON) && \
+ (defined(CONFIG_ARM64) || \
+ (defined(__LINUX_ARM_ARCH__) && \
+ __LINUX_ARM_ARCH__ == 7)))
+
+#if ARM_USE_NEON
asmlinkage void curve25519_neon(u8 mypublic[CURVE25519_POINT_SIZE],
const u8 secret[CURVE25519_POINT_SIZE],
const u8 basepoint[CURVE25519_POINT_SIZE]);
@@ -25,7 +29,7 @@ static inline bool curve25519_arch(u8 mypublic[CURVE25519_POINT_SIZE],
const u8 secret[CURVE25519_POINT_SIZE],
const u8 basepoint[CURVE25519_POINT_SIZE])
{
-#ifdef ARM_USE_NEON
+#if ARM_USE_NEON
if (curve25519_use_neon && may_use_simd()) {
kernel_neon_begin();
curve25519_neon(mypublic, secret, basepoint);
diff --git a/src/crypto/zinc/poly1305/poly1305-arm-glue.h b/src/crypto/zinc/poly1305/poly1305-arm-glue.h
index 1dfd549..fb7be17 100644
--- a/src/crypto/zinc/poly1305/poly1305-arm-glue.h
+++ b/src/crypto/zinc/poly1305/poly1305-arm-glue.h
@@ -6,13 +6,16 @@
#include <asm/hwcap.h>
#include <asm/neon.h>
+#define ARM_USE_NEON (defined(CONFIG_KERNEL_MODE_NEON) && \
+ (defined(CONFIG_ARM64) || \
+ (defined(__LINUX_ARM_ARCH__) && \
+ __LINUX_ARM_ARCH__ == 7)))
+
asmlinkage void poly1305_init_arm(void *ctx, const u8 key[16]);
asmlinkage void poly1305_blocks_arm(void *ctx, const u8 *inp, const size_t len,
const u32 padbit);
asmlinkage void poly1305_emit_arm(void *ctx, u8 mac[16], const u32 nonce[4]);
-#if IS_ENABLED(CONFIG_KERNEL_MODE_NEON) && \
- (defined(CONFIG_64BIT) || __LINUX_ARM_ARCH__ >= 7)
-#define ARM_USE_NEON
+#if ARM_USE_NEON
asmlinkage void poly1305_blocks_neon(void *ctx, const u8 *inp, const size_t len,
const u32 padbit);
asmlinkage void poly1305_emit_neon(void *ctx, u8 mac[16], const u32 nonce[4]);
@@ -54,7 +57,7 @@ struct poly1305_arch_internal {
};
#endif
-#if defined(ARM_USE_NEON)
+#if ARM_USE_NEON
static void convert_to_base2_64(void *ctx)
{
struct poly1305_arch_internal *state = ctx;
@@ -92,7 +95,7 @@ static inline bool poly1305_blocks_arch(void *ctx, const u8 *inp,
const size_t len, const u32 padbit,
simd_context_t *simd_context)
{
-#if defined(ARM_USE_NEON)
+#if ARM_USE_NEON
if (poly1305_use_neon && simd_use(simd_context)) {
poly1305_blocks_neon(ctx, inp, len, padbit);
return true;
@@ -108,7 +111,7 @@ static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE],
const u32 nonce[4],
simd_context_t *simd_context)
{
-#if defined(ARM_USE_NEON)
+#if ARM_USE_NEON
if (poly1305_use_neon && simd_use(simd_context)) {
poly1305_emit_neon(ctx, mac, nonce);
return true;