aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/aegis128-neon.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2019-07-03 04:55:11 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2019-07-26 01:03:58 -0400
commitecc8bc81f2fb3976737ef312f824ba6053aa3590 (patch)
tree74e2a1c6355d5c46500f9de32c5ddebeed628d5e /crypto/aegis128-neon.c
parent7cdc0ddbf74a19cecb2f0e9efa2cae9d3c665189 (diff)
crypto: aegis128 - provide a SIMD implementation based on NEON intrinsics
Provide an accelerated implementation of aegis128 by wiring up the SIMD hooks in the generic driver to an implementation based on NEON intrinsics, which can be compiled to both ARM and arm64 code. This results in a performance of 2.2 cycles per byte on Cortex-A53, which is a performance increase of ~11x compared to the generic code. Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/aegis128-neon.c')
-rw-r--r--crypto/aegis128-neon.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/crypto/aegis128-neon.c b/crypto/aegis128-neon.c
new file mode 100644
index 000000000000..c1c0a1686f67
--- /dev/null
+++ b/crypto/aegis128-neon.c
@@ -0,0 +1,43 @@
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) 2019 Linaro Ltd <ard.biesheuvel@linaro.org>
4 */
5
6#include <asm/cpufeature.h>
7#include <asm/neon.h>
8
9#include "aegis.h"
10
11void crypto_aegis128_update_neon(void *state, const void *msg);
12void crypto_aegis128_encrypt_chunk_neon(void *state, void *dst, const void *src,
13 unsigned int size);
14void crypto_aegis128_decrypt_chunk_neon(void *state, void *dst, const void *src,
15 unsigned int size);
16
17bool crypto_aegis128_have_simd(void)
18{
19 return cpu_have_feature(cpu_feature(AES));
20}
21
22void crypto_aegis128_update_simd(union aegis_block *state, const void *msg)
23{
24 kernel_neon_begin();
25 crypto_aegis128_update_neon(state, msg);
26 kernel_neon_end();
27}
28
29void crypto_aegis128_encrypt_chunk_simd(union aegis_block *state, u8 *dst,
30 const u8 *src, unsigned int size)
31{
32 kernel_neon_begin();
33 crypto_aegis128_encrypt_chunk_neon(state, dst, src, size);
34 kernel_neon_end();
35}
36
37void crypto_aegis128_decrypt_chunk_simd(union aegis_block *state, u8 *dst,
38 const u8 *src, unsigned int size)
39{
40 kernel_neon_begin();
41 crypto_aegis128_decrypt_chunk_neon(state, dst, src, size);
42 kernel_neon_end();
43}