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 #define ATAP_HEX_UUID_LEN 32 13 #define ATTEST_DH_SIZE 8 14 #define ATTEST_UUID_SIZE (ATAP_HEX_UUID_LEN+1) 15 #define ATTEST_CA_OUT_SIZE 256 16 17 void test_optee(void); 18 uint32_t trusty_read_rollback_index(uint32_t slot, uint64_t *value); 19 uint32_t trusty_write_rollback_index(uint32_t slot, uint64_t value); 20 uint32_t trusty_read_permanent_attributes(uint8_t *attributes, uint32_t size); 21 uint32_t trusty_write_permanent_attributes(uint8_t *attributes, uint32_t size); 22 uint32_t trusty_read_lock_state(uint8_t *lock_state); 23 uint32_t trusty_write_lock_state(uint8_t lock_state); 24 uint32_t trusty_read_flash_lock_state(uint8_t *flash_lock_state); 25 uint32_t trusty_write_flash_lock_state(uint8_t flash_lock_state); 26 27 /* 28 * read data from rk_keymaster 29 * 30 * @filename: the filename of the saved data to read 31 * @filename_size: size of filename 32 * @data: the buffer used to read data from rk_keymaster 33 * @data_size: buffer size of the data 34 * 35 * @return a positive number in case of error, or 0 on success. 36 */ 37 TEEC_Result read_from_keymaster 38 (uint8_t *filename, uint32_t filename_size, 39 uint8_t *data, uint32_t data_size); 40 uint32_t write_to_keymaster 41 (uint8_t *filename, uint32_t filename_size, 42 uint8_t *data, uint32_t data_size); 43 uint32_t trusty_read_attribute_hash(uint32_t *buf, uint32_t length); 44 uint32_t trusty_write_attribute_hash(uint32_t *buf, uint32_t length); 45 uint32_t trusty_notify_optee_uboot_end(void); 46 uint32_t trusty_read_vbootkey_hash(uint32_t *buf, uint32_t length); 47 uint32_t trusty_write_vbootkey_hash(uint32_t *buf, uint32_t length); 48 uint32_t trusty_read_vbootkey_enable_flag(uint8_t *flag); 49 uint32_t trusty_read_permanent_attributes_flag(uint8_t *attributes); 50 uint32_t trusty_write_permanent_attributes_flag(uint8_t attributes); 51 uint32_t trusty_attest_dh(uint8_t *dh, uint32_t *dh_size); 52 uint32_t trusty_attest_uuid(uint8_t *uuid, uint32_t *uuid_size); 53 uint32_t trusty_attest_get_ca 54 (uint8_t *operation_start, uint32_t *operation_size, 55 uint8_t *out, uint32_t *out_len); 56 uint32_t trusty_attest_set_ca(uint8_t *ca_response, uint32_t *ca_response_size); 57 58 /* 59 * read oem unlock status from rk_keymaster 60 * 61 * @unlock:used to read oem unlock status code,0:locked,1:unlocked 62 * 63 * @return a positive number in case of error, or 0 on success. 64 */ 65 TEEC_Result trusty_read_oem_unlock(uint8_t *unlock); 66 67 /* 68 * update oem unlock status to rk_keymaster 69 * 70 * @unlock: oem unlock status code,0:locked,1:unlocked 71 * 72 * @return a positive number in case of error, or 0 on success. 73 */ 74 TEEC_Result trusty_write_oem_unlock(uint8_t unlock); 75 76 #endif 77