Browse Source

2006-10-26 Marcus Brinkmann <marcus@g10code.de>

	* src/gpgsm.c (gpgsm_get_cert): Rename to ...
	(scute_gpgsm_get_cert): ... this.
	* src/gpgsm.h: New file.
	* src/Makefile.am (libscute_la_SOURCES): Add gpgsm.h.
	* src/slots.c (gpgsm_get_cert): Remove prototype.
	(slots_update_slot): Call scute_gpgsm_get_cert, not gpgsm_get_cert.
Marcus Brinkmann 19 years ago
parent
commit
645c0ba190
5 changed files with 66 additions and 13 deletions
  1. 7 0
      ChangeLog
  2. 1 1
      src/Makefile.am
  3. 3 2
      src/gpgsm.c
  4. 50 0
      src/gpgsm.h
  5. 5 10
      src/slots.c

+ 7 - 0
ChangeLog

@@ -1,5 +1,12 @@
 2006-10-26  Marcus Brinkmann  <marcus@g10code.de>
 
+	* src/gpgsm.c (gpgsm_get_cert): Rename to ...
+	(scute_gpgsm_get_cert): ... this.
+	* src/gpgsm.h: New file.
+	* src/Makefile.am (libscute_la_SOURCES): Add gpgsm.h.
+	* src/slots.c (gpgsm_get_cert): Remove prototype.
+	(slots_update_slot): Call scute_gpgsm_get_cert, not gpgsm_get_cert.
+
 	* src/error-mapping.c (scute_gpg_err_to_ck): Map GPG_ERR_NO_AGENT
 	to CKR_GENERAL_ERROR.
 	* src/agent.h (struct agent_card_info_s): Remove member error.

+ 1 - 1
src/Makefile.am

@@ -51,7 +51,7 @@ libscute_la_SOURCES = cryptoki.h debug.h settings.h support.h		\
 	locking.h locking.c error-mapping.h error-mapping.c		\
 	agent.h agent.c							\
 	slots.h slots.c table.h table.c					\
-	cert.h cert-gpgsm.c cert-object.c gpgsm.c			\
+	cert.h cert-gpgsm.c cert-object.c gpgsm.h gpgsm.c		\
 	p11-cancelfunction.c p11-closeallsessions.c p11-closesession.c	\
 	p11-copyobject.c p11-createobject.c p11-decrypt.c		\
 	p11-decryptdigestupdate.c p11-decryptfinal.c p11-decryptinit.c	\

+ 3 - 2
src/gpgsm.c

@@ -92,8 +92,9 @@ search_cb (void *hook, struct cert *cert)
    and ATTR_COUNTP, and for the private key object in PRV_ATTRP
    and PRV_ATTR_COUNTP.  */
 gpg_error_t
-gpgsm_get_cert (char *grip, CK_ATTRIBUTE_PTR *attrp, CK_ULONG *attr_countp,
-		CK_ATTRIBUTE_PTR *prv_attrp, CK_ULONG *prv_attr_countp)
+scute_gpgsm_get_cert (char *grip,
+		      CK_ATTRIBUTE_PTR *attrp, CK_ULONG *attr_countp,
+		      CK_ATTRIBUTE_PTR *prv_attrp, CK_ULONG *prv_attr_countp)
 {
   gpg_error_t err;
   struct search search;

+ 50 - 0
src/gpgsm.h

@@ -0,0 +1,50 @@
+/* gpgsm.h - Interface for talking to gpgsm.
+   Copyright (C) 2006 g10 Code GmbH
+
+   This file is part of Scute[1].
+
+   [1] Derived from the RSA Security Inc. PKCS #11 Cryptographic Token
+   Interface (Cryptoki).
+ 
+   Scute is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   Scute 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
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with Scute; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+   In addition, as a special exception, g10 Code GmbH gives permission
+   to link this library: with the Mozilla Foundation's code for
+   Mozilla (or with modified versions of it that use the same license
+   as the "Mozilla" code), and distribute the linked executables.  You
+   must obey the GNU General Public License in all respects for all of
+   the code used other than "Mozilla".  If you modify this file, you
+   may extend this exception to your version of the file, but you are
+   not obligated to do so.  If you do not wish to do so, delete this
+   exception statement from your version.  */
+
+#ifndef GPGSM_H
+#define GPGSM_H	1
+
+#include <gpg-error.h>
+
+#include "cryptoki.h"
+
+
+/* Create the attributes required for a new certificate object.
+   Returns allocated attributes for the certificate object in ATTRP
+   and ATTR_COUNTP, and for the private key object in PRV_ATTRP
+   and PRV_ATTR_COUNTP.  */
+gpg_error_t
+scute_gpgsm_get_cert (char *grip,
+		      CK_ATTRIBUTE_PTR *attrp, CK_ULONG *attr_countp,
+		      CK_ATTRIBUTE_PTR *prv_attrp, CK_ULONG *prv_attr_countp)
+
+#endif	/* GPGSM_H */

+ 5 - 10
src/slots.c

@@ -225,11 +225,6 @@ void scute_slots_finalize (void)
 }
 
 
-/* FIXME */
-gpg_error_t
-gpgsm_get_cert (char *grip, CK_ATTRIBUTE_PTR *attrp, CK_ULONG *attr_countp,
-		CK_ATTRIBUTE_PTR *prv_attrp, CK_ULONG *prv_attr_countp);
-
 static void
 object_free (struct object *objp)
 {
@@ -306,11 +301,11 @@ slots_update_slot (slot_iterator_t id)
       objects[1].dummy = DUMMY_PTR;
 
       /* FIXME: Should be grip3.  */
-      err = gpgsm_get_cert (slot->info.grip3,
-			    &objects[0].attributes,
-			    &objects[0].attributes_count,
-			    &objects[1].attributes,
-			    &objects[1].attributes_count);
+      err = scute_gpgsm_get_cert (slot->info.grip3,
+				  &objects[0].attributes,
+				  &objects[0].attributes_count,
+				  &objects[1].attributes,
+				  &objects[1].attributes_count);
       if (err)
 	return scute_gpg_err_to_ck (err);