diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-17 20:41:20 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-18 04:21:16 +0200 |
commit | fd24e1905b479dcdea58b9445fc4c837df908df7 (patch) | |
tree | f9a675256d7a02b1edd1b65b2be44f7263cc1d55 /src/crypto/zinc/poly1305/poly1305.c | |
parent | crypto: do not use -include trick (diff) | |
download | wireguard-monolithic-historical-fd24e1905b479dcdea58b9445fc4c837df908df7.tar.xz wireguard-monolithic-historical-fd24e1905b479dcdea58b9445fc4c837df908df7.zip |
crypto: turn Zinc into individual modules
Diffstat (limited to 'src/crypto/zinc/poly1305/poly1305.c')
-rw-r--r-- | src/crypto/zinc/poly1305/poly1305.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/crypto/zinc/poly1305/poly1305.c b/src/crypto/zinc/poly1305/poly1305.c index aad6587..5377721 100644 --- a/src/crypto/zinc/poly1305/poly1305.c +++ b/src/crypto/zinc/poly1305/poly1305.c @@ -12,6 +12,8 @@ #include <asm/unaligned.h> #include <linux/kernel.h> #include <linux/string.h> +#include <linux/module.h> +#include <linux/init.h> #if defined(CONFIG_ZINC_ARCH_X86_64) #include "poly1305-x86_64-glue.h" @@ -133,3 +135,29 @@ void poly1305_final(struct poly1305_ctx *ctx, u8 mac[POLY1305_MAC_SIZE], EXPORT_SYMBOL(poly1305_final); #include "../selftest/poly1305.h" + +#ifndef COMPAT_ZINC_IS_A_MODULE +int __init poly1305_mod_init(void) +#else +static int __init mod_init(void) +#endif +{ + poly1305_fpu_init(); +#ifdef DEBUG + if (!poly1305_selftest()) + return -ENOTRECOVERABLE; +#endif + 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("Poly1305 one-time MAC"); +MODULE_AUTHOR("Jason A. Donenfeld <Jason@zx2c4.com>"); +#endif |