xref: /OK3568_Linux_fs/u-boot/include/keymaster.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
4  */
5 
6 #ifndef KEYMASTER_H_
7 #define KEYMASTER_H_
8 
9 #include <optee_include/tee_client_api.h>
10 
11 /*
12  * read data from rk_keymaster
13  *
14  * @felename:           the filename of the saved data to read
15  * @filename_size:      size of filename
16  * @data:               the buffer used to read data from rk_keymaster
17  * @data_size:          buffer size of the data
18  *
19  * @return a positive number in case of error, or 0 on success.
20  */
21 TEEC_Result read_from_keymaster(uint8_t *filename,
22 				uint32_t filename_size,
23 				uint8_t *data,
24 				uint32_t data_size);
25 
26 /*
27  * write data to rk_keymaster
28  *
29  * @felename:           the filename of the saved data to read
30  * @filename_size:      size of filename
31  * @data:               the buffer used to read data from rk_keymaster
32  * @data_size:          buffer size of the data
33  *
34  * @return a positive number in case of error, or 0 on success.
35  */
36 TEEC_Result write_to_keymaster(uint8_t *filename,
37 			       uint32_t filename_size,
38 			       uint8_t *data,
39 			       uint32_t data_size);
40 
41 /*
42  * read oem unlock status from rk_keymaster
43  *
44  * @unlock:used to read oem unlock status code,0:locked,1:unlocked
45  *
46  * @return a positive number in case of error, or 0 on success.
47  */
48 TEEC_Result trusty_read_oem_unlock(uint8_t *unlock);
49 
50 /*
51  * update oem unlock status to rk_keymaster
52  *
53  * @unlock: oem unlock status code,0:locked,1:unlocked
54  *
55  * @return a positive number in case of error, or 0 on success.
56  */
57 TEEC_Result trusty_write_oem_unlock(uint8_t unlock);
58 
59 #endif  //KEYMASTER_H_
60