xref: /optee_os/core/arch/arm/crypto/sha3_armv8a_ce.c (revision bfedef0ce2d8851799a8b4075cf6a344ac159d27)
1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2023, Linaro Limited
4  */
5 
6 #include <crypto/crypto_accel.h>
7 #include <kernel/thread.h>
8 
9 /* Prototype for assembly function */
10 int sha3_ce_transform(uint64_t state[25], const void *src,
11 		      unsigned int block_count, unsigned int digest_size);
12 
crypto_accel_sha3_compress(uint64_t state[25],const void * src,unsigned int block_count,unsigned int digest_size)13 void crypto_accel_sha3_compress(uint64_t state[25], const void *src,
14 				unsigned int block_count,
15 				unsigned int digest_size)
16 {
17 	uint32_t vfp_state = 0;
18 	int res = 0;
19 
20 	vfp_state = thread_kernel_enable_vfp();
21 	res = sha3_ce_transform(state, src, block_count, digest_size);
22 	thread_kernel_disable_vfp(vfp_state);
23 	assert(!res);
24 }
25 
26