Skip to content

Commit 25f9b2c

Browse files
committed
Fix firefox test
1 parent 454b512 commit 25f9b2c

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/internal.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8158,6 +8158,9 @@ static WP11_Object* wp11_Session_FindNext(WP11_Session* session, int onToken,
81588158
}
81598159
#endif
81608160

8161+
/* Note: this CKA_PRIVATE check is intentionally active in NSS mode.
8162+
* NSS accesses private objects by handle (via WP11_Object_Find) rather
8163+
* than discovering them through C_FindObjects enumeration. */
81618164
if ((ret->opFlag & WP11_FLAG_PRIVATE) == WP11_FLAG_PRIVATE) {
81628165
if (!onToken)
81638166
WP11_Lock_LockRO(&session->slot->token.lock);
@@ -9176,7 +9179,10 @@ int WP11_Object_Find(WP11_Session* session, CK_OBJECT_HANDLE objHandle,
91769179
}
91779180

91789181
if (ret == 0 && obj != NULL && (obj->handle == objHandle)) {
9179-
/* Enforce CKA_PRIVATE: reject private objects from public sessions */
9182+
#ifndef WOLFPKCS11_NSS
9183+
/* Enforce CKA_PRIVATE: reject private objects from public sessions.
9184+
* Skipped in NSS mode because NSS operates as the internal crypto
9185+
* module without calling C_Login. */
91809186
if ((obj->opFlag & WP11_FLAG_PRIVATE) == WP11_FLAG_PRIVATE) {
91819187
int loginState;
91829188
WP11_Lock_LockRO(&session->slot->lock);
@@ -9188,6 +9194,7 @@ int WP11_Object_Find(WP11_Session* session, CK_OBJECT_HANDLE objHandle,
91889194
}
91899195
WP11_Lock_UnlockRO(&session->slot->lock);
91909196
}
9197+
#endif
91919198
if (ret == 0)
91929199
*object = obj;
91939200
}

tests/pkcs11test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16675,6 +16675,7 @@ static CK_RV test_private_object_access(void* args)
1667516675
return ret;
1667616676
}
1667716677

16678+
#ifndef WOLFPKCS11_NSS
1667816679
static CK_RV test_private_object_handle_access(void* args)
1667916680
{
1668016681
CK_SESSION_HANDLE session = *(CK_SESSION_HANDLE*)args;
@@ -16735,6 +16736,7 @@ static CK_RV test_private_object_handle_access(void* args)
1673516736

1673616737
return ret;
1673716738
}
16739+
#endif /* !WOLFPKCS11_NSS */
1673816740

1673916741
/* C_GetAttributeValue must process all attributes in the template even when one
1674016742
* returns an error, setting ulValueLen to (CK_ULONG)-1 for invalid types and
@@ -17269,7 +17271,9 @@ static TEST_FUNC testFunc[] = {
1726917271
PKCS11TEST_FUNC_SESS_DECL(test_get_attr_value_all_processed),
1727017272
PKCS11TEST_FUNC_SESS_DECL(test_find_objects),
1727117273
PKCS11TEST_FUNC_SESS_DECL(test_private_object_access),
17274+
#ifndef WOLFPKCS11_NSS
1727217275
PKCS11TEST_FUNC_SESS_DECL(test_private_object_handle_access),
17276+
#endif
1727317277
PKCS11TEST_FUNC_SESS_DECL(test_encrypt_decrypt),
1727417278
#ifndef NO_AES
1727517279
PKCS11TEST_FUNC_SESS_DECL(test_encrypt_decrypt_op_not_supported),

0 commit comments

Comments
 (0)