[gnome-keyring/dbus-api] [secret] Add standalone module for secrets-store.



commit 078e697eacbad37ae03869fd0e8a9749b345f581
Author: Stef Walter <stef memberwebs com>
Date:   Tue Jul 28 01:38:25 2009 +0000

    [secret] Add standalone module for secrets-store.

 pkcs11/secret-store/Makefile.am             |   25 +++++++++++-
 pkcs11/secret-store/gck-secret-standalone.c |   60 +++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 1 deletions(-)
---
diff --git a/pkcs11/secret-store/Makefile.am b/pkcs11/secret-store/Makefile.am
index 564058d..e5b4b02 100644
--- a/pkcs11/secret-store/Makefile.am
+++ b/pkcs11/secret-store/Makefile.am
@@ -7,7 +7,7 @@ INCLUDES = \
 	$(GLIB_CFLAGS)
 
 # ------------------------------------------------------------------------------
-# The roots component code
+# The secret store component code
 
 noinst_LTLIBRARIES = \
 	libgck-secret-store.la
@@ -22,4 +22,27 @@ libgck_secret_store_la_SOURCES = \
 	gck-secret-search.h gck-secret-search.c \
 	gck-secret-textual.c gck-secret-textual.h
 
+# ------------------------------------------------------------------------------
+# The standalone module
+
+moduledir = $(libdir)/gnome-keyring/standalone/
+
+module_LTLIBRARIES = \
+	gck-secret-store-standalone.la
+
+gck_secret_store_standalone_la_LDFLAGS = \
+	-module -avoid-version \
+	-no-undefined -export-symbols-regex 'C_GetFunctionList'
+
+gck_secret_store_standalone_la_SOURCES = \
+	gck-secret-standalone.c
+
+gck_secret_store_standalone_la_LIBADD = \
+	libgck-secret-store.la \
+	$(top_builddir)/pkcs11/gck/libgck.la \
+	$(GOBJECT_LIBS) \
+	$(GTHREAD_LIBS) \
+	$(GLIB_LIBS) \
+	$(LIBGCRYPT_LIBS)
+
 # -------------------------------------------------------------------------------
diff --git a/pkcs11/secret-store/gck-secret-standalone.c b/pkcs11/secret-store/gck-secret-standalone.c
new file mode 100644
index 0000000..3e7ee2e
--- /dev/null
+++ b/pkcs11/secret-store/gck-secret-standalone.c
@@ -0,0 +1,60 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* gck-secret-standalone.h - The Secret PKCS#11 code as a standalone module
+
+   Copyright (C) 2009, Stef Walter
+
+   The Gnome Keyring Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Keyring Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Author: Stef Walter <stef memberwebs com>
+*/
+
+#include "config.h"
+
+#include "gck-secret-store.h"
+
+#include "gck/gck-crypto.h"
+
+#include "egg/egg-secure-memory.h"
+
+#include <glib-object.h>
+
+#include "pkcs11/pkcs11.h"
+
+/* Module callbacks for secure memory */
+static GStaticMutex memory_mutex = G_STATIC_MUTEX_INIT;
+void egg_memory_lock (void) 
+	{ g_static_mutex_lock (&memory_mutex); }
+void egg_memory_unlock (void) 
+	{ g_static_mutex_unlock (&memory_mutex); }
+void* egg_memory_fallback (void *p, size_t sz) 
+	{ return g_realloc (p, sz); }
+
+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);
+	
+	gck_crypto_initialize ();
+	
+	*list = gck_secret_store_get_functions ();
+	return CKR_OK;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]