@@ -3170,10 +3170,16 @@ CK_C_INITIALIZE_ARGS CK_PTR args; uint32_t idx; int mutex_init_ret; CACKEY_DEBUG_PRINTF("Called."); + + if (cackey_initialized) { + CACKEY_DEBUG_PRINTF("Error. Already initialized."); + + return(CKR_CRYPTOKI_ALREADY_INITIALIZED); + } if (pInitArgs != NULL) { args = pInitArgs; memcpy(&cackey_args, args, sizeof(cackey_args)); @@ -3190,16 +3196,10 @@ cackey_args.LockMutex = NULL; cackey_args.UnlockMutex = NULL; cackey_args.flags = 0; } - if (cackey_initialized) { - CACKEY_DEBUG_PRINTF("Error. Already initialized."); - - return(CKR_CRYPTOKI_ALREADY_INITIALIZED); - } - for (idx = 0; idx < (sizeof(cackey_sessions) / sizeof(cackey_sessions[0])); idx++) { cackey_sessions[idx].active = 0; } for (idx = 0; idx < (sizeof(cackey_slots) / sizeof(cackey_slots[0])); idx++) { @@ -3700,10 +3700,11 @@ CACKEY_DEBUG_PRINTF("Error. Not initialized."); return(CKR_CRYPTOKI_NOT_INITIALIZED); } + /* XXX: TODO: Implement this... */ CACKEY_DEBUG_PRINTF("Returning CKR_FUNCTION_NOT_SUPPORTED (%i)", CKR_FUNCTION_NOT_SUPPORTED); return(CKR_FUNCTION_NOT_SUPPORTED); } @@ -3721,18 +3722,18 @@ return(CKR_ARGUMENTS_BAD); } if (pMechanismList == NULL) { - *pulCount = 3; + *pulCount = 2; CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i)", CKR_OK); return(CKR_OK); } - if (*pulCount < 3) { + if (*pulCount < 2) { CACKEY_DEBUG_PRINTF("Error. Buffer too small."); return(CKR_BUFFER_TOO_SMALL); }