1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * The MORUS-1280 Authenticated-Encryption Algorithm
4 * Glue for AVX2 implementation
6 * Copyright (c) 2016-2018 Ondrej Mosnacek <omosnacek@gmail.com>
7 * Copyright (C) 2017-2018 Red Hat, Inc. All rights reserved.
10 #include <crypto/internal/aead.h>
11 #include <crypto/internal/simd.h>
12 #include <crypto/morus1280_glue.h>
13 #include <linux/module.h>
14 #include <asm/fpu/api.h>
15 #include <asm/cpu_device_id.h>
17 asmlinkage void crypto_morus1280_avx2_init(void *state, const void *key,
19 asmlinkage void crypto_morus1280_avx2_ad(void *state, const void *data,
22 asmlinkage void crypto_morus1280_avx2_enc(void *state, const void *src,
23 void *dst, unsigned int length);
24 asmlinkage void crypto_morus1280_avx2_dec(void *state, const void *src,
25 void *dst, unsigned int length);
27 asmlinkage void crypto_morus1280_avx2_enc_tail(void *state, const void *src,
28 void *dst, unsigned int length);
29 asmlinkage void crypto_morus1280_avx2_dec_tail(void *state, const void *src,
30 void *dst, unsigned int length);
32 asmlinkage void crypto_morus1280_avx2_final(void *state, void *tag_xor,
33 u64 assoclen, u64 cryptlen);
35 MORUS1280_DECLARE_ALG(avx2, "morus1280-avx2", 400);
37 static struct simd_aead_alg *simd_alg;
39 static int __init crypto_morus1280_avx2_module_init(void)
41 if (!boot_cpu_has(X86_FEATURE_AVX2) ||
42 !boot_cpu_has(X86_FEATURE_OSXSAVE) ||
43 !cpu_has_xfeatures(XFEATURE_MASK_SSE | XFEATURE_MASK_YMM, NULL))
46 return simd_register_aeads_compat(&crypto_morus1280_avx2_alg, 1,
50 static void __exit crypto_morus1280_avx2_module_exit(void)
52 simd_unregister_aeads(&crypto_morus1280_avx2_alg, 1, &simd_alg);
55 module_init(crypto_morus1280_avx2_module_init);
56 module_exit(crypto_morus1280_avx2_module_exit);
58 MODULE_LICENSE("GPL");
59 MODULE_AUTHOR("Ondrej Mosnacek <omosnacek@gmail.com>");
60 MODULE_DESCRIPTION("MORUS-1280 AEAD algorithm -- AVX2 implementation");
61 MODULE_ALIAS_CRYPTO("morus1280");
62 MODULE_ALIAS_CRYPTO("morus1280-avx2");