Blame view
crypto/aegis128-neon.c
2.04 KB
a4397635a crypto: aegis128 ... |
1 2 3 4 5 6 7 8 9 |
// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2019 Linaro Ltd <ard.biesheuvel@linaro.org> */ #include <asm/cpufeature.h> #include <asm/neon.h> #include "aegis.h" |
528282630 crypto: aegis128 ... |
10 |
void crypto_aegis128_init_neon(void *state, const void *key, const void *iv); |
a4397635a crypto: aegis128 ... |
11 12 13 14 15 |
void crypto_aegis128_update_neon(void *state, const void *msg); void crypto_aegis128_encrypt_chunk_neon(void *state, void *dst, const void *src, unsigned int size); void crypto_aegis128_decrypt_chunk_neon(void *state, void *dst, const void *src, unsigned int size); |
97b70180b crypto: aegis128/... |
16 17 18 19 |
int crypto_aegis128_final_neon(void *state, void *tag_xor, unsigned int assoclen, unsigned int cryptlen, unsigned int authsize); |
a4397635a crypto: aegis128 ... |
20 |
|
198429631 crypto: arm64/aeg... |
21 |
int aegis128_have_aes_insn __ro_after_init; |
a4397635a crypto: aegis128 ... |
22 23 |
bool crypto_aegis128_have_simd(void) { |
198429631 crypto: arm64/aeg... |
24 25 26 27 28 |
if (cpu_have_feature(cpu_feature(AES))) { aegis128_have_aes_insn = 1; return true; } return IS_ENABLED(CONFIG_ARM64); |
a4397635a crypto: aegis128 ... |
29 |
} |
091499974 crypto: aegis128 ... |
30 |
void crypto_aegis128_init_simd(struct aegis_state *state, |
528282630 crypto: aegis128 ... |
31 32 33 34 35 36 37 |
const union aegis_block *key, const u8 *iv) { kernel_neon_begin(); crypto_aegis128_init_neon(state, key, iv); kernel_neon_end(); } |
091499974 crypto: aegis128 ... |
38 |
void crypto_aegis128_update_simd(struct aegis_state *state, const void *msg) |
a4397635a crypto: aegis128 ... |
39 40 41 42 43 |
{ kernel_neon_begin(); crypto_aegis128_update_neon(state, msg); kernel_neon_end(); } |
091499974 crypto: aegis128 ... |
44 |
void crypto_aegis128_encrypt_chunk_simd(struct aegis_state *state, u8 *dst, |
a4397635a crypto: aegis128 ... |
45 46 47 48 49 50 |
const u8 *src, unsigned int size) { kernel_neon_begin(); crypto_aegis128_encrypt_chunk_neon(state, dst, src, size); kernel_neon_end(); } |
091499974 crypto: aegis128 ... |
51 |
void crypto_aegis128_decrypt_chunk_simd(struct aegis_state *state, u8 *dst, |
a4397635a crypto: aegis128 ... |
52 53 54 55 56 57 |
const u8 *src, unsigned int size) { kernel_neon_begin(); crypto_aegis128_decrypt_chunk_neon(state, dst, src, size); kernel_neon_end(); } |
528282630 crypto: aegis128 ... |
58 |
|
091499974 crypto: aegis128 ... |
59 |
int crypto_aegis128_final_simd(struct aegis_state *state, |
97b70180b crypto: aegis128/... |
60 61 62 63 |
union aegis_block *tag_xor, unsigned int assoclen, unsigned int cryptlen, unsigned int authsize) |
528282630 crypto: aegis128 ... |
64 |
{ |
97b70180b crypto: aegis128/... |
65 |
int ret; |
528282630 crypto: aegis128 ... |
66 |
kernel_neon_begin(); |
97b70180b crypto: aegis128/... |
67 68 |
ret = crypto_aegis128_final_neon(state, tag_xor, assoclen, cryptlen, authsize); |
528282630 crypto: aegis128 ... |
69 |
kernel_neon_end(); |
97b70180b crypto: aegis128/... |
70 71 |
return ret; |
528282630 crypto: aegis128 ... |
72 |
} |