source: lab.git/Dev/utvpn/utvpn-unix-v101-7101-public/src/Mayaqua/pkcs11t.h @ a1bae3e

trunk
Last change on this file since a1bae3e was a1bae3e, checked in by mitty <mitty@…>, 12 years ago
  • copy vendor drop to trunk

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@147 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

  • Property mode set to 100644
File size: 53.3 KB
Line 
1/* pkcs11t.h include file for PKCS #11. */
2/* $Revision: 1.4 $ */
3
4/* License to copy and use this software is granted provided that it is
5 * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
6 * (Cryptoki)" in all material mentioning or referencing this software.
7
8 * License is also granted to make and use derivative works provided that
9 * such works are identified as "derived from the RSA Security Inc. PKCS #11
10 * Cryptographic Token Interface (Cryptoki)" in all material mentioning or
11 * referencing the derived work.
12
13 * RSA Security Inc. makes no representations concerning either the
14 * merchantability of this software or the suitability of this software for
15 * any particular purpose. It is provided "as is" without express or implied
16 * warranty of any kind.
17 */
18
19/* See top of pkcs11.h for information about the macros that
20 * must be defined and the structure-packing conventions that
21 * must be set before including this file. */
22
23#ifndef _PKCS11T_H_
24#define _PKCS11T_H_ 1
25
26#ifndef CK_DISABLE_TRUE_FALSE
27#ifndef FALSE
28#define FALSE 0
29#endif
30
31#ifndef TRUE
32#define TRUE !(FALSE)
33#endif
34#endif
35
36#define CK_TRUE 1
37#define CK_FALSE 0
38
39/* an unsigned 8-bit value */
40typedef unsigned char     CK_BYTE;
41
42/* an unsigned 8-bit character */
43typedef CK_BYTE           CK_CHAR;
44
45/* an 8-bit UTF-8 character */
46typedef CK_BYTE           CK_UTF8CHAR;
47
48/* a BYTE-sized Boolean flag */
49typedef CK_BYTE           CK_BBOOL;
50
51/* an unsigned value, at least 32 bits long */
52typedef unsigned long int CK_ULONG;
53
54/* a signed value, the same size as a CK_ULONG */
55/* CK_LONG is new for v2.0 */
56typedef long int          CK_LONG;
57
58/* at least 32 bits; each bit is a Boolean flag */
59typedef CK_ULONG          CK_FLAGS;
60
61
62/* some special values for certain CK_ULONG variables */
63#define CK_UNAVAILABLE_INFORMATION (~0UL)
64#define CK_EFFECTIVELY_INFINITE    0
65
66
67typedef CK_BYTE     CK_PTR   CK_BYTE_PTR;
68typedef CK_CHAR     CK_PTR   CK_CHAR_PTR;
69typedef CK_UTF8CHAR CK_PTR   CK_UTF8CHAR_PTR;
70typedef CK_ULONG    CK_PTR   CK_ULONG_PTR;
71typedef void        CK_PTR   CK_VOID_PTR;
72
73/* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */
74typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR;
75
76
77/* The following value is always invalid if used as a session */
78/* handle or object handle */
79#define CK_INVALID_HANDLE 0
80
81
82typedef struct CK_VERSION {
83  CK_BYTE       major;  /* integer portion of version number */
84  CK_BYTE       minor;  /* 1/100ths portion of version number */
85} CK_VERSION;
86
87typedef CK_VERSION CK_PTR CK_VERSION_PTR;
88
89
90typedef struct CK_INFO {
91  /* manufacturerID and libraryDecription have been changed from
92   * CK_CHAR to CK_UTF8CHAR for v2.10 */
93  CK_VERSION    cryptokiVersion;     /* Cryptoki interface ver */
94  CK_UTF8CHAR   manufacturerID[32];  /* blank padded */
95  CK_FLAGS      flags;               /* must be zero */
96
97  /* libraryDescription and libraryVersion are new for v2.0 */
98  CK_UTF8CHAR   libraryDescription[32];  /* blank padded */
99  CK_VERSION    libraryVersion;          /* version of library */
100} CK_INFO;
101
102typedef CK_INFO CK_PTR    CK_INFO_PTR;
103
104
105/* CK_NOTIFICATION enumerates the types of notifications that
106 * Cryptoki provides to an application */
107/* CK_NOTIFICATION has been changed from an enum to a CK_ULONG
108 * for v2.0 */
109typedef CK_ULONG CK_NOTIFICATION;
110#define CKN_SURRENDER       0
111
112
113typedef CK_ULONG          CK_SLOT_ID;
114
115typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR;
116
117
118/* CK_SLOT_INFO provides information about a slot */
119typedef struct CK_SLOT_INFO {
120  /* slotDescription and manufacturerID have been changed from
121   * CK_CHAR to CK_UTF8CHAR for v2.10 */
122  CK_UTF8CHAR   slotDescription[64];  /* blank padded */
123  CK_UTF8CHAR   manufacturerID[32];   /* blank padded */
124  CK_FLAGS      flags;
125
126  /* hardwareVersion and firmwareVersion are new for v2.0 */
127  CK_VERSION    hardwareVersion;  /* version of hardware */
128  CK_VERSION    firmwareVersion;  /* version of firmware */
129} CK_SLOT_INFO;
130
131/* flags: bit flags that provide capabilities of the slot
132 *      Bit Flag              Mask        Meaning
133 */
134#define CKF_TOKEN_PRESENT     0x00000001  /* a token is there */
135#define CKF_REMOVABLE_DEVICE  0x00000002  /* removable devices*/
136#define CKF_HW_SLOT           0x00000004  /* hardware slot */
137
138typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR;
139
140
141/* CK_TOKEN_INFO provides information about a token */
142typedef struct CK_TOKEN_INFO {
143  /* label, manufacturerID, and model have been changed from
144   * CK_CHAR to CK_UTF8CHAR for v2.10 */
145  CK_UTF8CHAR   label[32];           /* blank padded */
146  CK_UTF8CHAR   manufacturerID[32];  /* blank padded */
147  CK_UTF8CHAR   model[16];           /* blank padded */
148  CK_CHAR       serialNumber[16];    /* blank padded */
149  CK_FLAGS      flags;               /* see below */
150
151  /* ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount,
152   * ulRwSessionCount, ulMaxPinLen, and ulMinPinLen have all been
153   * changed from CK_USHORT to CK_ULONG for v2.0 */
154  CK_ULONG      ulMaxSessionCount;     /* max open sessions */
155  CK_ULONG      ulSessionCount;        /* sess. now open */
156  CK_ULONG      ulMaxRwSessionCount;   /* max R/W sessions */
157  CK_ULONG      ulRwSessionCount;      /* R/W sess. now open */
158  CK_ULONG      ulMaxPinLen;           /* in bytes */
159  CK_ULONG      ulMinPinLen;           /* in bytes */
160  CK_ULONG      ulTotalPublicMemory;   /* in bytes */
161  CK_ULONG      ulFreePublicMemory;    /* in bytes */
162  CK_ULONG      ulTotalPrivateMemory;  /* in bytes */
163  CK_ULONG      ulFreePrivateMemory;   /* in bytes */
164
165  /* hardwareVersion, firmwareVersion, and time are new for
166   * v2.0 */
167  CK_VERSION    hardwareVersion;       /* version of hardware */
168  CK_VERSION    firmwareVersion;       /* version of firmware */
169  CK_CHAR       utcTime[16];           /* time */
170} CK_TOKEN_INFO;
171
172/* The flags parameter is defined as follows:
173 *      Bit Flag                    Mask        Meaning
174 */
175#define CKF_RNG                     0x00000001  /* has random #
176                                                 * generator */
177#define CKF_WRITE_PROTECTED         0x00000002  /* token is
178                                                 * write-
179                                                 * protected */
180#define CKF_LOGIN_REQUIRED          0x00000004  /* user must
181                                                 * login */
182#define CKF_USER_PIN_INITIALIZED    0x00000008  /* normal user's
183                                                 * PIN is set */
184
185/* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0.  If it is set,
186 * that means that *every* time the state of cryptographic
187 * operations of a session is successfully saved, all keys
188 * needed to continue those operations are stored in the state */
189#define CKF_RESTORE_KEY_NOT_NEEDED  0x00000020
190
191/* CKF_CLOCK_ON_TOKEN is new for v2.0.  If it is set, that means
192 * that the token has some sort of clock.  The time on that
193 * clock is returned in the token info structure */
194#define CKF_CLOCK_ON_TOKEN          0x00000040
195
196/* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0.  If it is
197 * set, that means that there is some way for the user to login
198 * without sending a PIN through the Cryptoki library itself */
199#define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100
200
201/* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0.  If it is true,
202 * that means that a single session with the token can perform
203 * dual simultaneous cryptographic operations (digest and
204 * encrypt; decrypt and digest; sign and encrypt; and decrypt
205 * and sign) */
206#define CKF_DUAL_CRYPTO_OPERATIONS  0x00000200
207
208/* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the
209 * token has been initialized using C_InitializeToken or an
210 * equivalent mechanism outside the scope of PKCS #11.
211 * Calling C_InitializeToken when this flag is set will cause
212 * the token to be reinitialized. */
213#define CKF_TOKEN_INITIALIZED       0x00000400
214
215/* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is
216 * true, the token supports secondary authentication for
217 * private key objects. */
218#define CKF_SECONDARY_AUTHENTICATION  0x00000800
219
220/* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an
221 * incorrect user login PIN has been entered at least once
222 * since the last successful authentication. */
223#define CKF_USER_PIN_COUNT_LOW       0x00010000
224
225/* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true,
226 * supplying an incorrect user PIN will it to become locked. */
227#define CKF_USER_PIN_FINAL_TRY       0x00020000
228
229/* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the
230 * user PIN has been locked. User login to the token is not
231 * possible. */
232#define CKF_USER_PIN_LOCKED          0x00040000
233
234/* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
235 * the user PIN value is the default value set by token
236 * initialization or manufacturing, or the PIN has been
237 * expired by the card. */
238#define CKF_USER_PIN_TO_BE_CHANGED   0x00080000
239
240/* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an
241 * incorrect SO login PIN has been entered at least once since
242 * the last successful authentication. */
243#define CKF_SO_PIN_COUNT_LOW         0x00100000
244
245/* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true,
246 * supplying an incorrect SO PIN will it to become locked. */
247#define CKF_SO_PIN_FINAL_TRY         0x00200000
248
249/* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO
250 * PIN has been locked. SO login to the token is not possible.
251 */
252#define CKF_SO_PIN_LOCKED            0x00400000
253
254/* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
255 * the SO PIN value is the default value set by token
256 * initialization or manufacturing, or the PIN has been
257 * expired by the card. */
258#define CKF_SO_PIN_TO_BE_CHANGED     0x00800000
259
260typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR;
261
262
263/* CK_SESSION_HANDLE is a Cryptoki-assigned value that
264 * identifies a session */
265typedef CK_ULONG          CK_SESSION_HANDLE;
266
267typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR; 
268
269
270/* CK_USER_TYPE enumerates the types of Cryptoki users */
271/* CK_USER_TYPE has been changed from an enum to a CK_ULONG for
272 * v2.0 */
273typedef CK_ULONG          CK_USER_TYPE;
274/* Security Officer */
275#define CKU_SO    0
276/* Normal user */
277#define CKU_USER  1
278
279
280/* CK_STATE enumerates the session states */
281/* CK_STATE has been changed from an enum to a CK_ULONG for
282 * v2.0 */
283typedef CK_ULONG          CK_STATE;
284#define CKS_RO_PUBLIC_SESSION  0
285#define CKS_RO_USER_FUNCTIONS  1
286#define CKS_RW_PUBLIC_SESSION  2
287#define CKS_RW_USER_FUNCTIONS  3
288#define CKS_RW_SO_FUNCTIONS    4
289
290
291/* CK_SESSION_INFO provides information about a session */
292typedef struct CK_SESSION_INFO {
293  CK_SLOT_ID    slotID;
294  CK_STATE      state;
295  CK_FLAGS      flags;          /* see below */
296
297  /* ulDeviceError was changed from CK_USHORT to CK_ULONG for
298   * v2.0 */
299  CK_ULONG      ulDeviceError;  /* device-dependent error code */
300} CK_SESSION_INFO;
301
302/* The flags are defined in the following table:
303 *      Bit Flag                Mask        Meaning
304 */
305#define CKF_RW_SESSION          0x00000002  /* session is r/w */
306#define CKF_SERIAL_SESSION      0x00000004  /* no parallel */
307
308typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR;
309
310
311/* CK_OBJECT_HANDLE is a token-specific identifier for an
312 * object  */
313typedef CK_ULONG          CK_OBJECT_HANDLE;
314
315typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR;
316
317
318/* CK_OBJECT_CLASS is a value that identifies the classes (or
319 * types) of objects that Cryptoki recognizes.  It is defined
320 * as follows: */
321/* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for
322 * v2.0 */
323typedef CK_ULONG          CK_OBJECT_CLASS;
324
325/* The following classes of objects are defined: */
326/* CKO_HW_FEATURE is new for v2.10 */
327/* CKO_DOMAIN_PARAMETERS is new for v2.11 */
328#define CKO_DATA              0x00000000
329#define CKO_CERTIFICATE       0x00000001
330#define CKO_PUBLIC_KEY        0x00000002
331#define CKO_PRIVATE_KEY       0x00000003
332#define CKO_SECRET_KEY        0x00000004
333#define CKO_HW_FEATURE        0x00000005
334#define CKO_DOMAIN_PARAMETERS 0x00000006
335#define CKO_VENDOR_DEFINED    0x80000000
336
337typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR;
338
339/* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a
340 * value that identifies the hardware feature type of an object
341 * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */
342typedef CK_ULONG          CK_HW_FEATURE_TYPE;
343 
344/* The following hardware feature types are defined */
345#define CKH_MONOTONIC_COUNTER  0x00000001
346#define CKH_CLOCK           0x00000002
347#define CKH_VENDOR_DEFINED  0x80000000
348
349/* CK_KEY_TYPE is a value that identifies a key type */
350/* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */
351typedef CK_ULONG          CK_KEY_TYPE;
352
353/* the following key types are defined: */
354#define CKK_RSA             0x00000000
355#define CKK_DSA             0x00000001
356#define CKK_DH              0x00000002
357
358/* CKK_ECDSA and CKK_KEA are new for v2.0 */
359/* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */
360#define CKK_ECDSA           0x00000003
361#define CKK_EC              0x00000003
362#define CKK_X9_42_DH        0x00000004
363#define CKK_KEA             0x00000005
364
365#define CKK_GENERIC_SECRET  0x00000010
366#define CKK_RC2             0x00000011
367#define CKK_RC4             0x00000012
368#define CKK_DES             0x00000013
369#define CKK_DES2            0x00000014
370#define CKK_DES3            0x00000015
371
372/* all these key types are new for v2.0 */
373#define CKK_CAST            0x00000016
374#define CKK_CAST3           0x00000017
375/* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */
376#define CKK_CAST5           0x00000018
377#define CKK_CAST128         0x00000018
378#define CKK_RC5             0x00000019
379#define CKK_IDEA            0x0000001A
380#define CKK_SKIPJACK        0x0000001B
381#define CKK_BATON           0x0000001C
382#define CKK_JUNIPER         0x0000001D
383#define CKK_CDMF            0x0000001E
384#define CKK_AES             0x0000001F
385
386#define CKK_VENDOR_DEFINED  0x80000000
387
388
389/* CK_CERTIFICATE_TYPE is a value that identifies a certificate
390 * type */
391/* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG
392 * for v2.0 */
393typedef CK_ULONG          CK_CERTIFICATE_TYPE;
394
395/* The following certificate types are defined: */
396/* CKC_X_509_ATTR_CERT is new for v2.10 */
397#define CKC_X_509           0x00000000
398#define CKC_X_509_ATTR_CERT 0x00000001
399#define CKC_VENDOR_DEFINED  0x80000000
400
401
402/* CK_ATTRIBUTE_TYPE is a value that identifies an attribute
403 * type */
404/* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for
405 * v2.0 */
406typedef CK_ULONG          CK_ATTRIBUTE_TYPE;
407
408/* The following attribute types are defined: */
409#define CKA_CLASS              0x00000000
410#define CKA_TOKEN              0x00000001
411#define CKA_PRIVATE            0x00000002
412#define CKA_LABEL              0x00000003
413#define CKA_APPLICATION        0x00000010
414#define CKA_VALUE              0x00000011
415
416/* CKA_OBJECT_ID is new for v2.10 */
417#define CKA_OBJECT_ID          0x00000012
418
419#define CKA_CERTIFICATE_TYPE   0x00000080
420#define CKA_ISSUER             0x00000081
421#define CKA_SERIAL_NUMBER      0x00000082
422
423/* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new
424 * for v2.10 */
425#define CKA_AC_ISSUER          0x00000083
426#define CKA_OWNER              0x00000084
427#define CKA_ATTR_TYPES         0x00000085
428
429/* CKA_TRUSTED is new for v2.11 */
430#define CKA_TRUSTED            0x00000086
431
432#define CKA_KEY_TYPE           0x00000100
433#define CKA_SUBJECT            0x00000101
434#define CKA_ID                 0x00000102
435#define CKA_SENSITIVE          0x00000103
436#define CKA_ENCRYPT            0x00000104
437#define CKA_DECRYPT            0x00000105
438#define CKA_WRAP               0x00000106
439#define CKA_UNWRAP             0x00000107
440#define CKA_SIGN               0x00000108
441#define CKA_SIGN_RECOVER       0x00000109
442#define CKA_VERIFY             0x0000010A
443#define CKA_VERIFY_RECOVER     0x0000010B
444#define CKA_DERIVE             0x0000010C
445#define CKA_START_DATE         0x00000110
446#define CKA_END_DATE           0x00000111
447#define CKA_MODULUS            0x00000120
448#define CKA_MODULUS_BITS       0x00000121
449#define CKA_PUBLIC_EXPONENT    0x00000122
450#define CKA_PRIVATE_EXPONENT   0x00000123
451#define CKA_PRIME_1            0x00000124
452#define CKA_PRIME_2            0x00000125
453#define CKA_EXPONENT_1         0x00000126
454#define CKA_EXPONENT_2         0x00000127
455#define CKA_COEFFICIENT        0x00000128
456#define CKA_PRIME              0x00000130
457#define CKA_SUBPRIME           0x00000131
458#define CKA_BASE               0x00000132
459
460/* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */
461#define CKA_PRIME_BITS         0x00000133
462#define CKA_SUBPRIME_BITS      0x00000134
463#define CKA_SUB_PRIME_BITS     CKA_SUBPRIME_BITS
464/* (To retain backwards-compatibility) */
465
466#define CKA_VALUE_BITS         0x00000160
467#define CKA_VALUE_LEN          0x00000161
468
469/* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE,
470 * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS,
471 * and CKA_EC_POINT are new for v2.0 */
472#define CKA_EXTRACTABLE        0x00000162
473#define CKA_LOCAL              0x00000163
474#define CKA_NEVER_EXTRACTABLE  0x00000164
475#define CKA_ALWAYS_SENSITIVE   0x00000165
476
477/* CKA_KEY_GEN_MECHANISM is new for v2.11 */
478#define CKA_KEY_GEN_MECHANISM  0x00000166
479
480#define CKA_MODIFIABLE         0x00000170
481
482/* CKA_ECDSA_PARAMS is deprecated in v2.11,
483 * CKA_EC_PARAMS is preferred. */
484#define CKA_ECDSA_PARAMS       0x00000180
485#define CKA_EC_PARAMS          0x00000180
486
487#define CKA_EC_POINT           0x00000181
488
489/* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS,
490 * CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET
491 * are new for v2.10 */
492#define CKA_SECONDARY_AUTH     0x00000200
493#define CKA_AUTH_PIN_FLAGS     0x00000201
494#define CKA_HW_FEATURE_TYPE    0x00000300
495#define CKA_RESET_ON_INIT      0x00000301
496#define CKA_HAS_RESET          0x00000302
497
498#define CKA_VENDOR_DEFINED     0x80000000
499
500
501/* CK_ATTRIBUTE is a structure that includes the type, length
502 * and value of an attribute */
503typedef struct CK_ATTRIBUTE {
504  CK_ATTRIBUTE_TYPE type;
505  CK_VOID_PTR       pValue;
506
507  /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */
508  CK_ULONG          ulValueLen;  /* in bytes */
509} CK_ATTRIBUTE;
510
511typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR;
512
513
514/* CK_DATE is a structure that defines a date */
515typedef struct CK_DATE{
516  CK_CHAR       year[4];   /* the year ("1900" - "9999") */
517  CK_CHAR       month[2];  /* the month ("01" - "12") */
518  CK_CHAR       day[2];    /* the day   ("01" - "31") */
519} CK_DATE;
520
521
522/* CK_MECHANISM_TYPE is a value that identifies a mechanism
523 * type */
524/* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for
525 * v2.0 */
526typedef CK_ULONG          CK_MECHANISM_TYPE;
527
528/* the following mechanism types are defined: */
529#define CKM_RSA_PKCS_KEY_PAIR_GEN      0x00000000
530#define CKM_RSA_PKCS                   0x00000001
531#define CKM_RSA_9796                   0x00000002
532#define CKM_RSA_X_509                  0x00000003
533
534/* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS
535 * are new for v2.0.  They are mechanisms which hash and sign */
536#define CKM_MD2_RSA_PKCS               0x00000004
537#define CKM_MD5_RSA_PKCS               0x00000005
538#define CKM_SHA1_RSA_PKCS              0x00000006
539
540/* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and
541 * CKM_RSA_PKCS_OAEP are new for v2.10 */
542#define CKM_RIPEMD128_RSA_PKCS         0x00000007
543#define CKM_RIPEMD160_RSA_PKCS         0x00000008
544#define CKM_RSA_PKCS_OAEP              0x00000009
545
546/* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31,
547 * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */
548#define CKM_RSA_X9_31_KEY_PAIR_GEN     0x0000000A
549#define CKM_RSA_X9_31                  0x0000000B
550#define CKM_SHA1_RSA_X9_31             0x0000000C
551#define CKM_RSA_PKCS_PSS               0x0000000D
552#define CKM_SHA1_RSA_PKCS_PSS          0x0000000E
553
554#define CKM_DSA_KEY_PAIR_GEN           0x00000010
555#define CKM_DSA                        0x00000011
556#define CKM_DSA_SHA1                   0x00000012
557#define CKM_DH_PKCS_KEY_PAIR_GEN       0x00000020
558#define CKM_DH_PKCS_DERIVE             0x00000021
559
560/* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE,
561 * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for
562 * v2.11 */
563#define CKM_X9_42_DH_KEY_PAIR_GEN      0x00000030
564#define CKM_X9_42_DH_DERIVE            0x00000031
565#define CKM_X9_42_DH_HYBRID_DERIVE     0x00000032
566#define CKM_X9_42_MQV_DERIVE           0x00000033
567
568#define CKM_RC2_KEY_GEN                0x00000100
569#define CKM_RC2_ECB                    0x00000101
570#define CKM_RC2_CBC                    0x00000102
571#define CKM_RC2_MAC                    0x00000103
572
573/* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */
574#define CKM_RC2_MAC_GENERAL            0x00000104
575#define CKM_RC2_CBC_PAD                0x00000105
576
577#define CKM_RC4_KEY_GEN                0x00000110
578#define CKM_RC4                        0x00000111
579#define CKM_DES_KEY_GEN                0x00000120
580#define CKM_DES_ECB                    0x00000121
581#define CKM_DES_CBC                    0x00000122
582#define CKM_DES_MAC                    0x00000123
583
584/* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */
585#define CKM_DES_MAC_GENERAL            0x00000124
586#define CKM_DES_CBC_PAD                0x00000125
587
588#define CKM_DES2_KEY_GEN               0x00000130
589#define CKM_DES3_KEY_GEN               0x00000131
590#define CKM_DES3_ECB                   0x00000132
591#define CKM_DES3_CBC                   0x00000133
592#define CKM_DES3_MAC                   0x00000134
593
594/* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN,
595 * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC,
596 * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */
597#define CKM_DES3_MAC_GENERAL           0x00000135
598#define CKM_DES3_CBC_PAD               0x00000136
599#define CKM_CDMF_KEY_GEN               0x00000140
600#define CKM_CDMF_ECB                   0x00000141
601#define CKM_CDMF_CBC                   0x00000142
602#define CKM_CDMF_MAC                   0x00000143
603#define CKM_CDMF_MAC_GENERAL           0x00000144
604#define CKM_CDMF_CBC_PAD               0x00000145
605
606#define CKM_MD2                        0x00000200
607
608/* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */
609#define CKM_MD2_HMAC                   0x00000201
610#define CKM_MD2_HMAC_GENERAL           0x00000202
611
612#define CKM_MD5                        0x00000210
613
614/* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */
615#define CKM_MD5_HMAC                   0x00000211
616#define CKM_MD5_HMAC_GENERAL           0x00000212
617
618#define CKM_SHA_1                      0x00000220
619
620/* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */
621#define CKM_SHA_1_HMAC                 0x00000221
622#define CKM_SHA_1_HMAC_GENERAL         0x00000222
623
624/* CKM_RIPEMD128, CKM_RIPEMD128_HMAC,
625 * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC,
626 * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */
627#define CKM_RIPEMD128                  0x00000230
628#define CKM_RIPEMD128_HMAC             0x00000231
629#define CKM_RIPEMD128_HMAC_GENERAL     0x00000232
630#define CKM_RIPEMD160                  0x00000240
631#define CKM_RIPEMD160_HMAC             0x00000241
632#define CKM_RIPEMD160_HMAC_GENERAL     0x00000242
633
634/* All of the following mechanisms are new for v2.0 */
635/* Note that CAST128 and CAST5 are the same algorithm */
636#define CKM_CAST_KEY_GEN               0x00000300
637#define CKM_CAST_ECB                   0x00000301
638#define CKM_CAST_CBC                   0x00000302
639#define CKM_CAST_MAC                   0x00000303
640#define CKM_CAST_MAC_GENERAL           0x00000304
641#define CKM_CAST_CBC_PAD               0x00000305
642#define CKM_CAST3_KEY_GEN              0x00000310
643#define CKM_CAST3_ECB                  0x00000311
644#define CKM_CAST3_CBC                  0x00000312
645#define CKM_CAST3_MAC                  0x00000313
646#define CKM_CAST3_MAC_GENERAL          0x00000314
647#define CKM_CAST3_CBC_PAD              0x00000315
648#define CKM_CAST5_KEY_GEN              0x00000320
649#define CKM_CAST128_KEY_GEN            0x00000320
650#define CKM_CAST5_ECB                  0x00000321
651#define CKM_CAST128_ECB                0x00000321
652#define CKM_CAST5_CBC                  0x00000322
653#define CKM_CAST128_CBC                0x00000322
654#define CKM_CAST5_MAC                  0x00000323
655#define CKM_CAST128_MAC                0x00000323
656#define CKM_CAST5_MAC_GENERAL          0x00000324
657#define CKM_CAST128_MAC_GENERAL        0x00000324
658#define CKM_CAST5_CBC_PAD              0x00000325
659#define CKM_CAST128_CBC_PAD            0x00000325
660#define CKM_RC5_KEY_GEN                0x00000330
661#define CKM_RC5_ECB                    0x00000331
662#define CKM_RC5_CBC                    0x00000332
663#define CKM_RC5_MAC                    0x00000333
664#define CKM_RC5_MAC_GENERAL            0x00000334
665#define CKM_RC5_CBC_PAD                0x00000335
666#define CKM_IDEA_KEY_GEN               0x00000340
667#define CKM_IDEA_ECB                   0x00000341
668#define CKM_IDEA_CBC                   0x00000342
669#define CKM_IDEA_MAC                   0x00000343
670#define CKM_IDEA_MAC_GENERAL           0x00000344
671#define CKM_IDEA_CBC_PAD               0x00000345
672#define CKM_GENERIC_SECRET_KEY_GEN     0x00000350
673#define CKM_CONCATENATE_BASE_AND_KEY   0x00000360
674#define CKM_CONCATENATE_BASE_AND_DATA  0x00000362
675#define CKM_CONCATENATE_DATA_AND_BASE  0x00000363
676#define CKM_XOR_BASE_AND_DATA          0x00000364
677#define CKM_EXTRACT_KEY_FROM_KEY       0x00000365
678#define CKM_SSL3_PRE_MASTER_KEY_GEN    0x00000370
679#define CKM_SSL3_MASTER_KEY_DERIVE     0x00000371
680#define CKM_SSL3_KEY_AND_MAC_DERIVE    0x00000372
681
682/* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN,
683 * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and
684 * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */
685#define CKM_SSL3_MASTER_KEY_DERIVE_DH  0x00000373
686#define CKM_TLS_PRE_MASTER_KEY_GEN     0x00000374
687#define CKM_TLS_MASTER_KEY_DERIVE      0x00000375
688#define CKM_TLS_KEY_AND_MAC_DERIVE     0x00000376
689#define CKM_TLS_MASTER_KEY_DERIVE_DH   0x00000377
690
691#define CKM_SSL3_MD5_MAC               0x00000380
692#define CKM_SSL3_SHA1_MAC              0x00000381
693#define CKM_MD5_KEY_DERIVATION         0x00000390
694#define CKM_MD2_KEY_DERIVATION         0x00000391
695#define CKM_SHA1_KEY_DERIVATION        0x00000392
696#define CKM_PBE_MD2_DES_CBC            0x000003A0
697#define CKM_PBE_MD5_DES_CBC            0x000003A1
698#define CKM_PBE_MD5_CAST_CBC           0x000003A2
699#define CKM_PBE_MD5_CAST3_CBC          0x000003A3
700#define CKM_PBE_MD5_CAST5_CBC          0x000003A4
701#define CKM_PBE_MD5_CAST128_CBC        0x000003A4
702#define CKM_PBE_SHA1_CAST5_CBC         0x000003A5
703#define CKM_PBE_SHA1_CAST128_CBC       0x000003A5
704#define CKM_PBE_SHA1_RC4_128           0x000003A6
705#define CKM_PBE_SHA1_RC4_40            0x000003A7
706#define CKM_PBE_SHA1_DES3_EDE_CBC      0x000003A8
707#define CKM_PBE_SHA1_DES2_EDE_CBC      0x000003A9
708#define CKM_PBE_SHA1_RC2_128_CBC       0x000003AA
709#define CKM_PBE_SHA1_RC2_40_CBC        0x000003AB
710
711/* CKM_PKCS5_PBKD2 is new for v2.10 */
712#define CKM_PKCS5_PBKD2                0x000003B0
713
714#define CKM_PBA_SHA1_WITH_SHA1_HMAC    0x000003C0
715#define CKM_KEY_WRAP_LYNKS             0x00000400
716#define CKM_KEY_WRAP_SET_OAEP          0x00000401
717
718/* Fortezza mechanisms */
719#define CKM_SKIPJACK_KEY_GEN           0x00001000
720#define CKM_SKIPJACK_ECB64             0x00001001
721#define CKM_SKIPJACK_CBC64             0x00001002
722#define CKM_SKIPJACK_OFB64             0x00001003
723#define CKM_SKIPJACK_CFB64             0x00001004
724#define CKM_SKIPJACK_CFB32             0x00001005
725#define CKM_SKIPJACK_CFB16             0x00001006
726#define CKM_SKIPJACK_CFB8              0x00001007
727#define CKM_SKIPJACK_WRAP              0x00001008
728#define CKM_SKIPJACK_PRIVATE_WRAP      0x00001009
729#define CKM_SKIPJACK_RELAYX            0x0000100a
730#define CKM_KEA_KEY_PAIR_GEN           0x00001010
731#define CKM_KEA_KEY_DERIVE             0x00001011
732#define CKM_FORTEZZA_TIMESTAMP         0x00001020
733#define CKM_BATON_KEY_GEN              0x00001030
734#define CKM_BATON_ECB128               0x00001031
735#define CKM_BATON_ECB96                0x00001032
736#define CKM_BATON_CBC128               0x00001033
737#define CKM_BATON_COUNTER              0x00001034
738#define CKM_BATON_SHUFFLE              0x00001035
739#define CKM_BATON_WRAP                 0x00001036
740
741/* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11,
742 * CKM_EC_KEY_PAIR_GEN is preferred */
743#define CKM_ECDSA_KEY_PAIR_GEN         0x00001040
744#define CKM_EC_KEY_PAIR_GEN            0x00001040
745
746#define CKM_ECDSA                      0x00001041
747#define CKM_ECDSA_SHA1                 0x00001042
748
749/* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE
750 * are new for v2.11 */
751#define CKM_ECDH1_DERIVE               0x00001050
752#define CKM_ECDH1_COFACTOR_DERIVE      0x00001051
753#define CKM_ECMQV_DERIVE               0x00001052
754
755#define CKM_JUNIPER_KEY_GEN            0x00001060
756#define CKM_JUNIPER_ECB128             0x00001061
757#define CKM_JUNIPER_CBC128             0x00001062
758#define CKM_JUNIPER_COUNTER            0x00001063
759#define CKM_JUNIPER_SHUFFLE            0x00001064
760#define CKM_JUNIPER_WRAP               0x00001065
761#define CKM_FASTHASH                   0x00001070
762
763/* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC,
764 * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN,
765 * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are
766 * new for v2.11 */
767#define CKM_AES_KEY_GEN                0x00001080
768#define CKM_AES_ECB                    0x00001081
769#define CKM_AES_CBC                    0x00001082
770#define CKM_AES_MAC                    0x00001083
771#define CKM_AES_MAC_GENERAL            0x00001084
772#define CKM_AES_CBC_PAD                0x00001085
773#define CKM_DSA_PARAMETER_GEN          0x00002000
774#define CKM_DH_PKCS_PARAMETER_GEN      0x00002001
775#define CKM_X9_42_DH_PARAMETER_GEN     0x00002002
776
777#define CKM_VENDOR_DEFINED             0x80000000
778
779typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR;
780
781
782/* CK_MECHANISM is a structure that specifies a particular
783 * mechanism  */
784typedef struct CK_MECHANISM {
785  CK_MECHANISM_TYPE mechanism;
786  CK_VOID_PTR       pParameter;
787
788  /* ulParameterLen was changed from CK_USHORT to CK_ULONG for
789   * v2.0 */
790  CK_ULONG          ulParameterLen;  /* in bytes */
791} CK_MECHANISM;
792
793typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR;
794
795
796/* CK_MECHANISM_INFO provides information about a particular
797 * mechanism */
798typedef struct CK_MECHANISM_INFO {
799    CK_ULONG    ulMinKeySize;
800    CK_ULONG    ulMaxKeySize;
801    CK_FLAGS    flags;
802} CK_MECHANISM_INFO;
803
804/* The flags are defined as follows:
805 *      Bit Flag               Mask        Meaning */
806#define CKF_HW                 0x00000001  /* performed by HW */
807
808/* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN,
809 * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER,
810 * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP,
811 * and CKF_DERIVE are new for v2.0.  They specify whether or not
812 * a mechanism can be used for a particular task */
813#define CKF_ENCRYPT            0x00000100
814#define CKF_DECRYPT            0x00000200
815#define CKF_DIGEST             0x00000400
816#define CKF_SIGN               0x00000800
817#define CKF_SIGN_RECOVER       0x00001000
818#define CKF_VERIFY             0x00002000
819#define CKF_VERIFY_RECOVER     0x00004000
820#define CKF_GENERATE           0x00008000
821#define CKF_GENERATE_KEY_PAIR  0x00010000
822#define CKF_WRAP               0x00020000
823#define CKF_UNWRAP             0x00040000
824#define CKF_DERIVE             0x00080000
825
826/* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE,
827 * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They
828 * describe a token's EC capabilities not available in mechanism
829 * information. */
830#define CKF_EC_F_P             0x00100000
831#define CKF_EC_F_2M            0x00200000
832#define CKF_EC_ECPARAMETERS    0x00400000
833#define CKF_EC_NAMEDCURVE      0x00800000
834#define CKF_EC_UNCOMPRESS      0x01000000
835#define CKF_EC_COMPRESS        0x02000000
836
837#define CKF_EXTENSION          0x80000000  /* FALSE for 2.01 */
838
839typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR;
840
841
842/* CK_RV is a value that identifies the return value of a
843 * Cryptoki function */
844/* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */
845typedef CK_ULONG          CK_RV;
846
847#define CKR_OK                                0x00000000
848#define CKR_CANCEL                            0x00000001
849#define CKR_HOST_MEMORY                       0x00000002
850#define CKR_SLOT_ID_INVALID                   0x00000003
851
852/* CKR_FLAGS_INVALID was removed for v2.0 */
853
854/* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */
855#define CKR_GENERAL_ERROR                     0x00000005
856#define CKR_FUNCTION_FAILED                   0x00000006
857
858/* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS,
859 * and CKR_CANT_LOCK are new for v2.01 */
860#define CKR_ARGUMENTS_BAD                     0x00000007
861#define CKR_NO_EVENT                          0x00000008
862#define CKR_NEED_TO_CREATE_THREADS            0x00000009
863#define CKR_CANT_LOCK                         0x0000000A
864
865#define CKR_ATTRIBUTE_READ_ONLY               0x00000010
866#define CKR_ATTRIBUTE_SENSITIVE               0x00000011
867#define CKR_ATTRIBUTE_TYPE_INVALID            0x00000012
868#define CKR_ATTRIBUTE_VALUE_INVALID           0x00000013
869#define CKR_DATA_INVALID                      0x00000020
870#define CKR_DATA_LEN_RANGE                    0x00000021
871#define CKR_DEVICE_ERROR                      0x00000030
872#define CKR_DEVICE_MEMORY                     0x00000031
873#define CKR_DEVICE_REMOVED                    0x00000032
874#define CKR_ENCRYPTED_DATA_INVALID            0x00000040
875#define CKR_ENCRYPTED_DATA_LEN_RANGE          0x00000041
876#define CKR_FUNCTION_CANCELED                 0x00000050
877#define CKR_FUNCTION_NOT_PARALLEL             0x00000051
878
879/* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */
880#define CKR_FUNCTION_NOT_SUPPORTED            0x00000054
881
882#define CKR_KEY_HANDLE_INVALID                0x00000060
883
884/* CKR_KEY_SENSITIVE was removed for v2.0 */
885
886#define CKR_KEY_SIZE_RANGE                    0x00000062
887#define CKR_KEY_TYPE_INCONSISTENT             0x00000063
888
889/* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED,
890 * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED,
891 * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for
892 * v2.0 */
893#define CKR_KEY_NOT_NEEDED                    0x00000064
894#define CKR_KEY_CHANGED                       0x00000065
895#define CKR_KEY_NEEDED                        0x00000066
896#define CKR_KEY_INDIGESTIBLE                  0x00000067
897#define CKR_KEY_FUNCTION_NOT_PERMITTED        0x00000068
898#define CKR_KEY_NOT_WRAPPABLE                 0x00000069
899#define CKR_KEY_UNEXTRACTABLE                 0x0000006A
900
901#define CKR_MECHANISM_INVALID                 0x00000070
902#define CKR_MECHANISM_PARAM_INVALID           0x00000071
903
904/* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID
905 * were removed for v2.0 */
906#define CKR_OBJECT_HANDLE_INVALID             0x00000082
907#define CKR_OPERATION_ACTIVE                  0x00000090
908#define CKR_OPERATION_NOT_INITIALIZED         0x00000091
909#define CKR_PIN_INCORRECT                     0x000000A0
910#define CKR_PIN_INVALID                       0x000000A1
911#define CKR_PIN_LEN_RANGE                     0x000000A2
912
913/* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */
914#define CKR_PIN_EXPIRED                       0x000000A3
915#define CKR_PIN_LOCKED                        0x000000A4
916
917#define CKR_SESSION_CLOSED                    0x000000B0
918#define CKR_SESSION_COUNT                     0x000000B1
919#define CKR_SESSION_HANDLE_INVALID            0x000000B3
920#define CKR_SESSION_PARALLEL_NOT_SUPPORTED    0x000000B4
921#define CKR_SESSION_READ_ONLY                 0x000000B5
922#define CKR_SESSION_EXISTS                    0x000000B6
923
924/* CKR_SESSION_READ_ONLY_EXISTS and
925 * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */
926#define CKR_SESSION_READ_ONLY_EXISTS          0x000000B7
927#define CKR_SESSION_READ_WRITE_SO_EXISTS      0x000000B8
928
929#define CKR_SIGNATURE_INVALID                 0x000000C0
930#define CKR_SIGNATURE_LEN_RANGE               0x000000C1
931#define CKR_TEMPLATE_INCOMPLETE               0x000000D0
932#define CKR_TEMPLATE_INCONSISTENT             0x000000D1
933#define CKR_TOKEN_NOT_PRESENT                 0x000000E0
934#define CKR_TOKEN_NOT_RECOGNIZED              0x000000E1
935#define CKR_TOKEN_WRITE_PROTECTED             0x000000E2
936#define CKR_UNWRAPPING_KEY_HANDLE_INVALID     0x000000F0
937#define CKR_UNWRAPPING_KEY_SIZE_RANGE         0x000000F1
938#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT  0x000000F2
939#define CKR_USER_ALREADY_LOGGED_IN            0x00000100
940#define CKR_USER_NOT_LOGGED_IN                0x00000101
941#define CKR_USER_PIN_NOT_INITIALIZED          0x00000102
942#define CKR_USER_TYPE_INVALID                 0x00000103
943
944/* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES
945 * are new to v2.01 */
946#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN    0x00000104
947#define CKR_USER_TOO_MANY_TYPES               0x00000105
948
949#define CKR_WRAPPED_KEY_INVALID               0x00000110
950#define CKR_WRAPPED_KEY_LEN_RANGE             0x00000112
951#define CKR_WRAPPING_KEY_HANDLE_INVALID       0x00000113
952#define CKR_WRAPPING_KEY_SIZE_RANGE           0x00000114
953#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT    0x00000115
954#define CKR_RANDOM_SEED_NOT_SUPPORTED         0x00000120
955
956/* These are new to v2.0 */
957#define CKR_RANDOM_NO_RNG                     0x00000121
958
959/* These are new to v2.11 */
960#define CKR_DOMAIN_PARAMS_INVALID             0x00000130
961
962/* These are new to v2.0 */
963#define CKR_BUFFER_TOO_SMALL                  0x00000150
964#define CKR_SAVED_STATE_INVALID               0x00000160
965#define CKR_INFORMATION_SENSITIVE             0x00000170
966#define CKR_STATE_UNSAVEABLE                  0x00000180
967
968/* These are new to v2.01 */
969#define CKR_CRYPTOKI_NOT_INITIALIZED          0x00000190
970#define CKR_CRYPTOKI_ALREADY_INITIALIZED      0x00000191
971#define CKR_MUTEX_BAD                         0x000001A0
972#define CKR_MUTEX_NOT_LOCKED                  0x000001A1
973
974#define CKR_VENDOR_DEFINED                    0x80000000
975
976
977/* CK_NOTIFY is an application callback that processes events */
978typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)(
979  CK_SESSION_HANDLE hSession,     /* the session's handle */
980  CK_NOTIFICATION   event,
981  CK_VOID_PTR       pApplication  /* passed to C_OpenSession */
982);
983
984
985/* CK_FUNCTION_LIST is a structure holding a Cryptoki spec
986 * version and pointers of appropriate types to all the
987 * Cryptoki functions */
988/* CK_FUNCTION_LIST is new for v2.0 */
989typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST;
990
991typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR;
992
993typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR;
994
995
996/* CK_CREATEMUTEX is an application callback for creating a
997 * mutex object */
998typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)(
999  CK_VOID_PTR_PTR ppMutex  /* location to receive ptr to mutex */
1000);
1001
1002
1003/* CK_DESTROYMUTEX is an application callback for destroying a
1004 * mutex object */
1005typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)(
1006  CK_VOID_PTR pMutex  /* pointer to mutex */
1007);
1008
1009
1010/* CK_LOCKMUTEX is an application callback for locking a mutex */
1011typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)(
1012  CK_VOID_PTR pMutex  /* pointer to mutex */
1013);
1014
1015
1016/* CK_UNLOCKMUTEX is an application callback for unlocking a
1017 * mutex */
1018typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)(
1019  CK_VOID_PTR pMutex  /* pointer to mutex */
1020);
1021
1022
1023/* CK_C_INITIALIZE_ARGS provides the optional arguments to
1024 * C_Initialize */
1025typedef struct CK_C_INITIALIZE_ARGS {
1026  CK_CREATEMUTEX CreateMutex;
1027  CK_DESTROYMUTEX DestroyMutex;
1028  CK_LOCKMUTEX LockMutex;
1029  CK_UNLOCKMUTEX UnlockMutex;
1030  CK_FLAGS flags;
1031  CK_VOID_PTR pReserved;
1032} CK_C_INITIALIZE_ARGS;
1033
1034/* flags: bit flags that provide capabilities of the slot
1035 *      Bit Flag                           Mask       Meaning
1036 */
1037#define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001
1038#define CKF_OS_LOCKING_OK                  0x00000002
1039
1040typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR;
1041
1042
1043/* additional flags for parameters to functions */
1044
1045/* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */
1046#define CKF_DONT_BLOCK     1
1047
1048/* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10.
1049 * CK_RSA_PKCS_OAEP_MGF_TYPE  is used to indicate the Message
1050 * Generation Function (MGF) applied to a message block when
1051 * formatting a message block for the PKCS #1 OAEP encryption
1052 * scheme. */
1053typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE;
1054
1055typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR;
1056
1057/* The following MGFs are defined */
1058#define CKG_MGF1_SHA1         0x00000001
1059
1060/* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10.
1061 * CK_RSA_PKCS_OAEP_SOURCE_TYPE  is used to indicate the source
1062 * of the encoding parameter when formatting a message block
1063 * for the PKCS #1 OAEP encryption scheme. */
1064typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE;
1065
1066typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR;
1067
1068/* The following encoding parameter sources are defined */
1069#define CKZ_DATA_SPECIFIED    0x00000001
1070
1071/* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10.
1072 * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the
1073 * CKM_RSA_PKCS_OAEP mechanism. */
1074typedef struct CK_RSA_PKCS_OAEP_PARAMS {
1075    CK_MECHANISM_TYPE hashAlg;
1076    CK_RSA_PKCS_MGF_TYPE mgf;
1077    CK_RSA_PKCS_OAEP_SOURCE_TYPE source;
1078    CK_VOID_PTR pSourceData;
1079    CK_ULONG ulSourceDataLen;
1080} CK_RSA_PKCS_OAEP_PARAMS;
1081
1082typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR;
1083
1084/* CK_RSA_PKCS_PSS_PARAMS is new for v2.11.
1085 * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the
1086 * CKM_RSA_PKCS_PSS mechanism(s). */
1087typedef struct CK_RSA_PKCS_PSS_PARAMS {
1088    CK_MECHANISM_TYPE    hashAlg;
1089    CK_RSA_PKCS_MGF_TYPE mgf;
1090    CK_ULONG             sLen;
1091} CK_RSA_PKCS_PSS_PARAMS;
1092
1093typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR;
1094
1095/* CK_EC_KDF_TYPE is new for v2.11. */
1096typedef CK_ULONG CK_EC_KDF_TYPE;
1097
1098/* The following EC Key Derivation Functions are defined */
1099#define CKD_NULL                 0x00000001
1100#define CKD_SHA1_KDF             0x00000002
1101
1102/* CK_ECDH1_DERIVE_PARAMS is new for v2.11.
1103 * CK_ECDH1_DERIVE_PARAMS provides the parameters to the
1104 * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms,
1105 * where each party contributes one key pair.
1106 */
1107typedef struct CK_ECDH1_DERIVE_PARAMS {
1108  CK_EC_KDF_TYPE kdf;
1109  CK_ULONG ulSharedDataLen;
1110  CK_BYTE_PTR pSharedData;
1111  CK_ULONG ulPublicDataLen;
1112  CK_BYTE_PTR pPublicData;
1113} CK_ECDH1_DERIVE_PARAMS;
1114
1115typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR;
1116
1117
1118/* CK_ECDH2_DERIVE_PARAMS is new for v2.11.
1119 * CK_ECDH2_DERIVE_PARAMS provides the parameters to the
1120 * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */
1121typedef struct CK_ECDH2_DERIVE_PARAMS {
1122  CK_EC_KDF_TYPE kdf;
1123  CK_ULONG ulSharedDataLen;
1124  CK_BYTE_PTR pSharedData;
1125  CK_ULONG ulPublicDataLen;
1126  CK_BYTE_PTR pPublicData;
1127  CK_ULONG ulPrivateDataLen;
1128  CK_OBJECT_HANDLE hPrivateData;
1129  CK_ULONG ulPublicDataLen2;
1130  CK_BYTE_PTR pPublicData2;
1131} CK_ECDH2_DERIVE_PARAMS;
1132
1133typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR;
1134
1135/* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the
1136 * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */
1137typedef CK_ULONG CK_X9_42_DH_KDF_TYPE;
1138typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR;
1139
1140/* The following X9.42 DH key derivation functions are defined: */
1141#define CKD_NULL                 0x00000001
1142#define CKD_SHA1_KDF_ASN1        0x00000003
1143#define CKD_SHA1_KDF_CONCATENATE 0x00000004
1144
1145/* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11.
1146 * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the
1147 * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party
1148 * contributes one key pair */
1149typedef struct CK_X9_42_DH1_DERIVE_PARAMS {
1150  CK_X9_42_DH_KDF_TYPE kdf;
1151  CK_ULONG ulOtherInfoLen;
1152  CK_BYTE_PTR pOtherInfo;
1153  CK_ULONG ulPublicDataLen;
1154  CK_BYTE_PTR pPublicData;
1155} CK_X9_42_DH1_DERIVE_PARAMS;
1156
1157typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR;
1158
1159/* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11.
1160 * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the
1161 * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation
1162 * mechanisms, where each party contributes two key pairs */
1163typedef struct CK_X9_42_DH2_DERIVE_PARAMS {
1164  CK_X9_42_DH_KDF_TYPE kdf;
1165  CK_ULONG ulOtherInfoLen;
1166  CK_BYTE_PTR pOtherInfo;
1167  CK_ULONG ulPublicDataLen;
1168  CK_BYTE_PTR pPublicData;
1169  CK_ULONG ulPrivateDataLen;
1170  CK_OBJECT_HANDLE hPrivateData;
1171  CK_ULONG ulPublicDataLen2;
1172  CK_BYTE_PTR pPublicData2;
1173} CK_X9_42_DH2_DERIVE_PARAMS;
1174
1175typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR;
1176
1177/* CK_KEA_DERIVE_PARAMS provides the parameters to the
1178 * CKM_KEA_DERIVE mechanism */
1179/* CK_KEA_DERIVE_PARAMS is new for v2.0 */
1180typedef struct CK_KEA_DERIVE_PARAMS {
1181  CK_BBOOL      isSender;
1182  CK_ULONG      ulRandomLen;
1183  CK_BYTE_PTR   pRandomA;
1184  CK_BYTE_PTR   pRandomB;
1185  CK_ULONG      ulPublicDataLen;
1186  CK_BYTE_PTR   pPublicData;
1187} CK_KEA_DERIVE_PARAMS;
1188
1189typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR;
1190
1191
1192/* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and
1193 * CKM_RC2_MAC mechanisms.  An instance of CK_RC2_PARAMS just
1194 * holds the effective keysize */
1195typedef CK_ULONG          CK_RC2_PARAMS;
1196
1197typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR;
1198
1199
1200/* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC
1201 * mechanism */
1202typedef struct CK_RC2_CBC_PARAMS {
1203  /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for
1204   * v2.0 */
1205  CK_ULONG      ulEffectiveBits;  /* effective bits (1-1024) */
1206
1207  CK_BYTE       iv[8];            /* IV for CBC mode */
1208} CK_RC2_CBC_PARAMS;
1209
1210typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR;
1211
1212
1213/* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the
1214 * CKM_RC2_MAC_GENERAL mechanism */
1215/* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */
1216typedef struct CK_RC2_MAC_GENERAL_PARAMS {
1217  CK_ULONG      ulEffectiveBits;  /* effective bits (1-1024) */
1218  CK_ULONG      ulMacLength;      /* Length of MAC in bytes */
1219} CK_RC2_MAC_GENERAL_PARAMS;
1220
1221typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \
1222  CK_RC2_MAC_GENERAL_PARAMS_PTR;
1223
1224
1225/* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and
1226 * CKM_RC5_MAC mechanisms */
1227/* CK_RC5_PARAMS is new for v2.0 */
1228typedef struct CK_RC5_PARAMS {
1229  CK_ULONG      ulWordsize;  /* wordsize in bits */
1230  CK_ULONG      ulRounds;    /* number of rounds */
1231} CK_RC5_PARAMS;
1232
1233typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR;
1234
1235
1236/* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC
1237 * mechanism */
1238/* CK_RC5_CBC_PARAMS is new for v2.0 */
1239typedef struct CK_RC5_CBC_PARAMS {
1240  CK_ULONG      ulWordsize;  /* wordsize in bits */
1241  CK_ULONG      ulRounds;    /* number of rounds */
1242  CK_BYTE_PTR   pIv;         /* pointer to IV */
1243  CK_ULONG      ulIvLen;     /* length of IV in bytes */
1244} CK_RC5_CBC_PARAMS;
1245
1246typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR;
1247
1248
1249/* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the
1250 * CKM_RC5_MAC_GENERAL mechanism */
1251/* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */
1252typedef struct CK_RC5_MAC_GENERAL_PARAMS {
1253  CK_ULONG      ulWordsize;   /* wordsize in bits */
1254  CK_ULONG      ulRounds;     /* number of rounds */
1255  CK_ULONG      ulMacLength;  /* Length of MAC in bytes */
1256} CK_RC5_MAC_GENERAL_PARAMS;
1257
1258typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \
1259  CK_RC5_MAC_GENERAL_PARAMS_PTR;
1260
1261
1262/* CK_MAC_GENERAL_PARAMS provides the parameters to most block
1263 * ciphers' MAC_GENERAL mechanisms.  Its value is the length of
1264 * the MAC */
1265/* CK_MAC_GENERAL_PARAMS is new for v2.0 */
1266typedef CK_ULONG          CK_MAC_GENERAL_PARAMS;
1267
1268typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR;
1269
1270
1271/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the
1272 * CKM_SKIPJACK_PRIVATE_WRAP mechanism */
1273/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */
1274typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS {
1275  CK_ULONG      ulPasswordLen;
1276  CK_BYTE_PTR   pPassword;
1277  CK_ULONG      ulPublicDataLen;
1278  CK_BYTE_PTR   pPublicData;
1279  CK_ULONG      ulPAndGLen;
1280  CK_ULONG      ulQLen;
1281  CK_ULONG      ulRandomLen;
1282  CK_BYTE_PTR   pRandomA;
1283  CK_BYTE_PTR   pPrimeP;
1284  CK_BYTE_PTR   pBaseG;
1285  CK_BYTE_PTR   pSubprimeQ;
1286} CK_SKIPJACK_PRIVATE_WRAP_PARAMS;
1287
1288typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \
1289  CK_SKIPJACK_PRIVATE_WRAP_PTR;
1290
1291
1292/* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the
1293 * CKM_SKIPJACK_RELAYX mechanism */
1294/* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */
1295typedef struct CK_SKIPJACK_RELAYX_PARAMS {
1296  CK_ULONG      ulOldWrappedXLen;
1297  CK_BYTE_PTR   pOldWrappedX;
1298  CK_ULONG      ulOldPasswordLen;
1299  CK_BYTE_PTR   pOldPassword;
1300  CK_ULONG      ulOldPublicDataLen;
1301  CK_BYTE_PTR   pOldPublicData;
1302  CK_ULONG      ulOldRandomLen;
1303  CK_BYTE_PTR   pOldRandomA;
1304  CK_ULONG      ulNewPasswordLen;
1305  CK_BYTE_PTR   pNewPassword;
1306  CK_ULONG      ulNewPublicDataLen;
1307  CK_BYTE_PTR   pNewPublicData;
1308  CK_ULONG      ulNewRandomLen;
1309  CK_BYTE_PTR   pNewRandomA;
1310} CK_SKIPJACK_RELAYX_PARAMS;
1311
1312typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \
1313  CK_SKIPJACK_RELAYX_PARAMS_PTR;
1314
1315
1316typedef struct CK_PBE_PARAMS {
1317  CK_BYTE_PTR      pInitVector;
1318  CK_UTF8CHAR_PTR  pPassword;
1319  CK_ULONG         ulPasswordLen;
1320  CK_BYTE_PTR      pSalt;
1321  CK_ULONG         ulSaltLen;
1322  CK_ULONG         ulIteration;
1323} CK_PBE_PARAMS;
1324
1325typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR;
1326
1327
1328/* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the
1329 * CKM_KEY_WRAP_SET_OAEP mechanism */
1330/* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */
1331typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS {
1332  CK_BYTE       bBC;     /* block contents byte */
1333  CK_BYTE_PTR   pX;      /* extra data */
1334  CK_ULONG      ulXLen;  /* length of extra data in bytes */
1335} CK_KEY_WRAP_SET_OAEP_PARAMS;
1336
1337typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \
1338  CK_KEY_WRAP_SET_OAEP_PARAMS_PTR;
1339
1340
1341typedef struct CK_SSL3_RANDOM_DATA {
1342  CK_BYTE_PTR  pClientRandom;
1343  CK_ULONG     ulClientRandomLen;
1344  CK_BYTE_PTR  pServerRandom;
1345  CK_ULONG     ulServerRandomLen;
1346} CK_SSL3_RANDOM_DATA;
1347
1348
1349typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS {
1350  CK_SSL3_RANDOM_DATA RandomInfo;
1351  CK_VERSION_PTR pVersion;
1352} CK_SSL3_MASTER_KEY_DERIVE_PARAMS;
1353
1354typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1355  CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR;
1356
1357
1358typedef struct CK_SSL3_KEY_MAT_OUT {
1359  CK_OBJECT_HANDLE hClientMacSecret;
1360  CK_OBJECT_HANDLE hServerMacSecret;
1361  CK_OBJECT_HANDLE hClientKey;
1362  CK_OBJECT_HANDLE hServerKey;
1363  CK_BYTE_PTR      pIVClient;
1364  CK_BYTE_PTR      pIVServer;
1365} CK_SSL3_KEY_MAT_OUT;
1366
1367typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR;
1368
1369
1370typedef struct CK_SSL3_KEY_MAT_PARAMS {
1371  CK_ULONG                ulMacSizeInBits;
1372  CK_ULONG                ulKeySizeInBits;
1373  CK_ULONG                ulIVSizeInBits;
1374  CK_BBOOL                bIsExport;
1375  CK_SSL3_RANDOM_DATA     RandomInfo;
1376  CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
1377} CK_SSL3_KEY_MAT_PARAMS;
1378
1379typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR;
1380
1381
1382typedef struct CK_KEY_DERIVATION_STRING_DATA {
1383  CK_BYTE_PTR pData;
1384  CK_ULONG    ulLen;
1385} CK_KEY_DERIVATION_STRING_DATA;
1386
1387typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \
1388  CK_KEY_DERIVATION_STRING_DATA_PTR;
1389
1390
1391/* The CK_EXTRACT_PARAMS is used for the
1392 * CKM_EXTRACT_KEY_FROM_KEY mechanism.  It specifies which bit
1393 * of the base key should be used as the first bit of the
1394 * derived key */
1395/* CK_EXTRACT_PARAMS is new for v2.0 */
1396typedef CK_ULONG CK_EXTRACT_PARAMS;
1397
1398typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR;
1399
1400/* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10.
1401 * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to
1402 * indicate the Pseudo-Random Function (PRF) used to generate
1403 * key bits using PKCS #5 PBKDF2. */
1404typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE;
1405
1406typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR;
1407
1408/* The following PRFs are defined in PKCS #5 v2.0. */
1409#define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001
1410
1411
1412/* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10.
1413 * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the
1414 * source of the salt value when deriving a key using PKCS #5
1415 * PBKDF2. */
1416typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE;
1417
1418typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR;
1419
1420/* The following salt value sources are defined in PKCS #5 v2.0. */
1421#define CKZ_SALT_SPECIFIED        0x00000001
1422
1423/* CK_PKCS5_PBKD2_PARAMS is new for v2.10.
1424 * CK_PKCS5_PBKD2_PARAMS is a structure that provides the
1425 * parameters to the CKM_PKCS5_PBKD2 mechanism. */
1426typedef struct CK_PKCS5_PBKD2_PARAMS {
1427    CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE           saltSource;
1428    CK_VOID_PTR                                pSaltSourceData;
1429    CK_ULONG                                   ulSaltSourceDataLen;
1430    CK_ULONG                                   iterations;
1431    CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;
1432    CK_VOID_PTR                                pPrfData;
1433    CK_ULONG                                   ulPrfDataLen;
1434    CK_UTF8CHAR_PTR                            pPassword;
1435    CK_ULONG_PTR                               ulPasswordLen;
1436} CK_PKCS5_PBKD2_PARAMS;
1437
1438typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR;
1439
1440#endif
Note: See TracBrowser for help on using the repository browser.