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 | 023db2863e36fe648b62e21c30fda0f38765323b (patch) | |
tree | d3338db146361b72bfb406ba601c628e67bfbfde /src/crypto/zinc/curve25519/curve25519.c | |
parent | 1906c279fbe3420e31a5a48a19b6daac5fbf1904 (diff) |
crypto: turn Zinc into individual modules
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc/curve25519/curve25519.c')
-rw-r--r-- | src/crypto/zinc/curve25519/curve25519.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/crypto/zinc/curve25519/curve25519.c b/src/crypto/zinc/curve25519/curve25519.c index 7d19fb9..fca327f 100644 --- a/src/crypto/zinc/curve25519/curve25519.c +++ b/src/crypto/zinc/curve25519/curve25519.c @@ -15,6 +15,8 @@ #include <linux/version.h> #include <linux/string.h> #include <linux/random.h> +#include <linux/module.h> +#include <linux/init.h> #include <crypto/algapi.h> #if defined(CONFIG_ZINC_ARCH_X86_64) @@ -85,3 +87,29 @@ void curve25519_generate_secret(u8 secret[CURVE25519_POINT_SIZE]) EXPORT_SYMBOL(curve25519_generate_secret); #include "../selftest/curve25519.h" + +#ifndef COMPAT_ZINC_IS_A_MODULE +int __init curve25519_mod_init(void) +#else +static int __init mod_init(void) +#endif +{ + curve25519_fpu_init(); +#ifdef DEBUG + if (!curve25519_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("Curve25519 scalar multiplication"); +MODULE_AUTHOR("Jason A. Donenfeld <Jason@zx2c4.com>"); +#endif |