Linux 4.18.10
[linux/fpc-iii.git] / arch / x86 / crypto / morus640-sse2-glue.c
blob615fb7bc9a323d949d038a8496125eab0c4bc4ba
1 /*
2 * The MORUS-640 Authenticated-Encryption Algorithm
3 * Glue for SSE2 implementation
5 * Copyright (c) 2016-2018 Ondrej Mosnacek <omosnacek@gmail.com>
6 * Copyright (C) 2017-2018 Red Hat, Inc. All rights reserved.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
14 #include <crypto/internal/aead.h>
15 #include <crypto/morus640_glue.h>
16 #include <linux/module.h>
17 #include <asm/fpu/api.h>
18 #include <asm/cpu_device_id.h>
20 asmlinkage void crypto_morus640_sse2_init(void *state, const void *key,
21 const void *iv);
22 asmlinkage void crypto_morus640_sse2_ad(void *state, const void *data,
23 unsigned int length);
25 asmlinkage void crypto_morus640_sse2_enc(void *state, const void *src,
26 void *dst, unsigned int length);
27 asmlinkage void crypto_morus640_sse2_dec(void *state, const void *src,
28 void *dst, unsigned int length);
30 asmlinkage void crypto_morus640_sse2_enc_tail(void *state, const void *src,
31 void *dst, unsigned int length);
32 asmlinkage void crypto_morus640_sse2_dec_tail(void *state, const void *src,
33 void *dst, unsigned int length);
35 asmlinkage void crypto_morus640_sse2_final(void *state, void *tag_xor,
36 u64 assoclen, u64 cryptlen);
38 MORUS640_DECLARE_ALGS(sse2, "morus640-sse2", 400);
40 static int __init crypto_morus640_sse2_module_init(void)
42 if (!boot_cpu_has(X86_FEATURE_XMM2) ||
43 !boot_cpu_has(X86_FEATURE_OSXSAVE) ||
44 !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
45 return -ENODEV;
47 return crypto_register_aeads(crypto_morus640_sse2_algs,
48 ARRAY_SIZE(crypto_morus640_sse2_algs));
51 static void __exit crypto_morus640_sse2_module_exit(void)
53 crypto_unregister_aeads(crypto_morus640_sse2_algs,
54 ARRAY_SIZE(crypto_morus640_sse2_algs));
57 module_init(crypto_morus640_sse2_module_init);
58 module_exit(crypto_morus640_sse2_module_exit);
60 MODULE_LICENSE("GPL");
61 MODULE_AUTHOR("Ondrej Mosnacek <omosnacek@gmail.com>");
62 MODULE_DESCRIPTION("MORUS-640 AEAD algorithm -- SSE2 implementation");
63 MODULE_ALIAS_CRYPTO("morus640");
64 MODULE_ALIAS_CRYPTO("morus640-sse2");