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