diff --git a/ykcs11/tests/ykcs11_interfaces_tests.c b/ykcs11/tests/ykcs11_interfaces_tests.c index fc255c76..e4ec72c7 100644 --- a/ykcs11/tests/ykcs11_interfaces_tests.c +++ b/ykcs11/tests/ykcs11_interfaces_tests.c @@ -64,7 +64,7 @@ static void get_default_functions() { funcs = interface->pFunctionList; } -static void get_named_functions(CK_UTF8CHAR_PTR name) { +static void get_named_functions() { CK_INTERFACE_PTR interface; asrt(C_GetInterface((CK_UTF8CHAR_PTR)"PKCS 11",NULL,&interface,0), CKR_OK, "C_GetInterface named"); funcs = interface->pFunctionList; @@ -113,7 +113,7 @@ int main(void) { get_versioned_functions(CRYPTOKI_VERSION_MAJOR, CRYPTOKI_VERSION_MINOR); test_lib_info(CRYPTOKI_VERSION_MAJOR, CRYPTOKI_VERSION_MINOR); - get_named_functions("PKCS 11"); + get_named_functions(); test_lib_info(CRYPTOKI_VERSION_MAJOR, CRYPTOKI_VERSION_MINOR); return EXIT_SUCCESS; diff --git a/ykcs11/ykcs11.c b/ykcs11/ykcs11.c index 8113c848..17b63eda 100644 --- a/ykcs11/ykcs11.c +++ b/ykcs11/ykcs11.c @@ -64,6 +64,12 @@ static const CK_FUNCTION_LIST function_list; static const CK_FUNCTION_LIST_3_0 function_list_3; static struct CK_INTERFACE active_interface; +static const CK_INTERFACE interfaces_list[] = {{(CK_CHAR_PTR) "PKCS 11", + (CK_VOID_PTR)&function_list_3, 0}, + {(CK_CHAR_PTR) "PKCS 11", + (CK_VOID_PTR)&function_list, 0}}; + + static CK_SESSION_HANDLE get_session_handle(ykcs11_session_t *session) { return (CK_SESSION_HANDLE)(session - sessions + 1); } @@ -302,6 +308,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_GetFunctionList)( goto funclist_out; } *ppFunctionList = (CK_FUNCTION_LIST_PTR)&function_list; + active_interface = interfaces_list[1]; rv = CKR_OK; @@ -3874,11 +3881,6 @@ CK_DEFINE_FUNCTION(CK_RV, C_CancelFunction)( return CKR_FUNCTION_NOT_PARALLEL; } -static const CK_INTERFACE interfaces_list[] = {{(CK_CHAR_PTR) "PKCS 11", - (CK_VOID_PTR)&function_list_3, 0}, - {(CK_CHAR_PTR) "PKCS 11", - (CK_VOID_PTR)&function_list, 0}}; - /* C_GetInterfaceList returns all the interfaces supported by the module*/ CK_DEFINE_FUNCTION(CK_RV, C_GetInterfaceList) (CK_INTERFACE_PTR pInterfacesList, /* returned interfaces */