pkcs11 0.2.4-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +23 -0
  3. data/.gemtest +0 -0
  4. data/.yardopts +1 -0
  5. data/History.txt +57 -0
  6. data/MIT-LICENSE +22 -0
  7. data/Manifest.txt +57 -0
  8. data/README.rdoc +205 -0
  9. data/Rakefile +111 -0
  10. data/ext/extconf.rb +7 -0
  11. data/ext/generate_constants.rb +57 -0
  12. data/ext/generate_structs.rb +206 -0
  13. data/ext/generate_thread_funcs.rb +72 -0
  14. data/ext/include/cryptoki.h +66 -0
  15. data/ext/include/ct-kip.h +50 -0
  16. data/ext/include/otp-pkcs11.h +125 -0
  17. data/ext/include/pkcs-11v2-20a3.h +124 -0
  18. data/ext/include/pkcs11.h +299 -0
  19. data/ext/include/pkcs11f.h +912 -0
  20. data/ext/include/pkcs11t.h +1885 -0
  21. data/ext/pk11.c +1675 -0
  22. data/ext/pk11.h +81 -0
  23. data/ext/pk11_const.c +205 -0
  24. data/ext/pk11_const_def.inc +452 -0
  25. data/ext/pk11_const_macros.h +38 -0
  26. data/ext/pk11_struct.doc +792 -0
  27. data/ext/pk11_struct_def.inc +302 -0
  28. data/ext/pk11_struct_impl.inc +302 -0
  29. data/ext/pk11_struct_macros.h +435 -0
  30. data/ext/pk11_thread_funcs.c +411 -0
  31. data/ext/pk11_thread_funcs.h +482 -0
  32. data/ext/pk11_version.h +6 -0
  33. data/lib/2.0/pkcs11_ext.so +0 -0
  34. data/lib/pkcs11.rb +9 -0
  35. data/lib/pkcs11/extensions.rb +68 -0
  36. data/lib/pkcs11/helper.rb +144 -0
  37. data/lib/pkcs11/library.rb +140 -0
  38. data/lib/pkcs11/object.rb +171 -0
  39. data/lib/pkcs11/session.rb +765 -0
  40. data/lib/pkcs11/slot.rb +102 -0
  41. data/pkcs11_protect_server/Manifest.txt +14 -0
  42. data/pkcs11_protect_server/README_PROTECT_SERVER.rdoc +89 -0
  43. data/test/fixtures/softokn/cert8.db +0 -0
  44. data/test/fixtures/softokn/key3.db +0 -0
  45. data/test/fixtures/softokn/secmod.db +0 -0
  46. data/test/helper.rb +58 -0
  47. data/test/test_pkcs11.rb +71 -0
  48. data/test/test_pkcs11_crypt.rb +220 -0
  49. data/test/test_pkcs11_object.rb +122 -0
  50. data/test/test_pkcs11_session.rb +123 -0
  51. data/test/test_pkcs11_slot.rb +78 -0
  52. data/test/test_pkcs11_structs.rb +166 -0
  53. data/test/test_pkcs11_thread.rb +44 -0
  54. metadata +213 -0
  55. metadata.gz.sig +0 -0
@@ -0,0 +1,125 @@
1
+ /* otp-pkcs11.h include file for the PKCS #11 Mechanisms for One-Time
2
+ Password Tokens OTPS document. */
3
+ /* $Revision: 1.6 $ */
4
+
5
+ /* License to copy and use this software is granted provided that it is
6
+ * identified as "RSA Security Inc. PKCS #11 Mechanisms for One-Time
7
+ * Password Tokens" in all material mentioning or referencing this software.
8
+ *
9
+ * RSA Security Inc. makes no representations concerning either the
10
+ * merchantability of this software or the suitability of this software for
11
+ * any particular purpose. It is provided "as is" without express or implied
12
+ * warranty of any kind.
13
+ */
14
+
15
+ /* This file is preferably included after inclusion of pkcs11.h */
16
+
17
+ #ifndef _OTP_PKCS11_H_
18
+ #define _OTP_PKCS11_H_ 1
19
+
20
+ /* Are the definitions of this file already included in pkcs11t.h? */
21
+ #ifndef CKO_OTP_KEY
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ /* A.1 Object classes */
28
+ #define CKO_OTP_KEY 0x00000008
29
+
30
+ /* A.2 Key types */
31
+ #define CKK_SECURID 0x00000022
32
+ #define CKK_HOTP 0x00000023
33
+ #define CKK_ACTI 0x00000024
34
+
35
+ /* A.3 Mechanisms */
36
+ #define CKM_SECURID_KEY_GEN 0x00000280
37
+ #define CKM_SECURID 0x00000282
38
+ #define CKM_HOTP_KEY_GEN 0x00000290
39
+ #define CKM_HOTP 0x00000291
40
+ #define CKM_ACTI 0x000002A0
41
+ #define CKM_ACTI_KEY_GEN 0x000002A1
42
+
43
+ /* A.4 Attributes */
44
+ #define CKA_OTP_FORMAT 0x00000220
45
+ #define CKA_OTP_LENGTH 0x00000221
46
+ #define CKA_OTP_TIME_INTERVAL 0x00000222
47
+ #define CKA_OTP_USER_FRIENDLY_MODE 0x00000223
48
+ #define CKA_OTP_CHALLENGE_REQUIREMENT 0x00000224
49
+ #define CKA_OTP_TIME_REQUIREMENT 0x00000225
50
+ #define CKA_OTP_COUNTER_REQUIREMENT 0x00000226
51
+ #define CKA_OTP_PIN_REQUIREMENT 0x00000227
52
+ #define CKA_OTP_COUNTER 0x0000022E
53
+ #define CKA_OTP_TIME 0x0000022F
54
+ #define CKA_OTP_USER_IDENTIFIER 0x0000022A
55
+ #define CKA_OTP_SERVICE_IDENTIFIER 0x0000022B
56
+ #define CKA_OTP_SERVICE_LOGO 0x0000022C
57
+ #define CKA_OTP_SERVICE_LOGO_TYPE 0x0000022D
58
+
59
+ /* A.5 Attribute constants */
60
+ #define CK_OTP_FORMAT_DECIMAL 0
61
+ #define CK_OTP_FORMAT_HEXADECIMAL 1
62
+ #define CK_OTP_FORMAT_ALPHANUMERIC 2
63
+ #define CK_OTP_FORMAT_BINARY 3
64
+
65
+ #define CK_OTP_PARAM_IGNORED 0
66
+ #define CK_OTP_PARAM_OPTIONAL 1
67
+ #define CK_OTP_PARAM_MANDATORY 2
68
+
69
+ /* A.6 Other constants */
70
+ #define CK_OTP_VALUE 0
71
+ #define CK_OTP_PIN 1
72
+ #define CK_OTP_CHALLENGE 2
73
+ #define CK_OTP_TIME 3
74
+ #define CK_OTP_COUNTER 4
75
+ #define CK_OTP_FLAGS 5
76
+ #define CK_OTP_OUTPUT_LENGTH 6
77
+ #define CK_OTP_OUTPUT_FORMAT 7
78
+
79
+ #define CKF_NEXT_OTP 0x00000001
80
+ #define CKF_EXCLUDE_TIME 0x00000002
81
+ #define CKF_EXCLUDE_COUNTER 0x00000004
82
+ #define CKF_EXCLUDE_CHALLENGE 0x00000008
83
+ #define CKF_EXCLUDE_PIN 0x00000010
84
+ #define CKF_USER_FRIENDLY_OTP 0x00000020
85
+
86
+ /* A.7 Notifications */
87
+ #define CKN_OTP_CHANGED 1
88
+
89
+ /* A.8 Return values */
90
+ #define CKR_NEW_PIN_MODE 0x000001B0
91
+ #define CKR_NEXT_OTP 0x000001B1
92
+
93
+ /* Structs */
94
+ typedef CK_ULONG CK_OTP_PARAM_TYPE;
95
+ typedef CK_OTP_PARAM_TYPE CK_PARAM_TYPE; /* B/w compatibility */
96
+
97
+ typedef struct CK_OTP_PARAM {
98
+ CK_OTP_PARAM_TYPE type;
99
+ CK_VOID_PTR pValue;
100
+ CK_ULONG ulValueLen;
101
+ } CK_OTP_PARAM;
102
+
103
+ typedef CK_OTP_PARAM CK_PTR CK_OTP_PARAM_PTR;
104
+
105
+ typedef struct CK_OTP_PARAMS {
106
+ CK_OTP_PARAM_PTR pParams;
107
+ CK_ULONG ulCount;
108
+ } CK_OTP_PARAMS;
109
+
110
+ typedef CK_OTP_PARAMS CK_PTR CK_OTP_PARAMS_PTR;
111
+
112
+ typedef struct CK_OTP_SIGNATURE_INFO {
113
+ CK_OTP_PARAM_PTR pParams;
114
+ CK_ULONG ulCount;
115
+ } CK_OTP_SIGNATURE_INFO;
116
+
117
+ typedef CK_OTP_SIGNATURE_INFO CK_PTR CK_OTP_SIGNATURE_INFO_PTR;
118
+
119
+ #ifdef __cplusplus
120
+ }
121
+ #endif
122
+
123
+ #endif
124
+
125
+ #endif
@@ -0,0 +1,124 @@
1
+ /* pkcs-11v2-20a3.h include file for the PKCS #11 Version 2.20 Amendment 3
2
+ document. */
3
+
4
+ /* $Revision: 1.4 $ */
5
+
6
+ /* License to copy and use this software is granted provided that it is
7
+ * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
8
+ * (Cryptoki) Version 2.20 Amendment 3" in all material mentioning or
9
+ * referencing this software.
10
+
11
+ * RSA Security Inc. makes no representations concerning either the
12
+ * merchantability of this software or the suitability of this software for
13
+ * any particular purpose. It is provided "as is" without express or implied
14
+ * warranty of any kind.
15
+ */
16
+
17
+ /* This file is preferably included after inclusion of pkcs11.h */
18
+
19
+ #ifndef _PKCS_11V2_20A3_H_
20
+ #define _PKCS_11V2_20A3_H_ 1
21
+
22
+ /* Are the definitions of this file already included in pkcs11t.h ? */
23
+ #ifndef CKK_CAMELLIA
24
+
25
+ #ifdef __cplusplus
26
+ extern "C" {
27
+ #endif
28
+
29
+ /* Key types */
30
+
31
+ /* Camellia is new for PKCS #11 v2.20 amendment 3 */
32
+ #define CKK_CAMELLIA 0x00000025
33
+ /* ARIA is new for PKCS #11 v2.20 amendment 3 */
34
+ #define CKK_ARIA 0x00000026
35
+
36
+
37
+ /* Mask-generating functions */
38
+
39
+ /* SHA-224 is new for PKCS #11 v2.20 amendment 3 */
40
+ #define CKG_MGF1_SHA224 0x00000005
41
+
42
+
43
+ /* Mechanism Identifiers */
44
+
45
+ /* SHA-224 is new for PKCS #11 v2.20 amendment 3 */
46
+ #define CKM_SHA224 0x00000255
47
+ #define CKM_SHA224_HMAC 0x00000256
48
+ #define CKM_SHA224_HMAC_GENERAL 0x00000257
49
+
50
+ /* SHA-224 key derivation is new for PKCS #11 v2.20 amendment 3 */
51
+ #define CKM_SHA224_KEY_DERIVATION 0x00000396
52
+
53
+ /* SHA-224 RSA mechanisms are new for PKCS #11 v2.20 amendment 3 */
54
+ #define CKM_SHA224_RSA_PKCS 0x00000046
55
+ #define CKM_SHA224_RSA_PKCS_PSS 0x00000047
56
+
57
+ /* AES counter mode is new for PKCS #11 v2.20 amendment 3 */
58
+ #define CKM_AES_CTR 0x00001086
59
+
60
+ /* Camellia is new for PKCS #11 v2.20 amendment 3 */
61
+ #define CKM_CAMELLIA_KEY_GEN 0x00000550
62
+ #define CKM_CAMELLIA_ECB 0x00000551
63
+ #define CKM_CAMELLIA_CBC 0x00000552
64
+ #define CKM_CAMELLIA_MAC 0x00000553
65
+ #define CKM_CAMELLIA_MAC_GENERAL 0x00000554
66
+ #define CKM_CAMELLIA_CBC_PAD 0x00000555
67
+ #define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556
68
+ #define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557
69
+ #define CKM_CAMELLIA_CTR 0x00000558
70
+
71
+ /* ARIA is new for PKCS #11 v2.20 amendment 3 */
72
+ #define CKM_ARIA_KEY_GEN 0x00000560
73
+ #define CKM_ARIA_ECB 0x00000561
74
+ #define CKM_ARIA_CBC 0x00000562
75
+ #define CKM_ARIA_MAC 0x00000563
76
+ #define CKM_ARIA_MAC_GENERAL 0x00000564
77
+ #define CKM_ARIA_CBC_PAD 0x00000565
78
+ #define CKM_ARIA_ECB_ENCRYPT_DATA 0x00000566
79
+ #define CKM_ARIA_CBC_ENCRYPT_DATA 0x00000567
80
+
81
+
82
+ /* Mechanism parameters */
83
+
84
+ /* CK_AES_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */
85
+ typedef struct CK_AES_CTR_PARAMS {
86
+ CK_ULONG ulCounterBits;
87
+ CK_BYTE cb[16];
88
+ } CK_AES_CTR_PARAMS;
89
+
90
+ typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR;
91
+
92
+ /* CK_CAMELLIA_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */
93
+ typedef struct CK_CAMELLIA_CTR_PARAMS {
94
+ CK_ULONG ulCounterBits;
95
+ CK_BYTE cb[16];
96
+ } CK_CAMELLIA_CTR_PARAMS;
97
+
98
+ typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR;
99
+
100
+ /* CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */
101
+ typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS {
102
+ CK_BYTE iv[16];
103
+ CK_BYTE_PTR pData;
104
+ CK_ULONG length;
105
+ } CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS;
106
+
107
+ typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR;
108
+
109
+ /* CK_ARIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */
110
+ typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS {
111
+ CK_BYTE iv[16];
112
+ CK_BYTE_PTR pData;
113
+ CK_ULONG length;
114
+ } CK_ARIA_CBC_ENCRYPT_DATA_PARAMS;
115
+
116
+ typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR;
117
+
118
+ #ifdef __cplusplus
119
+ }
120
+ #endif
121
+
122
+ #endif
123
+
124
+ #endif
@@ -0,0 +1,299 @@
1
+ /* pkcs11.h include file for PKCS #11. */
2
+ /* $Revision: 1.4 $ */
3
+
4
+ /* License to copy and use this software is granted provided that it is
5
+ * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
6
+ * (Cryptoki)" in all material mentioning or referencing this software.
7
+
8
+ * License is also granted to make and use derivative works provided that
9
+ * such works are identified as "derived from the RSA Security Inc. PKCS #11
10
+ * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
11
+ * referencing the derived work.
12
+
13
+ * RSA Security Inc. makes no representations concerning either the
14
+ * merchantability of this software or the suitability of this software for
15
+ * any particular purpose. It is provided "as is" without express or implied
16
+ * warranty of any kind.
17
+ */
18
+
19
+ #ifndef _PKCS11_H_
20
+ #define _PKCS11_H_ 1
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif
25
+
26
+ /* Before including this file (pkcs11.h) (or pkcs11t.h by
27
+ * itself), 6 platform-specific macros must be defined. These
28
+ * macros are described below, and typical definitions for them
29
+ * are also given. Be advised that these definitions can depend
30
+ * on both the platform and the compiler used (and possibly also
31
+ * on whether a Cryptoki library is linked statically or
32
+ * dynamically).
33
+ *
34
+ * In addition to defining these 6 macros, the packing convention
35
+ * for Cryptoki structures should be set. The Cryptoki
36
+ * convention on packing is that structures should be 1-byte
37
+ * aligned.
38
+ *
39
+ * If you're using Microsoft Developer Studio 5.0 to produce
40
+ * Win32 stuff, this might be done by using the following
41
+ * preprocessor directive before including pkcs11.h or pkcs11t.h:
42
+ *
43
+ * #pragma pack(push, cryptoki, 1)
44
+ *
45
+ * and using the following preprocessor directive after including
46
+ * pkcs11.h or pkcs11t.h:
47
+ *
48
+ * #pragma pack(pop, cryptoki)
49
+ *
50
+ * If you're using an earlier version of Microsoft Developer
51
+ * Studio to produce Win16 stuff, this might be done by using
52
+ * the following preprocessor directive before including
53
+ * pkcs11.h or pkcs11t.h:
54
+ *
55
+ * #pragma pack(1)
56
+ *
57
+ * In a UNIX environment, you're on your own for this. You might
58
+ * not need to do (or be able to do!) anything.
59
+ *
60
+ *
61
+ * Now for the macros:
62
+ *
63
+ *
64
+ * 1. CK_PTR: The indirection string for making a pointer to an
65
+ * object. It can be used like this:
66
+ *
67
+ * typedef CK_BYTE CK_PTR CK_BYTE_PTR;
68
+ *
69
+ * If you're using Microsoft Developer Studio 5.0 to produce
70
+ * Win32 stuff, it might be defined by:
71
+ *
72
+ * #define CK_PTR *
73
+ *
74
+ * If you're using an earlier version of Microsoft Developer
75
+ * Studio to produce Win16 stuff, it might be defined by:
76
+ *
77
+ * #define CK_PTR far *
78
+ *
79
+ * In a typical UNIX environment, it might be defined by:
80
+ *
81
+ * #define CK_PTR *
82
+ *
83
+ *
84
+ * 2. CK_DEFINE_FUNCTION(returnType, name): A macro which makes
85
+ * an exportable Cryptoki library function definition out of a
86
+ * return type and a function name. It should be used in the
87
+ * following fashion to define the exposed Cryptoki functions in
88
+ * a Cryptoki library:
89
+ *
90
+ * CK_DEFINE_FUNCTION(CK_RV, C_Initialize)(
91
+ * CK_VOID_PTR pReserved
92
+ * )
93
+ * {
94
+ * ...
95
+ * }
96
+ *
97
+ * If you're using Microsoft Developer Studio 5.0 to define a
98
+ * function in a Win32 Cryptoki .dll, it might be defined by:
99
+ *
100
+ * #define CK_DEFINE_FUNCTION(returnType, name) \
101
+ * returnType __declspec(dllexport) name
102
+ *
103
+ * If you're using an earlier version of Microsoft Developer
104
+ * Studio to define a function in a Win16 Cryptoki .dll, it
105
+ * might be defined by:
106
+ *
107
+ * #define CK_DEFINE_FUNCTION(returnType, name) \
108
+ * returnType __export _far _pascal name
109
+ *
110
+ * In a UNIX environment, it might be defined by:
111
+ *
112
+ * #define CK_DEFINE_FUNCTION(returnType, name) \
113
+ * returnType name
114
+ *
115
+ *
116
+ * 3. CK_DECLARE_FUNCTION(returnType, name): A macro which makes
117
+ * an importable Cryptoki library function declaration out of a
118
+ * return type and a function name. It should be used in the
119
+ * following fashion:
120
+ *
121
+ * extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)(
122
+ * CK_VOID_PTR pReserved
123
+ * );
124
+ *
125
+ * If you're using Microsoft Developer Studio 5.0 to declare a
126
+ * function in a Win32 Cryptoki .dll, it might be defined by:
127
+ *
128
+ * #define CK_DECLARE_FUNCTION(returnType, name) \
129
+ * returnType __declspec(dllimport) name
130
+ *
131
+ * If you're using an earlier version of Microsoft Developer
132
+ * Studio to declare a function in a Win16 Cryptoki .dll, it
133
+ * might be defined by:
134
+ *
135
+ * #define CK_DECLARE_FUNCTION(returnType, name) \
136
+ * returnType __export _far _pascal name
137
+ *
138
+ * In a UNIX environment, it might be defined by:
139
+ *
140
+ * #define CK_DECLARE_FUNCTION(returnType, name) \
141
+ * returnType name
142
+ *
143
+ *
144
+ * 4. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro
145
+ * which makes a Cryptoki API function pointer declaration or
146
+ * function pointer type declaration out of a return type and a
147
+ * function name. It should be used in the following fashion:
148
+ *
149
+ * // Define funcPtr to be a pointer to a Cryptoki API function
150
+ * // taking arguments args and returning CK_RV.
151
+ * CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args);
152
+ *
153
+ * or
154
+ *
155
+ * // Define funcPtrType to be the type of a pointer to a
156
+ * // Cryptoki API function taking arguments args and returning
157
+ * // CK_RV, and then define funcPtr to be a variable of type
158
+ * // funcPtrType.
159
+ * typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args);
160
+ * funcPtrType funcPtr;
161
+ *
162
+ * If you're using Microsoft Developer Studio 5.0 to access
163
+ * functions in a Win32 Cryptoki .dll, in might be defined by:
164
+ *
165
+ * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
166
+ * returnType __declspec(dllimport) (* name)
167
+ *
168
+ * If you're using an earlier version of Microsoft Developer
169
+ * Studio to access functions in a Win16 Cryptoki .dll, it might
170
+ * be defined by:
171
+ *
172
+ * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
173
+ * returnType __export _far _pascal (* name)
174
+ *
175
+ * In a UNIX environment, it might be defined by:
176
+ *
177
+ * #define CK_DECLARE_FUNCTION_POINTER(returnType, name) \
178
+ * returnType (* name)
179
+ *
180
+ *
181
+ * 5. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes
182
+ * a function pointer type for an application callback out of
183
+ * a return type for the callback and a name for the callback.
184
+ * It should be used in the following fashion:
185
+ *
186
+ * CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args);
187
+ *
188
+ * to declare a function pointer, myCallback, to a callback
189
+ * which takes arguments args and returns a CK_RV. It can also
190
+ * be used like this:
191
+ *
192
+ * typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args);
193
+ * myCallbackType myCallback;
194
+ *
195
+ * If you're using Microsoft Developer Studio 5.0 to do Win32
196
+ * Cryptoki development, it might be defined by:
197
+ *
198
+ * #define CK_CALLBACK_FUNCTION(returnType, name) \
199
+ * returnType (* name)
200
+ *
201
+ * If you're using an earlier version of Microsoft Developer
202
+ * Studio to do Win16 development, it might be defined by:
203
+ *
204
+ * #define CK_CALLBACK_FUNCTION(returnType, name) \
205
+ * returnType _far _pascal (* name)
206
+ *
207
+ * In a UNIX environment, it might be defined by:
208
+ *
209
+ * #define CK_CALLBACK_FUNCTION(returnType, name) \
210
+ * returnType (* name)
211
+ *
212
+ *
213
+ * 6. NULL_PTR: This macro is the value of a NULL pointer.
214
+ *
215
+ * In any ANSI/ISO C environment (and in many others as well),
216
+ * this should best be defined by
217
+ *
218
+ * #ifndef NULL_PTR
219
+ * #define NULL_PTR 0
220
+ * #endif
221
+ */
222
+
223
+
224
+ /* All the various Cryptoki types and #define'd values are in the
225
+ * file pkcs11t.h. */
226
+ #include "pkcs11t.h"
227
+
228
+ #define __PASTE(x,y) x##y
229
+
230
+
231
+ /* ==============================================================
232
+ * Define the "extern" form of all the entry points.
233
+ * ==============================================================
234
+ */
235
+
236
+ #define CK_NEED_ARG_LIST 1
237
+ #define CK_PKCS11_FUNCTION_INFO(name) \
238
+ extern CK_DECLARE_FUNCTION(CK_RV, name)
239
+
240
+ /* pkcs11f.h has all the information about the Cryptoki
241
+ * function prototypes. */
242
+ #include "pkcs11f.h"
243
+
244
+ #undef CK_NEED_ARG_LIST
245
+ #undef CK_PKCS11_FUNCTION_INFO
246
+
247
+
248
+ /* ==============================================================
249
+ * Define the typedef form of all the entry points. That is, for
250
+ * each Cryptoki function C_XXX, define a type CK_C_XXX which is
251
+ * a pointer to that kind of function.
252
+ * ==============================================================
253
+ */
254
+
255
+ #define CK_NEED_ARG_LIST 1
256
+ #define CK_PKCS11_FUNCTION_INFO(name) \
257
+ typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))
258
+
259
+ /* pkcs11f.h has all the information about the Cryptoki
260
+ * function prototypes. */
261
+ #include "pkcs11f.h"
262
+
263
+ #undef CK_NEED_ARG_LIST
264
+ #undef CK_PKCS11_FUNCTION_INFO
265
+
266
+
267
+ /* ==============================================================
268
+ * Define structed vector of entry points. A CK_FUNCTION_LIST
269
+ * contains a CK_VERSION indicating a library's Cryptoki version
270
+ * and then a whole slew of function pointers to the routines in
271
+ * the library. This type was declared, but not defined, in
272
+ * pkcs11t.h.
273
+ * ==============================================================
274
+ */
275
+
276
+ #define CK_PKCS11_FUNCTION_INFO(name) \
277
+ __PASTE(CK_,name) name;
278
+
279
+ struct CK_FUNCTION_LIST {
280
+
281
+ CK_VERSION version; /* Cryptoki version */
282
+
283
+ /* Pile all the function pointers into the CK_FUNCTION_LIST. */
284
+ /* pkcs11f.h has all the information about the Cryptoki
285
+ * function prototypes. */
286
+ #include "pkcs11f.h"
287
+
288
+ };
289
+
290
+ #undef CK_PKCS11_FUNCTION_INFO
291
+
292
+
293
+ #undef __PASTE
294
+
295
+ #ifdef __cplusplus
296
+ }
297
+ #endif
298
+
299
+ #endif