1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2014, STMicroelectronics International N.V. 4 */ 5 6 #ifndef TEE_OBJ_H 7 #define TEE_OBJ_H 8 9 #include <tee_api_types.h> 10 #include <kernel/tee_ta_manager.h> 11 #include <sys/queue.h> 12 13 #define TEE_USAGE_DEFAULT 0xffffffff 14 15 struct tee_obj { 16 TAILQ_ENTRY(tee_obj) link; 17 TEE_ObjectInfo info; 18 bool busy; /* true if used by an operation */ 19 uint32_t have_attrs; /* bitfield identifying set properties */ 20 void *attr; 21 size_t ds_pos; 22 struct tee_pobj *pobj; /* ptr to persistant object */ 23 struct tee_file_handle *fh; 24 uint32_t flags; /* permission flags for persistent objects */ 25 }; 26 27 void tee_obj_add(struct user_ta_ctx *utc, struct tee_obj *o); 28 29 TEE_Result tee_obj_get(struct user_ta_ctx *utc, uint32_t obj_id, 30 struct tee_obj **obj); 31 32 void tee_obj_close(struct user_ta_ctx *utc, struct tee_obj *o); 33 34 void tee_obj_close_all(struct user_ta_ctx *utc); 35 36 TEE_Result tee_obj_verify(struct tee_ta_session *sess, struct tee_obj *o); 37 38 struct tee_obj *tee_obj_alloc(void); 39 void tee_obj_free(struct tee_obj *o); 40 41 #endif 42