xref: /optee_os/core/drivers/crypto/ele/include/ele.h (revision 06f66bf902321218cbc441af14110f7551c176b6)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright NXP 2025
4  */
5 
6 #ifndef __ELE_H_
7 #define __ELE_H_
8 
9 #include <drivers/imx_mu.h>
10 #include <tee_api_types.h>
11 #include <trace.h>
12 
13 /* Definitions for communication protocol */
14 #define ELE_VERSION_HSM 0x07
15 #define ELE_REQUEST_TAG 0x17
16 
size_msg(size_t cmd)17 static inline size_t size_msg(size_t cmd)
18 {
19 	size_t words = ROUNDUP(cmd, sizeof(uint32_t)) / sizeof(uint32_t);
20 
21 	/* Add the header size */
22 	words = words + 1;
23 
24 	return words;
25 }
26 
27 #define SIZE_MSG_32(_msg) size_msg(sizeof(_msg))
28 
29 /*
30  * The CRC is the last word of the message
31  *
32  * msg: MU message to hash
33  */
34 void update_crc(struct imx_mu_msg *msg);
35 
36 /*
37  * Initiate a communication with the EdgeLock Enclave. It sends a message
38  * and expects an answer.
39  *
40  * @msg MU message
41  */
42 TEE_Result imx_ele_call(struct imx_mu_msg *msg);
43 
44 #endif /* __ELE_H_ */
45