1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is the Netscape security libraries.
16 * The Initial Developer of the Original Code is
18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
19 * the Initial Developer. All Rights Reserved.
22 * Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
37 /* License to copy and use this software is granted provided that it is
38 * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
39 * (Cryptoki)" in all material mentioning or referencing this software.
41 * License is also granted to make and use derivative works provided that
42 * such works are identified as "derived from the RSA Security Inc. PKCS #11
43 * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
44 * referencing the derived work.
46 * RSA Security Inc. makes no representations concerning either the
47 * merchantability of this software or the suitability of this software for
48 * any particular purpose. It is provided "as is" without express or implied
49 * warranty of any kind.
63 #define CK_CALLBACK_FUNCTION(rtype,func) rtype (PR_CALLBACK * func)
64 #define CK_DECLARE_FUNCTION(rtype,func) extern rtype func
65 #define CK_DECLARE_FUNCTION_POINTER(rtype,func) rtype (PR_CALLBACK * func)
67 #define CK_INVALID_SESSION 0
69 /* an unsigned 8-bit value */
70 typedef unsigned char CK_BYTE
;
72 /* an unsigned 8-bit character */
73 typedef CK_BYTE CK_CHAR
;
75 /* an 8-bit UTF-8 character */
76 typedef CK_BYTE CK_UTF8CHAR
;
78 /* a BYTE-sized Boolean flag */
79 typedef CK_BYTE CK_BBOOL
;
81 /* an unsigned value, at least 32 bits long */
82 typedef unsigned long int CK_ULONG
;
84 /* a signed value, the same size as a CK_ULONG */
85 /* CK_LONG is new for v2.0 */
86 typedef long int CK_LONG
;
88 /* at least 32 bits; each bit is a Boolean flag */
89 typedef CK_ULONG CK_FLAGS
;
92 /* some special values for certain CK_ULONG variables */
93 #define CK_UNAVAILABLE_INFORMATION (~0UL)
94 #define CK_EFFECTIVELY_INFINITE 0
97 typedef CK_BYTE CK_PTR CK_BYTE_PTR
;
98 typedef CK_CHAR CK_PTR CK_CHAR_PTR
;
99 typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR
;
100 typedef CK_ULONG CK_PTR CK_ULONG_PTR
;
101 typedef void CK_PTR CK_VOID_PTR
;
103 /* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */
104 typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR
;
107 /* The following value is always invalid if used as a session */
108 /* handle or object handle */
109 #define CK_INVALID_HANDLE 0
115 typedef struct CK_VERSION
{
116 CK_BYTE major
; /* integer portion of version number */
117 CK_BYTE minor
; /* 1/100ths portion of version number */
120 typedef CK_VERSION CK_PTR CK_VERSION_PTR
;
123 typedef struct CK_INFO
{
124 /* manufacturerID and libraryDecription have been changed from
125 * CK_CHAR to CK_UTF8CHAR for v2.10 */
126 CK_VERSION cryptokiVersion
; /* PKCS #11 interface ver */
127 CK_UTF8CHAR manufacturerID
[32]; /* blank padded */
128 CK_FLAGS flags
; /* must be zero */
130 /* libraryDescription and libraryVersion are new for v2.0 */
131 CK_UTF8CHAR libraryDescription
[32]; /* blank padded */
132 CK_VERSION libraryVersion
; /* version of library */
135 typedef CK_INFO CK_PTR CK_INFO_PTR
;
138 /* CK_NOTIFICATION enumerates the types of notifications that
139 * PKCS #11 provides to an application */
140 /* CK_NOTIFICATION has been changed from an enum to a CK_ULONG
142 typedef CK_ULONG CK_NOTIFICATION
;
143 #define CKN_SURRENDER 0
146 typedef CK_ULONG CK_SLOT_ID
;
148 typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR
;
151 /* CK_SLOT_INFO provides information about a slot */
152 typedef struct CK_SLOT_INFO
{
153 /* slotDescription and manufacturerID have been changed from
154 * CK_CHAR to CK_UTF8CHAR for v2.10 */
155 CK_UTF8CHAR slotDescription
[64]; /* blank padded */
156 CK_UTF8CHAR manufacturerID
[32]; /* blank padded */
159 /* hardwareVersion and firmwareVersion are new for v2.0 */
160 CK_VERSION hardwareVersion
; /* version of hardware */
161 CK_VERSION firmwareVersion
; /* version of firmware */
164 /* flags: bit flags that provide capabilities of the slot
165 * Bit Flag Mask Meaning
167 #define CKF_TOKEN_PRESENT 0x00000001 /* a token is there */
168 #define CKF_REMOVABLE_DEVICE 0x00000002 /* removable devices*/
169 #define CKF_HW_SLOT 0x00000004 /* hardware slot */
171 typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR
;
174 /* CK_TOKEN_INFO provides information about a token */
175 typedef struct CK_TOKEN_INFO
{
176 /* label, manufacturerID, and model have been changed from
177 * CK_CHAR to CK_UTF8CHAR for v2.10 */
178 CK_UTF8CHAR label
[32]; /* blank padded */
179 CK_UTF8CHAR manufacturerID
[32]; /* blank padded */
180 CK_UTF8CHAR model
[16]; /* blank padded */
181 CK_CHAR serialNumber
[16]; /* blank padded */
182 CK_FLAGS flags
; /* see below */
184 /* ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount,
185 * ulRwSessionCount, ulMaxPinLen, and ulMinPinLen have all been
186 * changed from CK_USHORT to CK_ULONG for v2.0 */
187 CK_ULONG ulMaxSessionCount
; /* max open sessions */
188 CK_ULONG ulSessionCount
; /* sess. now open */
189 CK_ULONG ulMaxRwSessionCount
; /* max R/W sessions */
190 CK_ULONG ulRwSessionCount
; /* R/W sess. now open */
191 CK_ULONG ulMaxPinLen
; /* in bytes */
192 CK_ULONG ulMinPinLen
; /* in bytes */
193 CK_ULONG ulTotalPublicMemory
; /* in bytes */
194 CK_ULONG ulFreePublicMemory
; /* in bytes */
195 CK_ULONG ulTotalPrivateMemory
; /* in bytes */
196 CK_ULONG ulFreePrivateMemory
; /* in bytes */
198 /* hardwareVersion, firmwareVersion, and time are new for
200 CK_VERSION hardwareVersion
; /* version of hardware */
201 CK_VERSION firmwareVersion
; /* version of firmware */
202 CK_CHAR utcTime
[16]; /* time */
205 /* The flags parameter is defined as follows:
206 * Bit Flag Mask Meaning
208 #define CKF_RNG 0x00000001 /* has random #
210 #define CKF_WRITE_PROTECTED 0x00000002 /* token is
213 #define CKF_LOGIN_REQUIRED 0x00000004 /* user must
215 #define CKF_USER_PIN_INITIALIZED 0x00000008 /* normal user's
218 /* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0. If it is set,
219 * that means that *every* time the state of cryptographic
220 * operations of a session is successfully saved, all keys
221 * needed to continue those operations are stored in the state */
222 #define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020
224 /* CKF_CLOCK_ON_TOKEN is new for v2.0. If it is set, that means
225 * that the token has some sort of clock. The time on that
226 * clock is returned in the token info structure */
227 #define CKF_CLOCK_ON_TOKEN 0x00000040
229 /* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0. If it is
230 * set, that means that there is some way for the user to login
231 * without sending a PIN through the PKCS #11 library itself */
232 #define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100
234 /* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0. If it is true,
235 * that means that a single session with the token can perform
236 * dual simultaneous cryptographic operations (digest and
237 * encrypt; decrypt and digest; sign and encrypt; and decrypt
239 #define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200
241 /* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the
242 * token has been initialized using C_InitializeToken or an
243 * equivalent mechanism outside the scope of PKCS #11.
244 * Calling C_InitializeToken when this flag is set will cause
245 * the token to be reinitialized. */
246 #define CKF_TOKEN_INITIALIZED 0x00000400
248 /* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is
249 * true, the token supports secondary authentication for
250 * private key objects. This flag is deprecated in v2.11 and
252 #define CKF_SECONDARY_AUTHENTICATION 0x00000800
254 /* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an
255 * incorrect user login PIN has been entered at least once
256 * since the last successful authentication. */
257 #define CKF_USER_PIN_COUNT_LOW 0x00010000
259 /* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true,
260 * supplying an incorrect user PIN will it to become locked. */
261 #define CKF_USER_PIN_FINAL_TRY 0x00020000
263 /* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the
264 * user PIN has been locked. User login to the token is not
266 #define CKF_USER_PIN_LOCKED 0x00040000
268 /* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
269 * the user PIN value is the default value set by token
270 * initialization or manufacturing, or the PIN has been
271 * expired by the card. */
272 #define CKF_USER_PIN_TO_BE_CHANGED 0x00080000
274 /* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an
275 * incorrect SO login PIN has been entered at least once since
276 * the last successful authentication. */
277 #define CKF_SO_PIN_COUNT_LOW 0x00100000
279 /* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true,
280 * supplying an incorrect SO PIN will it to become locked. */
281 #define CKF_SO_PIN_FINAL_TRY 0x00200000
283 /* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO
284 * PIN has been locked. SO login to the token is not possible.
286 #define CKF_SO_PIN_LOCKED 0x00400000
288 /* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
289 * the SO PIN value is the default value set by token
290 * initialization or manufacturing, or the PIN has been
291 * expired by the card. */
292 #define CKF_SO_PIN_TO_BE_CHANGED 0x00800000
294 typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR
;
297 /* CK_SESSION_HANDLE is a PKCS #11-assigned value that
298 * identifies a session */
299 typedef CK_ULONG CK_SESSION_HANDLE
;
301 typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR
;
304 /* CK_USER_TYPE enumerates the types of PKCS #11 users */
305 /* CK_USER_TYPE has been changed from an enum to a CK_ULONG for
307 typedef CK_ULONG CK_USER_TYPE
;
308 /* Security Officer */
312 /* Context specific (added in v2.20) */
313 #define CKU_CONTEXT_SPECIFIC 2
315 /* CK_STATE enumerates the session states */
316 /* CK_STATE has been changed from an enum to a CK_ULONG for
318 typedef CK_ULONG CK_STATE
;
319 #define CKS_RO_PUBLIC_SESSION 0
320 #define CKS_RO_USER_FUNCTIONS 1
321 #define CKS_RW_PUBLIC_SESSION 2
322 #define CKS_RW_USER_FUNCTIONS 3
323 #define CKS_RW_SO_FUNCTIONS 4
326 /* CK_SESSION_INFO provides information about a session */
327 typedef struct CK_SESSION_INFO
{
330 CK_FLAGS flags
; /* see below */
332 /* ulDeviceError was changed from CK_USHORT to CK_ULONG for
334 CK_ULONG ulDeviceError
; /* device-dependent error code */
337 /* The flags are defined in the following table:
338 * Bit Flag Mask Meaning
340 #define CKF_RW_SESSION 0x00000002 /* session is r/w */
341 #define CKF_SERIAL_SESSION 0x00000004 /* no parallel */
343 typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR
;
346 /* CK_OBJECT_HANDLE is a token-specific identifier for an
348 typedef CK_ULONG CK_OBJECT_HANDLE
;
350 typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR
;
353 /* CK_OBJECT_CLASS is a value that identifies the classes (or
354 * types) of objects that PKCS #11 recognizes. It is defined
356 /* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for
358 typedef CK_ULONG CK_OBJECT_CLASS
;
360 /* The following classes of objects are defined: */
361 /* CKO_HW_FEATURE is new for v2.10 */
362 /* CKO_DOMAIN_PARAMETERS is new for v2.11 */
363 /* CKO_MECHANISM is new for v2.20 */
364 #define CKO_DATA 0x00000000
365 #define CKO_CERTIFICATE 0x00000001
366 #define CKO_PUBLIC_KEY 0x00000002
367 #define CKO_PRIVATE_KEY 0x00000003
368 #define CKO_SECRET_KEY 0x00000004
369 #define CKO_HW_FEATURE 0x00000005
370 #define CKO_DOMAIN_PARAMETERS 0x00000006
371 #define CKO_MECHANISM 0x00000007
372 #define CKO_VENDOR_DEFINED 0x80000000
374 typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR
;
376 /* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a
377 * value that identifies the hardware feature type of an object
378 * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */
379 typedef CK_ULONG CK_HW_FEATURE_TYPE
;
381 /* The following hardware feature types are defined */
382 /* CKH_USER_INTERFACE is new for v2.20 */
383 #define CKH_MONOTONIC_COUNTER 0x00000001
384 #define CKH_CLOCK 0x00000002
385 #define CKH_USER_INTERFACE 0x00000003
386 #define CKH_VENDOR_DEFINED 0x80000000
388 /* CK_KEY_TYPE is a value that identifies a key type */
389 /* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */
390 typedef CK_ULONG CK_KEY_TYPE
;
392 /* the following key types are defined: */
393 #define CKK_RSA 0x00000000
394 #define CKK_DSA 0x00000001
395 #define CKK_DH 0x00000002
397 /* CKK_ECDSA and CKK_KEA are new for v2.0 */
398 /* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */
399 #define CKK_ECDSA 0x00000003
400 #define CKK_EC 0x00000003
401 #define CKK_X9_42_DH 0x00000004
402 #define CKK_KEA 0x00000005
404 #define CKK_GENERIC_SECRET 0x00000010
405 #define CKK_RC2 0x00000011
406 #define CKK_RC4 0x00000012
407 #define CKK_DES 0x00000013
408 #define CKK_DES2 0x00000014
409 #define CKK_DES3 0x00000015
411 /* all these key types are new for v2.0 */
412 #define CKK_CAST 0x00000016
413 #define CKK_CAST3 0x00000017
414 /* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */
415 #define CKK_CAST5 0x00000018
416 #define CKK_CAST128 0x00000018
417 #define CKK_RC5 0x00000019
418 #define CKK_IDEA 0x0000001A
419 #define CKK_SKIPJACK 0x0000001B
420 #define CKK_BATON 0x0000001C
421 #define CKK_JUNIPER 0x0000001D
422 #define CKK_CDMF 0x0000001E
423 #define CKK_AES 0x0000001F
425 /* BlowFish and TwoFish are new for v2.20 */
426 #define CKK_BLOWFISH 0x00000020
427 #define CKK_TWOFISH 0x00000021
429 /* Camellia is proposed for v2.20 Amendment 3 */
430 #define CKK_CAMELLIA 0x00000025
432 #define CKK_VENDOR_DEFINED 0x80000000
435 /* CK_CERTIFICATE_TYPE is a value that identifies a certificate
437 /* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG
439 typedef CK_ULONG CK_CERTIFICATE_TYPE
;
441 /* The following certificate types are defined: */
442 /* CKC_X_509_ATTR_CERT is new for v2.10 */
443 /* CKC_WTLS is new for v2.20 */
444 #define CKC_X_509 0x00000000
445 #define CKC_X_509_ATTR_CERT 0x00000001
446 #define CKC_WTLS 0x00000002
447 #define CKC_VENDOR_DEFINED 0x80000000
450 /* CK_ATTRIBUTE_TYPE is a value that identifies an attribute
452 /* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for
454 typedef CK_ULONG CK_ATTRIBUTE_TYPE
;
456 /* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which
457 consists of an array of values. */
458 #define CKF_ARRAY_ATTRIBUTE 0x40000000
460 /* The following attribute types are defined: */
461 #define CKA_CLASS 0x00000000
462 #define CKA_TOKEN 0x00000001
463 #define CKA_PRIVATE 0x00000002
464 #define CKA_LABEL 0x00000003
465 #define CKA_APPLICATION 0x00000010
466 #define CKA_VALUE 0x00000011
468 /* CKA_OBJECT_ID is new for v2.10 */
469 #define CKA_OBJECT_ID 0x00000012
471 #define CKA_CERTIFICATE_TYPE 0x00000080
472 #define CKA_ISSUER 0x00000081
473 #define CKA_SERIAL_NUMBER 0x00000082
475 /* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new
477 #define CKA_AC_ISSUER 0x00000083
478 #define CKA_OWNER 0x00000084
479 #define CKA_ATTR_TYPES 0x00000085
481 /* CKA_TRUSTED is new for v2.11 */
482 #define CKA_TRUSTED 0x00000086
484 /* CKA_CERTIFICATE_CATEGORY ...
485 * CKA_CHECK_VALUE are new for v2.20 */
486 #define CKA_CERTIFICATE_CATEGORY 0x00000087
487 #define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088
488 #define CKA_URL 0x00000089
489 #define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008A
490 #define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008B
491 #define CKA_CHECK_VALUE 0x00000090
493 #define CKA_KEY_TYPE 0x00000100
494 #define CKA_SUBJECT 0x00000101
495 #define CKA_ID 0x00000102
496 #define CKA_SENSITIVE 0x00000103
497 #define CKA_ENCRYPT 0x00000104
498 #define CKA_DECRYPT 0x00000105
499 #define CKA_WRAP 0x00000106
500 #define CKA_UNWRAP 0x00000107
501 #define CKA_SIGN 0x00000108
502 #define CKA_SIGN_RECOVER 0x00000109
503 #define CKA_VERIFY 0x0000010A
504 #define CKA_VERIFY_RECOVER 0x0000010B
505 #define CKA_DERIVE 0x0000010C
506 #define CKA_START_DATE 0x00000110
507 #define CKA_END_DATE 0x00000111
508 #define CKA_MODULUS 0x00000120
509 #define CKA_MODULUS_BITS 0x00000121
510 #define CKA_PUBLIC_EXPONENT 0x00000122
511 #define CKA_PRIVATE_EXPONENT 0x00000123
512 #define CKA_PRIME_1 0x00000124
513 #define CKA_PRIME_2 0x00000125
514 #define CKA_EXPONENT_1 0x00000126
515 #define CKA_EXPONENT_2 0x00000127
516 #define CKA_COEFFICIENT 0x00000128
517 #define CKA_PRIME 0x00000130
518 #define CKA_SUBPRIME 0x00000131
519 #define CKA_BASE 0x00000132
521 /* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */
522 #define CKA_PRIME_BITS 0x00000133
523 #define CKA_SUBPRIME_BITS 0x00000134
524 #define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS
525 /* (To retain backwards-compatibility) */
527 #define CKA_VALUE_BITS 0x00000160
528 #define CKA_VALUE_LEN 0x00000161
530 /* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE,
531 * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS,
532 * and CKA_EC_POINT are new for v2.0 */
533 #define CKA_EXTRACTABLE 0x00000162
534 #define CKA_LOCAL 0x00000163
535 #define CKA_NEVER_EXTRACTABLE 0x00000164
536 #define CKA_ALWAYS_SENSITIVE 0x00000165
538 /* CKA_KEY_GEN_MECHANISM is new for v2.11 */
539 #define CKA_KEY_GEN_MECHANISM 0x00000166
541 #define CKA_MODIFIABLE 0x00000170
543 /* CKA_ECDSA_PARAMS is deprecated in v2.11,
544 * CKA_EC_PARAMS is preferred. */
545 #define CKA_ECDSA_PARAMS 0x00000180
546 #define CKA_EC_PARAMS 0x00000180
548 #define CKA_EC_POINT 0x00000181
550 /* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS,
551 * are new for v2.10. Deprecated in v2.11 and onwards. */
552 #define CKA_SECONDARY_AUTH 0x00000200
553 #define CKA_AUTH_PIN_FLAGS 0x00000201
555 /* CKA_ALWAYS_AUTHENTICATE ...
556 * CKA_UNWRAP_TEMPLATE are new for v2.20 */
557 #define CKA_ALWAYS_AUTHENTICATE 0x00000202
559 #define CKA_WRAP_WITH_TRUSTED 0x00000210
560 #define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211)
561 #define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212)
563 /* CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET
564 * are new for v2.10 */
565 #define CKA_HW_FEATURE_TYPE 0x00000300
566 #define CKA_RESET_ON_INIT 0x00000301
567 #define CKA_HAS_RESET 0x00000302
569 /* The following attributes are new for v2.20 */
570 #define CKA_PIXEL_X 0x00000400
571 #define CKA_PIXEL_Y 0x00000401
572 #define CKA_RESOLUTION 0x00000402
573 #define CKA_CHAR_ROWS 0x00000403
574 #define CKA_CHAR_COLUMNS 0x00000404
575 #define CKA_COLOR 0x00000405
576 #define CKA_BITS_PER_PIXEL 0x00000406
577 #define CKA_CHAR_SETS 0x00000480
578 #define CKA_ENCODING_METHODS 0x00000481
579 #define CKA_MIME_TYPES 0x00000482
580 #define CKA_MECHANISM_TYPE 0x00000500
581 #define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501
582 #define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502
583 #define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503
584 #define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600)
586 #define CKA_VENDOR_DEFINED 0x80000000
589 /* CK_ATTRIBUTE is a structure that includes the type, length
590 * and value of an attribute */
591 typedef struct CK_ATTRIBUTE
{
592 CK_ATTRIBUTE_TYPE type
;
595 /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */
596 CK_ULONG ulValueLen
; /* in bytes */
599 typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR
;
602 /* CK_DATE is a structure that defines a date */
603 typedef struct CK_DATE
{
604 CK_CHAR year
[4]; /* the year ("1900" - "9999") */
605 CK_CHAR month
[2]; /* the month ("01" - "12") */
606 CK_CHAR day
[2]; /* the day ("01" - "31") */
610 /* CK_MECHANISM_TYPE is a value that identifies a mechanism
612 /* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for
614 typedef CK_ULONG CK_MECHANISM_TYPE
;
616 /* the following mechanism types are defined: */
617 #define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000
618 #define CKM_RSA_PKCS 0x00000001
619 #define CKM_RSA_9796 0x00000002
620 #define CKM_RSA_X_509 0x00000003
622 /* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS
623 * are new for v2.0. They are mechanisms which hash and sign */
624 #define CKM_MD2_RSA_PKCS 0x00000004
625 #define CKM_MD5_RSA_PKCS 0x00000005
626 #define CKM_SHA1_RSA_PKCS 0x00000006
628 /* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and
629 * CKM_RSA_PKCS_OAEP are new for v2.10 */
630 #define CKM_RIPEMD128_RSA_PKCS 0x00000007
631 #define CKM_RIPEMD160_RSA_PKCS 0x00000008
632 #define CKM_RSA_PKCS_OAEP 0x00000009
634 /* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31,
635 * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */
636 #define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000A
637 #define CKM_RSA_X9_31 0x0000000B
638 #define CKM_SHA1_RSA_X9_31 0x0000000C
639 #define CKM_RSA_PKCS_PSS 0x0000000D
640 #define CKM_SHA1_RSA_PKCS_PSS 0x0000000E
642 #define CKM_DSA_KEY_PAIR_GEN 0x00000010
643 #define CKM_DSA 0x00000011
644 #define CKM_DSA_SHA1 0x00000012
645 #define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020
646 #define CKM_DH_PKCS_DERIVE 0x00000021
648 /* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE,
649 * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for
651 #define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030
652 #define CKM_X9_42_DH_DERIVE 0x00000031
653 #define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032
654 #define CKM_X9_42_MQV_DERIVE 0x00000033
656 /* CKM_SHA256/384/512 are new for v2.20 */
657 #define CKM_SHA256_RSA_PKCS 0x00000040
658 #define CKM_SHA384_RSA_PKCS 0x00000041
659 #define CKM_SHA512_RSA_PKCS 0x00000042
660 #define CKM_SHA256_RSA_PKCS_PSS 0x00000043
661 #define CKM_SHA384_RSA_PKCS_PSS 0x00000044
662 #define CKM_SHA512_RSA_PKCS_PSS 0x00000045
664 /* CKM_SHA224 new for v2.20 amendment 3 */
665 #define CKM_SHA224_RSA_PKCS 0x00000046
666 #define CKM_SHA224_RSA_PKCS_PSS 0x00000047
668 #define CKM_RC2_KEY_GEN 0x00000100
669 #define CKM_RC2_ECB 0x00000101
670 #define CKM_RC2_CBC 0x00000102
671 #define CKM_RC2_MAC 0x00000103
673 /* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */
674 #define CKM_RC2_MAC_GENERAL 0x00000104
675 #define CKM_RC2_CBC_PAD 0x00000105
677 #define CKM_RC4_KEY_GEN 0x00000110
678 #define CKM_RC4 0x00000111
679 #define CKM_DES_KEY_GEN 0x00000120
680 #define CKM_DES_ECB 0x00000121
681 #define CKM_DES_CBC 0x00000122
682 #define CKM_DES_MAC 0x00000123
684 /* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */
685 #define CKM_DES_MAC_GENERAL 0x00000124
686 #define CKM_DES_CBC_PAD 0x00000125
688 #define CKM_DES2_KEY_GEN 0x00000130
689 #define CKM_DES3_KEY_GEN 0x00000131
690 #define CKM_DES3_ECB 0x00000132
691 #define CKM_DES3_CBC 0x00000133
692 #define CKM_DES3_MAC 0x00000134
694 /* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN,
695 * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC,
696 * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */
697 #define CKM_DES3_MAC_GENERAL 0x00000135
698 #define CKM_DES3_CBC_PAD 0x00000136
699 #define CKM_CDMF_KEY_GEN 0x00000140
700 #define CKM_CDMF_ECB 0x00000141
701 #define CKM_CDMF_CBC 0x00000142
702 #define CKM_CDMF_MAC 0x00000143
703 #define CKM_CDMF_MAC_GENERAL 0x00000144
704 #define CKM_CDMF_CBC_PAD 0x00000145
706 /* the following four DES mechanisms are new for v2.20 */
707 #define CKM_DES_OFB64 0x00000150
708 #define CKM_DES_OFB8 0x00000151
709 #define CKM_DES_CFB64 0x00000152
710 #define CKM_DES_CFB8 0x00000153
712 #define CKM_MD2 0x00000200
714 /* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */
715 #define CKM_MD2_HMAC 0x00000201
716 #define CKM_MD2_HMAC_GENERAL 0x00000202
718 #define CKM_MD5 0x00000210
720 /* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */
721 #define CKM_MD5_HMAC 0x00000211
722 #define CKM_MD5_HMAC_GENERAL 0x00000212
724 #define CKM_SHA_1 0x00000220
726 /* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */
727 #define CKM_SHA_1_HMAC 0x00000221
728 #define CKM_SHA_1_HMAC_GENERAL 0x00000222
730 /* CKM_RIPEMD128, CKM_RIPEMD128_HMAC,
731 * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC,
732 * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */
733 #define CKM_RIPEMD128 0x00000230
734 #define CKM_RIPEMD128_HMAC 0x00000231
735 #define CKM_RIPEMD128_HMAC_GENERAL 0x00000232
736 #define CKM_RIPEMD160 0x00000240
737 #define CKM_RIPEMD160_HMAC 0x00000241
738 #define CKM_RIPEMD160_HMAC_GENERAL 0x00000242
740 /* CKM_SHA256/384/512 are new for v2.20 */
741 #define CKM_SHA256 0x00000250
742 #define CKM_SHA256_HMAC 0x00000251
743 #define CKM_SHA256_HMAC_GENERAL 0x00000252
744 #define CKM_SHA384 0x00000260
745 #define CKM_SHA384_HMAC 0x00000261
746 #define CKM_SHA384_HMAC_GENERAL 0x00000262
747 #define CKM_SHA512 0x00000270
748 #define CKM_SHA512_HMAC 0x00000271
749 #define CKM_SHA512_HMAC_GENERAL 0x00000272
751 /* CKM_SHA224 new for v2.20 amendment 3 */
752 #define CKM_SHA224 0x00000255
753 #define CKM_SHA224_HMAC 0x00000256
754 #define CKM_SHA224_HMAC_GENERAL 0x00000257
756 /* All of the following mechanisms are new for v2.0 */
757 /* Note that CAST128 and CAST5 are the same algorithm */
758 #define CKM_CAST_KEY_GEN 0x00000300
759 #define CKM_CAST_ECB 0x00000301
760 #define CKM_CAST_CBC 0x00000302
761 #define CKM_CAST_MAC 0x00000303
762 #define CKM_CAST_MAC_GENERAL 0x00000304
763 #define CKM_CAST_CBC_PAD 0x00000305
764 #define CKM_CAST3_KEY_GEN 0x00000310
765 #define CKM_CAST3_ECB 0x00000311
766 #define CKM_CAST3_CBC 0x00000312
767 #define CKM_CAST3_MAC 0x00000313
768 #define CKM_CAST3_MAC_GENERAL 0x00000314
769 #define CKM_CAST3_CBC_PAD 0x00000315
770 #define CKM_CAST5_KEY_GEN 0x00000320
771 #define CKM_CAST128_KEY_GEN 0x00000320
772 #define CKM_CAST5_ECB 0x00000321
773 #define CKM_CAST128_ECB 0x00000321
774 #define CKM_CAST5_CBC 0x00000322
775 #define CKM_CAST128_CBC 0x00000322
776 #define CKM_CAST5_MAC 0x00000323
777 #define CKM_CAST128_MAC 0x00000323
778 #define CKM_CAST5_MAC_GENERAL 0x00000324
779 #define CKM_CAST128_MAC_GENERAL 0x00000324
780 #define CKM_CAST5_CBC_PAD 0x00000325
781 #define CKM_CAST128_CBC_PAD 0x00000325
782 #define CKM_RC5_KEY_GEN 0x00000330
783 #define CKM_RC5_ECB 0x00000331
784 #define CKM_RC5_CBC 0x00000332
785 #define CKM_RC5_MAC 0x00000333
786 #define CKM_RC5_MAC_GENERAL 0x00000334
787 #define CKM_RC5_CBC_PAD 0x00000335
788 #define CKM_IDEA_KEY_GEN 0x00000340
789 #define CKM_IDEA_ECB 0x00000341
790 #define CKM_IDEA_CBC 0x00000342
791 #define CKM_IDEA_MAC 0x00000343
792 #define CKM_IDEA_MAC_GENERAL 0x00000344
793 #define CKM_IDEA_CBC_PAD 0x00000345
794 #define CKM_GENERIC_SECRET_KEY_GEN 0x00000350
795 #define CKM_CONCATENATE_BASE_AND_KEY 0x00000360
796 #define CKM_CONCATENATE_BASE_AND_DATA 0x00000362
797 #define CKM_CONCATENATE_DATA_AND_BASE 0x00000363
798 #define CKM_XOR_BASE_AND_DATA 0x00000364
799 #define CKM_EXTRACT_KEY_FROM_KEY 0x00000365
800 #define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370
801 #define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371
802 #define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372
804 /* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN,
805 * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and
806 * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */
807 #define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373
808 #define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374
809 #define CKM_TLS_MASTER_KEY_DERIVE 0x00000375
810 #define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376
811 #define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377
813 /* CKM_TLS_PRF is new for v2.20 */
814 #define CKM_TLS_PRF 0x00000378
816 #define CKM_SSL3_MD5_MAC 0x00000380
817 #define CKM_SSL3_SHA1_MAC 0x00000381
818 #define CKM_MD5_KEY_DERIVATION 0x00000390
819 #define CKM_MD2_KEY_DERIVATION 0x00000391
820 #define CKM_SHA1_KEY_DERIVATION 0x00000392
822 /* CKM_SHA256/384/512 are new for v2.20 */
823 #define CKM_SHA256_KEY_DERIVATION 0x00000393
824 #define CKM_SHA384_KEY_DERIVATION 0x00000394
825 #define CKM_SHA512_KEY_DERIVATION 0x00000395
827 /* CKM_SHA224 new for v2.20 amendment 3 */
828 #define CKM_SHA224_KEY_DERIVATION 0x00000396
830 #define CKM_PBE_MD2_DES_CBC 0x000003A0
831 #define CKM_PBE_MD5_DES_CBC 0x000003A1
832 #define CKM_PBE_MD5_CAST_CBC 0x000003A2
833 #define CKM_PBE_MD5_CAST3_CBC 0x000003A3
834 #define CKM_PBE_MD5_CAST5_CBC 0x000003A4
835 #define CKM_PBE_MD5_CAST128_CBC 0x000003A4
836 #define CKM_PBE_SHA1_CAST5_CBC 0x000003A5
837 #define CKM_PBE_SHA1_CAST128_CBC 0x000003A5
838 #define CKM_PBE_SHA1_RC4_128 0x000003A6
839 #define CKM_PBE_SHA1_RC4_40 0x000003A7
840 #define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8
841 #define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9
842 #define CKM_PBE_SHA1_RC2_128_CBC 0x000003AA
843 #define CKM_PBE_SHA1_RC2_40_CBC 0x000003AB
845 /* CKM_PKCS5_PBKD2 is new for v2.10 */
846 #define CKM_PKCS5_PBKD2 0x000003B0
848 #define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0
850 /* WTLS mechanisms are new for v2.20 */
851 #define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003D0
852 #define CKM_WTLS_MASTER_KEY_DERIVE 0x000003D1
853 #define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003D2
854 #define CKM_WTLS_PRF 0x000003D3
855 #define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003D4
856 #define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003D5
858 #define CKM_KEY_WRAP_LYNKS 0x00000400
859 #define CKM_KEY_WRAP_SET_OAEP 0x00000401
861 /* CKM_CMS_SIG is new for v2.20 */
862 #define CKM_CMS_SIG 0x00000500
864 /* Fortezza mechanisms */
865 #define CKM_SKIPJACK_KEY_GEN 0x00001000
866 #define CKM_SKIPJACK_ECB64 0x00001001
867 #define CKM_SKIPJACK_CBC64 0x00001002
868 #define CKM_SKIPJACK_OFB64 0x00001003
869 #define CKM_SKIPJACK_CFB64 0x00001004
870 #define CKM_SKIPJACK_CFB32 0x00001005
871 #define CKM_SKIPJACK_CFB16 0x00001006
872 #define CKM_SKIPJACK_CFB8 0x00001007
873 #define CKM_SKIPJACK_WRAP 0x00001008
874 #define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009
875 #define CKM_SKIPJACK_RELAYX 0x0000100a
876 #define CKM_KEA_KEY_PAIR_GEN 0x00001010
877 #define CKM_KEA_KEY_DERIVE 0x00001011
878 #define CKM_FORTEZZA_TIMESTAMP 0x00001020
879 #define CKM_BATON_KEY_GEN 0x00001030
880 #define CKM_BATON_ECB128 0x00001031
881 #define CKM_BATON_ECB96 0x00001032
882 #define CKM_BATON_CBC128 0x00001033
883 #define CKM_BATON_COUNTER 0x00001034
884 #define CKM_BATON_SHUFFLE 0x00001035
885 #define CKM_BATON_WRAP 0x00001036
887 /* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11,
888 * CKM_EC_KEY_PAIR_GEN is preferred */
889 #define CKM_ECDSA_KEY_PAIR_GEN 0x00001040
890 #define CKM_EC_KEY_PAIR_GEN 0x00001040
892 #define CKM_ECDSA 0x00001041
893 #define CKM_ECDSA_SHA1 0x00001042
895 /* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE
896 * are new for v2.11 */
897 #define CKM_ECDH1_DERIVE 0x00001050
898 #define CKM_ECDH1_COFACTOR_DERIVE 0x00001051
899 #define CKM_ECMQV_DERIVE 0x00001052
901 #define CKM_JUNIPER_KEY_GEN 0x00001060
902 #define CKM_JUNIPER_ECB128 0x00001061
903 #define CKM_JUNIPER_CBC128 0x00001062
904 #define CKM_JUNIPER_COUNTER 0x00001063
905 #define CKM_JUNIPER_SHUFFLE 0x00001064
906 #define CKM_JUNIPER_WRAP 0x00001065
907 #define CKM_FASTHASH 0x00001070
909 /* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC,
910 * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN,
911 * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are
913 #define CKM_AES_KEY_GEN 0x00001080
914 #define CKM_AES_ECB 0x00001081
915 #define CKM_AES_CBC 0x00001082
916 #define CKM_AES_MAC 0x00001083
917 #define CKM_AES_MAC_GENERAL 0x00001084
918 #define CKM_AES_CBC_PAD 0x00001085
920 /* BlowFish and TwoFish are new for v2.20 */
921 #define CKM_BLOWFISH_KEY_GEN 0x00001090
922 #define CKM_BLOWFISH_CBC 0x00001091
923 #define CKM_TWOFISH_KEY_GEN 0x00001092
924 #define CKM_TWOFISH_CBC 0x00001093
926 /* Camellia is proposed for v2.20 Amendment 3 */
927 #define CKM_CAMELLIA_KEY_GEN 0x00000550
928 #define CKM_CAMELLIA_ECB 0x00000551
929 #define CKM_CAMELLIA_CBC 0x00000552
930 #define CKM_CAMELLIA_MAC 0x00000553
931 #define CKM_CAMELLIA_MAC_GENERAL 0x00000554
932 #define CKM_CAMELLIA_CBC_PAD 0x00000555
933 #define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556
934 #define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557
936 /* CKM_xxx_ENCRYPT_DATA mechanisms are new for v2.20 */
937 #define CKM_DES_ECB_ENCRYPT_DATA 0x00001100
938 #define CKM_DES_CBC_ENCRYPT_DATA 0x00001101
939 #define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102
940 #define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103
941 #define CKM_AES_ECB_ENCRYPT_DATA 0x00001104
942 #define CKM_AES_CBC_ENCRYPT_DATA 0x00001105
944 #define CKM_DSA_PARAMETER_GEN 0x00002000
945 #define CKM_DH_PKCS_PARAMETER_GEN 0x00002001
946 #define CKM_X9_42_DH_PARAMETER_GEN 0x00002002
948 #define CKM_VENDOR_DEFINED 0x80000000
950 typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR
;
953 /* CK_MECHANISM is a structure that specifies a particular
955 typedef struct CK_MECHANISM
{
956 CK_MECHANISM_TYPE mechanism
;
957 CK_VOID_PTR pParameter
;
959 /* ulParameterLen was changed from CK_USHORT to CK_ULONG for
961 CK_ULONG ulParameterLen
; /* in bytes */
964 typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR
;
967 /* CK_MECHANISM_INFO provides information about a particular
969 typedef struct CK_MECHANISM_INFO
{
970 CK_ULONG ulMinKeySize
;
971 CK_ULONG ulMaxKeySize
;
975 /* The flags are defined as follows:
976 * Bit Flag Mask Meaning */
977 #define CKF_HW 0x00000001 /* performed by HW */
979 /* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN,
980 * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER,
981 * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP,
982 * and CKF_DERIVE are new for v2.0. They specify whether or not
983 * a mechanism can be used for a particular task */
984 #define CKF_ENCRYPT 0x00000100
985 #define CKF_DECRYPT 0x00000200
986 #define CKF_DIGEST 0x00000400
987 #define CKF_SIGN 0x00000800
988 #define CKF_SIGN_RECOVER 0x00001000
989 #define CKF_VERIFY 0x00002000
990 #define CKF_VERIFY_RECOVER 0x00004000
991 #define CKF_GENERATE 0x00008000
992 #define CKF_GENERATE_KEY_PAIR 0x00010000
993 #define CKF_WRAP 0x00020000
994 #define CKF_UNWRAP 0x00040000
995 #define CKF_DERIVE 0x00080000
997 /* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE,
998 * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They
999 * describe a token's EC capabilities not available in mechanism
1001 #define CKF_EC_F_P 0x00100000
1002 #define CKF_EC_F_2M 0x00200000
1003 #define CKF_EC_ECPARAMETERS 0x00400000
1004 #define CKF_EC_NAMEDCURVE 0x00800000
1005 #define CKF_EC_UNCOMPRESS 0x01000000
1006 #define CKF_EC_COMPRESS 0x02000000
1008 #define CKF_EXTENSION 0x80000000 /* FALSE for this version */
1010 typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR
;
1013 /* CK_RV is a value that identifies the return value of a
1014 * PKCS #11 function */
1015 /* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */
1016 typedef CK_ULONG CK_RV
;
1018 #define CKR_OK 0x00000000
1019 #define CKR_CANCEL 0x00000001
1020 #define CKR_HOST_MEMORY 0x00000002
1021 #define CKR_SLOT_ID_INVALID 0x00000003
1023 /* CKR_FLAGS_INVALID was removed for v2.0 */
1025 /* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */
1026 #define CKR_GENERAL_ERROR 0x00000005
1027 #define CKR_FUNCTION_FAILED 0x00000006
1029 /* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS,
1030 * and CKR_CANT_LOCK are new for v2.01 */
1031 #define CKR_ARGUMENTS_BAD 0x00000007
1032 #define CKR_NO_EVENT 0x00000008
1033 #define CKR_NEED_TO_CREATE_THREADS 0x00000009
1034 #define CKR_CANT_LOCK 0x0000000A
1036 #define CKR_ATTRIBUTE_READ_ONLY 0x00000010
1037 #define CKR_ATTRIBUTE_SENSITIVE 0x00000011
1038 #define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012
1039 #define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013
1040 #define CKR_DATA_INVALID 0x00000020
1041 #define CKR_DATA_LEN_RANGE 0x00000021
1042 #define CKR_DEVICE_ERROR 0x00000030
1043 #define CKR_DEVICE_MEMORY 0x00000031
1044 #define CKR_DEVICE_REMOVED 0x00000032
1045 #define CKR_ENCRYPTED_DATA_INVALID 0x00000040
1046 #define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041
1047 #define CKR_FUNCTION_CANCELED 0x00000050
1048 #define CKR_FUNCTION_NOT_PARALLEL 0x00000051
1050 /* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */
1051 #define CKR_FUNCTION_NOT_SUPPORTED 0x00000054
1053 #define CKR_KEY_HANDLE_INVALID 0x00000060
1055 /* CKR_KEY_SENSITIVE was removed for v2.0 */
1057 #define CKR_KEY_SIZE_RANGE 0x00000062
1058 #define CKR_KEY_TYPE_INCONSISTENT 0x00000063
1060 /* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED,
1061 * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED,
1062 * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for
1064 #define CKR_KEY_NOT_NEEDED 0x00000064
1065 #define CKR_KEY_CHANGED 0x00000065
1066 #define CKR_KEY_NEEDED 0x00000066
1067 #define CKR_KEY_INDIGESTIBLE 0x00000067
1068 #define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068
1069 #define CKR_KEY_NOT_WRAPPABLE 0x00000069
1070 #define CKR_KEY_UNEXTRACTABLE 0x0000006A
1072 #define CKR_MECHANISM_INVALID 0x00000070
1073 #define CKR_MECHANISM_PARAM_INVALID 0x00000071
1075 /* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID
1076 * were removed for v2.0 */
1077 #define CKR_OBJECT_HANDLE_INVALID 0x00000082
1078 #define CKR_OPERATION_ACTIVE 0x00000090
1079 #define CKR_OPERATION_NOT_INITIALIZED 0x00000091
1080 #define CKR_PIN_INCORRECT 0x000000A0
1081 #define CKR_PIN_INVALID 0x000000A1
1082 #define CKR_PIN_LEN_RANGE 0x000000A2
1084 /* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */
1085 #define CKR_PIN_EXPIRED 0x000000A3
1086 #define CKR_PIN_LOCKED 0x000000A4
1088 #define CKR_SESSION_CLOSED 0x000000B0
1089 #define CKR_SESSION_COUNT 0x000000B1
1090 #define CKR_SESSION_HANDLE_INVALID 0x000000B3
1091 #define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4
1092 #define CKR_SESSION_READ_ONLY 0x000000B5
1093 #define CKR_SESSION_EXISTS 0x000000B6
1095 /* CKR_SESSION_READ_ONLY_EXISTS and
1096 * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */
1097 #define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7
1098 #define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8
1100 #define CKR_SIGNATURE_INVALID 0x000000C0
1101 #define CKR_SIGNATURE_LEN_RANGE 0x000000C1
1102 #define CKR_TEMPLATE_INCOMPLETE 0x000000D0
1103 #define CKR_TEMPLATE_INCONSISTENT 0x000000D1
1104 #define CKR_TOKEN_NOT_PRESENT 0x000000E0
1105 #define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1
1106 #define CKR_TOKEN_WRITE_PROTECTED 0x000000E2
1107 #define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0
1108 #define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1
1109 #define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2
1110 #define CKR_USER_ALREADY_LOGGED_IN 0x00000100
1111 #define CKR_USER_NOT_LOGGED_IN 0x00000101
1112 #define CKR_USER_PIN_NOT_INITIALIZED 0x00000102
1113 #define CKR_USER_TYPE_INVALID 0x00000103
1115 /* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES
1116 * are new to v2.01 */
1117 #define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104
1118 #define CKR_USER_TOO_MANY_TYPES 0x00000105
1120 #define CKR_WRAPPED_KEY_INVALID 0x00000110
1121 #define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112
1122 #define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113
1123 #define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114
1124 #define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115
1125 #define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120
1127 /* These are new to v2.0 */
1128 #define CKR_RANDOM_NO_RNG 0x00000121
1130 /* These are new to v2.11 */
1131 #define CKR_DOMAIN_PARAMS_INVALID 0x00000130
1133 /* These are new to v2.0 */
1134 #define CKR_BUFFER_TOO_SMALL 0x00000150
1135 #define CKR_SAVED_STATE_INVALID 0x00000160
1136 #define CKR_INFORMATION_SENSITIVE 0x00000170
1137 #define CKR_STATE_UNSAVEABLE 0x00000180
1139 /* These are new to v2.01 */
1140 #define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190
1141 #define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191
1142 #define CKR_MUTEX_BAD 0x000001A0
1143 #define CKR_MUTEX_NOT_LOCKED 0x000001A1
1145 /* This is new to v2.20 */
1146 #define CKR_FUNCTION_REJECTED 0x00000200
1148 #define CKR_VENDOR_DEFINED 0x80000000
1151 /* CK_NOTIFY is an application callback that processes events */
1152 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_NOTIFY
)(
1153 CK_SESSION_HANDLE hSession
, /* the session's handle */
1154 CK_NOTIFICATION event
,
1155 CK_VOID_PTR pApplication
/* passed to C_OpenSession */
1159 /* CK_FUNCTION_LIST is a structure holding a PKCS #11 spec
1160 * version and pointers of appropriate types to all the
1161 * PKCS #11 functions */
1162 /* CK_FUNCTION_LIST is new for v2.0 */
1163 typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST
;
1165 typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR
;
1167 typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR
;
1170 /* CK_CREATEMUTEX is an application callback for creating a
1172 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_CREATEMUTEX
)(
1173 CK_VOID_PTR_PTR ppMutex
/* location to receive ptr to mutex */
1177 /* CK_DESTROYMUTEX is an application callback for destroying a
1179 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_DESTROYMUTEX
)(
1180 CK_VOID_PTR pMutex
/* pointer to mutex */
1184 /* CK_LOCKMUTEX is an application callback for locking a mutex */
1185 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_LOCKMUTEX
)(
1186 CK_VOID_PTR pMutex
/* pointer to mutex */
1190 /* CK_UNLOCKMUTEX is an application callback for unlocking a
1192 typedef CK_CALLBACK_FUNCTION(CK_RV
, CK_UNLOCKMUTEX
)(
1193 CK_VOID_PTR pMutex
/* pointer to mutex */
1197 /* CK_C_INITIALIZE_ARGS provides the optional arguments to
1199 typedef struct CK_C_INITIALIZE_ARGS
{
1200 CK_CREATEMUTEX CreateMutex
;
1201 CK_DESTROYMUTEX DestroyMutex
;
1202 CK_LOCKMUTEX LockMutex
;
1203 CK_UNLOCKMUTEX UnlockMutex
;
1205 /* The official PKCS #11 spec does not have a 'LibraryParameters' field, but
1206 * a reserved field. NSS needs a way to pass instance-specific information
1207 * to the library (like where to find its config files, etc). This
1208 * information is usually provided by the installer and passed uninterpreted
1209 * by NSS to the library, though NSS does know the specifics of the softoken
1210 * version of this parameter. Most compliant PKCS#11 modules expect this
1211 * parameter to be NULL, and will return CKR_ARGUMENTS_BAD from
1212 * C_Initialize if Library parameters is supplied. */
1213 CK_CHAR_PTR
*LibraryParameters
;
1214 /* This field is only present if the LibraryParameters is not NULL. It must
1215 * be NULL in all cases */
1216 CK_VOID_PTR pReserved
;
1217 } CK_C_INITIALIZE_ARGS
;
1219 /* flags: bit flags that provide capabilities of the slot
1220 * Bit Flag Mask Meaning
1222 #define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001
1223 #define CKF_OS_LOCKING_OK 0x00000002
1225 typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR
;
1228 /* additional flags for parameters to functions */
1230 /* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */
1231 #define CKF_DONT_BLOCK 1
1233 /* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10.
1234 * CK_RSA_PKCS_OAEP_MGF_TYPE is used to indicate the Message
1235 * Generation Function (MGF) applied to a message block when
1236 * formatting a message block for the PKCS #1 OAEP encryption
1238 typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE
;
1240 typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR
;
1242 /* The following MGFs are defined */
1243 /* CKG_MGF1_SHA256, CKG_MGF1_SHA384, and CKG_MGF1_SHA512
1244 * are new for v2.20 */
1245 #define CKG_MGF1_SHA1 0x00000001
1246 #define CKG_MGF1_SHA256 0x00000002
1247 #define CKG_MGF1_SHA384 0x00000003
1248 #define CKG_MGF1_SHA512 0x00000004
1250 /* v2.20 amendment 3 */
1251 #define CKG_MGF1_SHA224 0x00000005
1253 /* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10.
1254 * CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source
1255 * of the encoding parameter when formatting a message block
1256 * for the PKCS #1 OAEP encryption scheme. */
1257 typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE
;
1259 typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR
;
1261 /* The following encoding parameter sources are defined */
1262 #define CKZ_DATA_SPECIFIED 0x00000001
1264 /* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10.
1265 * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the
1266 * CKM_RSA_PKCS_OAEP mechanism. */
1267 typedef struct CK_RSA_PKCS_OAEP_PARAMS
{
1268 CK_MECHANISM_TYPE hashAlg
;
1269 CK_RSA_PKCS_MGF_TYPE mgf
;
1270 CK_RSA_PKCS_OAEP_SOURCE_TYPE source
;
1271 CK_VOID_PTR pSourceData
;
1272 CK_ULONG ulSourceDataLen
;
1273 } CK_RSA_PKCS_OAEP_PARAMS
;
1275 typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR
;
1277 /* CK_RSA_PKCS_PSS_PARAMS is new for v2.11.
1278 * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the
1279 * CKM_RSA_PKCS_PSS mechanism(s). */
1280 typedef struct CK_RSA_PKCS_PSS_PARAMS
{
1281 CK_MECHANISM_TYPE hashAlg
;
1282 CK_RSA_PKCS_MGF_TYPE mgf
;
1284 } CK_RSA_PKCS_PSS_PARAMS
;
1286 typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR
;
1288 /* CK_EC_KDF_TYPE is new for v2.11. */
1289 typedef CK_ULONG CK_EC_KDF_TYPE
;
1291 /* The following EC Key Derivation Functions are defined */
1292 #define CKD_NULL 0x00000001
1293 #define CKD_SHA1_KDF 0x00000002
1295 /* CK_ECDH1_DERIVE_PARAMS is new for v2.11.
1296 * CK_ECDH1_DERIVE_PARAMS provides the parameters to the
1297 * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms,
1298 * where each party contributes one key pair.
1300 typedef struct CK_ECDH1_DERIVE_PARAMS
{
1302 CK_ULONG ulSharedDataLen
;
1303 CK_BYTE_PTR pSharedData
;
1304 CK_ULONG ulPublicDataLen
;
1305 CK_BYTE_PTR pPublicData
;
1306 } CK_ECDH1_DERIVE_PARAMS
;
1308 typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR
;
1311 /* CK_ECDH2_DERIVE_PARAMS is new for v2.11.
1312 * CK_ECDH2_DERIVE_PARAMS provides the parameters to the
1313 * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */
1314 typedef struct CK_ECDH2_DERIVE_PARAMS
{
1316 CK_ULONG ulSharedDataLen
;
1317 CK_BYTE_PTR pSharedData
;
1318 CK_ULONG ulPublicDataLen
;
1319 CK_BYTE_PTR pPublicData
;
1320 CK_ULONG ulPrivateDataLen
;
1321 CK_OBJECT_HANDLE hPrivateData
;
1322 CK_ULONG ulPublicDataLen2
;
1323 CK_BYTE_PTR pPublicData2
;
1324 } CK_ECDH2_DERIVE_PARAMS
;
1326 typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR
;
1328 typedef struct CK_ECMQV_DERIVE_PARAMS
{
1330 CK_ULONG ulSharedDataLen
;
1331 CK_BYTE_PTR pSharedData
;
1332 CK_ULONG ulPublicDataLen
;
1333 CK_BYTE_PTR pPublicData
;
1334 CK_ULONG ulPrivateDataLen
;
1335 CK_OBJECT_HANDLE hPrivateData
;
1336 CK_ULONG ulPublicDataLen2
;
1337 CK_BYTE_PTR pPublicData2
;
1338 CK_OBJECT_HANDLE publicKey
;
1339 } CK_ECMQV_DERIVE_PARAMS
;
1341 typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR
;
1343 /* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the
1344 * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */
1345 typedef CK_ULONG CK_X9_42_DH_KDF_TYPE
;
1346 typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR
;
1348 /* The following X9.42 DH key derivation functions are defined
1349 (besides CKD_NULL already defined : */
1350 #define CKD_SHA1_KDF_ASN1 0x00000003
1351 #define CKD_SHA1_KDF_CONCATENATE 0x00000004
1353 /* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11.
1354 * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the
1355 * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party
1356 * contributes one key pair */
1357 typedef struct CK_X9_42_DH1_DERIVE_PARAMS
{
1358 CK_X9_42_DH_KDF_TYPE kdf
;
1359 CK_ULONG ulOtherInfoLen
;
1360 CK_BYTE_PTR pOtherInfo
;
1361 CK_ULONG ulPublicDataLen
;
1362 CK_BYTE_PTR pPublicData
;
1363 } CK_X9_42_DH1_DERIVE_PARAMS
;
1365 typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR
;
1367 /* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11.
1368 * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the
1369 * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation
1370 * mechanisms, where each party contributes two key pairs */
1371 typedef struct CK_X9_42_DH2_DERIVE_PARAMS
{
1372 CK_X9_42_DH_KDF_TYPE kdf
;
1373 CK_ULONG ulOtherInfoLen
;
1374 CK_BYTE_PTR pOtherInfo
;
1375 CK_ULONG ulPublicDataLen
;
1376 CK_BYTE_PTR pPublicData
;
1377 CK_ULONG ulPrivateDataLen
;
1378 CK_OBJECT_HANDLE hPrivateData
;
1379 CK_ULONG ulPublicDataLen2
;
1380 CK_BYTE_PTR pPublicData2
;
1381 } CK_X9_42_DH2_DERIVE_PARAMS
;
1383 typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR
;
1385 typedef struct CK_X9_42_MQV_DERIVE_PARAMS
{
1386 CK_X9_42_DH_KDF_TYPE kdf
;
1387 CK_ULONG ulOtherInfoLen
;
1388 CK_BYTE_PTR pOtherInfo
;
1389 CK_ULONG ulPublicDataLen
;
1390 CK_BYTE_PTR pPublicData
;
1391 CK_ULONG ulPrivateDataLen
;
1392 CK_OBJECT_HANDLE hPrivateData
;
1393 CK_ULONG ulPublicDataLen2
;
1394 CK_BYTE_PTR pPublicData2
;
1395 CK_OBJECT_HANDLE publicKey
;
1396 } CK_X9_42_MQV_DERIVE_PARAMS
;
1398 typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR
;
1400 /* CK_KEA_DERIVE_PARAMS provides the parameters to the
1401 * CKM_KEA_DERIVE mechanism */
1402 /* CK_KEA_DERIVE_PARAMS is new for v2.0 */
1403 typedef struct CK_KEA_DERIVE_PARAMS
{
1405 CK_ULONG ulRandomLen
;
1406 CK_BYTE_PTR pRandomA
;
1407 CK_BYTE_PTR pRandomB
;
1408 CK_ULONG ulPublicDataLen
;
1409 CK_BYTE_PTR pPublicData
;
1410 } CK_KEA_DERIVE_PARAMS
;
1412 typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR
;
1415 /* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and
1416 * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just
1417 * holds the effective keysize */
1418 typedef CK_ULONG CK_RC2_PARAMS
;
1420 typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR
;
1423 /* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC
1425 typedef struct CK_RC2_CBC_PARAMS
{
1426 /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for
1428 CK_ULONG ulEffectiveBits
; /* effective bits (1-1024) */
1430 CK_BYTE iv
[8]; /* IV for CBC mode */
1431 } CK_RC2_CBC_PARAMS
;
1433 typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR
;
1436 /* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the
1437 * CKM_RC2_MAC_GENERAL mechanism */
1438 /* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */
1439 typedef struct CK_RC2_MAC_GENERAL_PARAMS
{
1440 CK_ULONG ulEffectiveBits
; /* effective bits (1-1024) */
1441 CK_ULONG ulMacLength
; /* Length of MAC in bytes */
1442 } CK_RC2_MAC_GENERAL_PARAMS
;
1444 typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \
1445 CK_RC2_MAC_GENERAL_PARAMS_PTR
;
1448 /* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and
1449 * CKM_RC5_MAC mechanisms */
1450 /* CK_RC5_PARAMS is new for v2.0 */
1451 typedef struct CK_RC5_PARAMS
{
1452 CK_ULONG ulWordsize
; /* wordsize in bits */
1453 CK_ULONG ulRounds
; /* number of rounds */
1456 typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR
;
1459 /* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC
1461 /* CK_RC5_CBC_PARAMS is new for v2.0 */
1462 typedef struct CK_RC5_CBC_PARAMS
{
1463 CK_ULONG ulWordsize
; /* wordsize in bits */
1464 CK_ULONG ulRounds
; /* number of rounds */
1465 CK_BYTE_PTR pIv
; /* pointer to IV */
1466 CK_ULONG ulIvLen
; /* length of IV in bytes */
1467 } CK_RC5_CBC_PARAMS
;
1469 typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR
;
1472 /* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the
1473 * CKM_RC5_MAC_GENERAL mechanism */
1474 /* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */
1475 typedef struct CK_RC5_MAC_GENERAL_PARAMS
{
1476 CK_ULONG ulWordsize
; /* wordsize in bits */
1477 CK_ULONG ulRounds
; /* number of rounds */
1478 CK_ULONG ulMacLength
; /* Length of MAC in bytes */
1479 } CK_RC5_MAC_GENERAL_PARAMS
;
1481 typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \
1482 CK_RC5_MAC_GENERAL_PARAMS_PTR
;
1485 /* CK_MAC_GENERAL_PARAMS provides the parameters to most block
1486 * ciphers' MAC_GENERAL mechanisms. Its value is the length of
1488 /* CK_MAC_GENERAL_PARAMS is new for v2.0 */
1489 typedef CK_ULONG CK_MAC_GENERAL_PARAMS
;
1491 typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR
;
1493 /* CK_DES/AES_ECB/CBC_ENCRYPT_DATA_PARAMS are new for v2.20 */
1494 typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS
{
1498 } CK_DES_CBC_ENCRYPT_DATA_PARAMS
;
1500 typedef CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR
;
1502 typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS
{
1506 } CK_AES_CBC_ENCRYPT_DATA_PARAMS
;
1508 typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR
;
1510 /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the
1511 * CKM_SKIPJACK_PRIVATE_WRAP mechanism */
1512 /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */
1513 typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS
{
1514 CK_ULONG ulPasswordLen
;
1515 CK_BYTE_PTR pPassword
;
1516 CK_ULONG ulPublicDataLen
;
1517 CK_BYTE_PTR pPublicData
;
1518 CK_ULONG ulPAndGLen
;
1520 CK_ULONG ulRandomLen
;
1521 CK_BYTE_PTR pRandomA
;
1522 CK_BYTE_PTR pPrimeP
;
1524 CK_BYTE_PTR pSubprimeQ
;
1525 } CK_SKIPJACK_PRIVATE_WRAP_PARAMS
;
1527 typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \
1528 CK_SKIPJACK_PRIVATE_WRAP_PTR
;
1531 /* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the
1532 * CKM_SKIPJACK_RELAYX mechanism */
1533 /* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */
1534 typedef struct CK_SKIPJACK_RELAYX_PARAMS
{
1535 CK_ULONG ulOldWrappedXLen
;
1536 CK_BYTE_PTR pOldWrappedX
;
1537 CK_ULONG ulOldPasswordLen
;
1538 CK_BYTE_PTR pOldPassword
;
1539 CK_ULONG ulOldPublicDataLen
;
1540 CK_BYTE_PTR pOldPublicData
;
1541 CK_ULONG ulOldRandomLen
;
1542 CK_BYTE_PTR pOldRandomA
;
1543 CK_ULONG ulNewPasswordLen
;
1544 CK_BYTE_PTR pNewPassword
;
1545 CK_ULONG ulNewPublicDataLen
;
1546 CK_BYTE_PTR pNewPublicData
;
1547 CK_ULONG ulNewRandomLen
;
1548 CK_BYTE_PTR pNewRandomA
;
1549 } CK_SKIPJACK_RELAYX_PARAMS
;
1551 typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \
1552 CK_SKIPJACK_RELAYX_PARAMS_PTR
;
1555 typedef struct CK_PBE_PARAMS
{
1556 CK_BYTE_PTR pInitVector
;
1557 CK_UTF8CHAR_PTR pPassword
;
1558 CK_ULONG ulPasswordLen
;
1561 CK_ULONG ulIteration
;
1564 typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR
;
1567 /* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the
1568 * CKM_KEY_WRAP_SET_OAEP mechanism */
1569 /* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */
1570 typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS
{
1571 CK_BYTE bBC
; /* block contents byte */
1572 CK_BYTE_PTR pX
; /* extra data */
1573 CK_ULONG ulXLen
; /* length of extra data in bytes */
1574 } CK_KEY_WRAP_SET_OAEP_PARAMS
;
1576 typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \
1577 CK_KEY_WRAP_SET_OAEP_PARAMS_PTR
;
1580 typedef struct CK_SSL3_RANDOM_DATA
{
1581 CK_BYTE_PTR pClientRandom
;
1582 CK_ULONG ulClientRandomLen
;
1583 CK_BYTE_PTR pServerRandom
;
1584 CK_ULONG ulServerRandomLen
;
1585 } CK_SSL3_RANDOM_DATA
;
1588 typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS
{
1589 CK_SSL3_RANDOM_DATA RandomInfo
;
1590 CK_VERSION_PTR pVersion
;
1591 } CK_SSL3_MASTER_KEY_DERIVE_PARAMS
;
1593 typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1594 CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR
;
1597 typedef struct CK_SSL3_KEY_MAT_OUT
{
1598 CK_OBJECT_HANDLE hClientMacSecret
;
1599 CK_OBJECT_HANDLE hServerMacSecret
;
1600 CK_OBJECT_HANDLE hClientKey
;
1601 CK_OBJECT_HANDLE hServerKey
;
1602 CK_BYTE_PTR pIVClient
;
1603 CK_BYTE_PTR pIVServer
;
1604 } CK_SSL3_KEY_MAT_OUT
;
1606 typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR
;
1609 typedef struct CK_SSL3_KEY_MAT_PARAMS
{
1610 CK_ULONG ulMacSizeInBits
;
1611 CK_ULONG ulKeySizeInBits
;
1612 CK_ULONG ulIVSizeInBits
;
1614 CK_SSL3_RANDOM_DATA RandomInfo
;
1615 CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial
;
1616 } CK_SSL3_KEY_MAT_PARAMS
;
1618 typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR
;
1620 /* CK_TLS_PRF_PARAMS is new for version 2.20 */
1621 typedef struct CK_TLS_PRF_PARAMS
{
1625 CK_ULONG ulLabelLen
;
1626 CK_BYTE_PTR pOutput
;
1627 CK_ULONG_PTR pulOutputLen
;
1628 } CK_TLS_PRF_PARAMS
;
1630 typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR
;
1632 /* WTLS is new for version 2.20 */
1633 typedef struct CK_WTLS_RANDOM_DATA
{
1634 CK_BYTE_PTR pClientRandom
;
1635 CK_ULONG ulClientRandomLen
;
1636 CK_BYTE_PTR pServerRandom
;
1637 CK_ULONG ulServerRandomLen
;
1638 } CK_WTLS_RANDOM_DATA
;
1640 typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR
;
1642 typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS
{
1643 CK_MECHANISM_TYPE DigestMechanism
;
1644 CK_WTLS_RANDOM_DATA RandomInfo
;
1645 CK_BYTE_PTR pVersion
;
1646 } CK_WTLS_MASTER_KEY_DERIVE_PARAMS
;
1648 typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1649 CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR
;
1651 typedef struct CK_WTLS_PRF_PARAMS
{
1652 CK_MECHANISM_TYPE DigestMechanism
;
1656 CK_ULONG ulLabelLen
;
1657 CK_BYTE_PTR pOutput
;
1658 CK_ULONG_PTR pulOutputLen
;
1659 } CK_WTLS_PRF_PARAMS
;
1661 typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR
;
1663 typedef struct CK_WTLS_KEY_MAT_OUT
{
1664 CK_OBJECT_HANDLE hMacSecret
;
1665 CK_OBJECT_HANDLE hKey
;
1667 } CK_WTLS_KEY_MAT_OUT
;
1669 typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR
;
1671 typedef struct CK_WTLS_KEY_MAT_PARAMS
{
1672 CK_MECHANISM_TYPE DigestMechanism
;
1673 CK_ULONG ulMacSizeInBits
;
1674 CK_ULONG ulKeySizeInBits
;
1675 CK_ULONG ulIVSizeInBits
;
1676 CK_ULONG ulSequenceNumber
;
1678 CK_WTLS_RANDOM_DATA RandomInfo
;
1679 CK_WTLS_KEY_MAT_OUT_PTR pReturnedKeyMaterial
;
1680 } CK_WTLS_KEY_MAT_PARAMS
;
1682 typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR
;
1684 /* CMS is new for version 2.20 */
1685 typedef struct CK_CMS_SIG_PARAMS
{
1686 CK_OBJECT_HANDLE certificateHandle
;
1687 CK_MECHANISM_PTR pSigningMechanism
;
1688 CK_MECHANISM_PTR pDigestMechanism
;
1689 CK_UTF8CHAR_PTR pContentType
;
1690 CK_BYTE_PTR pRequestedAttributes
;
1691 CK_ULONG ulRequestedAttributesLen
;
1692 CK_BYTE_PTR pRequiredAttributes
;
1693 CK_ULONG ulRequiredAttributesLen
;
1694 } CK_CMS_SIG_PARAMS
;
1696 typedef CK_CMS_SIG_PARAMS CK_PTR CK_CMS_SIG_PARAMS_PTR
;
1698 typedef struct CK_KEY_DERIVATION_STRING_DATA
{
1701 } CK_KEY_DERIVATION_STRING_DATA
;
1703 typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \
1704 CK_KEY_DERIVATION_STRING_DATA_PTR
;
1707 /* The CK_EXTRACT_PARAMS is used for the
1708 * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit
1709 * of the base key should be used as the first bit of the
1711 /* CK_EXTRACT_PARAMS is new for v2.0 */
1712 typedef CK_ULONG CK_EXTRACT_PARAMS
;
1714 typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR
;
1716 /* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10.
1717 * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to
1718 * indicate the Pseudo-Random Function (PRF) used to generate
1719 * key bits using PKCS #5 PBKDF2. */
1720 typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE
;
1722 typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR
;
1724 /* The following PRFs are defined in PKCS #5 v2.0. */
1725 #define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001
1728 /* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10.
1729 * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the
1730 * source of the salt value when deriving a key using PKCS #5
1732 typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE
;
1734 typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR
;
1736 /* The following salt value sources are defined in PKCS #5 v2.0. */
1737 #define CKZ_SALT_SPECIFIED 0x00000001
1739 /* CK_PKCS5_PBKD2_PARAMS is new for v2.10.
1740 * CK_PKCS5_PBKD2_PARAMS is a structure that provides the
1741 * parameters to the CKM_PKCS5_PBKD2 mechanism. */
1742 typedef struct CK_PKCS5_PBKD2_PARAMS
{
1743 CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource
;
1744 CK_VOID_PTR pSaltSourceData
;
1745 CK_ULONG ulSaltSourceDataLen
;
1746 CK_ULONG iterations
;
1747 CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf
;
1748 CK_VOID_PTR pPrfData
;
1749 CK_ULONG ulPrfDataLen
;
1750 CK_UTF8CHAR_PTR pPassword
;
1751 CK_ULONG_PTR ulPasswordLen
;
1752 } CK_PKCS5_PBKD2_PARAMS
;
1754 typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR
;
1756 /* NSS Specific defines */
1758 /* defines that have been deprecated in 2.20, but maintained in our
1759 * header file for backward compatibility */
1760 #define CKO_KG_PARAMETERS CKO_DOMAIN_PARAMETERS
1761 #define CKF_EC_FP CKF_EC_F_P
1762 /* new in v2.11 deprecated by 2.20 */
1763 #define CKR_KEY_PARAMS_INVALID 0x0000006B
1765 /* stuff that for historic reasons is in this header file but should have
1766 * been in pkcs11n.h */
1767 #define CKK_INVALID_KEY_TYPE 0xffffffff
1769 #include "pkcs11n.h"
1772 #include "pkcs11u.h"