Skip to content

Commit

Permalink
C_CreateObject should not return CKR_SESSION_READ_ONLY when a RW sess…
Browse files Browse the repository at this point in the history
…ion is in use.

Signed-off-by: wenxin.leong <[email protected]>
  • Loading branch information
wxleong authored and AndreasFuchsTPM committed May 2, 2024
1 parent 3f8d6e4 commit 5679368
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/lib/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1123,12 +1123,14 @@ CK_RV object_create(session_ctx *ctx, CK_ATTRIBUTE *templ, CK_ULONG count, CK_OB
/*
* Currently we only support RW user session state objects.
*/
if (state != CKS_RW_USER_FUNCTIONS) {
if (state == CKS_RW_SO_FUNCTIONS) {
return CKR_USER_NOT_LOGGED_IN;
} else {
return CKR_SESSION_READ_ONLY;
}
switch(state) {
case CKS_RW_USER_FUNCTIONS:
break;
case CKS_RW_PUBLIC_SESSION:
case CKS_RW_SO_FUNCTIONS:
return CKR_USER_NOT_LOGGED_IN;
default:
return CKR_SESSION_READ_ONLY;
}

/*
Expand Down

0 comments on commit 5679368

Please sign in to comment.