aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto/zinc/chacha20
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/zinc/chacha20')
-rw-r--r--src/crypto/zinc/chacha20/chacha20-arm-glue.h2
-rw-r--r--src/crypto/zinc/chacha20/chacha20-mips-glue.h2
-rw-r--r--src/crypto/zinc/chacha20/chacha20-x86_64-glue.h2
-rw-r--r--src/crypto/zinc/chacha20/chacha20.c29
4 files changed, 28 insertions, 7 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20-arm-glue.h b/src/crypto/zinc/chacha20/chacha20-arm-glue.h
index 1de1a71..4d7eb8c 100644
--- a/src/crypto/zinc/chacha20/chacha20-arm-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-arm-glue.h
@@ -17,7 +17,7 @@ asmlinkage void chacha20_neon(u8 *out, const u8 *in, const size_t len,
static bool chacha20_use_neon __ro_after_init;
-void __init chacha20_fpu_init(void)
+static void __init chacha20_fpu_init(void)
{
#if defined(CONFIG_ARM64)
chacha20_use_neon = elf_hwcap & HWCAP_ASIMD;
diff --git a/src/crypto/zinc/chacha20/chacha20-mips-glue.h b/src/crypto/zinc/chacha20/chacha20-mips-glue.h
index 4bdaea5..518deb5 100644
--- a/src/crypto/zinc/chacha20/chacha20-mips-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-mips-glue.h
@@ -5,7 +5,7 @@
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)
+static void __init chacha20_fpu_init(void)
{
}
diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
index e9a0d1e..7eacde3 100644
--- a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
@@ -30,7 +30,7 @@ static bool chacha20_use_avx2 __ro_after_init;
static bool chacha20_use_avx512 __ro_after_init;
static bool chacha20_use_avx512vl __ro_after_init;
-void __init chacha20_fpu_init(void)
+static void __init chacha20_fpu_init(void)
{
chacha20_use_ssse3 = boot_cpu_has(X86_FEATURE_SSSE3);
chacha20_use_avx2 =
diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c
index a7156a9..2b3644f 100644
--- a/src/crypto/zinc/chacha20/chacha20.c
+++ b/src/crypto/zinc/chacha20/chacha20.c
@@ -10,6 +10,8 @@
#include <zinc/chacha20.h>
#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
#include <crypto/algapi.h>
#if defined(CONFIG_ZINC_ARCH_X86_64)
@@ -168,7 +170,26 @@ void hchacha20(u8 derived_key[CHACHA20_KEY_SIZE],
if (!hchacha20_arch(derived_key, nonce, key, simd_context))
hchacha20_generic(derived_key, nonce, key);
}
-/* Deliberately not EXPORT_SYMBOL'd, since there are few reasons why somebody
- * should be using this directly, rather than via xchacha20. Revisit only in
- * the unlikely event that somebody has a good reason to export this.
- */
+EXPORT_SYMBOL(hchacha20);
+
+#ifndef COMPAT_ZINC_IS_A_MODULE
+int __init chacha20_mod_init(void)
+#else
+static int __init mod_init(void)
+#endif
+{
+ chacha20_fpu_init();
+ return 0;
+}
+
+#ifdef COMPAT_ZINC_IS_A_MODULE
+static void __exit mod_exit(void)
+{
+}
+
+module_init(mod_init);
+module_exit(mod_exit);
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("ChaCha20 stream cipher");
+MODULE_AUTHOR("Jason A. Donenfeld <Jason@zx2c4.com>");
+#endif