void test_ssh_module_leave_and_finalize (void) { CK_FUNCTION_LIST_PTR funcs; CK_RV rv; test_ssh_module_leave (); funcs = gkm_ssh_store_get_functions (); rv = (funcs->C_Finalize) (NULL); g_return_if_fail (rv == CKR_OK); }
CK_RV C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list) { if (!list) return CKR_ARGUMENTS_BAD; g_type_init (); if (!g_thread_supported ()) g_thread_init (NULL); *list = gkm_ssh_store_get_functions (); return CKR_OK; }
GkmModule* test_ssh_module_initialize_and_enter (void) { CK_FUNCTION_LIST_PTR funcs; GkmModule *module; CK_RV rv; funcs = gkm_ssh_store_get_functions (); rv = (funcs->C_Initialize) (NULL); g_return_val_if_fail (rv == CKR_OK, NULL); module = _gkm_ssh_store_get_module_for_testing (); g_return_val_if_fail (module, NULL); mutex = _gkm_module_get_scary_mutex_that_you_should_not_touch (module); test_ssh_module_enter (); return module; }
gboolean gkd_pkcs11_initialize (void) { CK_FUNCTION_LIST_PTR roots_store; CK_FUNCTION_LIST_PTR secret_store; CK_FUNCTION_LIST_PTR ssh_store; CK_FUNCTION_LIST_PTR mate2_store; CK_FUNCTION_LIST_PTR xdg_store; CK_C_INITIALIZE_ARGS init_args; gboolean ret; CK_RV rv; /* Secrets */ secret_store = gkm_secret_store_get_functions (); /* SSH storage */ ssh_store = gkm_ssh_store_get_functions (); /* Root certificates */ roots_store = gkm_roots_store_get_functions (); /* Old User certificates */ mate2_store = gkm_mate2_store_get_functions (); /* User certificates */ xdg_store = gkm_xdg_store_get_functions (); /* Add all of those into the wrapper layer */ gkm_wrap_layer_add_module (ssh_store); #ifdef ROOT_CERTIFICATES gkm_wrap_layer_add_module (roots_store); #endif gkm_wrap_layer_add_module (secret_store); gkm_wrap_layer_add_module (mate2_store); gkm_wrap_layer_add_module (xdg_store); pkcs11_roof = gkm_wrap_layer_get_functions (); pkcs11_base = gkm_wrap_layer_get_functions_no_prompts (); memset (&init_args, 0, sizeof (init_args)); init_args.flags = CKF_OS_LOCKING_OK; #if WITH_TESTS { const gchar *path = g_getenv ("MATE_KEYRING_TEST_PATH"); if (path && path[0]) init_args.pReserved = g_strdup_printf ("directory=\"%s\"", path); } #endif /* Initialize the whole caboodle */ rv = (pkcs11_roof->C_Initialize) (&init_args); g_free (init_args.pReserved); if (rv != CKR_OK) { g_warning ("couldn't initialize internal PKCS#11 stack (code: %d)", (gint)rv); return FALSE; } egg_cleanup_register (pkcs11_daemon_cleanup, NULL); ret = gkd_gpg_agent_initialize (pkcs11_roof) && gkd_ssh_agent_initialize (pkcs11_roof) && gkm_rpc_layer_initialize (pkcs11_roof); return ret; }