summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crypto/Kbuild.include30
-rw-r--r--src/crypto/zinc/blake2s/blake2s-x86_64-glue.h3
-rw-r--r--src/crypto/zinc/blake2s/blake2s.c4
-rw-r--r--src/crypto/zinc/chacha20/chacha20-arm-glue.h3
-rw-r--r--src/crypto/zinc/chacha20/chacha20-mips-glue.h4
-rw-r--r--src/crypto/zinc/chacha20/chacha20-x86_64-glue.h3
-rw-r--r--src/crypto/zinc/chacha20/chacha20.c8
-rw-r--r--src/crypto/zinc/curve25519/curve25519-arm-glue.h3
-rw-r--r--src/crypto/zinc/curve25519/curve25519-x86_64-glue.h3
-rw-r--r--src/crypto/zinc/curve25519/curve25519.c6
-rw-r--r--src/crypto/zinc/poly1305/poly1305-arm-glue.h3
-rw-r--r--src/crypto/zinc/poly1305/poly1305-mips-glue.h4
-rw-r--r--src/crypto/zinc/poly1305/poly1305-x86_64-glue.h3
-rw-r--r--src/crypto/zinc/poly1305/poly1305.c8
14 files changed, 34 insertions, 51 deletions
diff --git a/src/crypto/Kbuild.include b/src/crypto/Kbuild.include
index c252c80..9ea7452 100644
--- a/src/crypto/Kbuild.include
+++ b/src/crypto/Kbuild.include
@@ -1,49 +1,43 @@
-ifeq ($(wildcard $(src)/compat/compat.h),)
-cmd_include_path_prefix := $(srctree)/$(src)
-else
-cmd_include_path_prefix := $(src)
-endif
-
ccflags-y += -I$(src)/crypto/include
wireguard-y += crypto/zinc/chacha20/chacha20.o
ifeq ($(CONFIG_X86_64)$(if $(CONFIG_UML),y,n),yn)
wireguard-y += crypto/zinc/chacha20/chacha20-x86_64.o
-CFLAGS_chacha20.o += -include $(cmd_include_path_prefix)/crypto/zinc/chacha20/chacha20-x86_64-glue.h
+CFLAGS_chacha20.o += -DCONFIG_ZINC_ARCH_X86_64
endif
ifeq ($(CONFIG_ARM),y)
wireguard-y += crypto/zinc/chacha20/chacha20-arm.o
-CFLAGS_chacha20.o += -include $(cmd_include_path_prefix)/crypto/zinc/chacha20/chacha20-arm-glue.h
+CFLAGS_chacha20.o += -DCONFIG_ZINC_ARCH_ARM
endif
ifeq ($(CONFIG_ARM64),y)
wireguard-y += crypto/zinc/chacha20/chacha20-arm64.o
-CFLAGS_chacha20.o += -include $(cmd_include_path_prefix)/crypto/zinc/chacha20/chacha20-arm-glue.h
+CFLAGS_chacha20.o += -DCONFIG_ZINC_ARCH_ARM64
endif
ifeq ($(CONFIG_MIPS)$(CONFIG_CPU_MIPS32_R2),yy)
wireguard-y += crypto/zinc/chacha20/chacha20-mips.o
-CFLAGS_chacha20.o += -include $(cmd_include_path_prefix)/crypto/zinc/chacha20/chacha20-mips-glue.h
+CFLAGS_chacha20.o += -DCONFIG_ZINC_ARCH_MIPS
endif
wireguard-y += crypto/zinc/poly1305/poly1305.o
ifeq ($(CONFIG_X86_64)$(if $(CONFIG_UML),y,n),yn)
wireguard-y += crypto/zinc/poly1305/poly1305-x86_64.o
-CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-x86_64-glue.h
+CFLAGS_poly1305.o += -DCONFIG_ZINC_ARCH_X86_64
endif
ifeq ($(CONFIG_ARM),y)
wireguard-y += crypto/zinc/poly1305/poly1305-arm.o
-CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-arm-glue.h
+CFLAGS_poly1305.o += -DCONFIG_ZINC_ARCH_ARM
endif
ifeq ($(CONFIG_ARM64),y)
wireguard-y += crypto/zinc/poly1305/poly1305-arm64.o
-CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-arm-glue.h
+CFLAGS_poly1305.o += -DCONFIG_ZINC_ARCH_ARM64
endif
ifeq ($(CONFIG_MIPS)$(CONFIG_CPU_MIPS32_R2),yy)
wireguard-y += crypto/zinc/poly1305/poly1305-mips.o
-CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-mips-glue.h
+CFLAGS_poly1305.o += -DCONFIG_ZINC_ARCH_MIPS
endif
ifeq ($(CONFIG_MIPS)$(CONFIG_64BIT),yy)
wireguard-y += crypto/zinc/poly1305/poly1305-mips64.o
-CFLAGS_poly1305.o += -include $(cmd_include_path_prefix)/crypto/zinc/poly1305/poly1305-mips-glue.h
+CFLAGS_poly1305.o += -DCONFIG_ZINC_ARCH_MIPS64
endif
wireguard-y += crypto/zinc/chacha20poly1305.o
@@ -51,14 +45,14 @@ wireguard-y += crypto/zinc/chacha20poly1305.o
wireguard-y += crypto/zinc/curve25519/curve25519.o
ifeq ($(CONFIG_ARM)$(CONFIG_KERNEL_MODE_NEON),yy)
wireguard-y += crypto/zinc/curve25519/curve25519-arm.o
-CFLAGS_curve25519.o += -include $(cmd_include_path_prefix)/crypto/zinc/curve25519/curve25519-arm-glue.h
+CFLAGS_curve25519.o += -DCONFIG_ZINC_ARCH_ARM
endif
ifeq ($(CONFIG_X86_64)$(if $(CONFIG_UML),y,n),yn)
-CFLAGS_curve25519.o += -include $(cmd_include_path_prefix)/crypto/zinc/curve25519/curve25519-x86_64-glue.h
+CFLAGS_curve25519.o += -DCONFIG_ZINC_ARCH_X86_64
endif
wireguard-y += crypto/zinc/blake2s/blake2s.o
ifeq ($(CONFIG_X86_64)$(if $(CONFIG_UML),y,n),yn)
wireguard-y += crypto/zinc/blake2s/blake2s-x86_64.o
-CFLAGS_blake2s.o += -include $(cmd_include_path_prefix)/crypto/zinc/blake2s/blake2s-x86_64-glue.h
+CFLAGS_blake2s.o += -DCONFIG_ZINC_ARCH_X86_64
endif
diff --git a/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h b/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h
index f0b43e8..e7cbef7 100644
--- a/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h
+++ b/src/crypto/zinc/blake2s/blake2s-x86_64-glue.h
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/blake2s.h>
#include <asm/cpufeature.h>
#include <asm/processor.h>
#include <asm/fpu/api.h>
@@ -60,5 +59,3 @@ static inline bool blake2s_arch(struct blake2s_state *state, const u8 *block,
#endif
return false;
}
-
-#define HAVE_BLAKE2S_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/blake2s/blake2s.c b/src/crypto/zinc/blake2s/blake2s.c
index d0b9bb9..bedff1e 100644
--- a/src/crypto/zinc/blake2s/blake2s.c
+++ b/src/crypto/zinc/blake2s/blake2s.c
@@ -111,7 +111,9 @@ void blake2s_init_key(struct blake2s_state *state, const size_t outlen,
}
EXPORT_SYMBOL(blake2s_init_key);
-#ifndef HAVE_BLAKE2S_ARCH_IMPLEMENTATION
+#if defined(CONFIG_ZINC_ARCH_X86_64)
+#include "blake2s-x86_64-glue.h"
+#else
void __init blake2s_fpu_init(void)
{
}
diff --git a/src/crypto/zinc/chacha20/chacha20-arm-glue.h b/src/crypto/zinc/chacha20/chacha20-arm-glue.h
index 0c8c9d5..1de1a71 100644
--- a/src/crypto/zinc/chacha20/chacha20-arm-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-arm-glue.h
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/chacha20.h>
#include <asm/hwcap.h>
#include <asm/neon.h>
@@ -46,5 +45,3 @@ static inline bool hchacha20_arch(u8 *derived_key, const u8 *nonce,
{
return false;
}
-
-#define HAVE_CHACHA20_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/chacha20/chacha20-mips-glue.h b/src/crypto/zinc/chacha20/chacha20-mips-glue.h
index e4185e1..4bdaea5 100644
--- a/src/crypto/zinc/chacha20/chacha20-mips-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-mips-glue.h
@@ -3,8 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/chacha20.h>
-
asmlinkage void chacha20_mips(u8 *out, const u8 *in, const size_t len,
const u32 key[8], const u32 counter[4]);
void __init chacha20_fpu_init(void)
@@ -24,5 +22,3 @@ static inline bool hchacha20_arch(u8 *derived_key, const u8 *nonce,
{
return false;
}
-
-#define HAVE_CHACHA20_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
index aef9697..e9a0d1e 100644
--- a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/chacha20.h>
#include <asm/fpu/api.h>
#include <asm/cpufeature.h>
#include <asm/processor.h>
@@ -101,5 +100,3 @@ static inline bool hchacha20_arch(u8 *derived_key, const u8 *nonce,
#endif
return false;
}
-
-#define HAVE_CHACHA20_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c
index da04d5b..a7156a9 100644
--- a/src/crypto/zinc/chacha20/chacha20.c
+++ b/src/crypto/zinc/chacha20/chacha20.c
@@ -12,7 +12,13 @@
#include <linux/kernel.h>
#include <crypto/algapi.h>
-#ifndef HAVE_CHACHA20_ARCH_IMPLEMENTATION
+#if defined(CONFIG_ZINC_ARCH_X86_64)
+#include "chacha20-x86_64-glue.h"
+#elif defined(CONFIG_ZINC_ARCH_ARM) || defined(CONFIG_ZINC_ARCH_ARM64)
+#include "chacha20-arm-glue.h"
+#elif defined(CONFIG_ZINC_ARCH_MIPS)
+#include "chacha20-mips-glue.h"
+#else
void __init chacha20_fpu_init(void)
{
}
diff --git a/src/crypto/zinc/curve25519/curve25519-arm-glue.h b/src/crypto/zinc/curve25519/curve25519-arm-glue.h
index 494fd3e..1b39920 100644
--- a/src/crypto/zinc/curve25519/curve25519-arm-glue.h
+++ b/src/crypto/zinc/curve25519/curve25519-arm-glue.h
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/curve25519.h>
#include <asm/hwcap.h>
#include <asm/neon.h>
#include <asm/simd.h>
@@ -42,5 +41,3 @@ static inline bool curve25519_base_arch(u8 pub[CURVE25519_POINT_SIZE],
{
return false;
}
-
-#define HAVE_CURVE25519_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/curve25519/curve25519-x86_64-glue.h b/src/crypto/zinc/curve25519/curve25519-x86_64-glue.h
index 3996b48..9159460 100644
--- a/src/crypto/zinc/curve25519/curve25519-x86_64-glue.h
+++ b/src/crypto/zinc/curve25519/curve25519-x86_64-glue.h
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/curve25519.h>
#include <asm/cpufeature.h>
#include <asm/processor.h>
@@ -45,5 +44,3 @@ static inline bool curve25519_base_arch(u8 pub[CURVE25519_POINT_SIZE],
}
return false;
}
-
-#define HAVE_CURVE25519_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/curve25519/curve25519.c b/src/crypto/zinc/curve25519/curve25519.c
index a20b295..7d19fb9 100644
--- a/src/crypto/zinc/curve25519/curve25519.c
+++ b/src/crypto/zinc/curve25519/curve25519.c
@@ -17,7 +17,11 @@
#include <linux/random.h>
#include <crypto/algapi.h>
-#ifndef HAVE_CURVE25519_ARCH_IMPLEMENTATION
+#if defined(CONFIG_ZINC_ARCH_X86_64)
+#include "curve25519-x86_64-glue.h"
+#elif defined(CONFIG_ZINC_ARCH_ARM)
+#include "curve25519-arm-glue.h"
+#else
void __init curve25519_fpu_init(void)
{
}
diff --git a/src/crypto/zinc/poly1305/poly1305-arm-glue.h b/src/crypto/zinc/poly1305/poly1305-arm-glue.h
index 6ec2fc8..50fb519 100644
--- a/src/crypto/zinc/poly1305/poly1305-arm-glue.h
+++ b/src/crypto/zinc/poly1305/poly1305-arm-glue.h
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/poly1305.h>
#include <asm/hwcap.h>
#include <asm/neon.h>
@@ -64,5 +63,3 @@ static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE],
poly1305_emit_arm(ctx, mac, nonce);
return true;
}
-
-#define HAVE_POLY1305_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/poly1305/poly1305-mips-glue.h b/src/crypto/zinc/poly1305/poly1305-mips-glue.h
index 0e72c8b..6af3f57 100644
--- a/src/crypto/zinc/poly1305/poly1305-mips-glue.h
+++ b/src/crypto/zinc/poly1305/poly1305-mips-glue.h
@@ -3,8 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/poly1305.h>
-
asmlinkage void poly1305_init_mips(void *ctx, const u8 key[16]);
asmlinkage void poly1305_blocks_mips(void *ctx, const u8 *inp, const size_t len,
const u32 padbit);
@@ -35,5 +33,3 @@ static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE],
poly1305_emit_mips(ctx, mac, nonce);
return true;
}
-
-#define HAVE_POLY1305_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/poly1305/poly1305-x86_64-glue.h b/src/crypto/zinc/poly1305/poly1305-x86_64-glue.h
index a884d22..63e2a5c 100644
--- a/src/crypto/zinc/poly1305/poly1305-x86_64-glue.h
+++ b/src/crypto/zinc/poly1305/poly1305-x86_64-glue.h
@@ -3,7 +3,6 @@
* Copyright (C) 2015-2018 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/
-#include <zinc/poly1305.h>
#include <asm/cpufeature.h>
#include <asm/processor.h>
#include <asm/intel-family.h>
@@ -117,5 +116,3 @@ static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE],
poly1305_emit_x86_64(ctx, mac, nonce);
return true;
}
-
-#define HAVE_POLY1305_ARCH_IMPLEMENTATION
diff --git a/src/crypto/zinc/poly1305/poly1305.c b/src/crypto/zinc/poly1305/poly1305.c
index a098b61..aad6587 100644
--- a/src/crypto/zinc/poly1305/poly1305.c
+++ b/src/crypto/zinc/poly1305/poly1305.c
@@ -13,7 +13,13 @@
#include <linux/kernel.h>
#include <linux/string.h>
-#ifndef HAVE_POLY1305_ARCH_IMPLEMENTATION
+#if defined(CONFIG_ZINC_ARCH_X86_64)
+#include "poly1305-x86_64-glue.h"
+#elif defined(CONFIG_ZINC_ARCH_ARM) || defined(CONFIG_ZINC_ARCH_ARM64)
+#include "poly1305-arm-glue.h"
+#elif defined(CONFIG_ZINC_ARCH_MIPS) || defined(CONFIG_ZINC_ARCH_MIPS64)
+#include "poly1305-mips-glue.h"
+#else
static inline bool poly1305_init_arch(void *ctx,
const u8 key[POLY1305_KEY_SIZE])
{