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()
165 pkcs11_object2handle(obj, session)); in destroy_object()
166 cleanup_volatile_obj_ref(obj); in destroy_object()
173 struct pkcs11_object *obj = NULL; in create_obj_instance() local
175 obj = TEE_Malloc(sizeof(struct pkcs11_object), TEE_MALLOC_FILL_ZERO); in create_obj_instance()
176 if (!obj) in create_obj_instance()
179 obj->key_handle = TEE_HANDLE_NULL; in create_obj_instance()
180 obj->attribs_hdl = TEE_HANDLE_NULL; in create_obj_instance()
181 obj->attributes = head; in create_obj_instance()
182 obj->token = token; in create_obj_instance()
184 return obj; in create_obj_instance()
191 struct pkcs11_object *obj = create_obj_instance(head, token); in create_token_object() local
193 if (obj) in create_token_object()
194 obj->uuid = uuid; in create_token_object()
196 return obj; in create_token_object()
210 struct pkcs11_object *obj = NULL; in create_object() local
223 obj = create_obj_instance(head, NULL); in create_object()
224 if (!obj) in create_object()
227 LIST_INSERT_HEAD(&temporary_object_list, obj, link); in create_object()
230 obj_handle = handle_get(get_object_handle_db(session), obj); in create_object()
236 if (get_bool(obj->attributes, PKCS11_CKA_TOKEN)) { in create_object()
246 obj->attributes->attrs_size; in create_object()
251 rc = create_object_uuid(get_session_token(session), obj); in create_object()
256 obj->uuid, sizeof(TEE_UUID), in create_object()
259 obj->attributes, size, in create_object()
260 &obj->attribs_hdl); in create_object()
267 obj->uuid); in create_object()
271 TEE_CloseObject(obj->attribs_hdl); in create_object()
272 obj->attribs_hdl = TEE_HANDLE_NULL; in create_object()
275 LIST_REMOVE(obj, link); in create_object()
276 LIST_INSERT_HEAD(&session->token->object_list, obj, link); in create_object()
279 LIST_REMOVE(obj, link); in create_object()
280 LIST_INSERT_HEAD(get_session_objects(session), obj, link); in create_object()
288 obj->attributes = NULL; in create_object()
291 cleanup_persistent_object(obj, session->token); in create_object()
293 cleanup_volatile_obj_ref(obj); in create_object()
502 struct pkcs11_object *obj = NULL; in entry_find_objects_init() local
576 LIST_FOREACH(obj, &sess->object_list, link) { in entry_find_objects_init()
582 if (obj->token) in entry_find_objects_init()
585 if (!attributes_match_reference(obj->attributes, in entry_find_objects_init()
590 pkcs11_object2handle(obj, session)); in entry_find_objects_init()
599 LIST_FOREACH(obj, &session->token->object_list, link) { in entry_find_objects_init()
603 if (!obj->attributes) { in entry_find_objects_init()
604 rc = load_persistent_object_attributes(obj); in entry_find_objects_init()
613 if (!obj->attributes || in entry_find_objects_init()
615 obj->attributes) || in entry_find_objects_init()
616 !attributes_match_reference(obj->attributes, req_attrs)) { in entry_find_objects_init()
618 release_persistent_object_attributes(obj); in entry_find_objects_init()
624 handle = pkcs11_object2handle(obj, session); in entry_find_objects_init()
626 handle = handle_get(object_db, obj); in entry_find_objects_init()
753 struct pkcs11_object *obj = NULL; in entry_get_attribute_value() local
784 obj = pkcs11_handle2object(object_handle, session); in entry_get_attribute_value()
785 if (!obj) { in entry_get_attribute_value()
790 rc = check_access_attrs_against_token(session, obj->attributes); in entry_get_attribute_value()
841 if (!attribute_is_exportable(&cli_head, obj)) { in entry_get_attribute_value()
856 rc = get_attribute(obj->attributes, cli_head.id, data_ptr, in entry_get_attribute_value()
923 struct pkcs11_object *obj = NULL; in entry_get_object_size() local
942 obj = pkcs11_handle2object(object_handle, session); in entry_get_object_size()
943 if (!obj) in entry_get_object_size()
946 rc = check_access_attrs_against_token(session, obj->attributes); in entry_get_object_size()
953 obj_size = ((struct obj_attrs *)obj->attributes)->attrs_size + in entry_get_object_size()
973 struct pkcs11_object *obj = NULL; in entry_set_attribute_value() local
1000 obj = pkcs11_handle2object(object_handle, session); in entry_set_attribute_value()
1001 if (!obj) { in entry_set_attribute_value()
1007 if (object_is_token(obj->attributes) && in entry_set_attribute_value()
1017 rc = check_access_attrs_against_token(session, obj->attributes); in entry_set_attribute_value()
1024 if (!object_is_modifiable(obj->attributes)) { in entry_set_attribute_value()
1044 rc = check_attrs_against_modification(session, head, obj, function); in entry_set_attribute_value()
1052 rc = modify_attributes_list(&obj->attributes, head); in entry_set_attribute_value()
1056 if (get_bool(obj->attributes, PKCS11_CKA_TOKEN)) { in entry_set_attribute_value()
1057 rc = update_persistent_object_attributes(obj); in entry_set_attribute_value()
1087 struct pkcs11_object *obj = NULL; in entry_copy_object() local
1116 obj = pkcs11_handle2object(object_handle, session); in entry_copy_object()
1117 if (!obj) { in entry_copy_object()
1123 if (object_is_token(obj->attributes) && in entry_copy_object()
1133 rc = check_access_attrs_against_token(session, obj->attributes); in entry_copy_object()
1140 if (!object_is_copyable(obj->attributes)) { in entry_copy_object()
1160 rc = check_attrs_against_modification(session, head, obj, function); in entry_copy_object()
1164 class = get_class(obj->attributes); in entry_copy_object()
1191 template_size = sizeof(*obj->attributes) + obj->attributes->attrs_size; in entry_copy_object()
1198 TEE_MemMove(head_new, obj->attributes, template_size); in entry_copy_object()