xref: /rk3399_rockchip-uboot/include/optee_include/OpteeClientInterface.h (revision eb6fc1c20bb3c2177dc69cd048b7996242b0f6d3)
1 /*
2  * Copyright 2017, Rockchip Electronics Co., Ltd
3  * hisping lin, <hisping.lin@rock-chips.com>
4  *
5  * SPDX-License-Identifier:	GPL-2.0+
6  */
7 #ifndef _OPTEECLIENTTEST_H_
8 #define _OPTEECLIENTTEST_H_
9 
10 #include <optee_include/tee_client_api.h>
11 
12 enum RK_OEM_HR_OTP_KEYID {
13 	RK_OEM_HR_OTP_KEY0 = 0,		/* keyladder key0 */
14 	RK_OEM_HR_OTP_KEY1 = 1,		/* keyladder key1 */
15 	RK_OEM_HR_OTP_KEY2 = 2,		/* keyladder key2 */
16 	RK_OEM_HR_OTP_KEY3 = 3,		/* keyladder key3 */
17 	RK_OEM_HR_OTP_KEYMAX
18 };
19 
20 #define ATAP_HEX_UUID_LEN 32
21 #define ATTEST_DH_SIZE     8
22 #define ATTEST_UUID_SIZE     (ATAP_HEX_UUID_LEN+1)
23 #define ATTEST_CA_OUT_SIZE     256
24 
25 uint32_t trusty_read_rollback_index(uint32_t slot, uint64_t *value);
26 uint32_t trusty_write_rollback_index(uint32_t slot, uint64_t value);
27 uint32_t trusty_read_permanent_attributes(uint8_t *attributes, uint32_t size);
28 uint32_t trusty_write_permanent_attributes(uint8_t *attributes, uint32_t size);
29 uint32_t trusty_read_permanent_attributes_cer(uint8_t *attributes,
30 					      uint32_t size);
31 uint32_t trusty_write_permanent_attributes_cer(uint8_t *attributes,
32 					       uint32_t size);
33 uint32_t trusty_read_lock_state(uint8_t *lock_state);
34 uint32_t trusty_write_lock_state(uint8_t lock_state);
35 uint32_t trusty_read_flash_lock_state(uint8_t *flash_lock_state);
36 uint32_t trusty_write_flash_lock_state(uint8_t flash_lock_state);
37 
38 uint32_t trusty_read_attribute_hash(uint32_t *buf, uint32_t length);
39 uint32_t trusty_write_attribute_hash(uint32_t *buf, uint32_t length);
40 uint32_t trusty_notify_optee_uboot_end(void);
41 uint32_t trusty_read_vbootkey_hash(uint32_t *buf, uint32_t length);
42 uint32_t trusty_write_vbootkey_hash(uint32_t *buf, uint32_t length);
43 uint32_t trusty_read_vbootkey_enable_flag(uint8_t *flag);
44 uint32_t trusty_write_ta_encryption_key(uint32_t *buf, uint32_t length);
45 uint32_t trusty_check_security_level_flag(uint8_t flag);
46 uint32_t trusty_write_oem_huk(uint32_t *buf, uint32_t length);
47 void trusty_select_security_level(void);
48 uint32_t trusty_read_permanent_attributes_flag(uint8_t *attributes);
49 uint32_t trusty_write_permanent_attributes_flag(uint8_t attributes);
50 uint32_t trusty_write_oem_ns_otp(uint32_t byte_off, uint8_t *byte_buf, uint32_t byte_len);
51 uint32_t trusty_read_oem_ns_otp(uint32_t byte_off, uint8_t *byte_buf, uint32_t byte_len);
52 uint32_t trusty_write_oem_hr_otp(enum RK_OEM_HR_OTP_KEYID key_id,
53 				 uint8_t *byte_buf, uint32_t byte_len);
54 uint32_t trusty_set_oem_hr_otp_read_lock(enum RK_OEM_HR_OTP_KEYID key_id);
55 uint32_t trusty_attest_dh(uint8_t *dh, uint32_t *dh_size);
56 uint32_t trusty_attest_uuid(uint8_t *uuid, uint32_t *uuid_size);
57 uint32_t trusty_attest_get_ca
58 	(uint8_t *operation_start, uint32_t *operation_size,
59 	 uint8_t *out, uint32_t *out_len);
60 uint32_t trusty_attest_set_ca(uint8_t *ca_response, uint32_t *ca_response_size);
61 
62 #endif
63