]> asedeno.scripts.mit.edu Git - linux.git/blob - arch/x86/crypto/morus640-sse2-glue.c
Merge tag 'spi-fix-v5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
[linux.git] / arch / x86 / crypto / morus640-sse2-glue.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * The MORUS-640 Authenticated-Encryption Algorithm
4  *   Glue for SSE2 implementation
5  *
6  * Copyright (c) 2016-2018 Ondrej Mosnacek <omosnacek@gmail.com>
7  * Copyright (C) 2017-2018 Red Hat, Inc. All rights reserved.
8  */
9
10 #include <crypto/internal/aead.h>
11 #include <crypto/internal/simd.h>
12 #include <crypto/morus640_glue.h>
13 #include <linux/module.h>
14 #include <asm/fpu/api.h>
15 #include <asm/cpu_device_id.h>
16
17 asmlinkage void crypto_morus640_sse2_init(void *state, const void *key,
18                                           const void *iv);
19 asmlinkage void crypto_morus640_sse2_ad(void *state, const void *data,
20                                         unsigned int length);
21
22 asmlinkage void crypto_morus640_sse2_enc(void *state, const void *src,
23                                          void *dst, unsigned int length);
24 asmlinkage void crypto_morus640_sse2_dec(void *state, const void *src,
25                                          void *dst, unsigned int length);
26
27 asmlinkage void crypto_morus640_sse2_enc_tail(void *state, const void *src,
28                                               void *dst, unsigned int length);
29 asmlinkage void crypto_morus640_sse2_dec_tail(void *state, const void *src,
30                                               void *dst, unsigned int length);
31
32 asmlinkage void crypto_morus640_sse2_final(void *state, void *tag_xor,
33                                            u64 assoclen, u64 cryptlen);
34
35 MORUS640_DECLARE_ALG(sse2, "morus640-sse2", 400);
36
37 static struct simd_aead_alg *simd_alg;
38
39 static int __init crypto_morus640_sse2_module_init(void)
40 {
41         if (!boot_cpu_has(X86_FEATURE_XMM2) ||
42             !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
43                 return -ENODEV;
44
45         return simd_register_aeads_compat(&crypto_morus640_sse2_alg, 1,
46                                           &simd_alg);
47 }
48
49 static void __exit crypto_morus640_sse2_module_exit(void)
50 {
51         simd_unregister_aeads(&crypto_morus640_sse2_alg, 1, &simd_alg);
52 }
53
54 module_init(crypto_morus640_sse2_module_init);
55 module_exit(crypto_morus640_sse2_module_exit);
56
57 MODULE_LICENSE("GPL");
58 MODULE_AUTHOR("Ondrej Mosnacek <omosnacek@gmail.com>");
59 MODULE_DESCRIPTION("MORUS-640 AEAD algorithm -- SSE2 implementation");
60 MODULE_ALIAS_CRYPTO("morus640");
61 MODULE_ALIAS_CRYPTO("morus640-sse2");