Skip to content

Commit

Permalink
Introduce p11prov_obj_refresh_invalid
Browse files Browse the repository at this point in the history
This is useful for refreshing invalid object handles
  • Loading branch information
bukka committed Dec 27, 2024
1 parent a54521b commit 945f3fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,17 @@ static void p11prov_obj_refresh(P11PROV_OBJ *obj)
p11prov_return_session(session);
}

CK_RV p11prov_obj_refresh_invalid(P11PROV_OBJ *obj)
{
obj->handle = CK_INVALID_HANDLE;
obj->cached = CK_INVALID_HANDLE;
p11prov_obj_refresh(obj);
if (obj->handle == CK_INVALID_HANDLE) {
return CKR_OBJECT_HANDLE_INVALID;
}
return CKR_OK;
}

#define SECRET_KEY_ATTRS 2
P11PROV_OBJ *p11prov_create_secret_key(P11PROV_CTX *provctx,
P11PROV_SESSION *session,
Expand Down
1 change: 1 addition & 0 deletions src/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ CK_RV p11prov_obj_from_handle(P11PROV_CTX *ctx, P11PROV_SESSION *session,
CK_RV p11prov_obj_find(P11PROV_CTX *provctx, P11PROV_SESSION *session,
CK_SLOT_ID slotid, P11PROV_URI *uri,
store_obj_callback cb, void *cb_ctx);
CK_RV p11prov_obj_refresh_invalid(P11PROV_OBJ *obj);
P11PROV_OBJ *p11prov_create_secret_key(P11PROV_CTX *provctx,
P11PROV_SESSION *session,
bool session_key, unsigned char *secret,
Expand Down

0 comments on commit 945f3fb

Please sign in to comment.