diff options
Diffstat (limited to 'src/slot.c')
-rw-r--r-- | src/slot.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -7,6 +7,7 @@ CK_INFO slot_global; +int p11t_slot_virtual = 0; CK_ULONG p11t_slot_count = 0; static CK_SLOT_ID_PTR slot_ids = NULL; static CK_SLOT_INFO_PTR slot_info = NULL; @@ -16,6 +17,9 @@ static CK_ULONG *slot_mech_count; static CK_MECHANISM_TYPE_PTR *slot_mech_type; static CK_MECHANISM_INFO_PTR *slot_mech_info; +/* TODO: Get this from a header */ +#define CKF_VIRTUAL_SLOTS 0x40000000 + /* ---------------------------------------------------------------------------------- * TESTS */ @@ -46,7 +50,9 @@ test_slot_global(void) P11T_CHECK_PADDED("manufacturerID", slot_global.manufacturerID); P11T_CHECK_PADDED("libraryDescription", slot_global.libraryDescription); - P11T_CHECK_ULONG("flags", slot_global.flags, 0); + P11T_CHECK_ULONG("flags", slot_global.flags, CKF_VIRTUAL_SLOTS); + if (slot_global.flags & CKF_VIRTUAL_SLOTS) + p11t_slot_virtual = 1; return CONTINUE; } @@ -266,7 +272,7 @@ test_slot_mechanisms(void) if(!p11t_slot_count) return CONTINUE; - if(p11t_test_unexpected) + if(p11t_test_unexpected && !p11t_slot_virtual) { mech_count = 0; rv = (p11t_module_funcs->C_GetMechanismList)((CK_ULONG)-10, NULL, &mech_count); @@ -341,8 +347,11 @@ test_slot_mechanisms(void) rv = (p11t_module_funcs->C_GetMechanismInfo)(slot_id, mech_list[0], NULL); P11T_CHECK_RV("Null arguments", rv, CKR_ARGUMENTS_BAD); - rv = (p11t_module_funcs->C_GetMechanismInfo)((CK_ULONG)-11, mech_list[0], mech_info); - P11T_CHECK_RV("Invalid slot id", rv, CKR_SLOT_ID_INVALID); + if (!p11t_slot_virtual) + { + rv = (p11t_module_funcs->C_GetMechanismInfo)((CK_ULONG)-11, mech_list[0], mech_info); + P11T_CHECK_RV("Invalid slot id", rv, CKR_SLOT_ID_INVALID); + } } for(j = 0; j < mech_count; ++j) |