From b37bf079d8ddfc7989d8e7da0b3e7eb7b9d8c856 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Fri, 5 Dec 2008 04:21:29 +0000 Subject: Add ability to run NSS libsoftokn3 using the lazy flag. --- src/Makefile.am | 2 +- src/check.c | 2 +- src/config.c | 2 +- src/module.c | 73 +++++++++++++++++------------- src/p11-tests.c | 7 ++- src/p11-tests.h | 2 + src/session.c | 101 ++++++++++++++++++++++++----------------- src/slot.c | 137 +++++++++++++++++++++++++++++++++++--------------------- 8 files changed, 198 insertions(+), 128 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index e9cfd0e..1f8a5ce 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,7 +2,7 @@ AM_CFLAGS = -I$(top_srcdir) bin_PROGRAMS = p11-tests -p11_tests_LDADD = -ldl +p11_tests_LDADD = -ldl -lpthread p11_tests_SOURCES = \ check.c \ config.c \ diff --git a/src/check.c b/src/check.c index e8bc31f..7e45f5f 100644 --- a/src/check.c +++ b/src/check.c @@ -71,7 +71,7 @@ p11t_check_mask(const char *message, CK_ULONG flags, CK_ULONG mask) int p11t_check_flag(const char *message, CK_ULONG flags, CK_ULONG flag) { - if((flags & flag) == flag) + if((flags & flag) != flag) { p11t_msg_print("%s: flag 0x%08x should be set in: 0x%08x", message, flag, flags); diff --git a/src/config.c b/src/config.c index 65cc70c..9ca3bb0 100644 --- a/src/config.c +++ b/src/config.c @@ -92,7 +92,7 @@ p11t_config_parse(const char* filename) t++; name = trim(p); - value = t; + value = trim(t); if(name && value) { diff --git a/src/module.c b/src/module.c index b1b82b0..9e018e7 100644 --- a/src/module.c +++ b/src/module.c @@ -166,14 +166,17 @@ p11t_module_load(const char *filename) if(rv != CKR_OK) p11t_msg_fatal("C_GetFunctiontList: couldn't get function list: %s", p11t_msg_rv(rv)); - /** C_GetFunctionList */ - rv = (p11t_module_funcs->C_GetFunctionList)(&list); - if(rv != CKR_OK) - p11t_msg_print("C_GetFunctionList: call through function list failed: %s", p11t_msg_rv(rv)); - - /** - See if returns same data as library entry point */ - if(!memcmp(list, p11t_module_funcs, sizeof(*list)) != 0) - p11t_msg_print("C_GetFunctionList: function lists returned directly and recursively differ"); + if(p11t_test_unexpected) + { + /** C_GetFunctionList */ + rv = (p11t_module_funcs->C_GetFunctionList)(&list); + if(rv != CKR_OK) + p11t_msg_print("C_GetFunctionList: call through function list failed: %s", p11t_msg_rv(rv)); + + /** - See if returns same data as library entry point */ + if(!memcmp(list, p11t_module_funcs, sizeof(*list)) != 0) + p11t_msg_print("C_GetFunctionList: function lists returned directly and recursively differ"); + } } static int @@ -259,15 +262,18 @@ p11t_module_initialize(void) assert(p11t_module_funcs); - /** - Calls without initializing */ - rv = (p11t_module_funcs->C_GetInfo)(&info); - p11t_check_returns("C_GetInfo: shouldn't run without initialize", rv, CKR_CRYPTOKI_NOT_INITIALIZED); + if(p11t_test_unexpected) + { + /** - Calls without initializing */ + rv = (p11t_module_funcs->C_GetInfo)(&info); + p11t_check_returns("C_GetInfo: shouldn't run without initialize", rv, CKR_CRYPTOKI_NOT_INITIALIZED); - /** - NULL argument */ - rv = (p11t_module_funcs->C_Initialize) (NULL); - p11t_check_returns("C_Initialize: should succeed with null argument", rv, CKR_OK); - is_initialized = 1; - p11t_module_finalize(); + /** - NULL argument */ + rv = (p11t_module_funcs->C_Initialize) (NULL); + p11t_check_returns("C_Initialize: should succeed with null argument", rv, CKR_OK); + is_initialized = 1; + p11t_module_finalize(); + } /** - Multiple initialize with C_Finalize between */ initialize_locking_1(); @@ -286,16 +292,17 @@ p11t_module_initialize(void) if(!is_initialized) p11t_msg_fatal("C_Initialize: couldn't initialize pkcs11 module"); - /** - Double initialize in a row */ - rv = (p11t_module_funcs->C_Initialize) (&init_args); - if (rv != CKR_CRYPTOKI_ALREADY_INITIALIZED) + if(p11t_test_unexpected) { - p11t_msg_print("C_Initialize: double initialize should return CKR_CRYPTOKI_ALREADY_INITIALIZED: %s", p11t_msg_rv(rv)); - } - else - { - is_initialized = 1; + /** - Double initialize in a row */ + rv = (p11t_module_funcs->C_Initialize) (&init_args); + if(rv != CKR_CRYPTOKI_ALREADY_INITIALIZED) + { + p11t_msg_print("C_Initialize: double initialize should return CKR_CRYPTOKI_ALREADY_INITIALIZED: %s", p11t_msg_rv(rv)); + } } + + is_initialized = 1; } void @@ -306,9 +313,12 @@ p11t_module_finalize(void) /** C_Finalize */ if(is_initialized) { - /** - With invalid argument */ - rv = p11t_module_funcs->C_Finalize(&rv); - p11t_check_returns("C_Finalize: bad argument", rv, CKR_ARGUMENTS_BAD); + if(p11t_test_unexpected) + { + /** - With invalid argument */ + rv = p11t_module_funcs->C_Finalize(&rv); + p11t_check_returns("C_Finalize: bad argument", rv, CKR_ARGUMENTS_BAD); + } /** - Normal call */ assert(p11t_module_funcs); @@ -317,9 +327,12 @@ p11t_module_finalize(void) is_initialized = 0; } - /** - Double finalize in a row */ - rv = p11t_module_funcs->C_Finalize(NULL); - p11t_check_returns("C_Finalize: double finalize", rv, CKR_CRYPTOKI_NOT_INITIALIZED); + if(p11t_test_unexpected) + { + /** - Double finalize in a row */ + rv = p11t_module_funcs->C_Finalize(NULL); + p11t_check_returns("C_Finalize: double finalize", rv, CKR_CRYPTOKI_NOT_INITIALIZED); + } } void diff --git a/src/p11-tests.c b/src/p11-tests.c index 65414dd..3346766 100644 --- a/src/p11-tests.c +++ b/src/p11-tests.c @@ -6,6 +6,8 @@ #include #include +int p11t_test_unexpected = 1; + static void usage() { @@ -19,13 +21,16 @@ main(int argc, char* argv[]) const char *config = NULL; int ch; - while((ch = getopt(argc, argv, "f")) != -1) + while((ch = getopt(argc, argv, "f:z")) != -1) { switch(ch) { case 'f': config = optarg; break; + case 'z': + p11t_test_unexpected = 0; + break; case '?': default: usage(); diff --git a/src/p11-tests.h b/src/p11-tests.h index 6256bd5..4792e56 100644 --- a/src/p11-tests.h +++ b/src/p11-tests.h @@ -8,6 +8,8 @@ #define CK_INVALID ((CK_ULONG)-1) +extern int p11t_test_unexpected; + /* ------------------------------------------------------------------- * msg.c */ diff --git a/src/session.c b/src/session.c index d7dac8a..ae20c0c 100644 --- a/src/session.c +++ b/src/session.c @@ -18,13 +18,16 @@ session_info(CK_SESSION_HANDLE session, CK_SLOT_ID slot, CK_FLAGS flags, CK_STAT /** C_GetSessionInfo */ - /** - Invalid session */ - rv = (p11t_module_funcs->C_GetSessionInfo)((CK_SESSION_HANDLE)-33, &info); - p11t_check_returns("C_GetSessionInfo: with invalid session", rv, CKR_SESSION_HANDLE_INVALID); + if(p11t_test_unexpected) + { + /** - Invalid session */ + rv = (p11t_module_funcs->C_GetSessionInfo)((CK_SESSION_HANDLE)-33, &info); + p11t_check_returns("C_GetSessionInfo: with invalid session", rv, CKR_SESSION_HANDLE_INVALID); - /** - NULL arguments */ - rv = (p11t_module_funcs->C_GetSessionInfo)(session, NULL); - p11t_check_returns("C_GetSessionInfo: with null", rv, CKR_ARGUMENTS_BAD); + /** - NULL arguments */ + rv = (p11t_module_funcs->C_GetSessionInfo)(session, NULL); + p11t_check_returns("C_GetSessionInfo: with null", rv, CKR_ARGUMENTS_BAD); + } /** - Valid call */ rv = (p11t_module_funcs->C_GetSessionInfo)(session, &info); @@ -54,21 +57,24 @@ session_main(CK_SLOT_ID slot) /** C_OpenSession */ - /** - Invalid slot */ - rv = (p11t_module_funcs->C_OpenSession)((CK_SLOT_ID)-5, CKF_SERIAL_SESSION, NULL, NULL, &session_ro); - p11t_check_returns("C_OpenSession: with invalid slot", rv, CKR_SLOT_ID_INVALID); + if(p11t_test_unexpected) + { + /** - Invalid slot */ + rv = (p11t_module_funcs->C_OpenSession)((CK_SLOT_ID)-5, CKF_SERIAL_SESSION, NULL, NULL, &session_ro); + p11t_check_returns("C_OpenSession: with invalid slot", rv, CKR_SLOT_ID_INVALID); - /** - Null arguments */ - rv = (p11t_module_funcs->C_OpenSession)(slot, CKF_SERIAL_SESSION, NULL, NULL, NULL); - p11t_check_returns("C_OpenSession: with invalid slot", rv, CKR_ARGUMENTS_BAD); + /** - Null arguments */ + rv = (p11t_module_funcs->C_OpenSession)(slot, CKF_SERIAL_SESSION, NULL, NULL, NULL); + p11t_check_returns("C_OpenSession: with invalid slot", rv, CKR_ARGUMENTS_BAD); - /** - No flags */ - rv = (p11t_module_funcs->C_OpenSession)(slot, 0, NULL, NULL, &session_ro); - p11t_check_returns("C_OpenSession: with 0 flags", rv, CKR_SESSION_PARALLEL_NOT_SUPPORTED); + /** - No flags */ + rv = (p11t_module_funcs->C_OpenSession)(slot, 0, NULL, NULL, &session_ro); + p11t_check_returns("C_OpenSession: with 0 flags", rv, CKR_SESSION_PARALLEL_NOT_SUPPORTED); - /** - Without serial flag */ - rv = (p11t_module_funcs->C_OpenSession)(slot, CKF_RW_SESSION, NULL, NULL, &session_ro); - p11t_check_returns("C_OpenSession: with RW flags", rv, CKR_SESSION_PARALLEL_NOT_SUPPORTED); + /** - Without serial flag */ + rv = (p11t_module_funcs->C_OpenSession)(slot, CKF_RW_SESSION, NULL, NULL, &session_ro); + p11t_check_returns("C_OpenSession: with RW flags", rv, CKR_SESSION_PARALLEL_NOT_SUPPORTED); + } /** - Valid flags */ rv = (p11t_module_funcs->C_OpenSession)(slot, CKF_SERIAL_SESSION, NULL, NULL, &session_ro); @@ -91,9 +97,12 @@ session_main(CK_SLOT_ID slot) /** C_CloseSession */ - /** - Invalid session */ - rv = (p11t_module_funcs->C_CloseSession)((CK_SESSION_HANDLE)-10); - p11t_check_returns("C_CloseSession: invalid handle", rv, CKR_SESSION_HANDLE_INVALID); + if(p11t_test_unexpected) + { + /** - Invalid session */ + rv = (p11t_module_funcs->C_CloseSession)((CK_SESSION_HANDLE)-10); + p11t_check_returns("C_CloseSession: invalid handle", rv, CKR_SESSION_HANDLE_INVALID); + } if(session_ro != CK_INVALID) { @@ -101,21 +110,23 @@ session_main(CK_SLOT_ID slot) rv = (p11t_module_funcs->C_CloseSession)(session_ro); p11t_check_returns("C_CloseSession: valid", rv, CKR_OK); - /** - Check open session was closed */ - rv = (p11t_module_funcs->C_GetSessionInfo)(session_ro, &info); - p11t_check_returns("C_GetSessionInfo: after close", rv, CKR_SESSION_HANDLE_INVALID); - + if(p11t_test_unexpected) + { + /** - Check open session was closed */ + rv = (p11t_module_funcs->C_GetSessionInfo)(session_ro, &info); + p11t_check_returns("C_GetSessionInfo: after close", rv, CKR_SESSION_HANDLE_INVALID); - /** - Close twice */ + /** - Close twice */ - /* - * Note that CKR_SESSION_CLOSED is a valid return in this case. - * That should only be returned in the rare case when a session - * was closed during the execution of a function. A corner case. - */ + /* + * Note that CKR_SESSION_CLOSED is a valid return in this case. + * That should only be returned in the rare case when a session + * was closed during the execution of a function. A corner case. + */ - rv = (p11t_module_funcs->C_CloseSession)(session_ro); - p11t_check_returns("C_CloseSession: valid", rv, CKR_SESSION_HANDLE_INVALID); + rv = (p11t_module_funcs->C_CloseSession)(session_ro); + p11t_check_returns("C_CloseSession: valid", rv, CKR_SESSION_HANDLE_INVALID); + } } if(session_rw != CK_INVALID) @@ -126,21 +137,27 @@ session_main(CK_SLOT_ID slot) /** C_CloseAllSessions */ - /** - Invalid slot id */ - rv = (p11t_module_funcs->C_CloseAllSessions)((CK_SLOT_ID)-34); - p11t_check_returns("C_CloseAllSessions: invalid slot", rv, CKR_SLOT_ID_INVALID); + if(p11t_test_unexpected) + { + /** - Invalid slot id */ + rv = (p11t_module_funcs->C_CloseAllSessions)((CK_SLOT_ID)-34); + p11t_check_returns("C_CloseAllSessions: invalid slot", rv, CKR_SLOT_ID_INVALID); + } /** - Normal call */ rv = (p11t_module_funcs->C_CloseAllSessions)(slot); p11t_check_returns("C_CloseAllSessions", rv, CKR_OK); - /** - Check open session was closed */ - rv = (p11t_module_funcs->C_GetSessionInfo)(session_ro2, &info); - p11t_check_returns("C_GetSessionInfo: after close all", rv, CKR_SESSION_HANDLE_INVALID); + if(p11t_test_unexpected) + { + /** - Check open session was closed */ + rv = (p11t_module_funcs->C_GetSessionInfo)(session_ro2, &info); + p11t_check_returns("C_GetSessionInfo: after close all", rv, CKR_SESSION_HANDLE_INVALID); - /** - Call when no sessions open */ - rv = (p11t_module_funcs->C_CloseAllSessions)(slot); - p11t_check_returns("C_CloseAllSessions", rv, CKR_OK); + /** - Call when no sessions open */ + rv = (p11t_module_funcs->C_CloseAllSessions)(slot); + p11t_check_returns("C_CloseAllSessions", rv, CKR_OK); + } } void diff --git a/src/slot.c b/src/slot.c index 1cad423..e7f8478 100644 --- a/src/slot.c +++ b/src/slot.c @@ -26,9 +26,12 @@ slot_global(void) assert(p11t_module_funcs); - /** - NULL argument */ - rv = (p11t_module_funcs->C_GetInfo)(NULL); - p11t_check_returns("C_GetInfo: null argument", rv, CKR_ARGUMENTS_BAD); + if(p11t_test_unexpected) + { + /** - NULL argument */ + rv = (p11t_module_funcs->C_GetInfo)(NULL); + p11t_check_returns("C_GetInfo: null argument", rv, CKR_ARGUMENTS_BAD); + } /* Obvious crap fill */ memset(&p11t_slot_global, 0xFF, sizeof(CK_INFO)); @@ -73,9 +76,12 @@ slot_info(void) assert(p11t_module_funcs); - /** - NULL arguments */ - rv = (p11t_module_funcs->C_GetSlotList)(FALSE, NULL, NULL); - p11t_check_returns("C_GetSlotList: null argument", rv, CKR_ARGUMENTS_BAD); + if(p11t_test_unexpected) + { + /** - NULL arguments */ + rv = (p11t_module_funcs->C_GetSlotList)(FALSE, NULL, NULL); + p11t_check_returns("C_GetSlotList: null argument", rv, CKR_ARGUMENTS_BAD); + } /** - Retrieving the count */ rv = (p11t_module_funcs->C_GetSlotList)(FALSE, NULL, &p11t_slot_count); @@ -97,23 +103,29 @@ slot_info(void) p11t_slot_token_info = calloc(p11t_slot_count, sizeof(CK_TOKEN_INFO)); assert(p11t_slot_token_info); - /** - Passing buffer space along with zero count. */ - count = 0; - rv = (p11t_module_funcs->C_GetSlotList)(FALSE, p11t_slot_ids, &count); - p11t_check_returns("C_GetSlotList: zero buffer", rv, CKR_BUFFER_TOO_SMALL); - p11t_check_ulong("C_GetSlotList: count invalid zero space passed", count, p11t_slot_count); - - if(p11t_slot_count > 1) + if(p11t_test_unexpected) { - /** - Passing buffer space along with low count. */ - count = 1; + /** - Passing buffer space along with zero count. */ + count = 0; rv = (p11t_module_funcs->C_GetSlotList)(FALSE, p11t_slot_ids, &count); - p11t_check_returns("C_GetSlotList: low buffer", rv, CKR_BUFFER_TOO_SMALL); - p11t_check_ulong("C_GetSlotList: count invalid when too little space passed", count, p11t_slot_count); + p11t_check_returns("C_GetSlotList: zero buffer", rv, CKR_BUFFER_TOO_SMALL); + p11t_check_ulong("C_GetSlotList: count invalid zero space passed", count, p11t_slot_count); + + if(p11t_slot_count > 1) + { + /** - Passing buffer space along with low count. */ + count = 1; + rv = (p11t_module_funcs->C_GetSlotList)(FALSE, p11t_slot_ids, &count); + p11t_check_returns("C_GetSlotList: low buffer", rv, CKR_BUFFER_TOO_SMALL); + p11t_check_ulong("C_GetSlotList: count invalid when too little space passed", count, p11t_slot_count); + } } /** - Passing too much buffer space. */ - count = p11t_slot_count + 5; + if(p11t_test_unexpected) + count = p11t_slot_count + 5; + else + count = p11t_slot_count; rv = (p11t_module_funcs->C_GetSlotList)(FALSE, p11t_slot_ids, &count); if(!p11t_check_returns("C_GetSlotList", rv, CKR_OK)) { @@ -134,9 +146,12 @@ slot_info(void) { /** C_GetSlotInfo */ - /** - NULL argument */ - rv = (p11t_module_funcs->C_GetSlotInfo)(p11t_slot_ids[i], NULL); - p11t_check_returns("C_GetSlotInfo: null argument", rv, CKR_ARGUMENTS_BAD); + if(p11t_test_unexpected) + { + /** - NULL argument */ + rv = (p11t_module_funcs->C_GetSlotInfo)(p11t_slot_ids[i], NULL); + p11t_check_returns("C_GetSlotInfo: null argument", rv, CKR_ARGUMENTS_BAD); + } /** - Normal call */ rv = (p11t_module_funcs->C_GetSlotInfo)(p11t_slot_ids[i], &p11t_slot_info[i]); @@ -158,9 +173,12 @@ slot_info(void) /** C_GetTokenInfo */ - /** - Null arguments */ - rv = (p11t_module_funcs->C_GetTokenInfo)(p11t_slot_ids[i], NULL); - p11t_check_returns("C_GetTokenInfo: null arguments", rv, CKR_ARGUMENTS_BAD); + if(p11t_test_unexpected) + { + /** - Null arguments */ + rv = (p11t_module_funcs->C_GetTokenInfo)(p11t_slot_ids[i], NULL); + p11t_check_returns("C_GetTokenInfo: null arguments", rv, CKR_ARGUMENTS_BAD); + } /** - Normal call */ rv = (p11t_module_funcs->C_GetTokenInfo)(p11t_slot_ids[i], &p11t_slot_token_info[i]); @@ -209,7 +227,7 @@ slot_info(void) } } } - else + else if(p11t_test_unexpected) { /** - Calling on slot without token */ rv = (p11t_module_funcs->C_GetTokenInfo)(p11t_slot_ids[i], &p11t_slot_token_info[i]); @@ -252,10 +270,13 @@ slot_mechanisms(void) if(!p11t_slot_count) return; - /* - Invalid Slot */ - mech_count = 0; - rv = (p11t_module_funcs->C_GetMechanismList)((CK_ULONG)-10, NULL, &mech_count); - p11t_check_returns("C_GetMechanismList: invalid slot id", rv, CKR_SLOT_ID_INVALID); + if(p11t_test_unexpected) + { + /* - Invalid Slot */ + mech_count = 0; + rv = (p11t_module_funcs->C_GetMechanismList)((CK_ULONG)-10, NULL, &mech_count); + p11t_check_returns("C_GetMechanismList: invalid slot id", rv, CKR_SLOT_ID_INVALID); + } p11t_slot_mech_count = calloc(p11t_slot_count, sizeof(CK_ULONG)); assert(p11t_slot_mech_count); @@ -268,9 +289,12 @@ slot_mechanisms(void) { slot_id = p11t_slot_ids[i]; - /** - Null arguments */ - rv = (p11t_module_funcs->C_GetMechanismList)(slot_id, NULL, NULL); - p11t_check_returns("C_GetMechanismList: null arguments", rv, CKR_ARGUMENTS_BAD); + if(p11t_test_unexpected) + { + /** - Null arguments */ + rv = (p11t_module_funcs->C_GetMechanismList)(slot_id, NULL, NULL); + p11t_check_returns("C_GetMechanismList: null arguments", rv, CKR_ARGUMENTS_BAD); + } /** - Without buffer */ rv = (p11t_module_funcs->C_GetMechanismList)(slot_id, NULL, &mech_count); @@ -281,23 +305,29 @@ slot_mechanisms(void) mech_list = calloc(mech_count + 5, sizeof(CK_MECHANISM_TYPE)); assert(mech_list); - /** - Zero count but buffer present */ - value = 0; - rv = (p11t_module_funcs->C_GetMechanismList)(slot_id, mech_list, &value); - p11t_check_returns("C_GetMechanismList: zero buffer", rv, CKR_BUFFER_TOO_SMALL); - p11t_check_ulong("C_GetMechanismList: should have number of mechs", value, mech_count); - - if(mech_count > 1) + if(p11t_test_unexpected) { - /** - Low count but buffer present */ - value = 1; + /** - Zero count but buffer present */ + value = 0; rv = (p11t_module_funcs->C_GetMechanismList)(slot_id, mech_list, &value); - p11t_check_returns("C_GetMechanismList: low buffer", rv, CKR_BUFFER_TOO_SMALL); + p11t_check_returns("C_GetMechanismList: zero buffer", rv, CKR_BUFFER_TOO_SMALL); p11t_check_ulong("C_GetMechanismList: should have number of mechs", value, mech_count); + + if(mech_count > 1) + { + /** - Low count but buffer present */ + value = 1; + rv = (p11t_module_funcs->C_GetMechanismList)(slot_id, mech_list, &value); + p11t_check_returns("C_GetMechanismList: low buffer", rv, CKR_BUFFER_TOO_SMALL); + p11t_check_ulong("C_GetMechanismList: should have number of mechs", value, mech_count); + } } /* - Call with too much buffer */ - value = mech_count + 5; + if(p11t_test_unexpected) + value = mech_count + 5; + else + value = mech_count; rv = (p11t_module_funcs->C_GetMechanismList)(slot_id, mech_list, &value); p11t_check_returns("C_GetMechanismList: high buffer", rv, CKR_OK); p11t_check_ulong("C_GetMechanismList: should have number of mechs", value, mech_count); @@ -308,17 +338,20 @@ slot_mechanisms(void) /** C_GetMechanismInfo */ - /** - Invalid mechanism */ - rv = (p11t_module_funcs->C_GetMechanismInfo)(slot_id, (CK_ULONG)-10, mech_info); - p11t_check_returns("C_GetMechanismInfo: with invalid mech", rv, CKR_MECHANISM_INVALID); + if(p11t_test_unexpected) + { + /** - Invalid mechanism */ + rv = (p11t_module_funcs->C_GetMechanismInfo)(slot_id, (CK_ULONG)-10, mech_info); + p11t_check_returns("C_GetMechanismInfo: with invalid mech", rv, CKR_MECHANISM_INVALID); - /** - Null arguments */ - rv = (p11t_module_funcs->C_GetMechanismInfo)(slot_id, mech_list[0], NULL); - p11t_check_returns("C_GetMechanismInfo: with null arg", rv, CKR_ARGUMENTS_BAD); + /** - Null arguments */ + rv = (p11t_module_funcs->C_GetMechanismInfo)(slot_id, mech_list[0], NULL); + p11t_check_returns("C_GetMechanismInfo: with null arg", rv, CKR_ARGUMENTS_BAD); - /** - Invalid slot id */ - rv = (p11t_module_funcs->C_GetMechanismInfo)((CK_ULONG)-11, mech_list[0], mech_info); - p11t_check_returns("C_GetMechanismInfo: with invalid slot", rv, CKR_SLOT_ID_INVALID); + /** - Invalid slot id */ + rv = (p11t_module_funcs->C_GetMechanismInfo)((CK_ULONG)-11, mech_list[0], mech_info); + p11t_check_returns("C_GetMechanismInfo: with invalid slot", rv, CKR_SLOT_ID_INVALID); + } for(j = 0; j < mech_count; ++j) { -- cgit v1.2.3