pkcs11 0.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -0,0 +1,912 @@
1
+ /* pkcs11f.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
+ /* This header file contains pretty much everything about all the */
20
+ /* Cryptoki function prototypes. Because this information is */
21
+ /* used for more than just declaring function prototypes, the */
22
+ /* order of the functions appearing herein is important, and */
23
+ /* should not be altered. */
24
+
25
+ /* General-purpose */
26
+
27
+ /* C_Initialize initializes the Cryptoki library. */
28
+ CK_PKCS11_FUNCTION_INFO(C_Initialize)
29
+ #ifdef CK_NEED_ARG_LIST
30
+ (
31
+ CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets
32
+ * cast to CK_C_INITIALIZE_ARGS_PTR
33
+ * and dereferenced */
34
+ );
35
+ #endif
36
+
37
+
38
+ /* C_Finalize indicates that an application is done with the
39
+ * Cryptoki library. */
40
+ CK_PKCS11_FUNCTION_INFO(C_Finalize)
41
+ #ifdef CK_NEED_ARG_LIST
42
+ (
43
+ CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */
44
+ );
45
+ #endif
46
+
47
+
48
+ /* C_GetInfo returns general information about Cryptoki. */
49
+ CK_PKCS11_FUNCTION_INFO(C_GetInfo)
50
+ #ifdef CK_NEED_ARG_LIST
51
+ (
52
+ CK_INFO_PTR pInfo /* location that receives information */
53
+ );
54
+ #endif
55
+
56
+
57
+ /* C_GetFunctionList returns the function list. */
58
+ CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
59
+ #ifdef CK_NEED_ARG_LIST
60
+ (
61
+ CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to
62
+ * function list */
63
+ );
64
+ #endif
65
+
66
+
67
+
68
+ /* Slot and token management */
69
+
70
+ /* C_GetSlotList obtains a list of slots in the system. */
71
+ CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
72
+ #ifdef CK_NEED_ARG_LIST
73
+ (
74
+ CK_BBOOL tokenPresent, /* only slots with tokens? */
75
+ CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */
76
+ CK_ULONG_PTR pulCount /* receives number of slots */
77
+ );
78
+ #endif
79
+
80
+
81
+ /* C_GetSlotInfo obtains information about a particular slot in
82
+ * the system. */
83
+ CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
84
+ #ifdef CK_NEED_ARG_LIST
85
+ (
86
+ CK_SLOT_ID slotID, /* the ID of the slot */
87
+ CK_SLOT_INFO_PTR pInfo /* receives the slot information */
88
+ );
89
+ #endif
90
+
91
+
92
+ /* C_GetTokenInfo obtains information about a particular token
93
+ * in the system. */
94
+ CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
95
+ #ifdef CK_NEED_ARG_LIST
96
+ (
97
+ CK_SLOT_ID slotID, /* ID of the token's slot */
98
+ CK_TOKEN_INFO_PTR pInfo /* receives the token information */
99
+ );
100
+ #endif
101
+
102
+
103
+ /* C_GetMechanismList obtains a list of mechanism types
104
+ * supported by a token. */
105
+ CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
106
+ #ifdef CK_NEED_ARG_LIST
107
+ (
108
+ CK_SLOT_ID slotID, /* ID of token's slot */
109
+ CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */
110
+ CK_ULONG_PTR pulCount /* gets # of mechs. */
111
+ );
112
+ #endif
113
+
114
+
115
+ /* C_GetMechanismInfo obtains information about a particular
116
+ * mechanism possibly supported by a token. */
117
+ CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
118
+ #ifdef CK_NEED_ARG_LIST
119
+ (
120
+ CK_SLOT_ID slotID, /* ID of the token's slot */
121
+ CK_MECHANISM_TYPE type, /* type of mechanism */
122
+ CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */
123
+ );
124
+ #endif
125
+
126
+
127
+ /* C_InitToken initializes a token. */
128
+ CK_PKCS11_FUNCTION_INFO(C_InitToken)
129
+ #ifdef CK_NEED_ARG_LIST
130
+ /* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
131
+ (
132
+ CK_SLOT_ID slotID, /* ID of the token's slot */
133
+ CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */
134
+ CK_ULONG ulPinLen, /* length in bytes of the PIN */
135
+ CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */
136
+ );
137
+ #endif
138
+
139
+
140
+ /* C_InitPIN initializes the normal user's PIN. */
141
+ CK_PKCS11_FUNCTION_INFO(C_InitPIN)
142
+ #ifdef CK_NEED_ARG_LIST
143
+ (
144
+ CK_SESSION_HANDLE hSession, /* the session's handle */
145
+ CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */
146
+ CK_ULONG ulPinLen /* length in bytes of the PIN */
147
+ );
148
+ #endif
149
+
150
+
151
+ /* C_SetPIN modifies the PIN of the user who is logged in. */
152
+ CK_PKCS11_FUNCTION_INFO(C_SetPIN)
153
+ #ifdef CK_NEED_ARG_LIST
154
+ (
155
+ CK_SESSION_HANDLE hSession, /* the session's handle */
156
+ CK_UTF8CHAR_PTR pOldPin, /* the old PIN */
157
+ CK_ULONG ulOldLen, /* length of the old PIN */
158
+ CK_UTF8CHAR_PTR pNewPin, /* the new PIN */
159
+ CK_ULONG ulNewLen /* length of the new PIN */
160
+ );
161
+ #endif
162
+
163
+
164
+
165
+ /* Session management */
166
+
167
+ /* C_OpenSession opens a session between an application and a
168
+ * token. */
169
+ CK_PKCS11_FUNCTION_INFO(C_OpenSession)
170
+ #ifdef CK_NEED_ARG_LIST
171
+ (
172
+ CK_SLOT_ID slotID, /* the slot's ID */
173
+ CK_FLAGS flags, /* from CK_SESSION_INFO */
174
+ CK_VOID_PTR pApplication, /* passed to callback */
175
+ CK_NOTIFY Notify, /* callback function */
176
+ CK_SESSION_HANDLE_PTR phSession /* gets session handle */
177
+ );
178
+ #endif
179
+
180
+
181
+ /* C_CloseSession closes a session between an application and a
182
+ * token. */
183
+ CK_PKCS11_FUNCTION_INFO(C_CloseSession)
184
+ #ifdef CK_NEED_ARG_LIST
185
+ (
186
+ CK_SESSION_HANDLE hSession /* the session's handle */
187
+ );
188
+ #endif
189
+
190
+
191
+ /* C_CloseAllSessions closes all sessions with a token. */
192
+ CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
193
+ #ifdef CK_NEED_ARG_LIST
194
+ (
195
+ CK_SLOT_ID slotID /* the token's slot */
196
+ );
197
+ #endif
198
+
199
+
200
+ /* C_GetSessionInfo obtains information about the session. */
201
+ CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
202
+ #ifdef CK_NEED_ARG_LIST
203
+ (
204
+ CK_SESSION_HANDLE hSession, /* the session's handle */
205
+ CK_SESSION_INFO_PTR pInfo /* receives session info */
206
+ );
207
+ #endif
208
+
209
+
210
+ /* C_GetOperationState obtains the state of the cryptographic operation
211
+ * in a session. */
212
+ CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
213
+ #ifdef CK_NEED_ARG_LIST
214
+ (
215
+ CK_SESSION_HANDLE hSession, /* session's handle */
216
+ CK_BYTE_PTR pOperationState, /* gets state */
217
+ CK_ULONG_PTR pulOperationStateLen /* gets state length */
218
+ );
219
+ #endif
220
+
221
+
222
+ /* C_SetOperationState restores the state of the cryptographic
223
+ * operation in a session. */
224
+ CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
225
+ #ifdef CK_NEED_ARG_LIST
226
+ (
227
+ CK_SESSION_HANDLE hSession, /* session's handle */
228
+ CK_BYTE_PTR pOperationState, /* holds state */
229
+ CK_ULONG ulOperationStateLen, /* holds state length */
230
+ CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */
231
+ CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */
232
+ );
233
+ #endif
234
+
235
+
236
+ /* C_Login logs a user into a token. */
237
+ CK_PKCS11_FUNCTION_INFO(C_Login)
238
+ #ifdef CK_NEED_ARG_LIST
239
+ (
240
+ CK_SESSION_HANDLE hSession, /* the session's handle */
241
+ CK_USER_TYPE userType, /* the user type */
242
+ CK_UTF8CHAR_PTR pPin, /* the user's PIN */
243
+ CK_ULONG ulPinLen /* the length of the PIN */
244
+ );
245
+ #endif
246
+
247
+
248
+ /* C_Logout logs a user out from a token. */
249
+ CK_PKCS11_FUNCTION_INFO(C_Logout)
250
+ #ifdef CK_NEED_ARG_LIST
251
+ (
252
+ CK_SESSION_HANDLE hSession /* the session's handle */
253
+ );
254
+ #endif
255
+
256
+
257
+
258
+ /* Object management */
259
+
260
+ /* C_CreateObject creates a new object. */
261
+ CK_PKCS11_FUNCTION_INFO(C_CreateObject)
262
+ #ifdef CK_NEED_ARG_LIST
263
+ (
264
+ CK_SESSION_HANDLE hSession, /* the session's handle */
265
+ CK_ATTRIBUTE_PTR pTemplate, /* the object's template */
266
+ CK_ULONG ulCount, /* attributes in template */
267
+ CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */
268
+ );
269
+ #endif
270
+
271
+
272
+ /* C_CopyObject copies an object, creating a new object for the
273
+ * copy. */
274
+ CK_PKCS11_FUNCTION_INFO(C_CopyObject)
275
+ #ifdef CK_NEED_ARG_LIST
276
+ (
277
+ CK_SESSION_HANDLE hSession, /* the session's handle */
278
+ CK_OBJECT_HANDLE hObject, /* the object's handle */
279
+ CK_ATTRIBUTE_PTR pTemplate, /* template for new object */
280
+ CK_ULONG ulCount, /* attributes in template */
281
+ CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */
282
+ );
283
+ #endif
284
+
285
+
286
+ /* C_DestroyObject destroys an object. */
287
+ CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
288
+ #ifdef CK_NEED_ARG_LIST
289
+ (
290
+ CK_SESSION_HANDLE hSession, /* the session's handle */
291
+ CK_OBJECT_HANDLE hObject /* the object's handle */
292
+ );
293
+ #endif
294
+
295
+
296
+ /* C_GetObjectSize gets the size of an object in bytes. */
297
+ CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
298
+ #ifdef CK_NEED_ARG_LIST
299
+ (
300
+ CK_SESSION_HANDLE hSession, /* the session's handle */
301
+ CK_OBJECT_HANDLE hObject, /* the object's handle */
302
+ CK_ULONG_PTR pulSize /* receives size of object */
303
+ );
304
+ #endif
305
+
306
+
307
+ /* C_GetAttributeValue obtains the value of one or more object
308
+ * attributes. */
309
+ CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
310
+ #ifdef CK_NEED_ARG_LIST
311
+ (
312
+ CK_SESSION_HANDLE hSession, /* the session's handle */
313
+ CK_OBJECT_HANDLE hObject, /* the object's handle */
314
+ CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */
315
+ CK_ULONG ulCount /* attributes in template */
316
+ );
317
+ #endif
318
+
319
+
320
+ /* C_SetAttributeValue modifies the value of one or more object
321
+ * attributes */
322
+ CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
323
+ #ifdef CK_NEED_ARG_LIST
324
+ (
325
+ CK_SESSION_HANDLE hSession, /* the session's handle */
326
+ CK_OBJECT_HANDLE hObject, /* the object's handle */
327
+ CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */
328
+ CK_ULONG ulCount /* attributes in template */
329
+ );
330
+ #endif
331
+
332
+
333
+ /* C_FindObjectsInit initializes a search for token and session
334
+ * objects that match a template. */
335
+ CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
336
+ #ifdef CK_NEED_ARG_LIST
337
+ (
338
+ CK_SESSION_HANDLE hSession, /* the session's handle */
339
+ CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */
340
+ CK_ULONG ulCount /* attrs in search template */
341
+ );
342
+ #endif
343
+
344
+
345
+ /* C_FindObjects continues a search for token and session
346
+ * objects that match a template, obtaining additional object
347
+ * handles. */
348
+ CK_PKCS11_FUNCTION_INFO(C_FindObjects)
349
+ #ifdef CK_NEED_ARG_LIST
350
+ (
351
+ CK_SESSION_HANDLE hSession, /* session's handle */
352
+ CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */
353
+ CK_ULONG ulMaxObjectCount, /* max handles to get */
354
+ CK_ULONG_PTR pulObjectCount /* actual # returned */
355
+ );
356
+ #endif
357
+
358
+
359
+ /* C_FindObjectsFinal finishes a search for token and session
360
+ * objects. */
361
+ CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
362
+ #ifdef CK_NEED_ARG_LIST
363
+ (
364
+ CK_SESSION_HANDLE hSession /* the session's handle */
365
+ );
366
+ #endif
367
+
368
+
369
+
370
+ /* Encryption and decryption */
371
+
372
+ /* C_EncryptInit initializes an encryption operation. */
373
+ CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
374
+ #ifdef CK_NEED_ARG_LIST
375
+ (
376
+ CK_SESSION_HANDLE hSession, /* the session's handle */
377
+ CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */
378
+ CK_OBJECT_HANDLE hKey /* handle of encryption key */
379
+ );
380
+ #endif
381
+
382
+
383
+ /* C_Encrypt encrypts single-part data. */
384
+ CK_PKCS11_FUNCTION_INFO(C_Encrypt)
385
+ #ifdef CK_NEED_ARG_LIST
386
+ (
387
+ CK_SESSION_HANDLE hSession, /* session's handle */
388
+ CK_BYTE_PTR pData, /* the plaintext data */
389
+ CK_ULONG ulDataLen, /* bytes of plaintext */
390
+ CK_BYTE_PTR pEncryptedData, /* gets ciphertext */
391
+ CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */
392
+ );
393
+ #endif
394
+
395
+
396
+ /* C_EncryptUpdate continues a multiple-part encryption
397
+ * operation. */
398
+ CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
399
+ #ifdef CK_NEED_ARG_LIST
400
+ (
401
+ CK_SESSION_HANDLE hSession, /* session's handle */
402
+ CK_BYTE_PTR pPart, /* the plaintext data */
403
+ CK_ULONG ulPartLen, /* plaintext data len */
404
+ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
405
+ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */
406
+ );
407
+ #endif
408
+
409
+
410
+ /* C_EncryptFinal finishes a multiple-part encryption
411
+ * operation. */
412
+ CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
413
+ #ifdef CK_NEED_ARG_LIST
414
+ (
415
+ CK_SESSION_HANDLE hSession, /* session handle */
416
+ CK_BYTE_PTR pLastEncryptedPart, /* last c-text */
417
+ CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */
418
+ );
419
+ #endif
420
+
421
+
422
+ /* C_DecryptInit initializes a decryption operation. */
423
+ CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
424
+ #ifdef CK_NEED_ARG_LIST
425
+ (
426
+ CK_SESSION_HANDLE hSession, /* the session's handle */
427
+ CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */
428
+ CK_OBJECT_HANDLE hKey /* handle of decryption key */
429
+ );
430
+ #endif
431
+
432
+
433
+ /* C_Decrypt decrypts encrypted data in a single part. */
434
+ CK_PKCS11_FUNCTION_INFO(C_Decrypt)
435
+ #ifdef CK_NEED_ARG_LIST
436
+ (
437
+ CK_SESSION_HANDLE hSession, /* session's handle */
438
+ CK_BYTE_PTR pEncryptedData, /* ciphertext */
439
+ CK_ULONG ulEncryptedDataLen, /* ciphertext length */
440
+ CK_BYTE_PTR pData, /* gets plaintext */
441
+ CK_ULONG_PTR pulDataLen /* gets p-text size */
442
+ );
443
+ #endif
444
+
445
+
446
+ /* C_DecryptUpdate continues a multiple-part decryption
447
+ * operation. */
448
+ CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
449
+ #ifdef CK_NEED_ARG_LIST
450
+ (
451
+ CK_SESSION_HANDLE hSession, /* session's handle */
452
+ CK_BYTE_PTR pEncryptedPart, /* encrypted data */
453
+ CK_ULONG ulEncryptedPartLen, /* input length */
454
+ CK_BYTE_PTR pPart, /* gets plaintext */
455
+ CK_ULONG_PTR pulPartLen /* p-text size */
456
+ );
457
+ #endif
458
+
459
+
460
+ /* C_DecryptFinal finishes a multiple-part decryption
461
+ * operation. */
462
+ CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
463
+ #ifdef CK_NEED_ARG_LIST
464
+ (
465
+ CK_SESSION_HANDLE hSession, /* the session's handle */
466
+ CK_BYTE_PTR pLastPart, /* gets plaintext */
467
+ CK_ULONG_PTR pulLastPartLen /* p-text size */
468
+ );
469
+ #endif
470
+
471
+
472
+
473
+ /* Message digesting */
474
+
475
+ /* C_DigestInit initializes a message-digesting operation. */
476
+ CK_PKCS11_FUNCTION_INFO(C_DigestInit)
477
+ #ifdef CK_NEED_ARG_LIST
478
+ (
479
+ CK_SESSION_HANDLE hSession, /* the session's handle */
480
+ CK_MECHANISM_PTR pMechanism /* the digesting mechanism */
481
+ );
482
+ #endif
483
+
484
+
485
+ /* C_Digest digests data in a single part. */
486
+ CK_PKCS11_FUNCTION_INFO(C_Digest)
487
+ #ifdef CK_NEED_ARG_LIST
488
+ (
489
+ CK_SESSION_HANDLE hSession, /* the session's handle */
490
+ CK_BYTE_PTR pData, /* data to be digested */
491
+ CK_ULONG ulDataLen, /* bytes of data to digest */
492
+ CK_BYTE_PTR pDigest, /* gets the message digest */
493
+ CK_ULONG_PTR pulDigestLen /* gets digest length */
494
+ );
495
+ #endif
496
+
497
+
498
+ /* C_DigestUpdate continues a multiple-part message-digesting
499
+ * operation. */
500
+ CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
501
+ #ifdef CK_NEED_ARG_LIST
502
+ (
503
+ CK_SESSION_HANDLE hSession, /* the session's handle */
504
+ CK_BYTE_PTR pPart, /* data to be digested */
505
+ CK_ULONG ulPartLen /* bytes of data to be digested */
506
+ );
507
+ #endif
508
+
509
+
510
+ /* C_DigestKey continues a multi-part message-digesting
511
+ * operation, by digesting the value of a secret key as part of
512
+ * the data already digested. */
513
+ CK_PKCS11_FUNCTION_INFO(C_DigestKey)
514
+ #ifdef CK_NEED_ARG_LIST
515
+ (
516
+ CK_SESSION_HANDLE hSession, /* the session's handle */
517
+ CK_OBJECT_HANDLE hKey /* secret key to digest */
518
+ );
519
+ #endif
520
+
521
+
522
+ /* C_DigestFinal finishes a multiple-part message-digesting
523
+ * operation. */
524
+ CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
525
+ #ifdef CK_NEED_ARG_LIST
526
+ (
527
+ CK_SESSION_HANDLE hSession, /* the session's handle */
528
+ CK_BYTE_PTR pDigest, /* gets the message digest */
529
+ CK_ULONG_PTR pulDigestLen /* gets byte count of digest */
530
+ );
531
+ #endif
532
+
533
+
534
+
535
+ /* Signing and MACing */
536
+
537
+ /* C_SignInit initializes a signature (private key encryption)
538
+ * operation, where the signature is (will be) an appendix to
539
+ * the data, and plaintext cannot be recovered from the
540
+ *signature. */
541
+ CK_PKCS11_FUNCTION_INFO(C_SignInit)
542
+ #ifdef CK_NEED_ARG_LIST
543
+ (
544
+ CK_SESSION_HANDLE hSession, /* the session's handle */
545
+ CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
546
+ CK_OBJECT_HANDLE hKey /* handle of signature key */
547
+ );
548
+ #endif
549
+
550
+
551
+ /* C_Sign signs (encrypts with private key) data in a single
552
+ * part, where the signature is (will be) an appendix to the
553
+ * data, and plaintext cannot be recovered from the signature. */
554
+ CK_PKCS11_FUNCTION_INFO(C_Sign)
555
+ #ifdef CK_NEED_ARG_LIST
556
+ (
557
+ CK_SESSION_HANDLE hSession, /* the session's handle */
558
+ CK_BYTE_PTR pData, /* the data to sign */
559
+ CK_ULONG ulDataLen, /* count of bytes to sign */
560
+ CK_BYTE_PTR pSignature, /* gets the signature */
561
+ CK_ULONG_PTR pulSignatureLen /* gets signature length */
562
+ );
563
+ #endif
564
+
565
+
566
+ /* C_SignUpdate continues a multiple-part signature operation,
567
+ * where the signature is (will be) an appendix to the data,
568
+ * and plaintext cannot be recovered from the signature. */
569
+ CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
570
+ #ifdef CK_NEED_ARG_LIST
571
+ (
572
+ CK_SESSION_HANDLE hSession, /* the session's handle */
573
+ CK_BYTE_PTR pPart, /* the data to sign */
574
+ CK_ULONG ulPartLen /* count of bytes to sign */
575
+ );
576
+ #endif
577
+
578
+
579
+ /* C_SignFinal finishes a multiple-part signature operation,
580
+ * returning the signature. */
581
+ CK_PKCS11_FUNCTION_INFO(C_SignFinal)
582
+ #ifdef CK_NEED_ARG_LIST
583
+ (
584
+ CK_SESSION_HANDLE hSession, /* the session's handle */
585
+ CK_BYTE_PTR pSignature, /* gets the signature */
586
+ CK_ULONG_PTR pulSignatureLen /* gets signature length */
587
+ );
588
+ #endif
589
+
590
+
591
+ /* C_SignRecoverInit initializes a signature operation, where
592
+ * the data can be recovered from the signature. */
593
+ CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
594
+ #ifdef CK_NEED_ARG_LIST
595
+ (
596
+ CK_SESSION_HANDLE hSession, /* the session's handle */
597
+ CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
598
+ CK_OBJECT_HANDLE hKey /* handle of the signature key */
599
+ );
600
+ #endif
601
+
602
+
603
+ /* C_SignRecover signs data in a single operation, where the
604
+ * data can be recovered from the signature. */
605
+ CK_PKCS11_FUNCTION_INFO(C_SignRecover)
606
+ #ifdef CK_NEED_ARG_LIST
607
+ (
608
+ CK_SESSION_HANDLE hSession, /* the session's handle */
609
+ CK_BYTE_PTR pData, /* the data to sign */
610
+ CK_ULONG ulDataLen, /* count of bytes to sign */
611
+ CK_BYTE_PTR pSignature, /* gets the signature */
612
+ CK_ULONG_PTR pulSignatureLen /* gets signature length */
613
+ );
614
+ #endif
615
+
616
+
617
+
618
+ /* Verifying signatures and MACs */
619
+
620
+ /* C_VerifyInit initializes a verification operation, where the
621
+ * signature is an appendix to the data, and plaintext cannot
622
+ * cannot be recovered from the signature (e.g. DSA). */
623
+ CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
624
+ #ifdef CK_NEED_ARG_LIST
625
+ (
626
+ CK_SESSION_HANDLE hSession, /* the session's handle */
627
+ CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
628
+ CK_OBJECT_HANDLE hKey /* verification key */
629
+ );
630
+ #endif
631
+
632
+
633
+ /* C_Verify verifies a signature in a single-part operation,
634
+ * where the signature is an appendix to the data, and plaintext
635
+ * cannot be recovered from the signature. */
636
+ CK_PKCS11_FUNCTION_INFO(C_Verify)
637
+ #ifdef CK_NEED_ARG_LIST
638
+ (
639
+ CK_SESSION_HANDLE hSession, /* the session's handle */
640
+ CK_BYTE_PTR pData, /* signed data */
641
+ CK_ULONG ulDataLen, /* length of signed data */
642
+ CK_BYTE_PTR pSignature, /* signature */
643
+ CK_ULONG ulSignatureLen /* signature length*/
644
+ );
645
+ #endif
646
+
647
+
648
+ /* C_VerifyUpdate continues a multiple-part verification
649
+ * operation, where the signature is an appendix to the data,
650
+ * and plaintext cannot be recovered from the signature. */
651
+ CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
652
+ #ifdef CK_NEED_ARG_LIST
653
+ (
654
+ CK_SESSION_HANDLE hSession, /* the session's handle */
655
+ CK_BYTE_PTR pPart, /* signed data */
656
+ CK_ULONG ulPartLen /* length of signed data */
657
+ );
658
+ #endif
659
+
660
+
661
+ /* C_VerifyFinal finishes a multiple-part verification
662
+ * operation, checking the signature. */
663
+ CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
664
+ #ifdef CK_NEED_ARG_LIST
665
+ (
666
+ CK_SESSION_HANDLE hSession, /* the session's handle */
667
+ CK_BYTE_PTR pSignature, /* signature to verify */
668
+ CK_ULONG ulSignatureLen /* signature length */
669
+ );
670
+ #endif
671
+
672
+
673
+ /* C_VerifyRecoverInit initializes a signature verification
674
+ * operation, where the data is recovered from the signature. */
675
+ CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
676
+ #ifdef CK_NEED_ARG_LIST
677
+ (
678
+ CK_SESSION_HANDLE hSession, /* the session's handle */
679
+ CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
680
+ CK_OBJECT_HANDLE hKey /* verification key */
681
+ );
682
+ #endif
683
+
684
+
685
+ /* C_VerifyRecover verifies a signature in a single-part
686
+ * operation, where the data is recovered from the signature. */
687
+ CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
688
+ #ifdef CK_NEED_ARG_LIST
689
+ (
690
+ CK_SESSION_HANDLE hSession, /* the session's handle */
691
+ CK_BYTE_PTR pSignature, /* signature to verify */
692
+ CK_ULONG ulSignatureLen, /* signature length */
693
+ CK_BYTE_PTR pData, /* gets signed data */
694
+ CK_ULONG_PTR pulDataLen /* gets signed data len */
695
+ );
696
+ #endif
697
+
698
+
699
+
700
+ /* Dual-function cryptographic operations */
701
+
702
+ /* C_DigestEncryptUpdate continues a multiple-part digesting
703
+ * and encryption operation. */
704
+ CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
705
+ #ifdef CK_NEED_ARG_LIST
706
+ (
707
+ CK_SESSION_HANDLE hSession, /* session's handle */
708
+ CK_BYTE_PTR pPart, /* the plaintext data */
709
+ CK_ULONG ulPartLen, /* plaintext length */
710
+ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
711
+ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
712
+ );
713
+ #endif
714
+
715
+
716
+ /* C_DecryptDigestUpdate continues a multiple-part decryption and
717
+ * digesting operation. */
718
+ CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
719
+ #ifdef CK_NEED_ARG_LIST
720
+ (
721
+ CK_SESSION_HANDLE hSession, /* session's handle */
722
+ CK_BYTE_PTR pEncryptedPart, /* ciphertext */
723
+ CK_ULONG ulEncryptedPartLen, /* ciphertext length */
724
+ CK_BYTE_PTR pPart, /* gets plaintext */
725
+ CK_ULONG_PTR pulPartLen /* gets plaintext len */
726
+ );
727
+ #endif
728
+
729
+
730
+ /* C_SignEncryptUpdate continues a multiple-part signing and
731
+ * encryption operation. */
732
+ CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
733
+ #ifdef CK_NEED_ARG_LIST
734
+ (
735
+ CK_SESSION_HANDLE hSession, /* session's handle */
736
+ CK_BYTE_PTR pPart, /* the plaintext data */
737
+ CK_ULONG ulPartLen, /* plaintext length */
738
+ CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
739
+ CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
740
+ );
741
+ #endif
742
+
743
+
744
+ /* C_DecryptVerifyUpdate continues a multiple-part decryption and
745
+ * verify operation. */
746
+ CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
747
+ #ifdef CK_NEED_ARG_LIST
748
+ (
749
+ CK_SESSION_HANDLE hSession, /* session's handle */
750
+ CK_BYTE_PTR pEncryptedPart, /* ciphertext */
751
+ CK_ULONG ulEncryptedPartLen, /* ciphertext length */
752
+ CK_BYTE_PTR pPart, /* gets plaintext */
753
+ CK_ULONG_PTR pulPartLen /* gets p-text length */
754
+ );
755
+ #endif
756
+
757
+
758
+
759
+ /* Key management */
760
+
761
+ /* C_GenerateKey generates a secret key, creating a new key
762
+ * object. */
763
+ CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
764
+ #ifdef CK_NEED_ARG_LIST
765
+ (
766
+ CK_SESSION_HANDLE hSession, /* the session's handle */
767
+ CK_MECHANISM_PTR pMechanism, /* key generation mech. */
768
+ CK_ATTRIBUTE_PTR pTemplate, /* template for new key */
769
+ CK_ULONG ulCount, /* # of attrs in template */
770
+ CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */
771
+ );
772
+ #endif
773
+
774
+
775
+ /* C_GenerateKeyPair generates a public-key/private-key pair,
776
+ * creating new key objects. */
777
+ CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
778
+ #ifdef CK_NEED_ARG_LIST
779
+ (
780
+ CK_SESSION_HANDLE hSession, /* session
781
+ * handle */
782
+ CK_MECHANISM_PTR pMechanism, /* key-gen
783
+ * mech. */
784
+ CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template
785
+ * for pub.
786
+ * key */
787
+ CK_ULONG ulPublicKeyAttributeCount, /* # pub.
788
+ * attrs. */
789
+ CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template
790
+ * for priv.
791
+ * key */
792
+ CK_ULONG ulPrivateKeyAttributeCount, /* # priv.
793
+ * attrs. */
794
+ CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub.
795
+ * key
796
+ * handle */
797
+ CK_OBJECT_HANDLE_PTR phPrivateKey /* gets
798
+ * priv. key
799
+ * handle */
800
+ );
801
+ #endif
802
+
803
+
804
+ /* C_WrapKey wraps (i.e., encrypts) a key. */
805
+ CK_PKCS11_FUNCTION_INFO(C_WrapKey)
806
+ #ifdef CK_NEED_ARG_LIST
807
+ (
808
+ CK_SESSION_HANDLE hSession, /* the session's handle */
809
+ CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */
810
+ CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */
811
+ CK_OBJECT_HANDLE hKey, /* key to be wrapped */
812
+ CK_BYTE_PTR pWrappedKey, /* gets wrapped key */
813
+ CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */
814
+ );
815
+ #endif
816
+
817
+
818
+ /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
819
+ * key object. */
820
+ CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
821
+ #ifdef CK_NEED_ARG_LIST
822
+ (
823
+ CK_SESSION_HANDLE hSession, /* session's handle */
824
+ CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */
825
+ CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */
826
+ CK_BYTE_PTR pWrappedKey, /* the wrapped key */
827
+ CK_ULONG ulWrappedKeyLen, /* wrapped key len */
828
+ CK_ATTRIBUTE_PTR pTemplate, /* new key template */
829
+ CK_ULONG ulAttributeCount, /* template length */
830
+ CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
831
+ );
832
+ #endif
833
+
834
+
835
+ /* C_DeriveKey derives a key from a base key, creating a new key
836
+ * object. */
837
+ CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
838
+ #ifdef CK_NEED_ARG_LIST
839
+ (
840
+ CK_SESSION_HANDLE hSession, /* session's handle */
841
+ CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */
842
+ CK_OBJECT_HANDLE hBaseKey, /* base key */
843
+ CK_ATTRIBUTE_PTR pTemplate, /* new key template */
844
+ CK_ULONG ulAttributeCount, /* template length */
845
+ CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
846
+ );
847
+ #endif
848
+
849
+
850
+
851
+ /* Random number generation */
852
+
853
+ /* C_SeedRandom mixes additional seed material into the token's
854
+ * random number generator. */
855
+ CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
856
+ #ifdef CK_NEED_ARG_LIST
857
+ (
858
+ CK_SESSION_HANDLE hSession, /* the session's handle */
859
+ CK_BYTE_PTR pSeed, /* the seed material */
860
+ CK_ULONG ulSeedLen /* length of seed material */
861
+ );
862
+ #endif
863
+
864
+
865
+ /* C_GenerateRandom generates random data. */
866
+ CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
867
+ #ifdef CK_NEED_ARG_LIST
868
+ (
869
+ CK_SESSION_HANDLE hSession, /* the session's handle */
870
+ CK_BYTE_PTR RandomData, /* receives the random data */
871
+ CK_ULONG ulRandomLen /* # of bytes to generate */
872
+ );
873
+ #endif
874
+
875
+
876
+
877
+ /* Parallel function management */
878
+
879
+ /* C_GetFunctionStatus is a legacy function; it obtains an
880
+ * updated status of a function running in parallel with an
881
+ * application. */
882
+ CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
883
+ #ifdef CK_NEED_ARG_LIST
884
+ (
885
+ CK_SESSION_HANDLE hSession /* the session's handle */
886
+ );
887
+ #endif
888
+
889
+
890
+ /* C_CancelFunction is a legacy function; it cancels a function
891
+ * running in parallel. */
892
+ CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
893
+ #ifdef CK_NEED_ARG_LIST
894
+ (
895
+ CK_SESSION_HANDLE hSession /* the session's handle */
896
+ );
897
+ #endif
898
+
899
+
900
+
901
+ /* Functions added in for Cryptoki Version 2.01 or later */
902
+
903
+ /* C_WaitForSlotEvent waits for a slot event (token insertion,
904
+ * removal, etc.) to occur. */
905
+ CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
906
+ #ifdef CK_NEED_ARG_LIST
907
+ (
908
+ CK_FLAGS flags, /* blocking/nonblocking flag */
909
+ CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
910
+ CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */
911
+ );
912
+ #endif