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 <kernel/tee_ta_manager.h> 10 #include <sys/queue.h> 11 #include <tee_api_types.h> 12 #include <types_ext.h> 13 14 #define TEE_USAGE_DEFAULT 0xffffffff 15 16 struct tee_obj { 17 TAILQ_ENTRY(tee_obj) link; 18 TEE_ObjectInfo info; 19 bool busy; /* true if used by an operation */ 20 uint32_t have_attrs; /* bitfield identifying set properties */ 21 void *attr; 22 size_t ds_pos; 23 struct tee_pobj *pobj; /* ptr to persistant object */ 24 struct tee_file_handle *fh; 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, vaddr_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