Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-block.git] / arch / x86 / crypto / morus1280-sse2-glue.c
CommitLineData
6ecc9d9f
OM
1/*
2 * The MORUS-1280 Authenticated-Encryption Algorithm
3 * Glue for SSE2 implementation
4 *
5 * Copyright (c) 2016-2018 Ondrej Mosnacek <omosnacek@gmail.com>
6 * Copyright (C) 2017-2018 Red Hat, Inc. All rights reserved.
7 *
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.
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_sse2_init(void *state, const void *key,
21 const void *iv);
22asmlinkage void crypto_morus1280_sse2_ad(void *state, const void *data,
23 unsigned int length);
24
25asmlinkage void crypto_morus1280_sse2_enc(void *state, const void *src,
26 void *dst, unsigned int length);
27asmlinkage void crypto_morus1280_sse2_dec(void *state, const void *src,
28 void *dst, unsigned int length);
29
30asmlinkage void crypto_morus1280_sse2_enc_tail(void *state, const void *src,
31 void *dst, unsigned int length);
32asmlinkage void crypto_morus1280_sse2_dec_tail(void *state, const void *src,
33 void *dst, unsigned int length);
34
35asmlinkage void crypto_morus1280_sse2_final(void *state, void *tag_xor,
36 u64 assoclen, u64 cryptlen);
37
38MORUS1280_DECLARE_ALGS(sse2, "morus1280-sse2", 350);
39
6ecc9d9f
OM
40static int __init crypto_morus1280_sse2_module_init(void)
41{
877ccce7 42 if (!boot_cpu_has(X86_FEATURE_XMM2) ||
877ccce7 43 !cpu_has_xfeatures(XFEATURE_MASK_SSE, NULL))
6ecc9d9f
OM
44 return -ENODEV;
45
46 return crypto_register_aeads(crypto_morus1280_sse2_algs,
47 ARRAY_SIZE(crypto_morus1280_sse2_algs));
48}
49
50static void __exit crypto_morus1280_sse2_module_exit(void)
51{
52 crypto_unregister_aeads(crypto_morus1280_sse2_algs,
53 ARRAY_SIZE(crypto_morus1280_sse2_algs));
54}
55
56module_init(crypto_morus1280_sse2_module_init);
57module_exit(crypto_morus1280_sse2_module_exit);
58
59MODULE_LICENSE("GPL");
60MODULE_AUTHOR("Ondrej Mosnacek <omosnacek@gmail.com>");
61MODULE_DESCRIPTION("MORUS-1280 AEAD algorithm -- SSE2 implementation");
62MODULE_ALIAS_CRYPTO("morus1280");
63MODULE_ALIAS_CRYPTO("morus1280-sse2");