mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 10:01:39 -05:00
crypto: aegis128-neon - Move to more abstract 'ksimd' guard API
Move away from calling kernel_neon_begin() and kernel_neon_end() directly, and instead, use the newly introduced scoped_ksimd() API. This permits arm64 to modify the kernel mode NEON API without affecting code that is shared between ARM and arm64. Reviewed-by: Eric Biggers <ebiggers@kernel.org> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <asm/cpufeature.h>
|
#include <asm/cpufeature.h>
|
||||||
#include <asm/neon.h>
|
#include <asm/simd.h>
|
||||||
|
|
||||||
#include "aegis.h"
|
#include "aegis.h"
|
||||||
#include "aegis-neon.h"
|
#include "aegis-neon.h"
|
||||||
@@ -24,32 +24,28 @@ void crypto_aegis128_init_simd(struct aegis_state *state,
|
|||||||
const union aegis_block *key,
|
const union aegis_block *key,
|
||||||
const u8 *iv)
|
const u8 *iv)
|
||||||
{
|
{
|
||||||
kernel_neon_begin();
|
scoped_ksimd()
|
||||||
crypto_aegis128_init_neon(state, key, iv);
|
crypto_aegis128_init_neon(state, key, iv);
|
||||||
kernel_neon_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto_aegis128_update_simd(struct aegis_state *state, const void *msg)
|
void crypto_aegis128_update_simd(struct aegis_state *state, const void *msg)
|
||||||
{
|
{
|
||||||
kernel_neon_begin();
|
scoped_ksimd()
|
||||||
crypto_aegis128_update_neon(state, msg);
|
crypto_aegis128_update_neon(state, msg);
|
||||||
kernel_neon_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto_aegis128_encrypt_chunk_simd(struct aegis_state *state, u8 *dst,
|
void crypto_aegis128_encrypt_chunk_simd(struct aegis_state *state, u8 *dst,
|
||||||
const u8 *src, unsigned int size)
|
const u8 *src, unsigned int size)
|
||||||
{
|
{
|
||||||
kernel_neon_begin();
|
scoped_ksimd()
|
||||||
crypto_aegis128_encrypt_chunk_neon(state, dst, src, size);
|
crypto_aegis128_encrypt_chunk_neon(state, dst, src, size);
|
||||||
kernel_neon_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void crypto_aegis128_decrypt_chunk_simd(struct aegis_state *state, u8 *dst,
|
void crypto_aegis128_decrypt_chunk_simd(struct aegis_state *state, u8 *dst,
|
||||||
const u8 *src, unsigned int size)
|
const u8 *src, unsigned int size)
|
||||||
{
|
{
|
||||||
kernel_neon_begin();
|
scoped_ksimd()
|
||||||
crypto_aegis128_decrypt_chunk_neon(state, dst, src, size);
|
crypto_aegis128_decrypt_chunk_neon(state, dst, src, size);
|
||||||
kernel_neon_end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int crypto_aegis128_final_simd(struct aegis_state *state,
|
int crypto_aegis128_final_simd(struct aegis_state *state,
|
||||||
@@ -58,12 +54,7 @@ int crypto_aegis128_final_simd(struct aegis_state *state,
|
|||||||
unsigned int cryptlen,
|
unsigned int cryptlen,
|
||||||
unsigned int authsize)
|
unsigned int authsize)
|
||||||
{
|
{
|
||||||
int ret;
|
scoped_ksimd()
|
||||||
|
return crypto_aegis128_final_neon(state, tag_xor, assoclen,
|
||||||
kernel_neon_begin();
|
cryptlen, authsize);
|
||||||
ret = crypto_aegis128_final_neon(state, tag_xor, assoclen, cryptlen,
|
|
||||||
authsize);
|
|
||||||
kernel_neon_end();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user