1 /* 2 * Copyright (c) 2017, Linaro Limited 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7 #ifndef __TEE_TADB_H 8 #define __TEE_TADB_H 9 10 #include <tee/tee_fs.h> 11 12 struct tee_tadb_ta_write; 13 struct tee_tadb_ta_read; 14 15 /* 16 * struct tee_tadb_property 17 * @uuid: UUID of Trusted Application (TA) or Security Domain (SD) 18 * @version: Version of TA or SD 19 * @custom_size:Size of customized properties, prepended to the encrypted 20 * TA binary 21 * @bin_size: Size of the binary TA 22 */ 23 struct tee_tadb_property { 24 TEE_UUID uuid; 25 uint32_t version; 26 uint32_t custom_size; 27 uint32_t bin_size; 28 }; 29 30 struct tee_fs_rpc_operation; 31 32 struct tee_tadb_file_operations { 33 TEE_Result (*open)(uint32_t file_number, int *fd); 34 TEE_Result (*create)(uint32_t file_number, int *fd); 35 void (*close)(int fd); 36 TEE_Result (*remove)(uint32_t file_number); 37 38 TEE_Result (*read_init)(struct tee_fs_rpc_operation *op, int fd, 39 size_t pos, uint8_t **data, size_t bytes); 40 TEE_Result (*read_final)(struct tee_fs_rpc_operation *op, 41 size_t *bytes); 42 43 TEE_Result (*write_init)(struct tee_fs_rpc_operation *op, int fd, 44 size_t pos, uint8_t **data, size_t len); 45 TEE_Result (*write_final)(struct tee_fs_rpc_operation *op); 46 }; 47 48 TEE_Result tee_tadb_ta_create(const struct tee_tadb_property *property, 49 struct tee_tadb_ta_write **ta); 50 TEE_Result tee_tadb_ta_write(struct tee_tadb_ta_write *ta, const void *buf, 51 size_t len); 52 void tee_tadb_ta_close_and_delete(struct tee_tadb_ta_write *ta); 53 TEE_Result tee_tadb_ta_close_and_commit(struct tee_tadb_ta_write *ta); 54 55 TEE_Result tee_tadb_ta_delete(const TEE_UUID *uuid); 56 57 TEE_Result tee_tadb_ta_open(const TEE_UUID *uuid, struct tee_tadb_ta_read **ta); 58 const struct tee_tadb_property * 59 tee_tadb_ta_get_property(struct tee_tadb_ta_read *ta); 60 TEE_Result tee_tadb_ta_read(struct tee_tadb_ta_read *ta, void *buf, 61 size_t *len); 62 void tee_tadb_ta_close(struct tee_tadb_ta_read *ta); 63 64 65 #endif /*__TEE_TADB_H*/ 66