Debian Codegraph @

pkcs11/secret-store/gkm-secret-standalone.c

raw
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* gkm-secret-standalone.h - The Secret PKCS#11 code as a standalone module
3
4 Copyright (C) 2009, Stef Walter
5
6 The Gnome Keyring Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
10
11 The Gnome Keyring Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public
17 License along with the Gnome Library; see the file COPYING.LIB. If not,
18 <http://www.gnu.org/licenses/>.
19
20 Author: Stef Walter <[email protected]>
21 */
22
23 #include "config.h"
24
25 #include "gkm-secret-store.h"
26
27 #include "gkm/gkm-crypto.h"
28
29 #include "egg/egg-secure-memory.h"
30
31 #include <glib-object.h>
32 #include <gmodule.h>
33
34 #include "pkcs11/pkcs11.h"
35
36 /* Module callbacks for secure memory */
37 EGG_SECURE_DEFINE_GLIB_GLOBALS ();
38
39 const gchar* g_module_check_init (GModule *module);
40
41 const gchar*
42 g_module_check_init (GModule *module)
43 {
44 /*
45 * We can't handle being unloaded due to the gobject
46 * types we register
47 */
48
49 g_module_make_resident (module);
50 return NULL;
51 }
52
53 CK_RV
54 C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
55 {
56 if (!list)
57 return CKR_ARGUMENTS_BAD;
58
59 #if !GLIB_CHECK_VERSION(2,35,0)
60 g_type_init ();
61 #endif
62
63 gkm_crypto_initialize ();
64
65 *list = gkm_secret_store_get_functions ();
66 return CKR_OK;
67 }