Merge autoland to mozilla-central. a=merge
[gecko.git] / third_party / rust / pkcs11-bindings / pkcs11f.h
bloba475f6deb539b71b523f626522c4844726b9a851
1 /* Copyright (c) OASIS Open 2016, 2019. All Rights Reserved./
2 * /Distributed under the terms of the OASIS IPR Policy,
3 * [http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY
4 * IMPLIED OR EXPRESS WARRANTY; there is no warranty of MERCHANTABILITY, FITNESS FOR A
5 * PARTICULAR PURPOSE or NONINFRINGEMENT of the rights of others.
6 */
8 /* Latest version of the specification:
9 * http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html
12 /* This header file contains pretty much everything about all the
13 * Cryptoki function prototypes. Because this information is
14 * used for more than just declaring function prototypes, the
15 * order of the functions appearing herein is important, and
16 * should not be altered.
19 /* General-purpose */
21 /* C_Initialize initializes the Cryptoki library. */
22 CK_PKCS11_FUNCTION_INFO(C_Initialize)
23 #ifdef CK_NEED_ARG_LIST
25 CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets
26 * cast to CK_C_INITIALIZE_ARGS_PTR
27 * and dereferenced
30 #endif
33 /* C_Finalize indicates that an application is done with the
34 * Cryptoki library.
36 CK_PKCS11_FUNCTION_INFO(C_Finalize)
37 #ifdef CK_NEED_ARG_LIST
39 CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */
41 #endif
44 /* C_GetInfo returns general information about Cryptoki. */
45 CK_PKCS11_FUNCTION_INFO(C_GetInfo)
46 #ifdef CK_NEED_ARG_LIST
48 CK_INFO_PTR pInfo /* location that receives information */
50 #endif
53 /* C_GetFunctionList returns the function list. */
54 CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
55 #ifdef CK_NEED_ARG_LIST
57 CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to
58 * function list
61 #endif
65 /* Slot and token management */
67 /* C_GetSlotList obtains a list of slots in the system. */
68 CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
69 #ifdef CK_NEED_ARG_LIST
71 CK_BBOOL tokenPresent, /* only slots with tokens */
72 CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */
73 CK_ULONG_PTR pulCount /* receives number of slots */
75 #endif
78 /* C_GetSlotInfo obtains information about a particular slot in
79 * the system.
81 CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
82 #ifdef CK_NEED_ARG_LIST
84 CK_SLOT_ID slotID, /* the ID of the slot */
85 CK_SLOT_INFO_PTR pInfo /* receives the slot information */
87 #endif
90 /* C_GetTokenInfo obtains information about a particular token
91 * in the system.
93 CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
94 #ifdef CK_NEED_ARG_LIST
96 CK_SLOT_ID slotID, /* ID of the token's slot */
97 CK_TOKEN_INFO_PTR pInfo /* receives the token information */
99 #endif
102 /* C_GetMechanismList obtains a list of mechanism types
103 * supported by a token.
105 CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
106 #ifdef CK_NEED_ARG_LIST
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. */
112 #endif
115 /* C_GetMechanismInfo obtains information about a particular
116 * mechanism possibly supported by a token.
118 CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
119 #ifdef CK_NEED_ARG_LIST
121 CK_SLOT_ID slotID, /* ID of the token's slot */
122 CK_MECHANISM_TYPE type, /* type of mechanism */
123 CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */
125 #endif
128 /* C_InitToken initializes a token. */
129 CK_PKCS11_FUNCTION_INFO(C_InitToken)
130 #ifdef CK_NEED_ARG_LIST
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) */
137 #endif
140 /* C_InitPIN initializes the normal user's PIN. */
141 CK_PKCS11_FUNCTION_INFO(C_InitPIN)
142 #ifdef CK_NEED_ARG_LIST
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 */
148 #endif
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
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 */
161 #endif
165 /* Session management */
167 /* C_OpenSession opens a session between an application and a
168 * token.
170 CK_PKCS11_FUNCTION_INFO(C_OpenSession)
171 #ifdef CK_NEED_ARG_LIST
173 CK_SLOT_ID slotID, /* the slot's ID */
174 CK_FLAGS flags, /* from CK_SESSION_INFO */
175 CK_VOID_PTR pApplication, /* passed to callback */
176 CK_NOTIFY Notify, /* callback function */
177 CK_SESSION_HANDLE_PTR phSession /* gets session handle */
179 #endif
182 /* C_CloseSession closes a session between an application and a
183 * token.
185 CK_PKCS11_FUNCTION_INFO(C_CloseSession)
186 #ifdef CK_NEED_ARG_LIST
188 CK_SESSION_HANDLE hSession /* the session's handle */
190 #endif
193 /* C_CloseAllSessions closes all sessions with a token. */
194 CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
195 #ifdef CK_NEED_ARG_LIST
197 CK_SLOT_ID slotID /* the token's slot */
199 #endif
202 /* C_GetSessionInfo obtains information about the session. */
203 CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
204 #ifdef CK_NEED_ARG_LIST
206 CK_SESSION_HANDLE hSession, /* the session's handle */
207 CK_SESSION_INFO_PTR pInfo /* receives session info */
209 #endif
212 /* C_GetOperationState obtains the state of the cryptographic operation
213 * in a session.
215 CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
216 #ifdef CK_NEED_ARG_LIST
218 CK_SESSION_HANDLE hSession, /* session's handle */
219 CK_BYTE_PTR pOperationState, /* gets state */
220 CK_ULONG_PTR pulOperationStateLen /* gets state length */
222 #endif
225 /* C_SetOperationState restores the state of the cryptographic
226 * operation in a session.
228 CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
229 #ifdef CK_NEED_ARG_LIST
231 CK_SESSION_HANDLE hSession, /* session's handle */
232 CK_BYTE_PTR pOperationState, /* holds state */
233 CK_ULONG ulOperationStateLen, /* holds state length */
234 CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */
235 CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */
237 #endif
240 /* C_Login logs a user into a token. */
241 CK_PKCS11_FUNCTION_INFO(C_Login)
242 #ifdef CK_NEED_ARG_LIST
244 CK_SESSION_HANDLE hSession, /* the session's handle */
245 CK_USER_TYPE userType, /* the user type */
246 CK_UTF8CHAR_PTR pPin, /* the user's PIN */
247 CK_ULONG ulPinLen /* the length of the PIN */
249 #endif
252 /* C_Logout logs a user out from a token. */
253 CK_PKCS11_FUNCTION_INFO(C_Logout)
254 #ifdef CK_NEED_ARG_LIST
256 CK_SESSION_HANDLE hSession /* the session's handle */
258 #endif
262 /* Object management */
264 /* C_CreateObject creates a new object. */
265 CK_PKCS11_FUNCTION_INFO(C_CreateObject)
266 #ifdef CK_NEED_ARG_LIST
268 CK_SESSION_HANDLE hSession, /* the session's handle */
269 CK_ATTRIBUTE_PTR pTemplate, /* the object's template */
270 CK_ULONG ulCount, /* attributes in template */
271 CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */
273 #endif
276 /* C_CopyObject copies an object, creating a new object for the
277 * copy.
279 CK_PKCS11_FUNCTION_INFO(C_CopyObject)
280 #ifdef CK_NEED_ARG_LIST
282 CK_SESSION_HANDLE hSession, /* the session's handle */
283 CK_OBJECT_HANDLE hObject, /* the object's handle */
284 CK_ATTRIBUTE_PTR pTemplate, /* template for new object */
285 CK_ULONG ulCount, /* attributes in template */
286 CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */
288 #endif
291 /* C_DestroyObject destroys an object. */
292 CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
293 #ifdef CK_NEED_ARG_LIST
295 CK_SESSION_HANDLE hSession, /* the session's handle */
296 CK_OBJECT_HANDLE hObject /* the object's handle */
298 #endif
301 /* C_GetObjectSize gets the size of an object in bytes. */
302 CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
303 #ifdef CK_NEED_ARG_LIST
305 CK_SESSION_HANDLE hSession, /* the session's handle */
306 CK_OBJECT_HANDLE hObject, /* the object's handle */
307 CK_ULONG_PTR pulSize /* receives size of object */
309 #endif
312 /* C_GetAttributeValue obtains the value of one or more object
313 * attributes.
315 CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
316 #ifdef CK_NEED_ARG_LIST
318 CK_SESSION_HANDLE hSession, /* the session's handle */
319 CK_OBJECT_HANDLE hObject, /* the object's handle */
320 CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */
321 CK_ULONG ulCount /* attributes in template */
323 #endif
326 /* C_SetAttributeValue modifies the value of one or more object
327 * attributes.
329 CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
330 #ifdef CK_NEED_ARG_LIST
332 CK_SESSION_HANDLE hSession, /* the session's handle */
333 CK_OBJECT_HANDLE hObject, /* the object's handle */
334 CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */
335 CK_ULONG ulCount /* attributes in template */
337 #endif
340 /* C_FindObjectsInit initializes a search for token and session
341 * objects that match a template.
343 CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
344 #ifdef CK_NEED_ARG_LIST
346 CK_SESSION_HANDLE hSession, /* the session's handle */
347 CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */
348 CK_ULONG ulCount /* attrs in search template */
350 #endif
353 /* C_FindObjects continues a search for token and session
354 * objects that match a template, obtaining additional object
355 * handles.
357 CK_PKCS11_FUNCTION_INFO(C_FindObjects)
358 #ifdef CK_NEED_ARG_LIST
360 CK_SESSION_HANDLE hSession, /* session's handle */
361 CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */
362 CK_ULONG ulMaxObjectCount, /* max handles to get */
363 CK_ULONG_PTR pulObjectCount /* actual # returned */
365 #endif
368 /* C_FindObjectsFinal finishes a search for token and session
369 * objects.
371 CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
372 #ifdef CK_NEED_ARG_LIST
374 CK_SESSION_HANDLE hSession /* the session's handle */
376 #endif
380 /* Encryption and decryption */
382 /* C_EncryptInit initializes an encryption operation. */
383 CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
384 #ifdef CK_NEED_ARG_LIST
386 CK_SESSION_HANDLE hSession, /* the session's handle */
387 CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */
388 CK_OBJECT_HANDLE hKey /* handle of encryption key */
390 #endif
393 /* C_Encrypt encrypts single-part data. */
394 CK_PKCS11_FUNCTION_INFO(C_Encrypt)
395 #ifdef CK_NEED_ARG_LIST
397 CK_SESSION_HANDLE hSession, /* session's handle */
398 CK_BYTE_PTR pData, /* the plaintext data */
399 CK_ULONG ulDataLen, /* bytes of plaintext */
400 CK_BYTE_PTR pEncryptedData, /* gets ciphertext */
401 CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */
403 #endif
406 /* C_EncryptUpdate continues a multiple-part encryption
407 * operation.
409 CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
410 #ifdef CK_NEED_ARG_LIST
412 CK_SESSION_HANDLE hSession, /* session's handle */
413 CK_BYTE_PTR pPart, /* the plaintext data */
414 CK_ULONG ulPartLen, /* plaintext data len */
415 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
416 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */
418 #endif
421 /* C_EncryptFinal finishes a multiple-part encryption
422 * operation.
424 CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
425 #ifdef CK_NEED_ARG_LIST
427 CK_SESSION_HANDLE hSession, /* session handle */
428 CK_BYTE_PTR pLastEncryptedPart, /* last c-text */
429 CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */
431 #endif
434 /* C_DecryptInit initializes a decryption operation. */
435 CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
436 #ifdef CK_NEED_ARG_LIST
438 CK_SESSION_HANDLE hSession, /* the session's handle */
439 CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */
440 CK_OBJECT_HANDLE hKey /* handle of decryption key */
442 #endif
445 /* C_Decrypt decrypts encrypted data in a single part. */
446 CK_PKCS11_FUNCTION_INFO(C_Decrypt)
447 #ifdef CK_NEED_ARG_LIST
449 CK_SESSION_HANDLE hSession, /* session's handle */
450 CK_BYTE_PTR pEncryptedData, /* ciphertext */
451 CK_ULONG ulEncryptedDataLen, /* ciphertext length */
452 CK_BYTE_PTR pData, /* gets plaintext */
453 CK_ULONG_PTR pulDataLen /* gets p-text size */
455 #endif
458 /* C_DecryptUpdate continues a multiple-part decryption
459 * operation.
461 CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
462 #ifdef CK_NEED_ARG_LIST
464 CK_SESSION_HANDLE hSession, /* session's handle */
465 CK_BYTE_PTR pEncryptedPart, /* encrypted data */
466 CK_ULONG ulEncryptedPartLen, /* input length */
467 CK_BYTE_PTR pPart, /* gets plaintext */
468 CK_ULONG_PTR pulPartLen /* p-text size */
470 #endif
473 /* C_DecryptFinal finishes a multiple-part decryption
474 * operation.
476 CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
477 #ifdef CK_NEED_ARG_LIST
479 CK_SESSION_HANDLE hSession, /* the session's handle */
480 CK_BYTE_PTR pLastPart, /* gets plaintext */
481 CK_ULONG_PTR pulLastPartLen /* p-text size */
483 #endif
487 /* Message digesting */
489 /* C_DigestInit initializes a message-digesting operation. */
490 CK_PKCS11_FUNCTION_INFO(C_DigestInit)
491 #ifdef CK_NEED_ARG_LIST
493 CK_SESSION_HANDLE hSession, /* the session's handle */
494 CK_MECHANISM_PTR pMechanism /* the digesting mechanism */
496 #endif
499 /* C_Digest digests data in a single part. */
500 CK_PKCS11_FUNCTION_INFO(C_Digest)
501 #ifdef CK_NEED_ARG_LIST
503 CK_SESSION_HANDLE hSession, /* the session's handle */
504 CK_BYTE_PTR pData, /* data to be digested */
505 CK_ULONG ulDataLen, /* bytes of data to digest */
506 CK_BYTE_PTR pDigest, /* gets the message digest */
507 CK_ULONG_PTR pulDigestLen /* gets digest length */
509 #endif
512 /* C_DigestUpdate continues a multiple-part message-digesting
513 * operation.
515 CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
516 #ifdef CK_NEED_ARG_LIST
518 CK_SESSION_HANDLE hSession, /* the session's handle */
519 CK_BYTE_PTR pPart, /* data to be digested */
520 CK_ULONG ulPartLen /* bytes of data to be digested */
522 #endif
525 /* C_DigestKey continues a multi-part message-digesting
526 * operation, by digesting the value of a secret key as part of
527 * the data already digested.
529 CK_PKCS11_FUNCTION_INFO(C_DigestKey)
530 #ifdef CK_NEED_ARG_LIST
532 CK_SESSION_HANDLE hSession, /* the session's handle */
533 CK_OBJECT_HANDLE hKey /* secret key to digest */
535 #endif
538 /* C_DigestFinal finishes a multiple-part message-digesting
539 * operation.
541 CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
542 #ifdef CK_NEED_ARG_LIST
544 CK_SESSION_HANDLE hSession, /* the session's handle */
545 CK_BYTE_PTR pDigest, /* gets the message digest */
546 CK_ULONG_PTR pulDigestLen /* gets byte count of digest */
548 #endif
552 /* Signing and MACing */
554 /* C_SignInit initializes a signature (private key encryption)
555 * operation, where the signature is (will be) an appendix to
556 * the data, and plaintext cannot be recovered from the
557 * signature.
559 CK_PKCS11_FUNCTION_INFO(C_SignInit)
560 #ifdef CK_NEED_ARG_LIST
562 CK_SESSION_HANDLE hSession, /* the session's handle */
563 CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
564 CK_OBJECT_HANDLE hKey /* handle of signature key */
566 #endif
569 /* C_Sign signs (encrypts with private key) data in a single
570 * part, where the signature is (will be) an appendix to the
571 * data, and plaintext cannot be recovered from the signature.
573 CK_PKCS11_FUNCTION_INFO(C_Sign)
574 #ifdef CK_NEED_ARG_LIST
576 CK_SESSION_HANDLE hSession, /* the session's handle */
577 CK_BYTE_PTR pData, /* the data to sign */
578 CK_ULONG ulDataLen, /* count of bytes to sign */
579 CK_BYTE_PTR pSignature, /* gets the signature */
580 CK_ULONG_PTR pulSignatureLen /* gets signature length */
582 #endif
585 /* C_SignUpdate continues a multiple-part signature operation,
586 * where the signature is (will be) an appendix to the data,
587 * and plaintext cannot be recovered from the signature.
589 CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
590 #ifdef CK_NEED_ARG_LIST
592 CK_SESSION_HANDLE hSession, /* the session's handle */
593 CK_BYTE_PTR pPart, /* the data to sign */
594 CK_ULONG ulPartLen /* count of bytes to sign */
596 #endif
599 /* C_SignFinal finishes a multiple-part signature operation,
600 * returning the signature.
602 CK_PKCS11_FUNCTION_INFO(C_SignFinal)
603 #ifdef CK_NEED_ARG_LIST
605 CK_SESSION_HANDLE hSession, /* the session's handle */
606 CK_BYTE_PTR pSignature, /* gets the signature */
607 CK_ULONG_PTR pulSignatureLen /* gets signature length */
609 #endif
612 /* C_SignRecoverInit initializes a signature operation, where
613 * the data can be recovered from the signature.
615 CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
616 #ifdef CK_NEED_ARG_LIST
618 CK_SESSION_HANDLE hSession, /* the session's handle */
619 CK_MECHANISM_PTR pMechanism, /* the signature mechanism */
620 CK_OBJECT_HANDLE hKey /* handle of the signature key */
622 #endif
625 /* C_SignRecover signs data in a single operation, where the
626 * data can be recovered from the signature.
628 CK_PKCS11_FUNCTION_INFO(C_SignRecover)
629 #ifdef CK_NEED_ARG_LIST
631 CK_SESSION_HANDLE hSession, /* the session's handle */
632 CK_BYTE_PTR pData, /* the data to sign */
633 CK_ULONG ulDataLen, /* count of bytes to sign */
634 CK_BYTE_PTR pSignature, /* gets the signature */
635 CK_ULONG_PTR pulSignatureLen /* gets signature length */
637 #endif
641 /* Verifying signatures and MACs */
643 /* C_VerifyInit initializes a verification operation, where the
644 * signature is an appendix to the data, and plaintext cannot
645 * cannot be recovered from the signature (e.g. DSA).
647 CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
648 #ifdef CK_NEED_ARG_LIST
650 CK_SESSION_HANDLE hSession, /* the session's handle */
651 CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
652 CK_OBJECT_HANDLE hKey /* verification key */
654 #endif
657 /* C_Verify verifies a signature in a single-part operation,
658 * where the signature is an appendix to the data, and plaintext
659 * cannot be recovered from the signature.
661 CK_PKCS11_FUNCTION_INFO(C_Verify)
662 #ifdef CK_NEED_ARG_LIST
664 CK_SESSION_HANDLE hSession, /* the session's handle */
665 CK_BYTE_PTR pData, /* signed data */
666 CK_ULONG ulDataLen, /* length of signed data */
667 CK_BYTE_PTR pSignature, /* signature */
668 CK_ULONG ulSignatureLen /* signature length*/
670 #endif
673 /* C_VerifyUpdate continues a multiple-part verification
674 * operation, where the signature is an appendix to the data,
675 * and plaintext cannot be recovered from the signature.
677 CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
678 #ifdef CK_NEED_ARG_LIST
680 CK_SESSION_HANDLE hSession, /* the session's handle */
681 CK_BYTE_PTR pPart, /* signed data */
682 CK_ULONG ulPartLen /* length of signed data */
684 #endif
687 /* C_VerifyFinal finishes a multiple-part verification
688 * operation, checking the signature.
690 CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
691 #ifdef CK_NEED_ARG_LIST
693 CK_SESSION_HANDLE hSession, /* the session's handle */
694 CK_BYTE_PTR pSignature, /* signature to verify */
695 CK_ULONG ulSignatureLen /* signature length */
697 #endif
700 /* C_VerifyRecoverInit initializes a signature verification
701 * operation, where the data is recovered from the signature.
703 CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
704 #ifdef CK_NEED_ARG_LIST
706 CK_SESSION_HANDLE hSession, /* the session's handle */
707 CK_MECHANISM_PTR pMechanism, /* the verification mechanism */
708 CK_OBJECT_HANDLE hKey /* verification key */
710 #endif
713 /* C_VerifyRecover verifies a signature in a single-part
714 * operation, where the data is recovered from the signature.
716 CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
717 #ifdef CK_NEED_ARG_LIST
719 CK_SESSION_HANDLE hSession, /* the session's handle */
720 CK_BYTE_PTR pSignature, /* signature to verify */
721 CK_ULONG ulSignatureLen, /* signature length */
722 CK_BYTE_PTR pData, /* gets signed data */
723 CK_ULONG_PTR pulDataLen /* gets signed data len */
725 #endif
729 /* Dual-function cryptographic operations */
731 /* C_DigestEncryptUpdate continues a multiple-part digesting
732 * and encryption operation.
734 CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
735 #ifdef CK_NEED_ARG_LIST
737 CK_SESSION_HANDLE hSession, /* session's handle */
738 CK_BYTE_PTR pPart, /* the plaintext data */
739 CK_ULONG ulPartLen, /* plaintext length */
740 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
741 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
743 #endif
746 /* C_DecryptDigestUpdate continues a multiple-part decryption and
747 * digesting operation.
749 CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
750 #ifdef CK_NEED_ARG_LIST
752 CK_SESSION_HANDLE hSession, /* session's handle */
753 CK_BYTE_PTR pEncryptedPart, /* ciphertext */
754 CK_ULONG ulEncryptedPartLen, /* ciphertext length */
755 CK_BYTE_PTR pPart, /* gets plaintext */
756 CK_ULONG_PTR pulPartLen /* gets plaintext len */
758 #endif
761 /* C_SignEncryptUpdate continues a multiple-part signing and
762 * encryption operation.
764 CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
765 #ifdef CK_NEED_ARG_LIST
767 CK_SESSION_HANDLE hSession, /* session's handle */
768 CK_BYTE_PTR pPart, /* the plaintext data */
769 CK_ULONG ulPartLen, /* plaintext length */
770 CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */
771 CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */
773 #endif
776 /* C_DecryptVerifyUpdate continues a multiple-part decryption and
777 * verify operation.
779 CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
780 #ifdef CK_NEED_ARG_LIST
782 CK_SESSION_HANDLE hSession, /* session's handle */
783 CK_BYTE_PTR pEncryptedPart, /* ciphertext */
784 CK_ULONG ulEncryptedPartLen, /* ciphertext length */
785 CK_BYTE_PTR pPart, /* gets plaintext */
786 CK_ULONG_PTR pulPartLen /* gets p-text length */
788 #endif
792 /* Key management */
794 /* C_GenerateKey generates a secret key, creating a new key
795 * object.
797 CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
798 #ifdef CK_NEED_ARG_LIST
800 CK_SESSION_HANDLE hSession, /* the session's handle */
801 CK_MECHANISM_PTR pMechanism, /* key generation mech. */
802 CK_ATTRIBUTE_PTR pTemplate, /* template for new key */
803 CK_ULONG ulCount, /* # of attrs in template */
804 CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */
806 #endif
809 /* C_GenerateKeyPair generates a public-key/private-key pair,
810 * creating new key objects.
812 CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
813 #ifdef CK_NEED_ARG_LIST
815 CK_SESSION_HANDLE hSession, /* session handle */
816 CK_MECHANISM_PTR pMechanism, /* key-gen mech. */
817 CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template for pub. key */
818 CK_ULONG ulPublicKeyAttributeCount, /* # pub. attrs. */
819 CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template for priv. key */
820 CK_ULONG ulPrivateKeyAttributeCount, /* # priv. attrs. */
821 CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. key handle */
822 CK_OBJECT_HANDLE_PTR phPrivateKey /* gets priv. key handle */
824 #endif
827 /* C_WrapKey wraps (i.e., encrypts) a key. */
828 CK_PKCS11_FUNCTION_INFO(C_WrapKey)
829 #ifdef CK_NEED_ARG_LIST
831 CK_SESSION_HANDLE hSession, /* the session's handle */
832 CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */
833 CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */
834 CK_OBJECT_HANDLE hKey, /* key to be wrapped */
835 CK_BYTE_PTR pWrappedKey, /* gets wrapped key */
836 CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */
838 #endif
841 /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
842 * key object.
844 CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
845 #ifdef CK_NEED_ARG_LIST
847 CK_SESSION_HANDLE hSession, /* session's handle */
848 CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */
849 CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */
850 CK_BYTE_PTR pWrappedKey, /* the wrapped key */
851 CK_ULONG ulWrappedKeyLen, /* wrapped key len */
852 CK_ATTRIBUTE_PTR pTemplate, /* new key template */
853 CK_ULONG ulAttributeCount, /* template length */
854 CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
856 #endif
859 /* C_DeriveKey derives a key from a base key, creating a new key
860 * object.
862 CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
863 #ifdef CK_NEED_ARG_LIST
865 CK_SESSION_HANDLE hSession, /* session's handle */
866 CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */
867 CK_OBJECT_HANDLE hBaseKey, /* base key */
868 CK_ATTRIBUTE_PTR pTemplate, /* new key template */
869 CK_ULONG ulAttributeCount, /* template length */
870 CK_OBJECT_HANDLE_PTR phKey /* gets new handle */
872 #endif
876 /* Random number generation */
878 /* C_SeedRandom mixes additional seed material into the token's
879 * random number generator.
881 CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
882 #ifdef CK_NEED_ARG_LIST
884 CK_SESSION_HANDLE hSession, /* the session's handle */
885 CK_BYTE_PTR pSeed, /* the seed material */
886 CK_ULONG ulSeedLen /* length of seed material */
888 #endif
891 /* C_GenerateRandom generates random data. */
892 CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
893 #ifdef CK_NEED_ARG_LIST
895 CK_SESSION_HANDLE hSession, /* the session's handle */
896 CK_BYTE_PTR RandomData, /* receives the random data */
897 CK_ULONG ulRandomLen /* # of bytes to generate */
899 #endif
903 /* Parallel function management */
905 /* C_GetFunctionStatus is a legacy function; it obtains an
906 * updated status of a function running in parallel with an
907 * application.
909 CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
910 #ifdef CK_NEED_ARG_LIST
912 CK_SESSION_HANDLE hSession /* the session's handle */
914 #endif
917 /* C_CancelFunction is a legacy function; it cancels a function
918 * running in parallel.
920 CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
921 #ifdef CK_NEED_ARG_LIST
923 CK_SESSION_HANDLE hSession /* the session's handle */
925 #endif
928 /* C_WaitForSlotEvent waits for a slot event (token insertion,
929 * removal, etc.) to occur.
931 CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
932 #ifdef CK_NEED_ARG_LIST
934 CK_FLAGS flags, /* blocking/nonblocking flag */
935 CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
936 CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */
938 #endif
940 #ifndef CK_PKCS11_2_0_ONLY
941 /* C_GetInterfaceList returns all the interfaces supported by the module*/
942 CK_PKCS11_FUNCTION_INFO(C_GetInterfaceList)
943 #ifdef CK_NEED_ARG_LIST
945 CK_INTERFACE_PTR pInterfacesList, /* returned interfaces */
946 CK_ULONG_PTR pulCount /* number of interfaces returned */
948 #endif
950 /* C_GetInterface returns a specific interface from the module. */
951 CK_PKCS11_FUNCTION_INFO(C_GetInterface)
952 #ifdef CK_NEED_ARG_LIST
954 CK_UTF8CHAR_PTR pInterfaceName, /* name of the interface */
955 CK_VERSION_PTR pVersion, /* version of the interface */
956 CK_INTERFACE_PTR_PTR ppInterface, /* returned interface */
957 CK_FLAGS flags /* flags controlling the semantics
958 * of the interface */
960 #endif
962 CK_PKCS11_FUNCTION_INFO(C_LoginUser)
963 #ifdef CK_NEED_ARG_LIST
965 CK_SESSION_HANDLE hSession, /* the session's handle */
966 CK_USER_TYPE userType, /* the user type */
967 CK_UTF8CHAR_PTR pPin, /* the user's PIN */
968 CK_ULONG ulPinLen, /* the length of the PIN */
969 CK_UTF8CHAR_PTR pUsername, /* the user's name */
970 CK_ULONG ulUsernameLen /*the length of the user's name */
972 #endif
974 CK_PKCS11_FUNCTION_INFO(C_SessionCancel)
975 #ifdef CK_NEED_ARG_LIST
977 CK_SESSION_HANDLE hSession, /* the session's handle */
978 CK_FLAGS flags /* flags control which sessions are cancelled */
980 #endif
982 CK_PKCS11_FUNCTION_INFO(C_MessageEncryptInit)
983 #ifdef CK_NEED_ARG_LIST
985 CK_SESSION_HANDLE hSession, /* the session's handle */
986 CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */
987 CK_OBJECT_HANDLE hKey /* handle of encryption key */
989 #endif
991 CK_PKCS11_FUNCTION_INFO(C_EncryptMessage)
992 #ifdef CK_NEED_ARG_LIST
994 CK_SESSION_HANDLE hSession, /* the session's handle */
995 CK_VOID_PTR pParameter, /* message specific parameter */
996 CK_ULONG ulParameterLen, /* length of message specific parameter */
997 CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */
998 CK_ULONG ulAssociatedDataLen, /* AEAD Associated data length */
999 CK_BYTE_PTR pPlaintext, /* plain text */
1000 CK_ULONG ulPlaintextLen, /* plain text length */
1001 CK_BYTE_PTR pCiphertext, /* gets cipher text */
1002 CK_ULONG_PTR pulCiphertextLen /* gets cipher text length */
1004 #endif
1006 CK_PKCS11_FUNCTION_INFO(C_EncryptMessageBegin)
1007 #ifdef CK_NEED_ARG_LIST
1009 CK_SESSION_HANDLE hSession, /* the session's handle */
1010 CK_VOID_PTR pParameter, /* message specific parameter */
1011 CK_ULONG ulParameterLen, /* length of message specific parameter */
1012 CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */
1013 CK_ULONG ulAssociatedDataLen /* AEAD Associated data length */
1015 #endif
1017 CK_PKCS11_FUNCTION_INFO(C_EncryptMessageNext)
1018 #ifdef CK_NEED_ARG_LIST
1020 CK_SESSION_HANDLE hSession, /* the session's handle */
1021 CK_VOID_PTR pParameter, /* message specific parameter */
1022 CK_ULONG ulParameterLen, /* length of message specific parameter */
1023 CK_BYTE_PTR pPlaintextPart, /* plain text */
1024 CK_ULONG ulPlaintextPartLen, /* plain text length */
1025 CK_BYTE_PTR pCiphertextPart, /* gets cipher text */
1026 CK_ULONG_PTR pulCiphertextPartLen, /* gets cipher text length */
1027 CK_FLAGS flags /* multi mode flag */
1029 #endif
1031 CK_PKCS11_FUNCTION_INFO(C_MessageEncryptFinal)
1032 #ifdef CK_NEED_ARG_LIST
1034 CK_SESSION_HANDLE hSession /* the session's handle */
1036 #endif
1038 CK_PKCS11_FUNCTION_INFO(C_MessageDecryptInit)
1039 #ifdef CK_NEED_ARG_LIST
1041 CK_SESSION_HANDLE hSession, /* the session's handle */
1042 CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */
1043 CK_OBJECT_HANDLE hKey /* handle of decryption key */
1045 #endif
1047 CK_PKCS11_FUNCTION_INFO(C_DecryptMessage)
1048 #ifdef CK_NEED_ARG_LIST
1050 CK_SESSION_HANDLE hSession, /* the session's handle */
1051 CK_VOID_PTR pParameter, /* message specific parameter */
1052 CK_ULONG ulParameterLen, /* length of message specific parameter */
1053 CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */
1054 CK_ULONG ulAssociatedDataLen, /* AEAD Associated data length */
1055 CK_BYTE_PTR pCiphertext, /* cipher text */
1056 CK_ULONG ulCiphertextLen, /* cipher text length */
1057 CK_BYTE_PTR pPlaintext, /* gets plain text */
1058 CK_ULONG_PTR pulPlaintextLen /* gets plain text length */
1060 #endif
1062 CK_PKCS11_FUNCTION_INFO(C_DecryptMessageBegin)
1063 #ifdef CK_NEED_ARG_LIST
1065 CK_SESSION_HANDLE hSession, /* the session's handle */
1066 CK_VOID_PTR pParameter, /* message specific parameter */
1067 CK_ULONG ulParameterLen, /* length of message specific parameter */
1068 CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */
1069 CK_ULONG ulAssociatedDataLen /* AEAD Associated data length */
1071 #endif
1073 CK_PKCS11_FUNCTION_INFO(C_DecryptMessageNext)
1074 #ifdef CK_NEED_ARG_LIST
1076 CK_SESSION_HANDLE hSession, /* the session's handle */
1077 CK_VOID_PTR pParameter, /* message specific parameter */
1078 CK_ULONG ulParameterLen, /* length of message specific parameter */
1079 CK_BYTE_PTR pCiphertextPart, /* cipher text */
1080 CK_ULONG ulCiphertextPartLen, /* cipher text length */
1081 CK_BYTE_PTR pPlaintextPart, /* gets plain text */
1082 CK_ULONG_PTR pulPlaintextPartLen, /* gets plain text length */
1083 CK_FLAGS flags /* multi mode flag */
1085 #endif
1087 CK_PKCS11_FUNCTION_INFO(C_MessageDecryptFinal)
1088 #ifdef CK_NEED_ARG_LIST
1090 CK_SESSION_HANDLE hSession /* the session's handle */
1092 #endif
1094 CK_PKCS11_FUNCTION_INFO(C_MessageSignInit)
1095 #ifdef CK_NEED_ARG_LIST
1097 CK_SESSION_HANDLE hSession, /* the session's handle */
1098 CK_MECHANISM_PTR pMechanism, /* the signing mechanism */
1099 CK_OBJECT_HANDLE hKey /* handle of signing key */
1101 #endif
1103 CK_PKCS11_FUNCTION_INFO(C_SignMessage)
1104 #ifdef CK_NEED_ARG_LIST
1106 CK_SESSION_HANDLE hSession, /* the session's handle */
1107 CK_VOID_PTR pParameter, /* message specific parameter */
1108 CK_ULONG ulParameterLen, /* length of message specific parameter */
1109 CK_BYTE_PTR pData, /* data to sign */
1110 CK_ULONG ulDataLen, /* data to sign length */
1111 CK_BYTE_PTR pSignature, /* gets signature */
1112 CK_ULONG_PTR pulSignatureLen /* gets signature length */
1114 #endif
1116 CK_PKCS11_FUNCTION_INFO(C_SignMessageBegin)
1117 #ifdef CK_NEED_ARG_LIST
1119 CK_SESSION_HANDLE hSession, /* the session's handle */
1120 CK_VOID_PTR pParameter, /* message specific parameter */
1121 CK_ULONG ulParameterLen /* length of message specific parameter */
1123 #endif
1125 CK_PKCS11_FUNCTION_INFO(C_SignMessageNext)
1126 #ifdef CK_NEED_ARG_LIST
1128 CK_SESSION_HANDLE hSession, /* the session's handle */
1129 CK_VOID_PTR pParameter, /* message specific parameter */
1130 CK_ULONG ulParameterLen, /* length of message specific parameter */
1131 CK_BYTE_PTR pData, /* data to sign */
1132 CK_ULONG ulDataLen, /* data to sign length */
1133 CK_BYTE_PTR pSignature, /* gets signature */
1134 CK_ULONG_PTR pulSignatureLen /* gets signature length */
1136 #endif
1138 CK_PKCS11_FUNCTION_INFO(C_MessageSignFinal)
1139 #ifdef CK_NEED_ARG_LIST
1141 CK_SESSION_HANDLE hSession /* the session's handle */
1143 #endif
1145 CK_PKCS11_FUNCTION_INFO(C_MessageVerifyInit)
1146 #ifdef CK_NEED_ARG_LIST
1148 CK_SESSION_HANDLE hSession, /* the session's handle */
1149 CK_MECHANISM_PTR pMechanism, /* the signing mechanism */
1150 CK_OBJECT_HANDLE hKey /* handle of signing key */
1152 #endif
1154 CK_PKCS11_FUNCTION_INFO(C_VerifyMessage)
1155 #ifdef CK_NEED_ARG_LIST
1157 CK_SESSION_HANDLE hSession, /* the session's handle */
1158 CK_VOID_PTR pParameter, /* message specific parameter */
1159 CK_ULONG ulParameterLen, /* length of message specific parameter */
1160 CK_BYTE_PTR pData, /* data to sign */
1161 CK_ULONG ulDataLen, /* data to sign length */
1162 CK_BYTE_PTR pSignature, /* signature */
1163 CK_ULONG ulSignatureLen /* signature length */
1165 #endif
1167 CK_PKCS11_FUNCTION_INFO(C_VerifyMessageBegin)
1168 #ifdef CK_NEED_ARG_LIST
1170 CK_SESSION_HANDLE hSession, /* the session's handle */
1171 CK_VOID_PTR pParameter, /* message specific parameter */
1172 CK_ULONG ulParameterLen /* length of message specific parameter */
1174 #endif
1176 CK_PKCS11_FUNCTION_INFO(C_VerifyMessageNext)
1177 #ifdef CK_NEED_ARG_LIST
1179 CK_SESSION_HANDLE hSession, /* the session's handle */
1180 CK_VOID_PTR pParameter, /* message specific parameter */
1181 CK_ULONG ulParameterLen, /* length of message specific parameter */
1182 CK_BYTE_PTR pData, /* data to sign */
1183 CK_ULONG ulDataLen, /* data to sign length */
1184 CK_BYTE_PTR pSignature, /* signature */
1185 CK_ULONG ulSignatureLen /* signature length */
1187 #endif
1189 CK_PKCS11_FUNCTION_INFO(C_MessageVerifyFinal)
1190 #ifdef CK_NEED_ARG_LIST
1192 CK_SESSION_HANDLE hSession /* the session's handle */
1194 #endif
1196 #endif /* CK_PKCS11_2_0_ONLY */