summaryrefslogtreecommitdiff
path: root/p11-kit/test-proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'p11-kit/test-proxy.c')
-rw-r--r--p11-kit/test-proxy.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/p11-kit/test-proxy.c b/p11-kit/test-proxy.c
index 9d894bf..3229002 100644
--- a/p11-kit/test-proxy.c
+++ b/p11-kit/test-proxy.c
@@ -121,6 +121,8 @@ test_initialize_child (void)
CK_RV rv;
pid_t pid;
int st;
+ CK_SLOT_ID slots[32], last_slot;
+ CK_ULONG count, last_count;
rv = C_GetFunctionList (&proxy);
assert (rv == CKR_OK);
@@ -130,6 +132,11 @@ test_initialize_child (void)
rv = proxy->C_Initialize(NULL);
assert_num_eq (rv, CKR_OK);
+ rv = proxy->C_GetSlotList (CK_FALSE, slots, &count);
+ assert_num_cmp (count, >=, 2);
+ last_slot = slots[count - 1];
+ last_count = count;
+
pid = fork ();
if (!pid) {
/* The PKCS#11 Usage Guide (v2.40) advocates in ยง2.5.2 that
@@ -149,6 +156,17 @@ test_initialize_child (void)
rv = proxy->C_Initialize(NULL);
assert_num_eq (rv, CKR_OK);
+ rv = proxy->C_GetSlotList (CK_FALSE, slots, &count);
+ assert_num_eq (rv, CKR_OK);
+ assert_num_cmp (count, >=, 2);
+
+ /* One of the module initializations should fail after
+ * fork (see mock-module-ep4.c) and the total number
+ * of slots should be less than last_count. */
+ assert_num_cmp (count, <, last_count);
+ /* Check if the last valid slot ID is preserved */
+ assert_num_eq (slots[count - 1], last_slot);
+
rv = proxy->C_Finalize (NULL);
assert_num_eq (rv, CKR_OK);