Lines Matching refs:obj

59 uint32_t pkcs11_object2handle(struct pkcs11_object *obj,  in pkcs11_object2handle()  argument
62 return handle_lookup_handle(get_object_handle_db(session), obj); in pkcs11_object2handle()
83 static void cleanup_volatile_obj_ref(struct pkcs11_object *obj) in cleanup_volatile_obj_ref() argument
85 if (!obj) in cleanup_volatile_obj_ref()
88 LIST_REMOVE(obj, link); in cleanup_volatile_obj_ref()
90 if (obj->key_handle != TEE_HANDLE_NULL) in cleanup_volatile_obj_ref()
91 TEE_FreeTransientObject(obj->key_handle); in cleanup_volatile_obj_ref()
93 if (obj->attribs_hdl != TEE_HANDLE_NULL) in cleanup_volatile_obj_ref()
94 TEE_CloseObject(obj->attribs_hdl); in cleanup_volatile_obj_ref()
96 TEE_Free(obj->attributes); in cleanup_volatile_obj_ref()
97 TEE_Free(obj->uuid); in cleanup_volatile_obj_ref()
98 TEE_Free(obj); in cleanup_volatile_obj_ref()
102 void cleanup_persistent_object(struct pkcs11_object *obj, in cleanup_persistent_object() argument
107 if (!obj) in cleanup_persistent_object()
111 if (obj->attribs_hdl != TEE_HANDLE_NULL) in cleanup_persistent_object()
112 TEE_CloseObject(obj->attribs_hdl); in cleanup_persistent_object()
115 obj->uuid, sizeof(TEE_UUID), in cleanup_persistent_object()
117 &obj->attribs_hdl); in cleanup_persistent_object()
119 TEE_CloseAndDeletePersistentObject1(obj->attribs_hdl); in cleanup_persistent_object()
121 obj->attribs_hdl = TEE_HANDLE_NULL; in cleanup_persistent_object()
122 destroy_object_uuid(token, obj); in cleanup_persistent_object()
124 cleanup_volatile_obj_ref(obj); in cleanup_persistent_object()
134 void destroy_object(struct pkcs11_session *session, struct pkcs11_object *obj, in destroy_object() argument
138 trace_attributes("[destroy]", obj->attributes); in destroy_object()
139 if (obj->uuid) in destroy_object()
140 MSG_RAW("[destroy] obj uuid %pUl", (void *)obj->uuid); in destroy_object()
146 pkcs11_object2handle(obj, session)); in destroy_object()
147 cleanup_volatile_obj_ref(obj); in destroy_object()
153 if (get_bool(obj->attributes, PKCS11_CKA_TOKEN)) { in destroy_object()
154 assert(obj->uuid); in destroy_object()
156 if (unregister_persistent_object(session->token, obj->uuid) && in destroy_object()
157 unregister_persistent_object(session->token, obj->uuid)) in destroy_object()
161 pkcs11_object2handle(obj, session)); in destroy_object()
162 cleanup_persistent_object(obj, session->token); in destroy_object()
164 token_invalidate_object_handles(obj); in destroy_object()
167 pkcs11_object2handle(obj, session)); in destroy_object()
168 cleanup_volatile_obj_ref(obj); in destroy_object()
175 struct pkcs11_object *obj = NULL; in create_obj_instance() local
177 obj = TEE_Malloc(sizeof(struct pkcs11_object), TEE_MALLOC_FILL_ZERO); in create_obj_instance()
178 if (!obj) in create_obj_instance()
181 obj->key_handle = TEE_HANDLE_NULL; in create_obj_instance()
182 obj->attribs_hdl = TEE_HANDLE_NULL; in create_obj_instance()
183 obj->attributes = head; in create_obj_instance()
184 obj->token = token; in create_obj_instance()
186 return obj; in create_obj_instance()
193 struct pkcs11_object *obj = create_obj_instance(head, token); in create_token_object() local
195 if (obj) in create_token_object()
196 obj->uuid = uuid; in create_token_object()
198 return obj; in create_token_object()
212 struct pkcs11_object *obj = NULL; in create_object() local
225 obj = create_obj_instance(head, NULL); in create_object()
226 if (!obj) in create_object()
229 LIST_INSERT_HEAD(&temporary_object_list, obj, link); in create_object()
232 obj_handle = handle_get(get_object_handle_db(session), obj); in create_object()
238 if (get_bool(obj->attributes, PKCS11_CKA_TOKEN)) { in create_object()
248 obj->attributes->attrs_size; in create_object()
253 rc = create_object_uuid(get_session_token(session), obj); in create_object()
258 obj->uuid, sizeof(TEE_UUID), in create_object()
261 obj->attributes, size, in create_object()
262 &obj->attribs_hdl); in create_object()
269 obj->uuid); in create_object()
273 TEE_CloseObject(obj->attribs_hdl); in create_object()
274 obj->attribs_hdl = TEE_HANDLE_NULL; in create_object()
277 LIST_REMOVE(obj, link); in create_object()
278 LIST_INSERT_HEAD(&session->token->object_list, obj, link); in create_object()
281 LIST_REMOVE(obj, link); in create_object()
282 LIST_INSERT_HEAD(get_session_objects(session), obj, link); in create_object()
290 obj->attributes = NULL; in create_object()
293 cleanup_persistent_object(obj, session->token); in create_object()
295 cleanup_volatile_obj_ref(obj); in create_object()
509 struct pkcs11_object *obj = NULL; in entry_find_objects_init() local
583 LIST_FOREACH(obj, &sess->object_list, link) { in entry_find_objects_init()
589 if (obj->token) in entry_find_objects_init()
592 if (!attributes_match_reference(obj->attributes, in entry_find_objects_init()
597 pkcs11_object2handle(obj, session)); in entry_find_objects_init()
606 LIST_FOREACH(obj, &session->token->object_list, link) { in entry_find_objects_init()
610 if (!obj->attributes) { in entry_find_objects_init()
611 rc = load_persistent_object_attributes(obj); in entry_find_objects_init()
620 if (!obj->attributes || in entry_find_objects_init()
622 obj->attributes) || in entry_find_objects_init()
623 !attributes_match_reference(obj->attributes, req_attrs)) { in entry_find_objects_init()
625 release_persistent_object_attributes(obj); in entry_find_objects_init()
631 handle = pkcs11_object2handle(obj, session); in entry_find_objects_init()
633 handle = handle_get(object_db, obj); in entry_find_objects_init()
760 struct pkcs11_object *obj = NULL; in entry_get_attribute_value() local
791 obj = pkcs11_handle2object(object_handle, session); in entry_get_attribute_value()
792 if (!obj) { in entry_get_attribute_value()
797 rc = check_access_attrs_against_token(session, obj->attributes); in entry_get_attribute_value()
857 if (!attribute_is_exportable(&cli_head, obj)) { in entry_get_attribute_value()
872 rc = get_attribute(obj->attributes, cli_head.id, data_ptr, in entry_get_attribute_value()
939 struct pkcs11_object *obj = NULL; in entry_get_object_size() local
958 obj = pkcs11_handle2object(object_handle, session); in entry_get_object_size()
959 if (!obj) in entry_get_object_size()
962 rc = check_access_attrs_against_token(session, obj->attributes); in entry_get_object_size()
969 obj_size = ((struct obj_attrs *)obj->attributes)->attrs_size + in entry_get_object_size()
989 struct pkcs11_object *obj = NULL; in entry_set_attribute_value() local
1018 obj = pkcs11_handle2object(object_handle, session); in entry_set_attribute_value()
1019 if (!obj) { in entry_set_attribute_value()
1025 if (object_is_token(obj->attributes) && in entry_set_attribute_value()
1035 rc = check_access_attrs_against_token(session, obj->attributes); in entry_set_attribute_value()
1042 if (!object_is_modifiable(obj->attributes)) { in entry_set_attribute_value()
1062 rc = check_attrs_against_modification(session, head, obj, function); in entry_set_attribute_value()
1067 template_size = sizeof(*obj->attributes) + obj->attributes->attrs_size; in entry_set_attribute_value()
1074 TEE_MemMove(head_new, obj->attributes, template_size); in entry_set_attribute_value()
1090 head_old = obj->attributes; in entry_set_attribute_value()
1091 obj->attributes = head_new; in entry_set_attribute_value()
1094 if (get_bool(obj->attributes, PKCS11_CKA_TOKEN)) { in entry_set_attribute_value()
1095 rc = update_persistent_object_attributes(obj); in entry_set_attribute_value()
1097 TEE_Free(obj->attributes); in entry_set_attribute_value()
1098 obj->attributes = head_old; in entry_set_attribute_value()
1131 struct pkcs11_object *obj = NULL; in entry_copy_object() local
1160 obj = pkcs11_handle2object(object_handle, session); in entry_copy_object()
1161 if (!obj) { in entry_copy_object()
1167 if (object_is_token(obj->attributes) && in entry_copy_object()
1177 rc = check_access_attrs_against_token(session, obj->attributes); in entry_copy_object()
1184 if (!object_is_copyable(obj->attributes)) { in entry_copy_object()
1204 rc = check_attrs_against_modification(session, head, obj, function); in entry_copy_object()
1208 class = get_class(obj->attributes); in entry_copy_object()
1235 template_size = sizeof(*obj->attributes) + obj->attributes->attrs_size; in entry_copy_object()
1242 TEE_MemMove(head_new, obj->attributes, template_size); in entry_copy_object()