Ver código fonte

2006-12-17 Marcus Brinkmann <marcus@g10code.de>

	* src/pkcs11.h: Minor cosmetic changes.  Require CRYPTOKI_GNU now
	to switch on the GNU API, and do not check what CRYPTOKI_COMPAT is
	defined to, just if it is defined at all.
Marcus Brinkmann 18 anos atrás
pai
commit
44ee2f976b
2 arquivos alterados com 27 adições e 13 exclusões
  1. 4 0
      ChangeLog
  2. 23 13
      src/pkcs11.h

+ 4 - 0
ChangeLog

@@ -1,5 +1,9 @@
 2006-12-17  Marcus Brinkmann  <marcus@g10code.de>
 
+	* src/pkcs11.h: Minor cosmetic changes.  Require CRYPTOKI_GNU now
+	to switch on the GNU API, and do not check what CRYPTOKI_COMPAT is
+	defined to, just if it is defined at all.
+
 	* src/pkcs11.h [__WIN32]: Changed to [_WIN32 ||
 	CRYPTOKI_FORCE_WIN32] at the end.
 	Submitted by Alon Bar-Lev.

+ 23 - 13
src/pkcs11.h

@@ -16,10 +16,18 @@
    they can be picked up by other projects from there as well.  */
 
 /* This file is a modified implementation of the PKCS #11 standard by
-   RSA Security Inc.  The goal is ABI compatibility to the PKCS #11
-   standard on the one hand and conformance to the GNU coding standard
-   in the API on the other hand.  For this, the following changes are
-   made to the specification:
+   RSA Security Inc.  It is mostly a drop-in replacement, with the
+   following change:
+
+   This header file does not require any macro definitions by the user
+   (like CK_DEFINE_FUNCTION etc).  In fact, it defines those macros
+   for you (if useful, some are missing, let me know if you need
+   more).
+
+   There is an additional API available that does comply better to the
+   GNU coding standard.  It can be switched on by defining
+   CRYPTOKI_GNU before including this header file.  For this, the
+   following changes are made to the specification:
 
    All structure types are changed to a "struct ck_foo" where CK_FOO
    is the type name in PKCS #11.
@@ -35,10 +43,8 @@
    Note that function names are still in the original case, as they
    need for ABI compatibility.
 
-   CK_FALSE, CK_TRUE and NULL_PTR are removed without substitute.
-
-   This header file does not require any macro definitions by the
-   user.
+   CK_FALSE, CK_TRUE and NULL_PTR are removed without substitute.  Use
+   <stdbool.h>.
 
    If CRYPTOKI_COMPAT is defined before including this header file,
    then none of the API changes above take place, and the API is the
@@ -59,12 +65,16 @@ extern "C" {
    versions).  */
 #define CRYPTOKI_VERSION_MAJOR		2
 #define CRYPTOKI_VERSION_MINOR		20
-#define CRYPTOKI_VERSION_REVISION	5
+#define CRYPTOKI_VERSION_REVISION	6
 
 
+/* Compatibility interface is default, unless CRYPTOKI_GNU is
+   given.  */
+#ifndef CRYPTOKI_GNU
 #ifndef CRYPTOKI_COMPAT
 #define CRYPTOKI_COMPAT 1
 #endif
+#endif
 
 /* System dependencies.  */
 
@@ -86,7 +96,7 @@ extern "C" {
 #endif
 
 
-#if CRYPTOKI_COMPAT
+#ifdef CRYPTOKI_COMPAT
   /* If we are in compatibility mode, switch all exposed names to the
      PKCS #11 variant.  There are corresponding #undefs below.  */
 
@@ -169,7 +179,7 @@ extern "C" {
 #define unlock_mutex UnlockMutex
 #define reserved pReserved
 
-#endif
+#endif	/* CRYPTOKI_COMPAT */
 
 
 
@@ -1160,7 +1170,7 @@ struct ck_c_initialize_args
 
 /* Compatibility layer.  */
 
-#if CRYPTOKI_COMPAT
+#ifdef CRYPTOKI_COMPAT
 
 #undef CK_DEFINE_FUNCTION
 #define CK_DEFINE_FUNCTION(retval, name) retval CK_SPEC name
@@ -1325,7 +1335,7 @@ typedef struct ck_c_initialize_args *CK_C_INITIALIZE_ARGS_PTR;
 #pragma pack(pop, cryptoki)
 #endif
 
-#ifdef __cplusplus
+#if defined(__cplusplus)
 }
 #endif