xref: /illumos-gate/usr/src/lib/pkcs11/include/pkcs11t.h (revision e8921a52c53ee69f7b65f054d9b2e886139daa59)
1 /* Copyright (c) OASIS Open 2016. All Rights Reserved./
2  * /Distributed under the terms of the OASIS IPR Policy,
3  * [http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY
4  * IMPLIED OR EXPRESS WARRANTY; there is no warranty of MERCHANTABILITY, FITNESS FOR A
5  * PARTICULAR PURPOSE or NONINFRINGEMENT of the rights of others.
6  */
7 
8 /* Latest version of the specification:
9  * http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html
10  */
11 
12 /* See top of pkcs11.h for information about the macros that
13  * must be defined and the structure-packing conventions that
14  * must be set before including this file.
15  */
16 
17 #ifndef _PKCS11T_H_
18 #define _PKCS11T_H_ 1
19 
20 #define CRYPTOKI_VERSION_MAJOR          2
21 #define CRYPTOKI_VERSION_MINOR          40
22 #define CRYPTOKI_VERSION_AMENDMENT      0
23 
24 #define CK_TRUE         1
25 #define CK_FALSE        0
26 
27 #ifndef CK_DISABLE_TRUE_FALSE
28 #ifndef FALSE
29 #define FALSE CK_FALSE
30 #endif
31 #ifndef TRUE
32 #define TRUE CK_TRUE
33 #endif
34 #endif
35 
36 /* an unsigned 8-bit value */
37 typedef unsigned char     CK_BYTE;
38 
39 /* an unsigned 8-bit character */
40 typedef CK_BYTE           CK_CHAR;
41 
42 /* an 8-bit UTF-8 character */
43 typedef CK_BYTE           CK_UTF8CHAR;
44 
45 /* a BYTE-sized Boolean flag */
46 typedef CK_BYTE           CK_BBOOL;
47 
48 /* an unsigned value, at least 32 bits long */
49 typedef unsigned long int CK_ULONG;
50 
51 /* a signed value, the same size as a CK_ULONG */
52 typedef long int          CK_LONG;
53 
54 /* at least 32 bits; each bit is a Boolean flag */
55 typedef CK_ULONG          CK_FLAGS;
56 
57 
58 /* some special values for certain CK_ULONG variables */
59 #define CK_UNAVAILABLE_INFORMATION      (~0UL)
60 #define CK_EFFECTIVELY_INFINITE         0UL
61 
62 
63 typedef CK_BYTE     CK_PTR   CK_BYTE_PTR;
64 typedef CK_CHAR     CK_PTR   CK_CHAR_PTR;
65 typedef CK_UTF8CHAR CK_PTR   CK_UTF8CHAR_PTR;
66 typedef CK_ULONG    CK_PTR   CK_ULONG_PTR;
67 typedef void        CK_PTR   CK_VOID_PTR;
68 
69 /* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */
70 typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR;
71 
72 
73 /* The following value is always invalid if used as a session
74  * handle or object handle
75  */
76 #define CK_INVALID_HANDLE       0UL
77 
78 
79 typedef struct CK_VERSION {
80   CK_BYTE       major;  /* integer portion of version number */
81   CK_BYTE       minor;  /* 1/100ths portion of version number */
82 } CK_VERSION;
83 
84 typedef CK_VERSION CK_PTR CK_VERSION_PTR;
85 
86 
87 typedef struct CK_INFO {
88   CK_VERSION    cryptokiVersion;     /* Cryptoki interface ver */
89   CK_UTF8CHAR   manufacturerID[32];  /* blank padded */
90   CK_FLAGS      flags;               /* must be zero */
91   CK_UTF8CHAR   libraryDescription[32];  /* blank padded */
92   CK_VERSION    libraryVersion;          /* version of library */
93 } CK_INFO;
94 
95 typedef CK_INFO CK_PTR    CK_INFO_PTR;
96 
97 
98 /* CK_NOTIFICATION enumerates the types of notifications that
99  * Cryptoki provides to an application
100  */
101 typedef CK_ULONG CK_NOTIFICATION;
102 #define CKN_SURRENDER           0UL
103 #define CKN_OTP_CHANGED         1UL
104 
105 typedef CK_ULONG          CK_SLOT_ID;
106 
107 typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR;
108 
109 
110 /* CK_SLOT_INFO provides information about a slot */
111 typedef struct CK_SLOT_INFO {
112   CK_UTF8CHAR   slotDescription[64];  /* blank padded */
113   CK_UTF8CHAR   manufacturerID[32];   /* blank padded */
114   CK_FLAGS      flags;
115 
116   CK_VERSION    hardwareVersion;  /* version of hardware */
117   CK_VERSION    firmwareVersion;  /* version of firmware */
118 } CK_SLOT_INFO;
119 
120 /* flags: bit flags that provide capabilities of the slot
121  *      Bit Flag              Mask        Meaning
122  */
123 #define CKF_TOKEN_PRESENT     0x00000001UL  /* a token is there */
124 #define CKF_REMOVABLE_DEVICE  0x00000002UL  /* removable devices*/
125 #define CKF_HW_SLOT           0x00000004UL  /* hardware slot */
126 
127 typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR;
128 
129 
130 /* CK_TOKEN_INFO provides information about a token */
131 typedef struct CK_TOKEN_INFO {
132   CK_UTF8CHAR   label[32];           /* blank padded */
133   CK_UTF8CHAR   manufacturerID[32];  /* blank padded */
134   CK_UTF8CHAR   model[16];           /* blank padded */
135   CK_CHAR       serialNumber[16];    /* blank padded */
136   CK_FLAGS      flags;               /* see below */
137 
138   CK_ULONG      ulMaxSessionCount;     /* max open sessions */
139   CK_ULONG      ulSessionCount;        /* sess. now open */
140   CK_ULONG      ulMaxRwSessionCount;   /* max R/W sessions */
141   CK_ULONG      ulRwSessionCount;      /* R/W sess. now open */
142   CK_ULONG      ulMaxPinLen;           /* in bytes */
143   CK_ULONG      ulMinPinLen;           /* in bytes */
144   CK_ULONG      ulTotalPublicMemory;   /* in bytes */
145   CK_ULONG      ulFreePublicMemory;    /* in bytes */
146   CK_ULONG      ulTotalPrivateMemory;  /* in bytes */
147   CK_ULONG      ulFreePrivateMemory;   /* in bytes */
148   CK_VERSION    hardwareVersion;       /* version of hardware */
149   CK_VERSION    firmwareVersion;       /* version of firmware */
150   CK_CHAR       utcTime[16];           /* time */
151 } CK_TOKEN_INFO;
152 
153 /* The flags parameter is defined as follows:
154  *      Bit Flag                    Mask        Meaning
155  */
156 #define CKF_RNG                     0x00000001UL  /* has random # generator */
157 #define CKF_WRITE_PROTECTED         0x00000002UL  /* token is write-protected */
158 #define CKF_LOGIN_REQUIRED          0x00000004UL  /* user must login */
159 #define CKF_USER_PIN_INITIALIZED    0x00000008UL  /* normal user's PIN is set */
160 
161 /* CKF_RESTORE_KEY_NOT_NEEDED.  If it is set,
162  * that means that *every* time the state of cryptographic
163  * operations of a session is successfully saved, all keys
164  * needed to continue those operations are stored in the state
165  */
166 #define CKF_RESTORE_KEY_NOT_NEEDED  0x00000020UL
167 
168 /* CKF_CLOCK_ON_TOKEN.  If it is set, that means
169  * that the token has some sort of clock.  The time on that
170  * clock is returned in the token info structure
171  */
172 #define CKF_CLOCK_ON_TOKEN          0x00000040UL
173 
174 /* CKF_PROTECTED_AUTHENTICATION_PATH.  If it is
175  * set, that means that there is some way for the user to login
176  * without sending a PIN through the Cryptoki library itself
177  */
178 #define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100UL
179 
180 /* CKF_DUAL_CRYPTO_OPERATIONS.  If it is true,
181  * that means that a single session with the token can perform
182  * dual simultaneous cryptographic operations (digest and
183  * encrypt; decrypt and digest; sign and encrypt; and decrypt
184  * and sign)
185  */
186 #define CKF_DUAL_CRYPTO_OPERATIONS  0x00000200UL
187 
188 /* CKF_TOKEN_INITIALIZED. If it is true, the
189  * token has been initialized using C_InitializeToken or an
190  * equivalent mechanism outside the scope of PKCS #11.
191  * Calling C_InitializeToken when this flag is set will cause
192  * the token to be reinitialized.
193  */
194 #define CKF_TOKEN_INITIALIZED       0x00000400UL
195 
196 /* CKF_SECONDARY_AUTHENTICATION. If it is
197  * true, the token supports secondary authentication for
198  * private key objects.
199  */
200 #define CKF_SECONDARY_AUTHENTICATION  0x00000800UL
201 
202 /* CKF_USER_PIN_COUNT_LOW. If it is true, an
203  * incorrect user login PIN has been entered at least once
204  * since the last successful authentication.
205  */
206 #define CKF_USER_PIN_COUNT_LOW       0x00010000UL
207 
208 /* CKF_USER_PIN_FINAL_TRY. If it is true,
209  * supplying an incorrect user PIN will it to become locked.
210  */
211 #define CKF_USER_PIN_FINAL_TRY       0x00020000UL
212 
213 /* CKF_USER_PIN_LOCKED. If it is true, the
214  * user PIN has been locked. User login to the token is not
215  * possible.
216  */
217 #define CKF_USER_PIN_LOCKED          0x00040000UL
218 
219 /* CKF_USER_PIN_TO_BE_CHANGED. If it is true,
220  * the user PIN value is the default value set by token
221  * initialization or manufacturing, or the PIN has been
222  * expired by the card.
223  */
224 #define CKF_USER_PIN_TO_BE_CHANGED   0x00080000UL
225 
226 /* CKF_SO_PIN_COUNT_LOW. If it is true, an
227  * incorrect SO login PIN has been entered at least once since
228  * the last successful authentication.
229  */
230 #define CKF_SO_PIN_COUNT_LOW         0x00100000UL
231 
232 /* CKF_SO_PIN_FINAL_TRY. If it is true,
233  * supplying an incorrect SO PIN will it to become locked.
234  */
235 #define CKF_SO_PIN_FINAL_TRY         0x00200000UL
236 
237 /* CKF_SO_PIN_LOCKED. If it is true, the SO
238  * PIN has been locked. SO login to the token is not possible.
239  */
240 #define CKF_SO_PIN_LOCKED            0x00400000UL
241 
242 /* CKF_SO_PIN_TO_BE_CHANGED. If it is true,
243  * the SO PIN value is the default value set by token
244  * initialization or manufacturing, or the PIN has been
245  * expired by the card.
246  */
247 #define CKF_SO_PIN_TO_BE_CHANGED     0x00800000UL
248 
249 #define CKF_ERROR_STATE              0x01000000UL
250 
251 typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR;
252 
253 
254 /* CK_SESSION_HANDLE is a Cryptoki-assigned value that
255  * identifies a session
256  */
257 typedef CK_ULONG          CK_SESSION_HANDLE;
258 
259 typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR;
260 
261 
262 /* CK_USER_TYPE enumerates the types of Cryptoki users */
263 typedef CK_ULONG          CK_USER_TYPE;
264 /* Security Officer */
265 #define CKU_SO                  0UL
266 /* Normal user */
267 #define CKU_USER                1UL
268 /* Context specific */
269 #define CKU_CONTEXT_SPECIFIC    2UL
270 
271 /* CK_STATE enumerates the session states */
272 typedef CK_ULONG          CK_STATE;
273 #define CKS_RO_PUBLIC_SESSION   0UL
274 #define CKS_RO_USER_FUNCTIONS   1UL
275 #define CKS_RW_PUBLIC_SESSION   2UL
276 #define CKS_RW_USER_FUNCTIONS   3UL
277 #define CKS_RW_SO_FUNCTIONS     4UL
278 
279 /* CK_SESSION_INFO provides information about a session */
280 typedef struct CK_SESSION_INFO {
281   CK_SLOT_ID    slotID;
282   CK_STATE      state;
283   CK_FLAGS      flags;          /* see below */
284   CK_ULONG      ulDeviceError;  /* device-dependent error code */
285 } CK_SESSION_INFO;
286 
287 /* The flags are defined in the following table:
288  *      Bit Flag                Mask        Meaning
289  */
290 #define CKF_RW_SESSION          0x00000002UL /* session is r/w */
291 #define CKF_SERIAL_SESSION      0x00000004UL /* no parallel    */
292 
293 typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR;
294 
295 
296 /* CK_OBJECT_HANDLE is a token-specific identifier for an
297  * object
298  */
299 typedef CK_ULONG          CK_OBJECT_HANDLE;
300 
301 typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR;
302 
303 
304 /* CK_OBJECT_CLASS is a value that identifies the classes (or
305  * types) of objects that Cryptoki recognizes.  It is defined
306  * as follows:
307  */
308 typedef CK_ULONG          CK_OBJECT_CLASS;
309 
310 /* The following classes of objects are defined: */
311 #define CKO_DATA              0x00000000UL
312 #define CKO_CERTIFICATE       0x00000001UL
313 #define CKO_PUBLIC_KEY        0x00000002UL
314 #define CKO_PRIVATE_KEY       0x00000003UL
315 #define CKO_SECRET_KEY        0x00000004UL
316 #define CKO_HW_FEATURE        0x00000005UL
317 #define CKO_DOMAIN_PARAMETERS 0x00000006UL
318 #define CKO_MECHANISM         0x00000007UL
319 #define CKO_OTP_KEY           0x00000008UL
320 
321 #define CKO_VENDOR_DEFINED    0x80000000UL
322 
323 typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR;
324 
325 /* CK_HW_FEATURE_TYPE is a value that identifies the hardware feature type
326  * of an object with CK_OBJECT_CLASS equal to CKO_HW_FEATURE.
327  */
328 typedef CK_ULONG          CK_HW_FEATURE_TYPE;
329 
330 /* The following hardware feature types are defined */
331 #define CKH_MONOTONIC_COUNTER  0x00000001UL
332 #define CKH_CLOCK              0x00000002UL
333 #define CKH_USER_INTERFACE     0x00000003UL
334 #define CKH_VENDOR_DEFINED     0x80000000UL
335 
336 /* CK_KEY_TYPE is a value that identifies a key type */
337 typedef CK_ULONG          CK_KEY_TYPE;
338 
339 /* the following key types are defined: */
340 #define CKK_RSA                 0x00000000UL
341 #define CKK_DSA                 0x00000001UL
342 #define CKK_DH                  0x00000002UL
343 #define CKK_ECDSA               0x00000003UL /* Deprecated */
344 #define CKK_EC                  0x00000003UL
345 #define CKK_X9_42_DH            0x00000004UL
346 #define CKK_KEA                 0x00000005UL
347 #define CKK_GENERIC_SECRET      0x00000010UL
348 #define CKK_RC2                 0x00000011UL
349 #define CKK_RC4                 0x00000012UL
350 #define CKK_DES                 0x00000013UL
351 #define CKK_DES2                0x00000014UL
352 #define CKK_DES3                0x00000015UL
353 #define CKK_CAST                0x00000016UL
354 #define CKK_CAST3               0x00000017UL
355 #define CKK_CAST5               0x00000018UL /* Deprecated */
356 #define CKK_CAST128             0x00000018UL
357 #define CKK_RC5                 0x00000019UL
358 #define CKK_IDEA                0x0000001AUL
359 #define CKK_SKIPJACK            0x0000001BUL
360 #define CKK_BATON               0x0000001CUL
361 #define CKK_JUNIPER             0x0000001DUL
362 #define CKK_CDMF                0x0000001EUL
363 #define CKK_AES                 0x0000001FUL
364 #define CKK_BLOWFISH            0x00000020UL
365 #define CKK_TWOFISH             0x00000021UL
366 #define CKK_SECURID             0x00000022UL
367 #define CKK_HOTP                0x00000023UL
368 #define CKK_ACTI                0x00000024UL
369 #define CKK_CAMELLIA            0x00000025UL
370 #define CKK_ARIA                0x00000026UL
371 
372 #define CKK_MD5_HMAC            0x00000027UL
373 #define CKK_SHA_1_HMAC          0x00000028UL
374 #define CKK_RIPEMD128_HMAC      0x00000029UL
375 #define CKK_RIPEMD160_HMAC      0x0000002AUL
376 #define CKK_SHA256_HMAC         0x0000002BUL
377 #define CKK_SHA384_HMAC         0x0000002CUL
378 #define CKK_SHA512_HMAC         0x0000002DUL
379 #define CKK_SHA224_HMAC         0x0000002EUL
380 
381 #define CKK_SEED                0x0000002FUL
382 #define CKK_GOSTR3410           0x00000030UL
383 #define CKK_GOSTR3411           0x00000031UL
384 #define CKK_GOST28147           0x00000032UL
385 
386 
387 
388 #define CKK_VENDOR_DEFINED      0x80000000UL
389 
390 
391 /* CK_CERTIFICATE_TYPE is a value that identifies a certificate
392  * type
393  */
394 typedef CK_ULONG          CK_CERTIFICATE_TYPE;
395 
396 #define CK_CERTIFICATE_CATEGORY_UNSPECIFIED     0UL
397 #define CK_CERTIFICATE_CATEGORY_TOKEN_USER      1UL
398 #define CK_CERTIFICATE_CATEGORY_AUTHORITY       2UL
399 #define CK_CERTIFICATE_CATEGORY_OTHER_ENTITY    3UL
400 
401 #define CK_SECURITY_DOMAIN_UNSPECIFIED     0UL
402 #define CK_SECURITY_DOMAIN_MANUFACTURER    1UL
403 #define CK_SECURITY_DOMAIN_OPERATOR        2UL
404 #define CK_SECURITY_DOMAIN_THIRD_PARTY     3UL
405 
406 
407 /* The following certificate types are defined: */
408 #define CKC_X_509               0x00000000UL
409 #define CKC_X_509_ATTR_CERT     0x00000001UL
410 #define CKC_WTLS                0x00000002UL
411 #define CKC_VENDOR_DEFINED      0x80000000UL
412 
413 
414 /* CK_ATTRIBUTE_TYPE is a value that identifies an attribute
415  * type
416  */
417 typedef CK_ULONG          CK_ATTRIBUTE_TYPE;
418 
419 /* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which
420  * consists of an array of values.
421  */
422 #define CKF_ARRAY_ATTRIBUTE     0x40000000UL
423 
424 /* The following OTP-related defines relate to the CKA_OTP_FORMAT attribute */
425 #define CK_OTP_FORMAT_DECIMAL           0UL
426 #define CK_OTP_FORMAT_HEXADECIMAL       1UL
427 #define CK_OTP_FORMAT_ALPHANUMERIC      2UL
428 #define CK_OTP_FORMAT_BINARY            3UL
429 
430 /* The following OTP-related defines relate to the CKA_OTP_..._REQUIREMENT
431  * attributes
432  */
433 #define CK_OTP_PARAM_IGNORED            0UL
434 #define CK_OTP_PARAM_OPTIONAL           1UL
435 #define CK_OTP_PARAM_MANDATORY          2UL
436 
437 /* The following attribute types are defined: */
438 #define CKA_CLASS              0x00000000UL
439 #define CKA_TOKEN              0x00000001UL
440 #define CKA_PRIVATE            0x00000002UL
441 #define CKA_LABEL              0x00000003UL
442 #define CKA_APPLICATION        0x00000010UL
443 #define CKA_VALUE              0x00000011UL
444 #define CKA_OBJECT_ID          0x00000012UL
445 #define CKA_CERTIFICATE_TYPE   0x00000080UL
446 #define CKA_ISSUER             0x00000081UL
447 #define CKA_SERIAL_NUMBER      0x00000082UL
448 #define CKA_AC_ISSUER          0x00000083UL
449 #define CKA_OWNER              0x00000084UL
450 #define CKA_ATTR_TYPES         0x00000085UL
451 #define CKA_TRUSTED            0x00000086UL
452 #define CKA_CERTIFICATE_CATEGORY        0x00000087UL
453 #define CKA_JAVA_MIDP_SECURITY_DOMAIN   0x00000088UL
454 #define CKA_URL                         0x00000089UL
455 #define CKA_HASH_OF_SUBJECT_PUBLIC_KEY  0x0000008AUL
456 #define CKA_HASH_OF_ISSUER_PUBLIC_KEY   0x0000008BUL
457 #define CKA_NAME_HASH_ALGORITHM         0x0000008CUL
458 #define CKA_CHECK_VALUE                 0x00000090UL
459 
460 #define CKA_KEY_TYPE           0x00000100UL
461 #define CKA_SUBJECT            0x00000101UL
462 #define CKA_ID                 0x00000102UL
463 #define CKA_SENSITIVE          0x00000103UL
464 #define CKA_ENCRYPT            0x00000104UL
465 #define CKA_DECRYPT            0x00000105UL
466 #define CKA_WRAP               0x00000106UL
467 #define CKA_UNWRAP             0x00000107UL
468 #define CKA_SIGN               0x00000108UL
469 #define CKA_SIGN_RECOVER       0x00000109UL
470 #define CKA_VERIFY             0x0000010AUL
471 #define CKA_VERIFY_RECOVER     0x0000010BUL
472 #define CKA_DERIVE             0x0000010CUL
473 #define CKA_START_DATE         0x00000110UL
474 #define CKA_END_DATE           0x00000111UL
475 #define CKA_MODULUS            0x00000120UL
476 #define CKA_MODULUS_BITS       0x00000121UL
477 #define CKA_PUBLIC_EXPONENT    0x00000122UL
478 #define CKA_PRIVATE_EXPONENT   0x00000123UL
479 #define CKA_PRIME_1            0x00000124UL
480 #define CKA_PRIME_2            0x00000125UL
481 #define CKA_EXPONENT_1         0x00000126UL
482 #define CKA_EXPONENT_2         0x00000127UL
483 #define CKA_COEFFICIENT        0x00000128UL
484 #define CKA_PUBLIC_KEY_INFO    0x00000129UL
485 #define CKA_PRIME              0x00000130UL
486 #define CKA_SUBPRIME           0x00000131UL
487 #define CKA_BASE               0x00000132UL
488 
489 #define CKA_PRIME_BITS         0x00000133UL
490 #define CKA_SUBPRIME_BITS      0x00000134UL
491 #define CKA_SUB_PRIME_BITS     CKA_SUBPRIME_BITS
492 
493 #define CKA_VALUE_BITS         0x00000160UL
494 #define CKA_VALUE_LEN          0x00000161UL
495 #define CKA_EXTRACTABLE        0x00000162UL
496 #define CKA_LOCAL              0x00000163UL
497 #define CKA_NEVER_EXTRACTABLE  0x00000164UL
498 #define CKA_ALWAYS_SENSITIVE   0x00000165UL
499 #define CKA_KEY_GEN_MECHANISM  0x00000166UL
500 
501 #define CKA_MODIFIABLE         0x00000170UL
502 #define CKA_COPYABLE           0x00000171UL
503 
504 #define CKA_DESTROYABLE        0x00000172UL
505 
506 #define CKA_ECDSA_PARAMS       0x00000180UL /* Deprecated */
507 #define CKA_EC_PARAMS          0x00000180UL
508 
509 #define CKA_EC_POINT           0x00000181UL
510 
511 #define CKA_SECONDARY_AUTH     0x00000200UL /* Deprecated */
512 #define CKA_AUTH_PIN_FLAGS     0x00000201UL /* Deprecated */
513 
514 #define CKA_ALWAYS_AUTHENTICATE  0x00000202UL
515 
516 #define CKA_WRAP_WITH_TRUSTED    0x00000210UL
517 #define CKA_WRAP_TEMPLATE        (CKF_ARRAY_ATTRIBUTE|0x00000211UL)
518 #define CKA_UNWRAP_TEMPLATE      (CKF_ARRAY_ATTRIBUTE|0x00000212UL)
519 #define CKA_DERIVE_TEMPLATE      (CKF_ARRAY_ATTRIBUTE|0x00000213UL)
520 
521 #define CKA_OTP_FORMAT                0x00000220UL
522 #define CKA_OTP_LENGTH                0x00000221UL
523 #define CKA_OTP_TIME_INTERVAL         0x00000222UL
524 #define CKA_OTP_USER_FRIENDLY_MODE    0x00000223UL
525 #define CKA_OTP_CHALLENGE_REQUIREMENT 0x00000224UL
526 #define CKA_OTP_TIME_REQUIREMENT      0x00000225UL
527 #define CKA_OTP_COUNTER_REQUIREMENT   0x00000226UL
528 #define CKA_OTP_PIN_REQUIREMENT       0x00000227UL
529 #define CKA_OTP_COUNTER               0x0000022EUL
530 #define CKA_OTP_TIME                  0x0000022FUL
531 #define CKA_OTP_USER_IDENTIFIER       0x0000022AUL
532 #define CKA_OTP_SERVICE_IDENTIFIER    0x0000022BUL
533 #define CKA_OTP_SERVICE_LOGO          0x0000022CUL
534 #define CKA_OTP_SERVICE_LOGO_TYPE     0x0000022DUL
535 
536 #define CKA_GOSTR3410_PARAMS            0x00000250UL
537 #define CKA_GOSTR3411_PARAMS            0x00000251UL
538 #define CKA_GOST28147_PARAMS            0x00000252UL
539 
540 #define CKA_HW_FEATURE_TYPE             0x00000300UL
541 #define CKA_RESET_ON_INIT               0x00000301UL
542 #define CKA_HAS_RESET                   0x00000302UL
543 
544 #define CKA_PIXEL_X                     0x00000400UL
545 #define CKA_PIXEL_Y                     0x00000401UL
546 #define CKA_RESOLUTION                  0x00000402UL
547 #define CKA_CHAR_ROWS                   0x00000403UL
548 #define CKA_CHAR_COLUMNS                0x00000404UL
549 #define CKA_COLOR                       0x00000405UL
550 #define CKA_BITS_PER_PIXEL              0x00000406UL
551 #define CKA_CHAR_SETS                   0x00000480UL
552 #define CKA_ENCODING_METHODS            0x00000481UL
553 #define CKA_MIME_TYPES                  0x00000482UL
554 #define CKA_MECHANISM_TYPE              0x00000500UL
555 #define CKA_REQUIRED_CMS_ATTRIBUTES     0x00000501UL
556 #define CKA_DEFAULT_CMS_ATTRIBUTES      0x00000502UL
557 #define CKA_SUPPORTED_CMS_ATTRIBUTES    0x00000503UL
558 #define CKA_ALLOWED_MECHANISMS          (CKF_ARRAY_ATTRIBUTE|0x00000600UL)
559 
560 #define CKA_VENDOR_DEFINED              0x80000000UL
561 
562 /* CK_ATTRIBUTE is a structure that includes the type, length
563  * and value of an attribute
564  */
565 typedef struct CK_ATTRIBUTE {
566   CK_ATTRIBUTE_TYPE type;
567   CK_VOID_PTR       pValue;
568   CK_ULONG          ulValueLen;  /* in bytes */
569 } CK_ATTRIBUTE;
570 
571 typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR;
572 
573 /* CK_DATE is a structure that defines a date */
574 typedef struct CK_DATE{
575   CK_CHAR       year[4];   /* the year ("1900" - "9999") */
576   CK_CHAR       month[2];  /* the month ("01" - "12") */
577   CK_CHAR       day[2];    /* the day   ("01" - "31") */
578 } CK_DATE;
579 
580 
581 /* CK_MECHANISM_TYPE is a value that identifies a mechanism
582  * type
583  */
584 typedef CK_ULONG          CK_MECHANISM_TYPE;
585 
586 /* the following mechanism types are defined: */
587 #define CKM_RSA_PKCS_KEY_PAIR_GEN      0x00000000UL
588 #define CKM_RSA_PKCS                   0x00000001UL
589 #define CKM_RSA_9796                   0x00000002UL
590 #define CKM_RSA_X_509                  0x00000003UL
591 
592 #define CKM_MD2_RSA_PKCS               0x00000004UL
593 #define CKM_MD5_RSA_PKCS               0x00000005UL
594 #define CKM_SHA1_RSA_PKCS              0x00000006UL
595 
596 #define CKM_RIPEMD128_RSA_PKCS         0x00000007UL
597 #define CKM_RIPEMD160_RSA_PKCS         0x00000008UL
598 #define CKM_RSA_PKCS_OAEP              0x00000009UL
599 
600 #define CKM_RSA_X9_31_KEY_PAIR_GEN     0x0000000AUL
601 #define CKM_RSA_X9_31                  0x0000000BUL
602 #define CKM_SHA1_RSA_X9_31             0x0000000CUL
603 #define CKM_RSA_PKCS_PSS               0x0000000DUL
604 #define CKM_SHA1_RSA_PKCS_PSS          0x0000000EUL
605 
606 #define CKM_DSA_KEY_PAIR_GEN           0x00000010UL
607 #define CKM_DSA                        0x00000011UL
608 #define CKM_DSA_SHA1                   0x00000012UL
609 #define CKM_DSA_SHA224                 0x00000013UL
610 #define CKM_DSA_SHA256                 0x00000014UL
611 #define CKM_DSA_SHA384                 0x00000015UL
612 #define CKM_DSA_SHA512                 0x00000016UL
613 
614 #define CKM_DH_PKCS_KEY_PAIR_GEN       0x00000020UL
615 #define CKM_DH_PKCS_DERIVE             0x00000021UL
616 
617 #define CKM_X9_42_DH_KEY_PAIR_GEN      0x00000030UL
618 #define CKM_X9_42_DH_DERIVE            0x00000031UL
619 #define CKM_X9_42_DH_HYBRID_DERIVE     0x00000032UL
620 #define CKM_X9_42_MQV_DERIVE           0x00000033UL
621 
622 #define CKM_SHA256_RSA_PKCS            0x00000040UL
623 #define CKM_SHA384_RSA_PKCS            0x00000041UL
624 #define CKM_SHA512_RSA_PKCS            0x00000042UL
625 #define CKM_SHA256_RSA_PKCS_PSS        0x00000043UL
626 #define CKM_SHA384_RSA_PKCS_PSS        0x00000044UL
627 #define CKM_SHA512_RSA_PKCS_PSS        0x00000045UL
628 
629 #define CKM_SHA224_RSA_PKCS            0x00000046UL
630 #define CKM_SHA224_RSA_PKCS_PSS        0x00000047UL
631 
632 #define CKM_SHA512_224                 0x00000048UL
633 #define CKM_SHA512_224_HMAC            0x00000049UL
634 #define CKM_SHA512_224_HMAC_GENERAL    0x0000004AUL
635 #define CKM_SHA512_224_KEY_DERIVATION  0x0000004BUL
636 #define CKM_SHA512_256                 0x0000004CUL
637 #define CKM_SHA512_256_HMAC            0x0000004DUL
638 #define CKM_SHA512_256_HMAC_GENERAL    0x0000004EUL
639 #define CKM_SHA512_256_KEY_DERIVATION  0x0000004FUL
640 
641 #define CKM_SHA512_T                   0x00000050UL
642 #define CKM_SHA512_T_HMAC              0x00000051UL
643 #define CKM_SHA512_T_HMAC_GENERAL      0x00000052UL
644 #define CKM_SHA512_T_KEY_DERIVATION    0x00000053UL
645 
646 #define CKM_RC2_KEY_GEN                0x00000100UL
647 #define CKM_RC2_ECB                    0x00000101UL
648 #define CKM_RC2_CBC                    0x00000102UL
649 #define CKM_RC2_MAC                    0x00000103UL
650 
651 #define CKM_RC2_MAC_GENERAL            0x00000104UL
652 #define CKM_RC2_CBC_PAD                0x00000105UL
653 
654 #define CKM_RC4_KEY_GEN                0x00000110UL
655 #define CKM_RC4                        0x00000111UL
656 #define CKM_DES_KEY_GEN                0x00000120UL
657 #define CKM_DES_ECB                    0x00000121UL
658 #define CKM_DES_CBC                    0x00000122UL
659 #define CKM_DES_MAC                    0x00000123UL
660 
661 #define CKM_DES_MAC_GENERAL            0x00000124UL
662 #define CKM_DES_CBC_PAD                0x00000125UL
663 
664 #define CKM_DES2_KEY_GEN               0x00000130UL
665 #define CKM_DES3_KEY_GEN               0x00000131UL
666 #define CKM_DES3_ECB                   0x00000132UL
667 #define CKM_DES3_CBC                   0x00000133UL
668 #define CKM_DES3_MAC                   0x00000134UL
669 
670 #define CKM_DES3_MAC_GENERAL           0x00000135UL
671 #define CKM_DES3_CBC_PAD               0x00000136UL
672 #define CKM_DES3_CMAC_GENERAL          0x00000137UL
673 #define CKM_DES3_CMAC                  0x00000138UL
674 #define CKM_CDMF_KEY_GEN               0x00000140UL
675 #define CKM_CDMF_ECB                   0x00000141UL
676 #define CKM_CDMF_CBC                   0x00000142UL
677 #define CKM_CDMF_MAC                   0x00000143UL
678 #define CKM_CDMF_MAC_GENERAL           0x00000144UL
679 #define CKM_CDMF_CBC_PAD               0x00000145UL
680 
681 #define CKM_DES_OFB64                  0x00000150UL
682 #define CKM_DES_OFB8                   0x00000151UL
683 #define CKM_DES_CFB64                  0x00000152UL
684 #define CKM_DES_CFB8                   0x00000153UL
685 
686 #define CKM_MD2                        0x00000200UL
687 
688 #define CKM_MD2_HMAC                   0x00000201UL
689 #define CKM_MD2_HMAC_GENERAL           0x00000202UL
690 
691 #define CKM_MD5                        0x00000210UL
692 
693 #define CKM_MD5_HMAC                   0x00000211UL
694 #define CKM_MD5_HMAC_GENERAL           0x00000212UL
695 
696 #define CKM_SHA_1                      0x00000220UL
697 
698 #define CKM_SHA_1_HMAC                 0x00000221UL
699 #define CKM_SHA_1_HMAC_GENERAL         0x00000222UL
700 
701 #define CKM_RIPEMD128                  0x00000230UL
702 #define CKM_RIPEMD128_HMAC             0x00000231UL
703 #define CKM_RIPEMD128_HMAC_GENERAL     0x00000232UL
704 #define CKM_RIPEMD160                  0x00000240UL
705 #define CKM_RIPEMD160_HMAC             0x00000241UL
706 #define CKM_RIPEMD160_HMAC_GENERAL     0x00000242UL
707 
708 #define CKM_SHA256                     0x00000250UL
709 #define CKM_SHA256_HMAC                0x00000251UL
710 #define CKM_SHA256_HMAC_GENERAL        0x00000252UL
711 #define CKM_SHA224                     0x00000255UL
712 #define CKM_SHA224_HMAC                0x00000256UL
713 #define CKM_SHA224_HMAC_GENERAL        0x00000257UL
714 #define CKM_SHA384                     0x00000260UL
715 #define CKM_SHA384_HMAC                0x00000261UL
716 #define CKM_SHA384_HMAC_GENERAL        0x00000262UL
717 #define CKM_SHA512                     0x00000270UL
718 #define CKM_SHA512_HMAC                0x00000271UL
719 #define CKM_SHA512_HMAC_GENERAL        0x00000272UL
720 #define CKM_SECURID_KEY_GEN            0x00000280UL
721 #define CKM_SECURID                    0x00000282UL
722 #define CKM_HOTP_KEY_GEN               0x00000290UL
723 #define CKM_HOTP                       0x00000291UL
724 #define CKM_ACTI                       0x000002A0UL
725 #define CKM_ACTI_KEY_GEN               0x000002A1UL
726 
727 #define CKM_CAST_KEY_GEN               0x00000300UL
728 #define CKM_CAST_ECB                   0x00000301UL
729 #define CKM_CAST_CBC                   0x00000302UL
730 #define CKM_CAST_MAC                   0x00000303UL
731 #define CKM_CAST_MAC_GENERAL           0x00000304UL
732 #define CKM_CAST_CBC_PAD               0x00000305UL
733 #define CKM_CAST3_KEY_GEN              0x00000310UL
734 #define CKM_CAST3_ECB                  0x00000311UL
735 #define CKM_CAST3_CBC                  0x00000312UL
736 #define CKM_CAST3_MAC                  0x00000313UL
737 #define CKM_CAST3_MAC_GENERAL          0x00000314UL
738 #define CKM_CAST3_CBC_PAD              0x00000315UL
739 /* Note that CAST128 and CAST5 are the same algorithm */
740 #define CKM_CAST5_KEY_GEN              0x00000320UL
741 #define CKM_CAST128_KEY_GEN            0x00000320UL
742 #define CKM_CAST5_ECB                  0x00000321UL
743 #define CKM_CAST128_ECB                0x00000321UL
744 #define CKM_CAST5_CBC                  0x00000322UL /* Deprecated */
745 #define CKM_CAST128_CBC                0x00000322UL
746 #define CKM_CAST5_MAC                  0x00000323UL /* Deprecated */
747 #define CKM_CAST128_MAC                0x00000323UL
748 #define CKM_CAST5_MAC_GENERAL          0x00000324UL /* Deprecated */
749 #define CKM_CAST128_MAC_GENERAL        0x00000324UL
750 #define CKM_CAST5_CBC_PAD              0x00000325UL /* Deprecated */
751 #define CKM_CAST128_CBC_PAD            0x00000325UL
752 #define CKM_RC5_KEY_GEN                0x00000330UL
753 #define CKM_RC5_ECB                    0x00000331UL
754 #define CKM_RC5_CBC                    0x00000332UL
755 #define CKM_RC5_MAC                    0x00000333UL
756 #define CKM_RC5_MAC_GENERAL            0x00000334UL
757 #define CKM_RC5_CBC_PAD                0x00000335UL
758 #define CKM_IDEA_KEY_GEN               0x00000340UL
759 #define CKM_IDEA_ECB                   0x00000341UL
760 #define CKM_IDEA_CBC                   0x00000342UL
761 #define CKM_IDEA_MAC                   0x00000343UL
762 #define CKM_IDEA_MAC_GENERAL           0x00000344UL
763 #define CKM_IDEA_CBC_PAD               0x00000345UL
764 #define CKM_GENERIC_SECRET_KEY_GEN     0x00000350UL
765 #define CKM_CONCATENATE_BASE_AND_KEY   0x00000360UL
766 #define CKM_CONCATENATE_BASE_AND_DATA  0x00000362UL
767 #define CKM_CONCATENATE_DATA_AND_BASE  0x00000363UL
768 #define CKM_XOR_BASE_AND_DATA          0x00000364UL
769 #define CKM_EXTRACT_KEY_FROM_KEY       0x00000365UL
770 #define CKM_SSL3_PRE_MASTER_KEY_GEN    0x00000370UL
771 #define CKM_SSL3_MASTER_KEY_DERIVE     0x00000371UL
772 #define CKM_SSL3_KEY_AND_MAC_DERIVE    0x00000372UL
773 
774 #define CKM_SSL3_MASTER_KEY_DERIVE_DH  0x00000373UL
775 #define CKM_TLS_PRE_MASTER_KEY_GEN     0x00000374UL
776 #define CKM_TLS_MASTER_KEY_DERIVE      0x00000375UL
777 #define CKM_TLS_KEY_AND_MAC_DERIVE     0x00000376UL
778 #define CKM_TLS_MASTER_KEY_DERIVE_DH   0x00000377UL
779 
780 #define CKM_TLS_PRF                    0x00000378UL
781 
782 #define CKM_SSL3_MD5_MAC               0x00000380UL
783 #define CKM_SSL3_SHA1_MAC              0x00000381UL
784 #define CKM_MD5_KEY_DERIVATION         0x00000390UL
785 #define CKM_MD2_KEY_DERIVATION         0x00000391UL
786 #define CKM_SHA1_KEY_DERIVATION        0x00000392UL
787 
788 #define CKM_SHA256_KEY_DERIVATION      0x00000393UL
789 #define CKM_SHA384_KEY_DERIVATION      0x00000394UL
790 #define CKM_SHA512_KEY_DERIVATION      0x00000395UL
791 #define CKM_SHA224_KEY_DERIVATION      0x00000396UL
792 
793 #define CKM_PBE_MD2_DES_CBC            0x000003A0UL
794 #define CKM_PBE_MD5_DES_CBC            0x000003A1UL
795 #define CKM_PBE_MD5_CAST_CBC           0x000003A2UL
796 #define CKM_PBE_MD5_CAST3_CBC          0x000003A3UL
797 #define CKM_PBE_MD5_CAST5_CBC          0x000003A4UL /* Deprecated */
798 #define CKM_PBE_MD5_CAST128_CBC        0x000003A4UL
799 #define CKM_PBE_SHA1_CAST5_CBC         0x000003A5UL /* Deprecated */
800 #define CKM_PBE_SHA1_CAST128_CBC       0x000003A5UL
801 #define CKM_PBE_SHA1_RC4_128           0x000003A6UL
802 #define CKM_PBE_SHA1_RC4_40            0x000003A7UL
803 #define CKM_PBE_SHA1_DES3_EDE_CBC      0x000003A8UL
804 #define CKM_PBE_SHA1_DES2_EDE_CBC      0x000003A9UL
805 #define CKM_PBE_SHA1_RC2_128_CBC       0x000003AAUL
806 #define CKM_PBE_SHA1_RC2_40_CBC        0x000003ABUL
807 
808 #define CKM_PKCS5_PBKD2                0x000003B0UL
809 
810 #define CKM_PBA_SHA1_WITH_SHA1_HMAC    0x000003C0UL
811 
812 #define CKM_WTLS_PRE_MASTER_KEY_GEN         0x000003D0UL
813 #define CKM_WTLS_MASTER_KEY_DERIVE          0x000003D1UL
814 #define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC   0x000003D2UL
815 #define CKM_WTLS_PRF                        0x000003D3UL
816 #define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE  0x000003D4UL
817 #define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE  0x000003D5UL
818 
819 #define CKM_TLS10_MAC_SERVER                0x000003D6UL
820 #define CKM_TLS10_MAC_CLIENT                0x000003D7UL
821 #define CKM_TLS12_MAC                       0x000003D8UL
822 #define CKM_TLS12_KDF                       0x000003D9UL
823 #define CKM_TLS12_MASTER_KEY_DERIVE         0x000003E0UL
824 #define CKM_TLS12_KEY_AND_MAC_DERIVE        0x000003E1UL
825 #define CKM_TLS12_MASTER_KEY_DERIVE_DH      0x000003E2UL
826 #define CKM_TLS12_KEY_SAFE_DERIVE           0x000003E3UL
827 #define CKM_TLS_MAC                         0x000003E4UL
828 #define CKM_TLS_KDF                         0x000003E5UL
829 
830 #define CKM_KEY_WRAP_LYNKS             0x00000400UL
831 #define CKM_KEY_WRAP_SET_OAEP          0x00000401UL
832 
833 #define CKM_CMS_SIG                    0x00000500UL
834 #define CKM_KIP_DERIVE                 0x00000510UL
835 #define CKM_KIP_WRAP                   0x00000511UL
836 #define CKM_KIP_MAC                    0x00000512UL
837 
838 #define CKM_CAMELLIA_KEY_GEN           0x00000550UL
839 #define CKM_CAMELLIA_ECB               0x00000551UL
840 #define CKM_CAMELLIA_CBC               0x00000552UL
841 #define CKM_CAMELLIA_MAC               0x00000553UL
842 #define CKM_CAMELLIA_MAC_GENERAL       0x00000554UL
843 #define CKM_CAMELLIA_CBC_PAD           0x00000555UL
844 #define CKM_CAMELLIA_ECB_ENCRYPT_DATA  0x00000556UL
845 #define CKM_CAMELLIA_CBC_ENCRYPT_DATA  0x00000557UL
846 #define CKM_CAMELLIA_CTR               0x00000558UL
847 
848 #define CKM_ARIA_KEY_GEN               0x00000560UL
849 #define CKM_ARIA_ECB                   0x00000561UL
850 #define CKM_ARIA_CBC                   0x00000562UL
851 #define CKM_ARIA_MAC                   0x00000563UL
852 #define CKM_ARIA_MAC_GENERAL           0x00000564UL
853 #define CKM_ARIA_CBC_PAD               0x00000565UL
854 #define CKM_ARIA_ECB_ENCRYPT_DATA      0x00000566UL
855 #define CKM_ARIA_CBC_ENCRYPT_DATA      0x00000567UL
856 
857 #define CKM_SEED_KEY_GEN               0x00000650UL
858 #define CKM_SEED_ECB                   0x00000651UL
859 #define CKM_SEED_CBC                   0x00000652UL
860 #define CKM_SEED_MAC                   0x00000653UL
861 #define CKM_SEED_MAC_GENERAL           0x00000654UL
862 #define CKM_SEED_CBC_PAD               0x00000655UL
863 #define CKM_SEED_ECB_ENCRYPT_DATA      0x00000656UL
864 #define CKM_SEED_CBC_ENCRYPT_DATA      0x00000657UL
865 
866 #define CKM_SKIPJACK_KEY_GEN           0x00001000UL
867 #define CKM_SKIPJACK_ECB64             0x00001001UL
868 #define CKM_SKIPJACK_CBC64             0x00001002UL
869 #define CKM_SKIPJACK_OFB64             0x00001003UL
870 #define CKM_SKIPJACK_CFB64             0x00001004UL
871 #define CKM_SKIPJACK_CFB32             0x00001005UL
872 #define CKM_SKIPJACK_CFB16             0x00001006UL
873 #define CKM_SKIPJACK_CFB8              0x00001007UL
874 #define CKM_SKIPJACK_WRAP              0x00001008UL
875 #define CKM_SKIPJACK_PRIVATE_WRAP      0x00001009UL
876 #define CKM_SKIPJACK_RELAYX            0x0000100aUL
877 #define CKM_KEA_KEY_PAIR_GEN           0x00001010UL
878 #define CKM_KEA_KEY_DERIVE             0x00001011UL
879 #define CKM_KEA_DERIVE                 0x00001012UL
880 #define CKM_FORTEZZA_TIMESTAMP         0x00001020UL
881 #define CKM_BATON_KEY_GEN              0x00001030UL
882 #define CKM_BATON_ECB128               0x00001031UL
883 #define CKM_BATON_ECB96                0x00001032UL
884 #define CKM_BATON_CBC128               0x00001033UL
885 #define CKM_BATON_COUNTER              0x00001034UL
886 #define CKM_BATON_SHUFFLE              0x00001035UL
887 #define CKM_BATON_WRAP                 0x00001036UL
888 
889 #define CKM_ECDSA_KEY_PAIR_GEN         0x00001040UL /* Deprecated */
890 #define CKM_EC_KEY_PAIR_GEN            0x00001040UL
891 
892 #define CKM_ECDSA                      0x00001041UL
893 #define CKM_ECDSA_SHA1                 0x00001042UL
894 #define CKM_ECDSA_SHA224               0x00001043UL
895 #define CKM_ECDSA_SHA256               0x00001044UL
896 #define CKM_ECDSA_SHA384               0x00001045UL
897 #define CKM_ECDSA_SHA512               0x00001046UL
898 
899 #define CKM_ECDH1_DERIVE               0x00001050UL
900 #define CKM_ECDH1_COFACTOR_DERIVE      0x00001051UL
901 #define CKM_ECMQV_DERIVE               0x00001052UL
902 
903 #define CKM_ECDH_AES_KEY_WRAP          0x00001053UL
904 #define CKM_RSA_AES_KEY_WRAP           0x00001054UL
905 
906 #define CKM_JUNIPER_KEY_GEN            0x00001060UL
907 #define CKM_JUNIPER_ECB128             0x00001061UL
908 #define CKM_JUNIPER_CBC128             0x00001062UL
909 #define CKM_JUNIPER_COUNTER            0x00001063UL
910 #define CKM_JUNIPER_SHUFFLE            0x00001064UL
911 #define CKM_JUNIPER_WRAP               0x00001065UL
912 #define CKM_FASTHASH                   0x00001070UL
913 
914 #define CKM_AES_KEY_GEN                0x00001080UL
915 #define CKM_AES_ECB                    0x00001081UL
916 #define CKM_AES_CBC                    0x00001082UL
917 #define CKM_AES_MAC                    0x00001083UL
918 #define CKM_AES_MAC_GENERAL            0x00001084UL
919 #define CKM_AES_CBC_PAD                0x00001085UL
920 #define CKM_AES_CTR                    0x00001086UL
921 #define CKM_AES_GCM                    0x00001087UL
922 #define CKM_AES_CCM                    0x00001088UL
923 #define CKM_AES_CTS                    0x00001089UL
924 #define CKM_AES_CMAC                   0x0000108AUL
925 #define CKM_AES_CMAC_GENERAL           0x0000108BUL
926 
927 #define CKM_AES_XCBC_MAC               0x0000108CUL
928 #define CKM_AES_XCBC_MAC_96            0x0000108DUL
929 #define CKM_AES_GMAC                   0x0000108EUL
930 
931 #define CKM_BLOWFISH_KEY_GEN           0x00001090UL
932 #define CKM_BLOWFISH_CBC               0x00001091UL
933 #define CKM_TWOFISH_KEY_GEN            0x00001092UL
934 #define CKM_TWOFISH_CBC                0x00001093UL
935 #define CKM_BLOWFISH_CBC_PAD           0x00001094UL
936 #define CKM_TWOFISH_CBC_PAD            0x00001095UL
937 
938 #define CKM_DES_ECB_ENCRYPT_DATA       0x00001100UL
939 #define CKM_DES_CBC_ENCRYPT_DATA       0x00001101UL
940 #define CKM_DES3_ECB_ENCRYPT_DATA      0x00001102UL
941 #define CKM_DES3_CBC_ENCRYPT_DATA      0x00001103UL
942 #define CKM_AES_ECB_ENCRYPT_DATA       0x00001104UL
943 #define CKM_AES_CBC_ENCRYPT_DATA       0x00001105UL
944 
945 #define CKM_GOSTR3410_KEY_PAIR_GEN     0x00001200UL
946 #define CKM_GOSTR3410                  0x00001201UL
947 #define CKM_GOSTR3410_WITH_GOSTR3411   0x00001202UL
948 #define CKM_GOSTR3410_KEY_WRAP         0x00001203UL
949 #define CKM_GOSTR3410_DERIVE           0x00001204UL
950 #define CKM_GOSTR3411                  0x00001210UL
951 #define CKM_GOSTR3411_HMAC             0x00001211UL
952 #define CKM_GOST28147_KEY_GEN          0x00001220UL
953 #define CKM_GOST28147_ECB              0x00001221UL
954 #define CKM_GOST28147                  0x00001222UL
955 #define CKM_GOST28147_MAC              0x00001223UL
956 #define CKM_GOST28147_KEY_WRAP         0x00001224UL
957 
958 #define CKM_DSA_PARAMETER_GEN          0x00002000UL
959 #define CKM_DH_PKCS_PARAMETER_GEN      0x00002001UL
960 #define CKM_X9_42_DH_PARAMETER_GEN     0x00002002UL
961 #define CKM_DSA_PROBABLISTIC_PARAMETER_GEN    0x00002003UL
962 #define CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN    0x00002004UL
963 
964 #define CKM_AES_OFB                    0x00002104UL
965 #define CKM_AES_CFB64                  0x00002105UL
966 #define CKM_AES_CFB8                   0x00002106UL
967 #define CKM_AES_CFB128                 0x00002107UL
968 
969 #define CKM_AES_CFB1                   0x00002108UL
970 #define CKM_AES_KEY_WRAP               0x00002109UL     /* WAS: 0x00001090 */
971 #define CKM_AES_KEY_WRAP_PAD           0x0000210AUL     /* WAS: 0x00001091 */
972 
973 #define CKM_RSA_PKCS_TPM_1_1           0x00004001UL
974 #define CKM_RSA_PKCS_OAEP_TPM_1_1      0x00004002UL
975 
976 #define CKM_VENDOR_DEFINED             0x80000000UL
977 
978 typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR;
979 
980 
981 /* CK_MECHANISM is a structure that specifies a particular
982  * mechanism
983  */
984 typedef struct CK_MECHANISM {
985   CK_MECHANISM_TYPE mechanism;
986   CK_VOID_PTR       pParameter;
987   CK_ULONG          ulParameterLen;  /* in bytes */
988 } CK_MECHANISM;
989 
990 typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR;
991 
992 
993 /* CK_MECHANISM_INFO provides information about a particular
994  * mechanism
995  */
996 typedef struct CK_MECHANISM_INFO {
997     CK_ULONG    ulMinKeySize;
998     CK_ULONG    ulMaxKeySize;
999     CK_FLAGS    flags;
1000 } CK_MECHANISM_INFO;
1001 
1002 /* The flags are defined as follows:
1003  *      Bit Flag               Mask          Meaning */
1004 #define CKF_HW                 0x00000001UL  /* performed by HW */
1005 
1006 /* Specify whether or not a mechanism can be used for a particular task */
1007 #define CKF_ENCRYPT            0x00000100UL
1008 #define CKF_DECRYPT            0x00000200UL
1009 #define CKF_DIGEST             0x00000400UL
1010 #define CKF_SIGN               0x00000800UL
1011 #define CKF_SIGN_RECOVER       0x00001000UL
1012 #define CKF_VERIFY             0x00002000UL
1013 #define CKF_VERIFY_RECOVER     0x00004000UL
1014 #define CKF_GENERATE           0x00008000UL
1015 #define CKF_GENERATE_KEY_PAIR  0x00010000UL
1016 #define CKF_WRAP               0x00020000UL
1017 #define CKF_UNWRAP             0x00040000UL
1018 #define CKF_DERIVE             0x00080000UL
1019 
1020 /* Describe a token's EC capabilities not available in mechanism
1021  * information.
1022  */
1023 #define CKF_EC_F_P             0x00100000UL
1024 #define CKF_EC_F_2M            0x00200000UL
1025 #define CKF_EC_ECPARAMETERS    0x00400000UL
1026 #define CKF_EC_NAMEDCURVE      0x00800000UL
1027 #define CKF_EC_UNCOMPRESS      0x01000000UL
1028 #define CKF_EC_COMPRESS        0x02000000UL
1029 
1030 #define CKF_EXTENSION          0x80000000UL
1031 
1032 typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR;
1033 
1034 /* CK_RV is a value that identifies the return value of a
1035  * Cryptoki function
1036  */
1037 typedef CK_ULONG          CK_RV;
1038 
1039 #define CKR_OK                                0x00000000UL
1040 #define CKR_CANCEL                            0x00000001UL
1041 #define CKR_HOST_MEMORY                       0x00000002UL
1042 #define CKR_SLOT_ID_INVALID                   0x00000003UL
1043 
1044 #define CKR_GENERAL_ERROR                     0x00000005UL
1045 #define CKR_FUNCTION_FAILED                   0x00000006UL
1046 
1047 #define CKR_ARGUMENTS_BAD                     0x00000007UL
1048 #define CKR_NO_EVENT                          0x00000008UL
1049 #define CKR_NEED_TO_CREATE_THREADS            0x00000009UL
1050 #define CKR_CANT_LOCK                         0x0000000AUL
1051 
1052 #define CKR_ATTRIBUTE_READ_ONLY               0x00000010UL
1053 #define CKR_ATTRIBUTE_SENSITIVE               0x00000011UL
1054 #define CKR_ATTRIBUTE_TYPE_INVALID            0x00000012UL
1055 #define CKR_ATTRIBUTE_VALUE_INVALID           0x00000013UL
1056 
1057 #define CKR_ACTION_PROHIBITED                 0x0000001BUL
1058 
1059 #define CKR_DATA_INVALID                      0x00000020UL
1060 #define CKR_DATA_LEN_RANGE                    0x00000021UL
1061 #define CKR_DEVICE_ERROR                      0x00000030UL
1062 #define CKR_DEVICE_MEMORY                     0x00000031UL
1063 #define CKR_DEVICE_REMOVED                    0x00000032UL
1064 #define CKR_ENCRYPTED_DATA_INVALID            0x00000040UL
1065 #define CKR_ENCRYPTED_DATA_LEN_RANGE          0x00000041UL
1066 #define CKR_FUNCTION_CANCELED                 0x00000050UL
1067 #define CKR_FUNCTION_NOT_PARALLEL             0x00000051UL
1068 
1069 #define CKR_FUNCTION_NOT_SUPPORTED            0x00000054UL
1070 
1071 #define CKR_KEY_HANDLE_INVALID                0x00000060UL
1072 
1073 #define CKR_KEY_SIZE_RANGE                    0x00000062UL
1074 #define CKR_KEY_TYPE_INCONSISTENT             0x00000063UL
1075 
1076 #define CKR_KEY_NOT_NEEDED                    0x00000064UL
1077 #define CKR_KEY_CHANGED                       0x00000065UL
1078 #define CKR_KEY_NEEDED                        0x00000066UL
1079 #define CKR_KEY_INDIGESTIBLE                  0x00000067UL
1080 #define CKR_KEY_FUNCTION_NOT_PERMITTED        0x00000068UL
1081 #define CKR_KEY_NOT_WRAPPABLE                 0x00000069UL
1082 #define CKR_KEY_UNEXTRACTABLE                 0x0000006AUL
1083 
1084 #define CKR_MECHANISM_INVALID                 0x00000070UL
1085 #define CKR_MECHANISM_PARAM_INVALID           0x00000071UL
1086 
1087 #define CKR_OBJECT_HANDLE_INVALID             0x00000082UL
1088 #define CKR_OPERATION_ACTIVE                  0x00000090UL
1089 #define CKR_OPERATION_NOT_INITIALIZED         0x00000091UL
1090 #define CKR_PIN_INCORRECT                     0x000000A0UL
1091 #define CKR_PIN_INVALID                       0x000000A1UL
1092 #define CKR_PIN_LEN_RANGE                     0x000000A2UL
1093 
1094 #define CKR_PIN_EXPIRED                       0x000000A3UL
1095 #define CKR_PIN_LOCKED                        0x000000A4UL
1096 
1097 #define CKR_SESSION_CLOSED                    0x000000B0UL
1098 #define CKR_SESSION_COUNT                     0x000000B1UL
1099 #define CKR_SESSION_HANDLE_INVALID            0x000000B3UL
1100 #define CKR_SESSION_PARALLEL_NOT_SUPPORTED    0x000000B4UL
1101 #define CKR_SESSION_READ_ONLY                 0x000000B5UL
1102 #define CKR_SESSION_EXISTS                    0x000000B6UL
1103 
1104 #define CKR_SESSION_READ_ONLY_EXISTS          0x000000B7UL
1105 #define CKR_SESSION_READ_WRITE_SO_EXISTS      0x000000B8UL
1106 
1107 #define CKR_SIGNATURE_INVALID                 0x000000C0UL
1108 #define CKR_SIGNATURE_LEN_RANGE               0x000000C1UL
1109 #define CKR_TEMPLATE_INCOMPLETE               0x000000D0UL
1110 #define CKR_TEMPLATE_INCONSISTENT             0x000000D1UL
1111 #define CKR_TOKEN_NOT_PRESENT                 0x000000E0UL
1112 #define CKR_TOKEN_NOT_RECOGNIZED              0x000000E1UL
1113 #define CKR_TOKEN_WRITE_PROTECTED             0x000000E2UL
1114 #define CKR_UNWRAPPING_KEY_HANDLE_INVALID     0x000000F0UL
1115 #define CKR_UNWRAPPING_KEY_SIZE_RANGE         0x000000F1UL
1116 #define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT  0x000000F2UL
1117 #define CKR_USER_ALREADY_LOGGED_IN            0x00000100UL
1118 #define CKR_USER_NOT_LOGGED_IN                0x00000101UL
1119 #define CKR_USER_PIN_NOT_INITIALIZED          0x00000102UL
1120 #define CKR_USER_TYPE_INVALID                 0x00000103UL
1121 
1122 #define CKR_USER_ANOTHER_ALREADY_LOGGED_IN    0x00000104UL
1123 #define CKR_USER_TOO_MANY_TYPES               0x00000105UL
1124 
1125 #define CKR_WRAPPED_KEY_INVALID               0x00000110UL
1126 #define CKR_WRAPPED_KEY_LEN_RANGE             0x00000112UL
1127 #define CKR_WRAPPING_KEY_HANDLE_INVALID       0x00000113UL
1128 #define CKR_WRAPPING_KEY_SIZE_RANGE           0x00000114UL
1129 #define CKR_WRAPPING_KEY_TYPE_INCONSISTENT    0x00000115UL
1130 #define CKR_RANDOM_SEED_NOT_SUPPORTED         0x00000120UL
1131 
1132 #define CKR_RANDOM_NO_RNG                     0x00000121UL
1133 
1134 #define CKR_DOMAIN_PARAMS_INVALID             0x00000130UL
1135 
1136 #define CKR_CURVE_NOT_SUPPORTED               0x00000140UL
1137 
1138 #define CKR_BUFFER_TOO_SMALL                  0x00000150UL
1139 #define CKR_SAVED_STATE_INVALID               0x00000160UL
1140 #define CKR_INFORMATION_SENSITIVE             0x00000170UL
1141 #define CKR_STATE_UNSAVEABLE                  0x00000180UL
1142 
1143 #define CKR_CRYPTOKI_NOT_INITIALIZED          0x00000190UL
1144 #define CKR_CRYPTOKI_ALREADY_INITIALIZED      0x00000191UL
1145 #define CKR_MUTEX_BAD                         0x000001A0UL
1146 #define CKR_MUTEX_NOT_LOCKED                  0x000001A1UL
1147 
1148 #define CKR_NEW_PIN_MODE                      0x000001B0UL
1149 #define CKR_NEXT_OTP                          0x000001B1UL
1150 
1151 #define CKR_EXCEEDED_MAX_ITERATIONS           0x000001B5UL
1152 #define CKR_FIPS_SELF_TEST_FAILED             0x000001B6UL
1153 #define CKR_LIBRARY_LOAD_FAILED               0x000001B7UL
1154 #define CKR_PIN_TOO_WEAK                      0x000001B8UL
1155 #define CKR_PUBLIC_KEY_INVALID                0x000001B9UL
1156 
1157 #define CKR_FUNCTION_REJECTED                 0x00000200UL
1158 
1159 #define CKR_VENDOR_DEFINED                    0x80000000UL
1160 
1161 
1162 /* CK_NOTIFY is an application callback that processes events */
1163 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)(
1164   CK_SESSION_HANDLE hSession,     /* the session's handle */
1165   CK_NOTIFICATION   event,
1166   CK_VOID_PTR       pApplication  /* passed to C_OpenSession */
1167 );
1168 
1169 
1170 /* CK_FUNCTION_LIST is a structure holding a Cryptoki spec
1171  * version and pointers of appropriate types to all the
1172  * Cryptoki functions
1173  */
1174 typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST;
1175 
1176 typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR;
1177 
1178 typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR;
1179 
1180 
1181 /* CK_CREATEMUTEX is an application callback for creating a
1182  * mutex object
1183  */
1184 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)(
1185   CK_VOID_PTR_PTR ppMutex  /* location to receive ptr to mutex */
1186 );
1187 
1188 
1189 /* CK_DESTROYMUTEX is an application callback for destroying a
1190  * mutex object
1191  */
1192 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)(
1193   CK_VOID_PTR pMutex  /* pointer to mutex */
1194 );
1195 
1196 
1197 /* CK_LOCKMUTEX is an application callback for locking a mutex */
1198 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)(
1199   CK_VOID_PTR pMutex  /* pointer to mutex */
1200 );
1201 
1202 
1203 /* CK_UNLOCKMUTEX is an application callback for unlocking a
1204  * mutex
1205  */
1206 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)(
1207   CK_VOID_PTR pMutex  /* pointer to mutex */
1208 );
1209 
1210 
1211 /* CK_C_INITIALIZE_ARGS provides the optional arguments to
1212  * C_Initialize
1213  */
1214 typedef struct CK_C_INITIALIZE_ARGS {
1215   CK_CREATEMUTEX CreateMutex;
1216   CK_DESTROYMUTEX DestroyMutex;
1217   CK_LOCKMUTEX LockMutex;
1218   CK_UNLOCKMUTEX UnlockMutex;
1219   CK_FLAGS flags;
1220   CK_VOID_PTR pReserved;
1221 } CK_C_INITIALIZE_ARGS;
1222 
1223 /* flags: bit flags that provide capabilities of the slot
1224  *      Bit Flag                           Mask       Meaning
1225  */
1226 #define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001UL
1227 #define CKF_OS_LOCKING_OK                  0x00000002UL
1228 
1229 typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR;
1230 
1231 
1232 /* additional flags for parameters to functions */
1233 
1234 /* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */
1235 #define CKF_DONT_BLOCK     1
1236 
1237 /* CK_RSA_PKCS_MGF_TYPE  is used to indicate the Message
1238  * Generation Function (MGF) applied to a message block when
1239  * formatting a message block for the PKCS #1 OAEP encryption
1240  * scheme.
1241  */
1242 typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE;
1243 
1244 typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR;
1245 
1246 /* The following MGFs are defined */
1247 #define CKG_MGF1_SHA1         0x00000001UL
1248 #define CKG_MGF1_SHA256       0x00000002UL
1249 #define CKG_MGF1_SHA384       0x00000003UL
1250 #define CKG_MGF1_SHA512       0x00000004UL
1251 #define CKG_MGF1_SHA224       0x00000005UL
1252 
1253 /* CK_RSA_PKCS_OAEP_SOURCE_TYPE  is used to indicate the source
1254  * of the encoding parameter when formatting a message block
1255  * for the PKCS #1 OAEP encryption scheme.
1256  */
1257 typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE;
1258 
1259 typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR;
1260 
1261 /* The following encoding parameter sources are defined */
1262 #define CKZ_DATA_SPECIFIED    0x00000001UL
1263 
1264 /* CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the
1265  * CKM_RSA_PKCS_OAEP mechanism.
1266  */
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;
1274 
1275 typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR;
1276 
1277 /* CK_RSA_PKCS_PSS_PARAMS provides the parameters to the
1278  * CKM_RSA_PKCS_PSS mechanism(s).
1279  */
1280 typedef struct CK_RSA_PKCS_PSS_PARAMS {
1281         CK_MECHANISM_TYPE    hashAlg;
1282         CK_RSA_PKCS_MGF_TYPE mgf;
1283         CK_ULONG             sLen;
1284 } CK_RSA_PKCS_PSS_PARAMS;
1285 
1286 typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR;
1287 
1288 typedef CK_ULONG CK_EC_KDF_TYPE;
1289 
1290 /* The following EC Key Derivation Functions are defined */
1291 #define CKD_NULL                 0x00000001UL
1292 #define CKD_SHA1_KDF             0x00000002UL
1293 
1294 /* The following X9.42 DH key derivation functions are defined */
1295 #define CKD_SHA1_KDF_ASN1        0x00000003UL
1296 #define CKD_SHA1_KDF_CONCATENATE 0x00000004UL
1297 #define CKD_SHA224_KDF           0x00000005UL
1298 #define CKD_SHA256_KDF           0x00000006UL
1299 #define CKD_SHA384_KDF           0x00000007UL
1300 #define CKD_SHA512_KDF           0x00000008UL
1301 #define CKD_CPDIVERSIFY_KDF      0x00000009UL
1302 
1303 
1304 /* CK_ECDH1_DERIVE_PARAMS provides the parameters to the
1305  * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms,
1306  * where each party contributes one key pair.
1307  */
1308 typedef struct CK_ECDH1_DERIVE_PARAMS {
1309   CK_EC_KDF_TYPE kdf;
1310   CK_ULONG ulSharedDataLen;
1311   CK_BYTE_PTR pSharedData;
1312   CK_ULONG ulPublicDataLen;
1313   CK_BYTE_PTR pPublicData;
1314 } CK_ECDH1_DERIVE_PARAMS;
1315 
1316 typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR;
1317 
1318 /*
1319  * CK_ECDH2_DERIVE_PARAMS provides the parameters to the
1320  * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs.
1321  */
1322 typedef struct CK_ECDH2_DERIVE_PARAMS {
1323   CK_EC_KDF_TYPE kdf;
1324   CK_ULONG ulSharedDataLen;
1325   CK_BYTE_PTR pSharedData;
1326   CK_ULONG ulPublicDataLen;
1327   CK_BYTE_PTR pPublicData;
1328   CK_ULONG ulPrivateDataLen;
1329   CK_OBJECT_HANDLE hPrivateData;
1330   CK_ULONG ulPublicDataLen2;
1331   CK_BYTE_PTR pPublicData2;
1332 } CK_ECDH2_DERIVE_PARAMS;
1333 
1334 typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR;
1335 
1336 typedef struct CK_ECMQV_DERIVE_PARAMS {
1337   CK_EC_KDF_TYPE kdf;
1338   CK_ULONG ulSharedDataLen;
1339   CK_BYTE_PTR pSharedData;
1340   CK_ULONG ulPublicDataLen;
1341   CK_BYTE_PTR pPublicData;
1342   CK_ULONG ulPrivateDataLen;
1343   CK_OBJECT_HANDLE hPrivateData;
1344   CK_ULONG ulPublicDataLen2;
1345   CK_BYTE_PTR pPublicData2;
1346   CK_OBJECT_HANDLE publicKey;
1347 } CK_ECMQV_DERIVE_PARAMS;
1348 
1349 typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR;
1350 
1351 /* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the
1352  * CKM_X9_42_DH_PARAMETER_GEN mechanisms
1353  */
1354 typedef CK_ULONG CK_X9_42_DH_KDF_TYPE;
1355 typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR;
1356 
1357 /* CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the
1358  * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party
1359  * contributes one key pair
1360  */
1361 typedef struct CK_X9_42_DH1_DERIVE_PARAMS {
1362   CK_X9_42_DH_KDF_TYPE kdf;
1363   CK_ULONG ulOtherInfoLen;
1364   CK_BYTE_PTR pOtherInfo;
1365   CK_ULONG ulPublicDataLen;
1366   CK_BYTE_PTR pPublicData;
1367 } CK_X9_42_DH1_DERIVE_PARAMS;
1368 
1369 typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR;
1370 
1371 /* CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the
1372  * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation
1373  * mechanisms, where each party contributes two key pairs
1374  */
1375 typedef struct CK_X9_42_DH2_DERIVE_PARAMS {
1376   CK_X9_42_DH_KDF_TYPE kdf;
1377   CK_ULONG ulOtherInfoLen;
1378   CK_BYTE_PTR pOtherInfo;
1379   CK_ULONG ulPublicDataLen;
1380   CK_BYTE_PTR pPublicData;
1381   CK_ULONG ulPrivateDataLen;
1382   CK_OBJECT_HANDLE hPrivateData;
1383   CK_ULONG ulPublicDataLen2;
1384   CK_BYTE_PTR pPublicData2;
1385 } CK_X9_42_DH2_DERIVE_PARAMS;
1386 
1387 typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR;
1388 
1389 typedef struct CK_X9_42_MQV_DERIVE_PARAMS {
1390   CK_X9_42_DH_KDF_TYPE kdf;
1391   CK_ULONG ulOtherInfoLen;
1392   CK_BYTE_PTR pOtherInfo;
1393   CK_ULONG ulPublicDataLen;
1394   CK_BYTE_PTR pPublicData;
1395   CK_ULONG ulPrivateDataLen;
1396   CK_OBJECT_HANDLE hPrivateData;
1397   CK_ULONG ulPublicDataLen2;
1398   CK_BYTE_PTR pPublicData2;
1399   CK_OBJECT_HANDLE publicKey;
1400 } CK_X9_42_MQV_DERIVE_PARAMS;
1401 
1402 typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR;
1403 
1404 /* CK_KEA_DERIVE_PARAMS provides the parameters to the
1405  * CKM_KEA_DERIVE mechanism
1406  */
1407 typedef struct CK_KEA_DERIVE_PARAMS {
1408   CK_BBOOL      isSender;
1409   CK_ULONG      ulRandomLen;
1410   CK_BYTE_PTR   pRandomA;
1411   CK_BYTE_PTR   pRandomB;
1412   CK_ULONG      ulPublicDataLen;
1413   CK_BYTE_PTR   pPublicData;
1414 } CK_KEA_DERIVE_PARAMS;
1415 
1416 typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR;
1417 
1418 
1419 /* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and
1420  * CKM_RC2_MAC mechanisms.  An instance of CK_RC2_PARAMS just
1421  * holds the effective keysize
1422  */
1423 typedef CK_ULONG          CK_RC2_PARAMS;
1424 
1425 typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR;
1426 
1427 
1428 /* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC
1429  * mechanism
1430  */
1431 typedef struct CK_RC2_CBC_PARAMS {
1432   CK_ULONG      ulEffectiveBits;  /* effective bits (1-1024) */
1433   CK_BYTE       iv[8];            /* IV for CBC mode */
1434 } CK_RC2_CBC_PARAMS;
1435 
1436 typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR;
1437 
1438 
1439 /* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the
1440  * CKM_RC2_MAC_GENERAL mechanism
1441  */
1442 typedef struct CK_RC2_MAC_GENERAL_PARAMS {
1443   CK_ULONG      ulEffectiveBits;  /* effective bits (1-1024) */
1444   CK_ULONG      ulMacLength;      /* Length of MAC in bytes */
1445 } CK_RC2_MAC_GENERAL_PARAMS;
1446 
1447 typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \
1448   CK_RC2_MAC_GENERAL_PARAMS_PTR;
1449 
1450 
1451 /* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and
1452  * CKM_RC5_MAC mechanisms
1453  */
1454 typedef struct CK_RC5_PARAMS {
1455   CK_ULONG      ulWordsize;  /* wordsize in bits */
1456   CK_ULONG      ulRounds;    /* number of rounds */
1457 } CK_RC5_PARAMS;
1458 
1459 typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR;
1460 
1461 
1462 /* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC
1463  * mechanism
1464  */
1465 typedef struct CK_RC5_CBC_PARAMS {
1466   CK_ULONG      ulWordsize;  /* wordsize in bits */
1467   CK_ULONG      ulRounds;    /* number of rounds */
1468   CK_BYTE_PTR   pIv;         /* pointer to IV */
1469   CK_ULONG      ulIvLen;     /* length of IV in bytes */
1470 } CK_RC5_CBC_PARAMS;
1471 
1472 typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR;
1473 
1474 
1475 /* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the
1476  * CKM_RC5_MAC_GENERAL mechanism
1477  */
1478 typedef struct CK_RC5_MAC_GENERAL_PARAMS {
1479   CK_ULONG      ulWordsize;   /* wordsize in bits */
1480   CK_ULONG      ulRounds;     /* number of rounds */
1481   CK_ULONG      ulMacLength;  /* Length of MAC in bytes */
1482 } CK_RC5_MAC_GENERAL_PARAMS;
1483 
1484 typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \
1485   CK_RC5_MAC_GENERAL_PARAMS_PTR;
1486 
1487 /* CK_MAC_GENERAL_PARAMS provides the parameters to most block
1488  * ciphers' MAC_GENERAL mechanisms.  Its value is the length of
1489  * the MAC
1490  */
1491 typedef CK_ULONG          CK_MAC_GENERAL_PARAMS;
1492 
1493 typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR;
1494 
1495 typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS {
1496   CK_BYTE      iv[8];
1497   CK_BYTE_PTR  pData;
1498   CK_ULONG     length;
1499 } CK_DES_CBC_ENCRYPT_DATA_PARAMS;
1500 
1501 typedef CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR;
1502 
1503 typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS {
1504   CK_BYTE      iv[16];
1505   CK_BYTE_PTR  pData;
1506   CK_ULONG     length;
1507 } CK_AES_CBC_ENCRYPT_DATA_PARAMS;
1508 
1509 typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR;
1510 
1511 /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the
1512  * CKM_SKIPJACK_PRIVATE_WRAP mechanism
1513  */
1514 typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS {
1515   CK_ULONG      ulPasswordLen;
1516   CK_BYTE_PTR   pPassword;
1517   CK_ULONG      ulPublicDataLen;
1518   CK_BYTE_PTR   pPublicData;
1519   CK_ULONG      ulPAndGLen;
1520   CK_ULONG      ulQLen;
1521   CK_ULONG      ulRandomLen;
1522   CK_BYTE_PTR   pRandomA;
1523   CK_BYTE_PTR   pPrimeP;
1524   CK_BYTE_PTR   pBaseG;
1525   CK_BYTE_PTR   pSubprimeQ;
1526 } CK_SKIPJACK_PRIVATE_WRAP_PARAMS;
1527 
1528 typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \
1529   CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR;
1530 
1531 
1532 /* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the
1533  * CKM_SKIPJACK_RELAYX mechanism
1534  */
1535 typedef struct CK_SKIPJACK_RELAYX_PARAMS {
1536   CK_ULONG      ulOldWrappedXLen;
1537   CK_BYTE_PTR   pOldWrappedX;
1538   CK_ULONG      ulOldPasswordLen;
1539   CK_BYTE_PTR   pOldPassword;
1540   CK_ULONG      ulOldPublicDataLen;
1541   CK_BYTE_PTR   pOldPublicData;
1542   CK_ULONG      ulOldRandomLen;
1543   CK_BYTE_PTR   pOldRandomA;
1544   CK_ULONG      ulNewPasswordLen;
1545   CK_BYTE_PTR   pNewPassword;
1546   CK_ULONG      ulNewPublicDataLen;
1547   CK_BYTE_PTR   pNewPublicData;
1548   CK_ULONG      ulNewRandomLen;
1549   CK_BYTE_PTR   pNewRandomA;
1550 } CK_SKIPJACK_RELAYX_PARAMS;
1551 
1552 typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \
1553   CK_SKIPJACK_RELAYX_PARAMS_PTR;
1554 
1555 
1556 typedef struct CK_PBE_PARAMS {
1557   CK_BYTE_PTR      pInitVector;
1558   CK_UTF8CHAR_PTR  pPassword;
1559   CK_ULONG         ulPasswordLen;
1560   CK_BYTE_PTR      pSalt;
1561   CK_ULONG         ulSaltLen;
1562   CK_ULONG         ulIteration;
1563 } CK_PBE_PARAMS;
1564 
1565 typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR;
1566 
1567 
1568 /* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the
1569  * CKM_KEY_WRAP_SET_OAEP mechanism
1570  */
1571 typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS {
1572   CK_BYTE       bBC;     /* block contents byte */
1573   CK_BYTE_PTR   pX;      /* extra data */
1574   CK_ULONG      ulXLen;  /* length of extra data in bytes */
1575 } CK_KEY_WRAP_SET_OAEP_PARAMS;
1576 
1577 typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR CK_KEY_WRAP_SET_OAEP_PARAMS_PTR;
1578 
1579 typedef struct CK_SSL3_RANDOM_DATA {
1580   CK_BYTE_PTR  pClientRandom;
1581   CK_ULONG     ulClientRandomLen;
1582   CK_BYTE_PTR  pServerRandom;
1583   CK_ULONG     ulServerRandomLen;
1584 } CK_SSL3_RANDOM_DATA;
1585 
1586 
1587 typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS {
1588   CK_SSL3_RANDOM_DATA RandomInfo;
1589   CK_VERSION_PTR pVersion;
1590 } CK_SSL3_MASTER_KEY_DERIVE_PARAMS;
1591 
1592 typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1593   CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR;
1594 
1595 typedef struct CK_SSL3_KEY_MAT_OUT {
1596   CK_OBJECT_HANDLE hClientMacSecret;
1597   CK_OBJECT_HANDLE hServerMacSecret;
1598   CK_OBJECT_HANDLE hClientKey;
1599   CK_OBJECT_HANDLE hServerKey;
1600   CK_BYTE_PTR      pIVClient;
1601   CK_BYTE_PTR      pIVServer;
1602 } CK_SSL3_KEY_MAT_OUT;
1603 
1604 typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR;
1605 
1606 
1607 typedef struct CK_SSL3_KEY_MAT_PARAMS {
1608   CK_ULONG                ulMacSizeInBits;
1609   CK_ULONG                ulKeySizeInBits;
1610   CK_ULONG                ulIVSizeInBits;
1611   CK_BBOOL                bIsExport;
1612   CK_SSL3_RANDOM_DATA     RandomInfo;
1613   CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
1614 } CK_SSL3_KEY_MAT_PARAMS;
1615 
1616 typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR;
1617 
1618 typedef struct CK_TLS_PRF_PARAMS {
1619   CK_BYTE_PTR  pSeed;
1620   CK_ULONG     ulSeedLen;
1621   CK_BYTE_PTR  pLabel;
1622   CK_ULONG     ulLabelLen;
1623   CK_BYTE_PTR  pOutput;
1624   CK_ULONG_PTR pulOutputLen;
1625 } CK_TLS_PRF_PARAMS;
1626 
1627 typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR;
1628 
1629 typedef struct CK_WTLS_RANDOM_DATA {
1630   CK_BYTE_PTR pClientRandom;
1631   CK_ULONG    ulClientRandomLen;
1632   CK_BYTE_PTR pServerRandom;
1633   CK_ULONG    ulServerRandomLen;
1634 } CK_WTLS_RANDOM_DATA;
1635 
1636 typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR;
1637 
1638 typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS {
1639   CK_MECHANISM_TYPE   DigestMechanism;
1640   CK_WTLS_RANDOM_DATA RandomInfo;
1641   CK_BYTE_PTR         pVersion;
1642 } CK_WTLS_MASTER_KEY_DERIVE_PARAMS;
1643 
1644 typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1645   CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR;
1646 
1647 typedef struct CK_WTLS_PRF_PARAMS {
1648   CK_MECHANISM_TYPE DigestMechanism;
1649   CK_BYTE_PTR       pSeed;
1650   CK_ULONG          ulSeedLen;
1651   CK_BYTE_PTR       pLabel;
1652   CK_ULONG          ulLabelLen;
1653   CK_BYTE_PTR       pOutput;
1654   CK_ULONG_PTR      pulOutputLen;
1655 } CK_WTLS_PRF_PARAMS;
1656 
1657 typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR;
1658 
1659 typedef struct CK_WTLS_KEY_MAT_OUT {
1660   CK_OBJECT_HANDLE hMacSecret;
1661   CK_OBJECT_HANDLE hKey;
1662   CK_BYTE_PTR      pIV;
1663 } CK_WTLS_KEY_MAT_OUT;
1664 
1665 typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR;
1666 
1667 typedef struct CK_WTLS_KEY_MAT_PARAMS {
1668   CK_MECHANISM_TYPE       DigestMechanism;
1669   CK_ULONG                ulMacSizeInBits;
1670   CK_ULONG                ulKeySizeInBits;
1671   CK_ULONG                ulIVSizeInBits;
1672   CK_ULONG                ulSequenceNumber;
1673   CK_BBOOL                bIsExport;
1674   CK_WTLS_RANDOM_DATA     RandomInfo;
1675   CK_WTLS_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
1676 } CK_WTLS_KEY_MAT_PARAMS;
1677 
1678 typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR;
1679 
1680 typedef struct CK_CMS_SIG_PARAMS {
1681   CK_OBJECT_HANDLE      certificateHandle;
1682   CK_MECHANISM_PTR      pSigningMechanism;
1683   CK_MECHANISM_PTR      pDigestMechanism;
1684   CK_UTF8CHAR_PTR       pContentType;
1685   CK_BYTE_PTR           pRequestedAttributes;
1686   CK_ULONG              ulRequestedAttributesLen;
1687   CK_BYTE_PTR           pRequiredAttributes;
1688   CK_ULONG              ulRequiredAttributesLen;
1689 } CK_CMS_SIG_PARAMS;
1690 
1691 typedef CK_CMS_SIG_PARAMS CK_PTR CK_CMS_SIG_PARAMS_PTR;
1692 
1693 typedef struct CK_KEY_DERIVATION_STRING_DATA {
1694   CK_BYTE_PTR pData;
1695   CK_ULONG    ulLen;
1696 } CK_KEY_DERIVATION_STRING_DATA;
1697 
1698 typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \
1699   CK_KEY_DERIVATION_STRING_DATA_PTR;
1700 
1701 
1702 /* The CK_EXTRACT_PARAMS is used for the
1703  * CKM_EXTRACT_KEY_FROM_KEY mechanism.  It specifies which bit
1704  * of the base key should be used as the first bit of the
1705  * derived key
1706  */
1707 typedef CK_ULONG CK_EXTRACT_PARAMS;
1708 
1709 typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR;
1710 
1711 /* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to
1712  * indicate the Pseudo-Random Function (PRF) used to generate
1713  * key bits using PKCS #5 PBKDF2.
1714  */
1715 typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE;
1716 
1717 typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR \
1718                         CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR;
1719 
1720 #define CKP_PKCS5_PBKD2_HMAC_SHA1          0x00000001UL
1721 #define CKP_PKCS5_PBKD2_HMAC_GOSTR3411     0x00000002UL
1722 #define CKP_PKCS5_PBKD2_HMAC_SHA224        0x00000003UL
1723 #define CKP_PKCS5_PBKD2_HMAC_SHA256        0x00000004UL
1724 #define CKP_PKCS5_PBKD2_HMAC_SHA384        0x00000005UL
1725 #define CKP_PKCS5_PBKD2_HMAC_SHA512        0x00000006UL
1726 #define CKP_PKCS5_PBKD2_HMAC_SHA512_224    0x00000007UL
1727 #define CKP_PKCS5_PBKD2_HMAC_SHA512_256    0x00000008UL
1728 
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
1731  * PBKDF2.
1732  */
1733 typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE;
1734 
1735 typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR \
1736                         CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR;
1737 
1738 /* The following salt value sources are defined in PKCS #5 v2.0. */
1739 #define CKZ_SALT_SPECIFIED        0x00000001UL
1740 
1741 /* CK_PKCS5_PBKD2_PARAMS is a structure that provides the
1742  * parameters to the CKM_PKCS5_PBKD2 mechanism.
1743  */
1744 typedef struct CK_PKCS5_PBKD2_PARAMS {
1745         CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE           saltSource;
1746         CK_VOID_PTR                                pSaltSourceData;
1747         CK_ULONG                                   ulSaltSourceDataLen;
1748         CK_ULONG                                   iterations;
1749         CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;
1750         CK_VOID_PTR                                pPrfData;
1751         CK_ULONG                                   ulPrfDataLen;
1752         CK_UTF8CHAR_PTR                            pPassword;
1753         CK_ULONG_PTR                               ulPasswordLen;
1754 } CK_PKCS5_PBKD2_PARAMS;
1755 
1756 typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR;
1757 
1758 /* CK_PKCS5_PBKD2_PARAMS2 is a corrected version of the CK_PKCS5_PBKD2_PARAMS
1759  * structure that provides the parameters to the CKM_PKCS5_PBKD2 mechanism
1760  * noting that the ulPasswordLen field is a CK_ULONG and not a CK_ULONG_PTR.
1761  */
1762 typedef struct CK_PKCS5_PBKD2_PARAMS2 {
1763         CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource;
1764         CK_VOID_PTR pSaltSourceData;
1765         CK_ULONG ulSaltSourceDataLen;
1766         CK_ULONG iterations;
1767         CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;
1768         CK_VOID_PTR pPrfData;
1769         CK_ULONG ulPrfDataLen;
1770         CK_UTF8CHAR_PTR pPassword;
1771         CK_ULONG ulPasswordLen;
1772 } CK_PKCS5_PBKD2_PARAMS2;
1773 
1774 typedef CK_PKCS5_PBKD2_PARAMS2 CK_PTR CK_PKCS5_PBKD2_PARAMS2_PTR;
1775 
1776 typedef CK_ULONG CK_OTP_PARAM_TYPE;
1777 typedef CK_OTP_PARAM_TYPE CK_PARAM_TYPE; /* backward compatibility */
1778 
1779 typedef struct CK_OTP_PARAM {
1780     CK_OTP_PARAM_TYPE type;
1781     CK_VOID_PTR pValue;
1782     CK_ULONG ulValueLen;
1783 } CK_OTP_PARAM;
1784 
1785 typedef CK_OTP_PARAM CK_PTR CK_OTP_PARAM_PTR;
1786 
1787 typedef struct CK_OTP_PARAMS {
1788     CK_OTP_PARAM_PTR pParams;
1789     CK_ULONG ulCount;
1790 } CK_OTP_PARAMS;
1791 
1792 typedef CK_OTP_PARAMS CK_PTR CK_OTP_PARAMS_PTR;
1793 
1794 typedef struct CK_OTP_SIGNATURE_INFO {
1795     CK_OTP_PARAM_PTR pParams;
1796     CK_ULONG ulCount;
1797 } CK_OTP_SIGNATURE_INFO;
1798 
1799 typedef CK_OTP_SIGNATURE_INFO CK_PTR CK_OTP_SIGNATURE_INFO_PTR;
1800 
1801 #define CK_OTP_VALUE          0UL
1802 #define CK_OTP_PIN            1UL
1803 #define CK_OTP_CHALLENGE      2UL
1804 #define CK_OTP_TIME           3UL
1805 #define CK_OTP_COUNTER        4UL
1806 #define CK_OTP_FLAGS          5UL
1807 #define CK_OTP_OUTPUT_LENGTH  6UL
1808 #define CK_OTP_OUTPUT_FORMAT  7UL
1809 
1810 #define CKF_NEXT_OTP          0x00000001UL
1811 #define CKF_EXCLUDE_TIME      0x00000002UL
1812 #define CKF_EXCLUDE_COUNTER   0x00000004UL
1813 #define CKF_EXCLUDE_CHALLENGE 0x00000008UL
1814 #define CKF_EXCLUDE_PIN       0x00000010UL
1815 #define CKF_USER_FRIENDLY_OTP 0x00000020UL
1816 
1817 typedef struct CK_KIP_PARAMS {
1818     CK_MECHANISM_PTR  pMechanism;
1819     CK_OBJECT_HANDLE  hKey;
1820     CK_BYTE_PTR       pSeed;
1821     CK_ULONG          ulSeedLen;
1822 } CK_KIP_PARAMS;
1823 
1824 typedef CK_KIP_PARAMS CK_PTR CK_KIP_PARAMS_PTR;
1825 
1826 typedef struct CK_AES_CTR_PARAMS {
1827     CK_ULONG ulCounterBits;
1828     CK_BYTE cb[16];
1829 } CK_AES_CTR_PARAMS;
1830 
1831 typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR;
1832 
1833 typedef struct CK_GCM_PARAMS {
1834     CK_BYTE_PTR       pIv;
1835     CK_ULONG          ulIvLen;
1836     CK_ULONG          ulIvBits;
1837     CK_BYTE_PTR       pAAD;
1838     CK_ULONG          ulAADLen;
1839     CK_ULONG          ulTagBits;
1840 } CK_GCM_PARAMS;
1841 
1842 typedef CK_GCM_PARAMS CK_PTR CK_GCM_PARAMS_PTR;
1843 
1844 typedef struct CK_CCM_PARAMS {
1845     CK_ULONG          ulDataLen;
1846     CK_BYTE_PTR       pNonce;
1847     CK_ULONG          ulNonceLen;
1848     CK_BYTE_PTR       pAAD;
1849     CK_ULONG          ulAADLen;
1850     CK_ULONG          ulMACLen;
1851 } CK_CCM_PARAMS;
1852 
1853 typedef CK_CCM_PARAMS CK_PTR CK_CCM_PARAMS_PTR;
1854 
1855 /*
1856  * These conflict w/ definitions in usr/src/crypto/common and are deprecated,
1857  * so we will require clients to explicitly request their use.
1858  */
1859 #ifdef PKCS11_DEPRECATED_PARAMS
1860 /* Deprecated. Use CK_GCM_PARAMS */
1861 typedef struct CK_AES_GCM_PARAMS {
1862   CK_BYTE_PTR pIv;
1863   CK_ULONG ulIvLen;
1864   CK_ULONG ulIvBits;
1865   CK_BYTE_PTR pAAD;
1866   CK_ULONG ulAADLen;
1867   CK_ULONG ulTagBits;
1868 } CK_AES_GCM_PARAMS;
1869 
1870 typedef CK_AES_GCM_PARAMS CK_PTR CK_AES_GCM_PARAMS_PTR;
1871 
1872 /* Deprecated. Use CK_CCM_PARAMS */
1873 typedef struct CK_AES_CCM_PARAMS {
1874     CK_ULONG          ulDataLen;
1875     CK_BYTE_PTR       pNonce;
1876     CK_ULONG          ulNonceLen;
1877     CK_BYTE_PTR       pAAD;
1878     CK_ULONG          ulAADLen;
1879     CK_ULONG          ulMACLen;
1880 } CK_AES_CCM_PARAMS;
1881 
1882 typedef CK_AES_CCM_PARAMS CK_PTR CK_AES_CCM_PARAMS_PTR;
1883 #endif
1884 
1885 typedef struct CK_CAMELLIA_CTR_PARAMS {
1886     CK_ULONG          ulCounterBits;
1887     CK_BYTE           cb[16];
1888 } CK_CAMELLIA_CTR_PARAMS;
1889 
1890 typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR;
1891 
1892 typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS {
1893     CK_BYTE           iv[16];
1894     CK_BYTE_PTR       pData;
1895     CK_ULONG          length;
1896 } CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS;
1897 
1898 typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR \
1899                                 CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR;
1900 
1901 typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS {
1902     CK_BYTE           iv[16];
1903     CK_BYTE_PTR       pData;
1904     CK_ULONG          length;
1905 } CK_ARIA_CBC_ENCRYPT_DATA_PARAMS;
1906 
1907 typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR \
1908                                 CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR;
1909 
1910 typedef struct CK_DSA_PARAMETER_GEN_PARAM {
1911     CK_MECHANISM_TYPE  hash;
1912     CK_BYTE_PTR        pSeed;
1913     CK_ULONG           ulSeedLen;
1914     CK_ULONG           ulIndex;
1915 } CK_DSA_PARAMETER_GEN_PARAM;
1916 
1917 typedef CK_DSA_PARAMETER_GEN_PARAM CK_PTR CK_DSA_PARAMETER_GEN_PARAM_PTR;
1918 
1919 typedef struct CK_ECDH_AES_KEY_WRAP_PARAMS {
1920     CK_ULONG           ulAESKeyBits;
1921     CK_EC_KDF_TYPE     kdf;
1922     CK_ULONG           ulSharedDataLen;
1923     CK_BYTE_PTR        pSharedData;
1924 } CK_ECDH_AES_KEY_WRAP_PARAMS;
1925 
1926 typedef CK_ECDH_AES_KEY_WRAP_PARAMS CK_PTR CK_ECDH_AES_KEY_WRAP_PARAMS_PTR;
1927 
1928 typedef CK_ULONG CK_JAVA_MIDP_SECURITY_DOMAIN;
1929 
1930 typedef CK_ULONG CK_CERTIFICATE_CATEGORY;
1931 
1932 typedef struct CK_RSA_AES_KEY_WRAP_PARAMS {
1933     CK_ULONG                      ulAESKeyBits;
1934     CK_RSA_PKCS_OAEP_PARAMS_PTR   pOAEPParams;
1935 } CK_RSA_AES_KEY_WRAP_PARAMS;
1936 
1937 typedef CK_RSA_AES_KEY_WRAP_PARAMS CK_PTR CK_RSA_AES_KEY_WRAP_PARAMS_PTR;
1938 
1939 typedef struct CK_TLS12_MASTER_KEY_DERIVE_PARAMS {
1940     CK_SSL3_RANDOM_DATA       RandomInfo;
1941     CK_VERSION_PTR            pVersion;
1942     CK_MECHANISM_TYPE         prfHashMechanism;
1943 } CK_TLS12_MASTER_KEY_DERIVE_PARAMS;
1944 
1945 typedef CK_TLS12_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1946                                 CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR;
1947 
1948 typedef struct CK_TLS12_KEY_MAT_PARAMS {
1949     CK_ULONG                  ulMacSizeInBits;
1950     CK_ULONG                  ulKeySizeInBits;
1951     CK_ULONG                  ulIVSizeInBits;
1952     CK_BBOOL                  bIsExport;
1953     CK_SSL3_RANDOM_DATA       RandomInfo;
1954     CK_SSL3_KEY_MAT_OUT_PTR   pReturnedKeyMaterial;
1955     CK_MECHANISM_TYPE         prfHashMechanism;
1956 } CK_TLS12_KEY_MAT_PARAMS;
1957 
1958 typedef CK_TLS12_KEY_MAT_PARAMS CK_PTR CK_TLS12_KEY_MAT_PARAMS_PTR;
1959 
1960 typedef struct CK_TLS_KDF_PARAMS {
1961     CK_MECHANISM_TYPE         prfMechanism;
1962     CK_BYTE_PTR               pLabel;
1963     CK_ULONG                  ulLabelLength;
1964     CK_SSL3_RANDOM_DATA       RandomInfo;
1965     CK_BYTE_PTR               pContextData;
1966     CK_ULONG                  ulContextDataLength;
1967 } CK_TLS_KDF_PARAMS;
1968 
1969 typedef CK_TLS_KDF_PARAMS CK_PTR CK_TLS_KDF_PARAMS_PTR;
1970 
1971 typedef struct CK_TLS_MAC_PARAMS {
1972     CK_MECHANISM_TYPE         prfHashMechanism;
1973     CK_ULONG                  ulMacLength;
1974     CK_ULONG                  ulServerOrClient;
1975 } CK_TLS_MAC_PARAMS;
1976 
1977 typedef CK_TLS_MAC_PARAMS CK_PTR CK_TLS_MAC_PARAMS_PTR;
1978 
1979 typedef struct CK_GOSTR3410_DERIVE_PARAMS {
1980     CK_EC_KDF_TYPE            kdf;
1981     CK_BYTE_PTR               pPublicData;
1982     CK_ULONG                  ulPublicDataLen;
1983     CK_BYTE_PTR               pUKM;
1984     CK_ULONG                  ulUKMLen;
1985 } CK_GOSTR3410_DERIVE_PARAMS;
1986 
1987 typedef CK_GOSTR3410_DERIVE_PARAMS CK_PTR CK_GOSTR3410_DERIVE_PARAMS_PTR;
1988 
1989 typedef struct CK_GOSTR3410_KEY_WRAP_PARAMS {
1990     CK_BYTE_PTR               pWrapOID;
1991     CK_ULONG                  ulWrapOIDLen;
1992     CK_BYTE_PTR               pUKM;
1993     CK_ULONG                  ulUKMLen;
1994     CK_OBJECT_HANDLE          hKey;
1995 } CK_GOSTR3410_KEY_WRAP_PARAMS;
1996 
1997 typedef CK_GOSTR3410_KEY_WRAP_PARAMS CK_PTR CK_GOSTR3410_KEY_WRAP_PARAMS_PTR;
1998 
1999 typedef struct CK_SEED_CBC_ENCRYPT_DATA_PARAMS {
2000     CK_BYTE                   iv[16];
2001     CK_BYTE_PTR               pData;
2002     CK_ULONG                  length;
2003 } CK_SEED_CBC_ENCRYPT_DATA_PARAMS;
2004 
2005 typedef CK_SEED_CBC_ENCRYPT_DATA_PARAMS CK_PTR \
2006                                         CK_SEED_CBC_ENCRYPT_DATA_PARAMS_PTR;
2007 
2008 #endif /* _PKCS11T_H_ */
2009 
2010