1
2
3
4
5
6
7
8
9
10
11
12
13
14#include <crypto/internal/aead.h>
15#include <crypto/morus1280_glue.h>
16#include <linux/module.h>
17#include <asm/fpu/api.h>
18#include <asm/cpu_device_id.h>
19
20asmlinkage void crypto_morus1280_avx2_init(void *state, const void *key,
21 const void *iv);
22asmlinkage void crypto_morus1280_avx2_ad(void *state, const void *data,
23 unsigned int length);
24
25asmlinkage void crypto_morus1280_avx2_enc(void *state, const void *src,
26 void *dst, unsigned int length);
27asmlinkage void crypto_morus1280_avx2_dec(void *state, const void *src,
28 void *dst, unsigned int length);
29
30asmlinkage void crypto_morus1280_avx2_enc_tail(void *state, const void *src,
31 void *dst, unsigned int length);
32asmlinkage void crypto_morus1280_avx2_dec_tail(void *state, const void *src,
33 void *dst, unsigned int length);
34
35asmlinkage void crypto_morus1280_avx2_final(void *state, void *tag_xor,
36 u64 assoclen, u64 cryptlen);
37
38MORUS1280_DECLARE_ALGS(avx2, "morus1280-avx2", 400);
39
40static int __init crypto_morus1280_avx2_module_init(void)
41{
42 if (!boot_cpu_has(X86_FEATURE_AVX2) ||
43 !boot_cpu_has(X86_FEATURE_OSXSAVE) ||
44 !cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL))
45 return -ENODEV;
46
47 return crypto_register_aeads(crypto_morus1280_avx2_algs,
48 ARRAY_SIZE(crypto_morus1280_avx2_algs));
49}
50
51static void __exit crypto_morus1280_avx2_module_exit(void)
52{
53 crypto_unregister_aeads(crypto_morus1280_avx2_algs,
54 ARRAY_SIZE(crypto_morus1280_avx2_algs));
55}
56
57module_init(crypto_morus1280_avx2_module_init);
58module_exit(crypto_morus1280_avx2_module_exit);
59
60MODULE_LICENSE("GPL");
61MODULE_AUTHOR("Ondrej Mosnacek <omosnacek@gmail.com>");
62MODULE_DESCRIPTION("MORUS-1280 AEAD algorithm -- AVX2 implementation");
63MODULE_ALIAS_CRYPTO("morus1280");
64MODULE_ALIAS_CRYPTO("morus1280-avx2");
65