comparison nss/lib/util/pkcs11t.h @ 0:1e5118fa0cb1

This is NSS with a Cmake Buildsyste To compile a static NSS library for Windows we've used the Chromium-NSS fork and added a Cmake buildsystem to compile it statically for Windows. See README.chromium for chromium changes and README.trustbridge for our modifications.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 28 Jul 2014 10:47:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e5118fa0cb1
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
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
20 #ifndef _PKCS11T_H_
21 #define _PKCS11T_H_ 1
22
23 #define CK_TRUE 1
24 #define CK_FALSE 0
25
26 #include "prtypes.h"
27
28 #define CK_PTR *
29 #define CK_NULL_PTR 0
30 #define CK_CALLBACK_FUNCTION(rtype,func) rtype (PR_CALLBACK * func)
31 #define CK_DECLARE_FUNCTION(rtype,func) extern rtype func
32 #define CK_DECLARE_FUNCTION_POINTER(rtype,func) rtype (PR_CALLBACK * func)
33
34 #define CK_INVALID_SESSION 0
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 /* CK_LONG is new for v2.0 */
53 typedef long int CK_LONG;
54
55 /* at least 32 bits; each bit is a Boolean flag */
56 typedef CK_ULONG CK_FLAGS;
57
58
59 /* some special values for certain CK_ULONG variables */
60 #define CK_UNAVAILABLE_INFORMATION (~0UL)
61 #define CK_EFFECTIVELY_INFINITE 0
62
63
64 typedef CK_BYTE CK_PTR CK_BYTE_PTR;
65 typedef CK_CHAR CK_PTR CK_CHAR_PTR;
66 typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR;
67 typedef CK_ULONG CK_PTR CK_ULONG_PTR;
68 typedef void CK_PTR CK_VOID_PTR;
69
70 /* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */
71 typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR;
72
73
74 /* The following value is always invalid if used as a session */
75 /* handle or object handle */
76 #define CK_INVALID_HANDLE 0
77
78
79 /* pack */
80 #include "pkcs11p.h"
81
82 typedef 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
87 typedef CK_VERSION CK_PTR CK_VERSION_PTR;
88
89
90 typedef struct CK_INFO {
91 /* manufacturerID and libraryDecription have been changed from
92 * CK_CHAR to CK_UTF8CHAR for v2.10 */
93 CK_VERSION cryptokiVersion; /* PKCS #11 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
102 typedef CK_INFO CK_PTR CK_INFO_PTR;
103
104
105 /* CK_NOTIFICATION enumerates the types of notifications that
106 * PKCS #11 provides to an application */
107 /* CK_NOTIFICATION has been changed from an enum to a CK_ULONG
108 * for v2.0 */
109 typedef CK_ULONG CK_NOTIFICATION;
110 #define CKN_SURRENDER 0
111
112
113 typedef CK_ULONG CK_SLOT_ID;
114
115 typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR;
116
117
118 /* CK_SLOT_INFO provides information about a slot */
119 typedef 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
138 typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR;
139
140
141 /* CK_TOKEN_INFO provides information about a token */
142 typedef 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 PKCS #11 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. This flag is deprecated in v2.11 and
218 onwards. */
219 #define CKF_SECONDARY_AUTHENTICATION 0x00000800
220
221 /* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an
222 * incorrect user login PIN has been entered at least once
223 * since the last successful authentication. */
224 #define CKF_USER_PIN_COUNT_LOW 0x00010000
225
226 /* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true,
227 * supplying an incorrect user PIN will it to become locked. */
228 #define CKF_USER_PIN_FINAL_TRY 0x00020000
229
230 /* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the
231 * user PIN has been locked. User login to the token is not
232 * possible. */
233 #define CKF_USER_PIN_LOCKED 0x00040000
234
235 /* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
236 * the user PIN value is the default value set by token
237 * initialization or manufacturing, or the PIN has been
238 * expired by the card. */
239 #define CKF_USER_PIN_TO_BE_CHANGED 0x00080000
240
241 /* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an
242 * incorrect SO login PIN has been entered at least once since
243 * the last successful authentication. */
244 #define CKF_SO_PIN_COUNT_LOW 0x00100000
245
246 /* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true,
247 * supplying an incorrect SO PIN will it to become locked. */
248 #define CKF_SO_PIN_FINAL_TRY 0x00200000
249
250 /* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO
251 * PIN has been locked. SO login to the token is not possible.
252 */
253 #define CKF_SO_PIN_LOCKED 0x00400000
254
255 /* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true,
256 * the SO PIN value is the default value set by token
257 * initialization or manufacturing, or the PIN has been
258 * expired by the card. */
259 #define CKF_SO_PIN_TO_BE_CHANGED 0x00800000
260
261 typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR;
262
263
264 /* CK_SESSION_HANDLE is a PKCS #11-assigned value that
265 * identifies a session */
266 typedef CK_ULONG CK_SESSION_HANDLE;
267
268 typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR;
269
270
271 /* CK_USER_TYPE enumerates the types of PKCS #11 users */
272 /* CK_USER_TYPE has been changed from an enum to a CK_ULONG for
273 * v2.0 */
274 typedef CK_ULONG CK_USER_TYPE;
275 /* Security Officer */
276 #define CKU_SO 0
277 /* Normal user */
278 #define CKU_USER 1
279 /* Context specific (added in v2.20) */
280 #define CKU_CONTEXT_SPECIFIC 2
281
282 /* CK_STATE enumerates the session states */
283 /* CK_STATE has been changed from an enum to a CK_ULONG for
284 * v2.0 */
285 typedef CK_ULONG CK_STATE;
286 #define CKS_RO_PUBLIC_SESSION 0
287 #define CKS_RO_USER_FUNCTIONS 1
288 #define CKS_RW_PUBLIC_SESSION 2
289 #define CKS_RW_USER_FUNCTIONS 3
290 #define CKS_RW_SO_FUNCTIONS 4
291
292
293 /* CK_SESSION_INFO provides information about a session */
294 typedef struct CK_SESSION_INFO {
295 CK_SLOT_ID slotID;
296 CK_STATE state;
297 CK_FLAGS flags; /* see below */
298
299 /* ulDeviceError was changed from CK_USHORT to CK_ULONG for
300 * v2.0 */
301 CK_ULONG ulDeviceError; /* device-dependent error code */
302 } CK_SESSION_INFO;
303
304 /* The flags are defined in the following table:
305 * Bit Flag Mask Meaning
306 */
307 #define CKF_RW_SESSION 0x00000002 /* session is r/w */
308 #define CKF_SERIAL_SESSION 0x00000004 /* no parallel */
309
310 typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR;
311
312
313 /* CK_OBJECT_HANDLE is a token-specific identifier for an
314 * object */
315 typedef CK_ULONG CK_OBJECT_HANDLE;
316
317 typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR;
318
319
320 /* CK_OBJECT_CLASS is a value that identifies the classes (or
321 * types) of objects that PKCS #11 recognizes. It is defined
322 * as follows: */
323 /* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for
324 * v2.0 */
325 typedef CK_ULONG CK_OBJECT_CLASS;
326
327 /* The following classes of objects are defined: */
328 /* CKO_HW_FEATURE is new for v2.10 */
329 /* CKO_DOMAIN_PARAMETERS is new for v2.11 */
330 /* CKO_MECHANISM is new for v2.20 */
331 #define CKO_DATA 0x00000000
332 #define CKO_CERTIFICATE 0x00000001
333 #define CKO_PUBLIC_KEY 0x00000002
334 #define CKO_PRIVATE_KEY 0x00000003
335 #define CKO_SECRET_KEY 0x00000004
336 #define CKO_HW_FEATURE 0x00000005
337 #define CKO_DOMAIN_PARAMETERS 0x00000006
338 #define CKO_MECHANISM 0x00000007
339 #define CKO_VENDOR_DEFINED 0x80000000
340
341 typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR;
342
343 /* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a
344 * value that identifies the hardware feature type of an object
345 * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */
346 typedef CK_ULONG CK_HW_FEATURE_TYPE;
347
348 /* The following hardware feature types are defined */
349 /* CKH_USER_INTERFACE is new for v2.20 */
350 #define CKH_MONOTONIC_COUNTER 0x00000001
351 #define CKH_CLOCK 0x00000002
352 #define CKH_USER_INTERFACE 0x00000003
353 #define CKH_VENDOR_DEFINED 0x80000000
354
355 /* CK_KEY_TYPE is a value that identifies a key type */
356 /* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */
357 typedef CK_ULONG CK_KEY_TYPE;
358
359 /* the following key types are defined: */
360 #define CKK_RSA 0x00000000
361 #define CKK_DSA 0x00000001
362 #define CKK_DH 0x00000002
363
364 /* CKK_ECDSA and CKK_KEA are new for v2.0 */
365 /* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */
366 #define CKK_ECDSA 0x00000003
367 #define CKK_EC 0x00000003
368 #define CKK_X9_42_DH 0x00000004
369 #define CKK_KEA 0x00000005
370
371 #define CKK_GENERIC_SECRET 0x00000010
372 #define CKK_RC2 0x00000011
373 #define CKK_RC4 0x00000012
374 #define CKK_DES 0x00000013
375 #define CKK_DES2 0x00000014
376 #define CKK_DES3 0x00000015
377
378 /* all these key types are new for v2.0 */
379 #define CKK_CAST 0x00000016
380 #define CKK_CAST3 0x00000017
381 /* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */
382 #define CKK_CAST5 0x00000018
383 #define CKK_CAST128 0x00000018
384 #define CKK_RC5 0x00000019
385 #define CKK_IDEA 0x0000001A
386 #define CKK_SKIPJACK 0x0000001B
387 #define CKK_BATON 0x0000001C
388 #define CKK_JUNIPER 0x0000001D
389 #define CKK_CDMF 0x0000001E
390 #define CKK_AES 0x0000001F
391
392 /* BlowFish and TwoFish are new for v2.20 */
393 #define CKK_BLOWFISH 0x00000020
394 #define CKK_TWOFISH 0x00000021
395
396 /* Camellia is proposed for v2.20 Amendment 3 */
397 #define CKK_CAMELLIA 0x00000025
398
399 #define CKK_SEED 0x00000026
400
401 #define CKK_VENDOR_DEFINED 0x80000000
402
403
404 /* CK_CERTIFICATE_TYPE is a value that identifies a certificate
405 * type */
406 /* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG
407 * for v2.0 */
408 typedef CK_ULONG CK_CERTIFICATE_TYPE;
409
410 /* The following certificate types are defined: */
411 /* CKC_X_509_ATTR_CERT is new for v2.10 */
412 /* CKC_WTLS is new for v2.20 */
413 #define CKC_X_509 0x00000000
414 #define CKC_X_509_ATTR_CERT 0x00000001
415 #define CKC_WTLS 0x00000002
416 #define CKC_VENDOR_DEFINED 0x80000000
417
418
419 /* CK_ATTRIBUTE_TYPE is a value that identifies an attribute
420 * type */
421 /* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for
422 * v2.0 */
423 typedef CK_ULONG CK_ATTRIBUTE_TYPE;
424
425 /* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which
426 consists of an array of values. */
427 #define CKF_ARRAY_ATTRIBUTE 0x40000000
428
429 /* The following attribute types are defined: */
430 #define CKA_CLASS 0x00000000
431 #define CKA_TOKEN 0x00000001
432 #define CKA_PRIVATE 0x00000002
433 #define CKA_LABEL 0x00000003
434 #define CKA_APPLICATION 0x00000010
435 #define CKA_VALUE 0x00000011
436
437 /* CKA_OBJECT_ID is new for v2.10 */
438 #define CKA_OBJECT_ID 0x00000012
439
440 #define CKA_CERTIFICATE_TYPE 0x00000080
441 #define CKA_ISSUER 0x00000081
442 #define CKA_SERIAL_NUMBER 0x00000082
443
444 /* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new
445 * for v2.10 */
446 #define CKA_AC_ISSUER 0x00000083
447 #define CKA_OWNER 0x00000084
448 #define CKA_ATTR_TYPES 0x00000085
449
450 /* CKA_TRUSTED is new for v2.11 */
451 #define CKA_TRUSTED 0x00000086
452
453 /* CKA_CERTIFICATE_CATEGORY ...
454 * CKA_CHECK_VALUE are new for v2.20 */
455 #define CKA_CERTIFICATE_CATEGORY 0x00000087
456 #define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088
457 #define CKA_URL 0x00000089
458 #define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008A
459 #define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008B
460 #define CKA_CHECK_VALUE 0x00000090
461
462 #define CKA_KEY_TYPE 0x00000100
463 #define CKA_SUBJECT 0x00000101
464 #define CKA_ID 0x00000102
465 #define CKA_SENSITIVE 0x00000103
466 #define CKA_ENCRYPT 0x00000104
467 #define CKA_DECRYPT 0x00000105
468 #define CKA_WRAP 0x00000106
469 #define CKA_UNWRAP 0x00000107
470 #define CKA_SIGN 0x00000108
471 #define CKA_SIGN_RECOVER 0x00000109
472 #define CKA_VERIFY 0x0000010A
473 #define CKA_VERIFY_RECOVER 0x0000010B
474 #define CKA_DERIVE 0x0000010C
475 #define CKA_START_DATE 0x00000110
476 #define CKA_END_DATE 0x00000111
477 #define CKA_MODULUS 0x00000120
478 #define CKA_MODULUS_BITS 0x00000121
479 #define CKA_PUBLIC_EXPONENT 0x00000122
480 #define CKA_PRIVATE_EXPONENT 0x00000123
481 #define CKA_PRIME_1 0x00000124
482 #define CKA_PRIME_2 0x00000125
483 #define CKA_EXPONENT_1 0x00000126
484 #define CKA_EXPONENT_2 0x00000127
485 #define CKA_COEFFICIENT 0x00000128
486 #define CKA_PRIME 0x00000130
487 #define CKA_SUBPRIME 0x00000131
488 #define CKA_BASE 0x00000132
489
490 /* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */
491 #define CKA_PRIME_BITS 0x00000133
492 #define CKA_SUBPRIME_BITS 0x00000134
493 #define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS
494 /* (To retain backwards-compatibility) */
495
496 #define CKA_VALUE_BITS 0x00000160
497 #define CKA_VALUE_LEN 0x00000161
498
499 /* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE,
500 * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS,
501 * and CKA_EC_POINT are new for v2.0 */
502 #define CKA_EXTRACTABLE 0x00000162
503 #define CKA_LOCAL 0x00000163
504 #define CKA_NEVER_EXTRACTABLE 0x00000164
505 #define CKA_ALWAYS_SENSITIVE 0x00000165
506
507 /* CKA_KEY_GEN_MECHANISM is new for v2.11 */
508 #define CKA_KEY_GEN_MECHANISM 0x00000166
509
510 #define CKA_MODIFIABLE 0x00000170
511
512 /* CKA_ECDSA_PARAMS is deprecated in v2.11,
513 * CKA_EC_PARAMS is preferred. */
514 #define CKA_ECDSA_PARAMS 0x00000180
515 #define CKA_EC_PARAMS 0x00000180
516
517 #define CKA_EC_POINT 0x00000181
518
519 /* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS,
520 * are new for v2.10. Deprecated in v2.11 and onwards. */
521 #define CKA_SECONDARY_AUTH 0x00000200
522 #define CKA_AUTH_PIN_FLAGS 0x00000201
523
524 /* CKA_ALWAYS_AUTHENTICATE ...
525 * CKA_UNWRAP_TEMPLATE are new for v2.20 */
526 #define CKA_ALWAYS_AUTHENTICATE 0x00000202
527
528 #define CKA_WRAP_WITH_TRUSTED 0x00000210
529 #define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211)
530 #define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212)
531
532 /* CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET
533 * are new for v2.10 */
534 #define CKA_HW_FEATURE_TYPE 0x00000300
535 #define CKA_RESET_ON_INIT 0x00000301
536 #define CKA_HAS_RESET 0x00000302
537
538 /* The following attributes are new for v2.20 */
539 #define CKA_PIXEL_X 0x00000400
540 #define CKA_PIXEL_Y 0x00000401
541 #define CKA_RESOLUTION 0x00000402
542 #define CKA_CHAR_ROWS 0x00000403
543 #define CKA_CHAR_COLUMNS 0x00000404
544 #define CKA_COLOR 0x00000405
545 #define CKA_BITS_PER_PIXEL 0x00000406
546 #define CKA_CHAR_SETS 0x00000480
547 #define CKA_ENCODING_METHODS 0x00000481
548 #define CKA_MIME_TYPES 0x00000482
549 #define CKA_MECHANISM_TYPE 0x00000500
550 #define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501
551 #define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502
552 #define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503
553 #define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600)
554
555 #define CKA_VENDOR_DEFINED 0x80000000
556
557
558 /* CK_ATTRIBUTE is a structure that includes the type, length
559 * and value of an attribute */
560 typedef struct CK_ATTRIBUTE {
561 CK_ATTRIBUTE_TYPE type;
562 CK_VOID_PTR pValue;
563
564 /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */
565 CK_ULONG ulValueLen; /* in bytes */
566 } CK_ATTRIBUTE;
567
568 typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR;
569
570
571 /* CK_DATE is a structure that defines a date */
572 typedef struct CK_DATE{
573 CK_CHAR year[4]; /* the year ("1900" - "9999") */
574 CK_CHAR month[2]; /* the month ("01" - "12") */
575 CK_CHAR day[2]; /* the day ("01" - "31") */
576 } CK_DATE;
577
578
579 /* CK_MECHANISM_TYPE is a value that identifies a mechanism
580 * type */
581 /* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for
582 * v2.0 */
583 typedef CK_ULONG CK_MECHANISM_TYPE;
584
585 /* the following mechanism types are defined: */
586 #define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000
587 #define CKM_RSA_PKCS 0x00000001
588 #define CKM_RSA_9796 0x00000002
589 #define CKM_RSA_X_509 0x00000003
590
591 /* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS
592 * are new for v2.0. They are mechanisms which hash and sign */
593 #define CKM_MD2_RSA_PKCS 0x00000004
594 #define CKM_MD5_RSA_PKCS 0x00000005
595 #define CKM_SHA1_RSA_PKCS 0x00000006
596
597 /* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and
598 * CKM_RSA_PKCS_OAEP are new for v2.10 */
599 #define CKM_RIPEMD128_RSA_PKCS 0x00000007
600 #define CKM_RIPEMD160_RSA_PKCS 0x00000008
601 #define CKM_RSA_PKCS_OAEP 0x00000009
602
603 /* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31,
604 * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */
605 #define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000A
606 #define CKM_RSA_X9_31 0x0000000B
607 #define CKM_SHA1_RSA_X9_31 0x0000000C
608 #define CKM_RSA_PKCS_PSS 0x0000000D
609 #define CKM_SHA1_RSA_PKCS_PSS 0x0000000E
610
611 #define CKM_DSA_KEY_PAIR_GEN 0x00000010
612 #define CKM_DSA 0x00000011
613 #define CKM_DSA_SHA1 0x00000012
614 #define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020
615 #define CKM_DH_PKCS_DERIVE 0x00000021
616
617 /* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE,
618 * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for
619 * v2.11 */
620 #define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030
621 #define CKM_X9_42_DH_DERIVE 0x00000031
622 #define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032
623 #define CKM_X9_42_MQV_DERIVE 0x00000033
624
625 /* CKM_SHA256/384/512 are new for v2.20 */
626 #define CKM_SHA256_RSA_PKCS 0x00000040
627 #define CKM_SHA384_RSA_PKCS 0x00000041
628 #define CKM_SHA512_RSA_PKCS 0x00000042
629 #define CKM_SHA256_RSA_PKCS_PSS 0x00000043
630 #define CKM_SHA384_RSA_PKCS_PSS 0x00000044
631 #define CKM_SHA512_RSA_PKCS_PSS 0x00000045
632
633 /* CKM_SHA224 new for v2.20 amendment 3 */
634 #define CKM_SHA224_RSA_PKCS 0x00000046
635 #define CKM_SHA224_RSA_PKCS_PSS 0x00000047
636
637 #define CKM_RC2_KEY_GEN 0x00000100
638 #define CKM_RC2_ECB 0x00000101
639 #define CKM_RC2_CBC 0x00000102
640 #define CKM_RC2_MAC 0x00000103
641
642 /* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */
643 #define CKM_RC2_MAC_GENERAL 0x00000104
644 #define CKM_RC2_CBC_PAD 0x00000105
645
646 #define CKM_RC4_KEY_GEN 0x00000110
647 #define CKM_RC4 0x00000111
648 #define CKM_DES_KEY_GEN 0x00000120
649 #define CKM_DES_ECB 0x00000121
650 #define CKM_DES_CBC 0x00000122
651 #define CKM_DES_MAC 0x00000123
652
653 /* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */
654 #define CKM_DES_MAC_GENERAL 0x00000124
655 #define CKM_DES_CBC_PAD 0x00000125
656
657 #define CKM_DES2_KEY_GEN 0x00000130
658 #define CKM_DES3_KEY_GEN 0x00000131
659 #define CKM_DES3_ECB 0x00000132
660 #define CKM_DES3_CBC 0x00000133
661 #define CKM_DES3_MAC 0x00000134
662
663 /* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN,
664 * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC,
665 * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */
666 #define CKM_DES3_MAC_GENERAL 0x00000135
667 #define CKM_DES3_CBC_PAD 0x00000136
668 #define CKM_CDMF_KEY_GEN 0x00000140
669 #define CKM_CDMF_ECB 0x00000141
670 #define CKM_CDMF_CBC 0x00000142
671 #define CKM_CDMF_MAC 0x00000143
672 #define CKM_CDMF_MAC_GENERAL 0x00000144
673 #define CKM_CDMF_CBC_PAD 0x00000145
674
675 /* the following four DES mechanisms are new for v2.20 */
676 #define CKM_DES_OFB64 0x00000150
677 #define CKM_DES_OFB8 0x00000151
678 #define CKM_DES_CFB64 0x00000152
679 #define CKM_DES_CFB8 0x00000153
680
681 #define CKM_MD2 0x00000200
682
683 /* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */
684 #define CKM_MD2_HMAC 0x00000201
685 #define CKM_MD2_HMAC_GENERAL 0x00000202
686
687 #define CKM_MD5 0x00000210
688
689 /* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */
690 #define CKM_MD5_HMAC 0x00000211
691 #define CKM_MD5_HMAC_GENERAL 0x00000212
692
693 #define CKM_SHA_1 0x00000220
694
695 /* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */
696 #define CKM_SHA_1_HMAC 0x00000221
697 #define CKM_SHA_1_HMAC_GENERAL 0x00000222
698
699 /* CKM_RIPEMD128, CKM_RIPEMD128_HMAC,
700 * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC,
701 * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */
702 #define CKM_RIPEMD128 0x00000230
703 #define CKM_RIPEMD128_HMAC 0x00000231
704 #define CKM_RIPEMD128_HMAC_GENERAL 0x00000232
705 #define CKM_RIPEMD160 0x00000240
706 #define CKM_RIPEMD160_HMAC 0x00000241
707 #define CKM_RIPEMD160_HMAC_GENERAL 0x00000242
708
709 /* CKM_SHA256/384/512 are new for v2.20 */
710 #define CKM_SHA256 0x00000250
711 #define CKM_SHA256_HMAC 0x00000251
712 #define CKM_SHA256_HMAC_GENERAL 0x00000252
713 #define CKM_SHA384 0x00000260
714 #define CKM_SHA384_HMAC 0x00000261
715 #define CKM_SHA384_HMAC_GENERAL 0x00000262
716 #define CKM_SHA512 0x00000270
717 #define CKM_SHA512_HMAC 0x00000271
718 #define CKM_SHA512_HMAC_GENERAL 0x00000272
719
720 /* CKM_SHA224 new for v2.20 amendment 3 */
721 #define CKM_SHA224 0x00000255
722 #define CKM_SHA224_HMAC 0x00000256
723 #define CKM_SHA224_HMAC_GENERAL 0x00000257
724
725 /* All of the following mechanisms are new for v2.0 */
726 /* Note that CAST128 and CAST5 are the same algorithm */
727 #define CKM_CAST_KEY_GEN 0x00000300
728 #define CKM_CAST_ECB 0x00000301
729 #define CKM_CAST_CBC 0x00000302
730 #define CKM_CAST_MAC 0x00000303
731 #define CKM_CAST_MAC_GENERAL 0x00000304
732 #define CKM_CAST_CBC_PAD 0x00000305
733 #define CKM_CAST3_KEY_GEN 0x00000310
734 #define CKM_CAST3_ECB 0x00000311
735 #define CKM_CAST3_CBC 0x00000312
736 #define CKM_CAST3_MAC 0x00000313
737 #define CKM_CAST3_MAC_GENERAL 0x00000314
738 #define CKM_CAST3_CBC_PAD 0x00000315
739 #define CKM_CAST5_KEY_GEN 0x00000320
740 #define CKM_CAST128_KEY_GEN 0x00000320
741 #define CKM_CAST5_ECB 0x00000321
742 #define CKM_CAST128_ECB 0x00000321
743 #define CKM_CAST5_CBC 0x00000322
744 #define CKM_CAST128_CBC 0x00000322
745 #define CKM_CAST5_MAC 0x00000323
746 #define CKM_CAST128_MAC 0x00000323
747 #define CKM_CAST5_MAC_GENERAL 0x00000324
748 #define CKM_CAST128_MAC_GENERAL 0x00000324
749 #define CKM_CAST5_CBC_PAD 0x00000325
750 #define CKM_CAST128_CBC_PAD 0x00000325
751 #define CKM_RC5_KEY_GEN 0x00000330
752 #define CKM_RC5_ECB 0x00000331
753 #define CKM_RC5_CBC 0x00000332
754 #define CKM_RC5_MAC 0x00000333
755 #define CKM_RC5_MAC_GENERAL 0x00000334
756 #define CKM_RC5_CBC_PAD 0x00000335
757 #define CKM_IDEA_KEY_GEN 0x00000340
758 #define CKM_IDEA_ECB 0x00000341
759 #define CKM_IDEA_CBC 0x00000342
760 #define CKM_IDEA_MAC 0x00000343
761 #define CKM_IDEA_MAC_GENERAL 0x00000344
762 #define CKM_IDEA_CBC_PAD 0x00000345
763 #define CKM_GENERIC_SECRET_KEY_GEN 0x00000350
764 #define CKM_CONCATENATE_BASE_AND_KEY 0x00000360
765 #define CKM_CONCATENATE_BASE_AND_DATA 0x00000362
766 #define CKM_CONCATENATE_DATA_AND_BASE 0x00000363
767 #define CKM_XOR_BASE_AND_DATA 0x00000364
768 #define CKM_EXTRACT_KEY_FROM_KEY 0x00000365
769 #define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370
770 #define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371
771 #define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372
772
773 /* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN,
774 * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and
775 * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */
776 #define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373
777 #define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374
778 #define CKM_TLS_MASTER_KEY_DERIVE 0x00000375
779 #define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376
780 #define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377
781
782 /* CKM_TLS_PRF is new for v2.20 */
783 #define CKM_TLS_PRF 0x00000378
784
785 #define CKM_SSL3_MD5_MAC 0x00000380
786 #define CKM_SSL3_SHA1_MAC 0x00000381
787 #define CKM_MD5_KEY_DERIVATION 0x00000390
788 #define CKM_MD2_KEY_DERIVATION 0x00000391
789 #define CKM_SHA1_KEY_DERIVATION 0x00000392
790
791 /* CKM_SHA256/384/512 are new for v2.20 */
792 #define CKM_SHA256_KEY_DERIVATION 0x00000393
793 #define CKM_SHA384_KEY_DERIVATION 0x00000394
794 #define CKM_SHA512_KEY_DERIVATION 0x00000395
795
796 /* CKM_SHA224 new for v2.20 amendment 3 */
797 #define CKM_SHA224_KEY_DERIVATION 0x00000396
798
799 #define CKM_PBE_MD2_DES_CBC 0x000003A0
800 #define CKM_PBE_MD5_DES_CBC 0x000003A1
801 #define CKM_PBE_MD5_CAST_CBC 0x000003A2
802 #define CKM_PBE_MD5_CAST3_CBC 0x000003A3
803 #define CKM_PBE_MD5_CAST5_CBC 0x000003A4
804 #define CKM_PBE_MD5_CAST128_CBC 0x000003A4
805 #define CKM_PBE_SHA1_CAST5_CBC 0x000003A5
806 #define CKM_PBE_SHA1_CAST128_CBC 0x000003A5
807 #define CKM_PBE_SHA1_RC4_128 0x000003A6
808 #define CKM_PBE_SHA1_RC4_40 0x000003A7
809 #define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8
810 #define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9
811 #define CKM_PBE_SHA1_RC2_128_CBC 0x000003AA
812 #define CKM_PBE_SHA1_RC2_40_CBC 0x000003AB
813
814 /* CKM_PKCS5_PBKD2 is new for v2.10 */
815 #define CKM_PKCS5_PBKD2 0x000003B0
816
817 #define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0
818
819 /* WTLS mechanisms are new for v2.20 */
820 #define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003D0
821 #define CKM_WTLS_MASTER_KEY_DERIVE 0x000003D1
822 #define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003D2
823 #define CKM_WTLS_PRF 0x000003D3
824 #define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003D4
825 #define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003D5
826
827 #define CKM_KEY_WRAP_LYNKS 0x00000400
828 #define CKM_KEY_WRAP_SET_OAEP 0x00000401
829
830 /* CKM_CMS_SIG is new for v2.20 */
831 #define CKM_CMS_SIG 0x00000500
832
833 /* Fortezza mechanisms */
834 #define CKM_SKIPJACK_KEY_GEN 0x00001000
835 #define CKM_SKIPJACK_ECB64 0x00001001
836 #define CKM_SKIPJACK_CBC64 0x00001002
837 #define CKM_SKIPJACK_OFB64 0x00001003
838 #define CKM_SKIPJACK_CFB64 0x00001004
839 #define CKM_SKIPJACK_CFB32 0x00001005
840 #define CKM_SKIPJACK_CFB16 0x00001006
841 #define CKM_SKIPJACK_CFB8 0x00001007
842 #define CKM_SKIPJACK_WRAP 0x00001008
843 #define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009
844 #define CKM_SKIPJACK_RELAYX 0x0000100a
845 #define CKM_KEA_KEY_PAIR_GEN 0x00001010
846 #define CKM_KEA_KEY_DERIVE 0x00001011
847 #define CKM_FORTEZZA_TIMESTAMP 0x00001020
848 #define CKM_BATON_KEY_GEN 0x00001030
849 #define CKM_BATON_ECB128 0x00001031
850 #define CKM_BATON_ECB96 0x00001032
851 #define CKM_BATON_CBC128 0x00001033
852 #define CKM_BATON_COUNTER 0x00001034
853 #define CKM_BATON_SHUFFLE 0x00001035
854 #define CKM_BATON_WRAP 0x00001036
855
856 /* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11,
857 * CKM_EC_KEY_PAIR_GEN is preferred */
858 #define CKM_ECDSA_KEY_PAIR_GEN 0x00001040
859 #define CKM_EC_KEY_PAIR_GEN 0x00001040
860
861 #define CKM_ECDSA 0x00001041
862 #define CKM_ECDSA_SHA1 0x00001042
863
864 /* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE
865 * are new for v2.11 */
866 #define CKM_ECDH1_DERIVE 0x00001050
867 #define CKM_ECDH1_COFACTOR_DERIVE 0x00001051
868 #define CKM_ECMQV_DERIVE 0x00001052
869
870 #define CKM_JUNIPER_KEY_GEN 0x00001060
871 #define CKM_JUNIPER_ECB128 0x00001061
872 #define CKM_JUNIPER_CBC128 0x00001062
873 #define CKM_JUNIPER_COUNTER 0x00001063
874 #define CKM_JUNIPER_SHUFFLE 0x00001064
875 #define CKM_JUNIPER_WRAP 0x00001065
876 #define CKM_FASTHASH 0x00001070
877
878 /* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC,
879 * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN,
880 * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are
881 * new for v2.11 */
882 #define CKM_AES_KEY_GEN 0x00001080
883 #define CKM_AES_ECB 0x00001081
884 #define CKM_AES_CBC 0x00001082
885 #define CKM_AES_MAC 0x00001083
886 #define CKM_AES_MAC_GENERAL 0x00001084
887 #define CKM_AES_CBC_PAD 0x00001085
888 /* new for v2.20 amendment 3 */
889 #define CKM_AES_CTR 0x00001086
890 /* new for v2.30 */
891 #define CKM_AES_GCM 0x00001087
892 #define CKM_AES_CCM 0x00001088
893 #define CKM_AES_CTS 0x00001089
894
895 /* BlowFish and TwoFish are new for v2.20 */
896 #define CKM_BLOWFISH_KEY_GEN 0x00001090
897 #define CKM_BLOWFISH_CBC 0x00001091
898 #define CKM_TWOFISH_KEY_GEN 0x00001092
899 #define CKM_TWOFISH_CBC 0x00001093
900
901 /* Camellia is proposed for v2.20 Amendment 3 */
902 #define CKM_CAMELLIA_KEY_GEN 0x00000550
903 #define CKM_CAMELLIA_ECB 0x00000551
904 #define CKM_CAMELLIA_CBC 0x00000552
905 #define CKM_CAMELLIA_MAC 0x00000553
906 #define CKM_CAMELLIA_MAC_GENERAL 0x00000554
907 #define CKM_CAMELLIA_CBC_PAD 0x00000555
908 #define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556
909 #define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557
910
911 #define CKM_SEED_KEY_GEN 0x00000650
912 #define CKM_SEED_ECB 0x00000651
913 #define CKM_SEED_CBC 0x00000652
914 #define CKM_SEED_MAC 0x00000653
915 #define CKM_SEED_MAC_GENERAL 0x00000654
916 #define CKM_SEED_CBC_PAD 0x00000655
917 #define CKM_SEED_ECB_ENCRYPT_DATA 0x00000656
918 #define CKM_SEED_CBC_ENCRYPT_DATA 0x00000657
919
920 /* CKM_xxx_ENCRYPT_DATA mechanisms are new for v2.20 */
921 #define CKM_DES_ECB_ENCRYPT_DATA 0x00001100
922 #define CKM_DES_CBC_ENCRYPT_DATA 0x00001101
923 #define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102
924 #define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103
925 #define CKM_AES_ECB_ENCRYPT_DATA 0x00001104
926 #define CKM_AES_CBC_ENCRYPT_DATA 0x00001105
927
928 #define CKM_DSA_PARAMETER_GEN 0x00002000
929 #define CKM_DH_PKCS_PARAMETER_GEN 0x00002001
930 #define CKM_X9_42_DH_PARAMETER_GEN 0x00002002
931
932 #define CKM_VENDOR_DEFINED 0x80000000
933
934 typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR;
935
936
937 /* CK_MECHANISM is a structure that specifies a particular
938 * mechanism */
939 typedef struct CK_MECHANISM {
940 CK_MECHANISM_TYPE mechanism;
941 CK_VOID_PTR pParameter;
942
943 /* ulParameterLen was changed from CK_USHORT to CK_ULONG for
944 * v2.0 */
945 CK_ULONG ulParameterLen; /* in bytes */
946 } CK_MECHANISM;
947
948 typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR;
949
950
951 /* CK_MECHANISM_INFO provides information about a particular
952 * mechanism */
953 typedef struct CK_MECHANISM_INFO {
954 CK_ULONG ulMinKeySize;
955 CK_ULONG ulMaxKeySize;
956 CK_FLAGS flags;
957 } CK_MECHANISM_INFO;
958
959 /* The flags are defined as follows:
960 * Bit Flag Mask Meaning */
961 #define CKF_HW 0x00000001 /* performed by HW */
962
963 /* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN,
964 * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER,
965 * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP,
966 * and CKF_DERIVE are new for v2.0. They specify whether or not
967 * a mechanism can be used for a particular task */
968 #define CKF_ENCRYPT 0x00000100
969 #define CKF_DECRYPT 0x00000200
970 #define CKF_DIGEST 0x00000400
971 #define CKF_SIGN 0x00000800
972 #define CKF_SIGN_RECOVER 0x00001000
973 #define CKF_VERIFY 0x00002000
974 #define CKF_VERIFY_RECOVER 0x00004000
975 #define CKF_GENERATE 0x00008000
976 #define CKF_GENERATE_KEY_PAIR 0x00010000
977 #define CKF_WRAP 0x00020000
978 #define CKF_UNWRAP 0x00040000
979 #define CKF_DERIVE 0x00080000
980
981 /* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE,
982 * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They
983 * describe a token's EC capabilities not available in mechanism
984 * information. */
985 #define CKF_EC_F_P 0x00100000
986 #define CKF_EC_F_2M 0x00200000
987 #define CKF_EC_ECPARAMETERS 0x00400000
988 #define CKF_EC_NAMEDCURVE 0x00800000
989 #define CKF_EC_UNCOMPRESS 0x01000000
990 #define CKF_EC_COMPRESS 0x02000000
991
992 #define CKF_EXTENSION 0x80000000 /* FALSE for this version */
993
994 typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR;
995
996
997 /* CK_RV is a value that identifies the return value of a
998 * PKCS #11 function */
999 /* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */
1000 typedef CK_ULONG CK_RV;
1001
1002 #define CKR_OK 0x00000000
1003 #define CKR_CANCEL 0x00000001
1004 #define CKR_HOST_MEMORY 0x00000002
1005 #define CKR_SLOT_ID_INVALID 0x00000003
1006
1007 /* CKR_FLAGS_INVALID was removed for v2.0 */
1008
1009 /* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */
1010 #define CKR_GENERAL_ERROR 0x00000005
1011 #define CKR_FUNCTION_FAILED 0x00000006
1012
1013 /* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS,
1014 * and CKR_CANT_LOCK are new for v2.01 */
1015 #define CKR_ARGUMENTS_BAD 0x00000007
1016 #define CKR_NO_EVENT 0x00000008
1017 #define CKR_NEED_TO_CREATE_THREADS 0x00000009
1018 #define CKR_CANT_LOCK 0x0000000A
1019
1020 #define CKR_ATTRIBUTE_READ_ONLY 0x00000010
1021 #define CKR_ATTRIBUTE_SENSITIVE 0x00000011
1022 #define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012
1023 #define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013
1024 #define CKR_DATA_INVALID 0x00000020
1025 #define CKR_DATA_LEN_RANGE 0x00000021
1026 #define CKR_DEVICE_ERROR 0x00000030
1027 #define CKR_DEVICE_MEMORY 0x00000031
1028 #define CKR_DEVICE_REMOVED 0x00000032
1029 #define CKR_ENCRYPTED_DATA_INVALID 0x00000040
1030 #define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041
1031 #define CKR_FUNCTION_CANCELED 0x00000050
1032 #define CKR_FUNCTION_NOT_PARALLEL 0x00000051
1033
1034 /* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */
1035 #define CKR_FUNCTION_NOT_SUPPORTED 0x00000054
1036
1037 #define CKR_KEY_HANDLE_INVALID 0x00000060
1038
1039 /* CKR_KEY_SENSITIVE was removed for v2.0 */
1040
1041 #define CKR_KEY_SIZE_RANGE 0x00000062
1042 #define CKR_KEY_TYPE_INCONSISTENT 0x00000063
1043
1044 /* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED,
1045 * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED,
1046 * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for
1047 * v2.0 */
1048 #define CKR_KEY_NOT_NEEDED 0x00000064
1049 #define CKR_KEY_CHANGED 0x00000065
1050 #define CKR_KEY_NEEDED 0x00000066
1051 #define CKR_KEY_INDIGESTIBLE 0x00000067
1052 #define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068
1053 #define CKR_KEY_NOT_WRAPPABLE 0x00000069
1054 #define CKR_KEY_UNEXTRACTABLE 0x0000006A
1055
1056 #define CKR_MECHANISM_INVALID 0x00000070
1057 #define CKR_MECHANISM_PARAM_INVALID 0x00000071
1058
1059 /* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID
1060 * were removed for v2.0 */
1061 #define CKR_OBJECT_HANDLE_INVALID 0x00000082
1062 #define CKR_OPERATION_ACTIVE 0x00000090
1063 #define CKR_OPERATION_NOT_INITIALIZED 0x00000091
1064 #define CKR_PIN_INCORRECT 0x000000A0
1065 #define CKR_PIN_INVALID 0x000000A1
1066 #define CKR_PIN_LEN_RANGE 0x000000A2
1067
1068 /* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */
1069 #define CKR_PIN_EXPIRED 0x000000A3
1070 #define CKR_PIN_LOCKED 0x000000A4
1071
1072 #define CKR_SESSION_CLOSED 0x000000B0
1073 #define CKR_SESSION_COUNT 0x000000B1
1074 #define CKR_SESSION_HANDLE_INVALID 0x000000B3
1075 #define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4
1076 #define CKR_SESSION_READ_ONLY 0x000000B5
1077 #define CKR_SESSION_EXISTS 0x000000B6
1078
1079 /* CKR_SESSION_READ_ONLY_EXISTS and
1080 * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */
1081 #define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7
1082 #define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8
1083
1084 #define CKR_SIGNATURE_INVALID 0x000000C0
1085 #define CKR_SIGNATURE_LEN_RANGE 0x000000C1
1086 #define CKR_TEMPLATE_INCOMPLETE 0x000000D0
1087 #define CKR_TEMPLATE_INCONSISTENT 0x000000D1
1088 #define CKR_TOKEN_NOT_PRESENT 0x000000E0
1089 #define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1
1090 #define CKR_TOKEN_WRITE_PROTECTED 0x000000E2
1091 #define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0
1092 #define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1
1093 #define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2
1094 #define CKR_USER_ALREADY_LOGGED_IN 0x00000100
1095 #define CKR_USER_NOT_LOGGED_IN 0x00000101
1096 #define CKR_USER_PIN_NOT_INITIALIZED 0x00000102
1097 #define CKR_USER_TYPE_INVALID 0x00000103
1098
1099 /* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES
1100 * are new to v2.01 */
1101 #define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104
1102 #define CKR_USER_TOO_MANY_TYPES 0x00000105
1103
1104 #define CKR_WRAPPED_KEY_INVALID 0x00000110
1105 #define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112
1106 #define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113
1107 #define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114
1108 #define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115
1109 #define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120
1110
1111 /* These are new to v2.0 */
1112 #define CKR_RANDOM_NO_RNG 0x00000121
1113
1114 /* These are new to v2.11 */
1115 #define CKR_DOMAIN_PARAMS_INVALID 0x00000130
1116
1117 /* These are new to v2.0 */
1118 #define CKR_BUFFER_TOO_SMALL 0x00000150
1119 #define CKR_SAVED_STATE_INVALID 0x00000160
1120 #define CKR_INFORMATION_SENSITIVE 0x00000170
1121 #define CKR_STATE_UNSAVEABLE 0x00000180
1122
1123 /* These are new to v2.01 */
1124 #define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190
1125 #define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191
1126 #define CKR_MUTEX_BAD 0x000001A0
1127 #define CKR_MUTEX_NOT_LOCKED 0x000001A1
1128
1129 /* This is new to v2.20 */
1130 #define CKR_FUNCTION_REJECTED 0x00000200
1131
1132 #define CKR_VENDOR_DEFINED 0x80000000
1133
1134
1135 /* CK_NOTIFY is an application callback that processes events */
1136 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)(
1137 CK_SESSION_HANDLE hSession, /* the session's handle */
1138 CK_NOTIFICATION event,
1139 CK_VOID_PTR pApplication /* passed to C_OpenSession */
1140 );
1141
1142
1143 /* CK_FUNCTION_LIST is a structure holding a PKCS #11 spec
1144 * version and pointers of appropriate types to all the
1145 * PKCS #11 functions */
1146 /* CK_FUNCTION_LIST is new for v2.0 */
1147 typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST;
1148
1149 typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR;
1150
1151 typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR;
1152
1153
1154 /* CK_CREATEMUTEX is an application callback for creating a
1155 * mutex object */
1156 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)(
1157 CK_VOID_PTR_PTR ppMutex /* location to receive ptr to mutex */
1158 );
1159
1160
1161 /* CK_DESTROYMUTEX is an application callback for destroying a
1162 * mutex object */
1163 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)(
1164 CK_VOID_PTR pMutex /* pointer to mutex */
1165 );
1166
1167
1168 /* CK_LOCKMUTEX is an application callback for locking a mutex */
1169 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)(
1170 CK_VOID_PTR pMutex /* pointer to mutex */
1171 );
1172
1173
1174 /* CK_UNLOCKMUTEX is an application callback for unlocking a
1175 * mutex */
1176 typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)(
1177 CK_VOID_PTR pMutex /* pointer to mutex */
1178 );
1179
1180
1181 /* CK_C_INITIALIZE_ARGS provides the optional arguments to
1182 * C_Initialize */
1183 typedef struct CK_C_INITIALIZE_ARGS {
1184 CK_CREATEMUTEX CreateMutex;
1185 CK_DESTROYMUTEX DestroyMutex;
1186 CK_LOCKMUTEX LockMutex;
1187 CK_UNLOCKMUTEX UnlockMutex;
1188 CK_FLAGS flags;
1189 /* The official PKCS #11 spec does not have a 'LibraryParameters' field, but
1190 * a reserved field. NSS needs a way to pass instance-specific information
1191 * to the library (like where to find its config files, etc). This
1192 * information is usually provided by the installer and passed uninterpreted
1193 * by NSS to the library, though NSS does know the specifics of the softoken
1194 * version of this parameter. Most compliant PKCS#11 modules expect this
1195 * parameter to be NULL, and will return CKR_ARGUMENTS_BAD from
1196 * C_Initialize if Library parameters is supplied. */
1197 CK_CHAR_PTR *LibraryParameters;
1198 /* This field is only present if the LibraryParameters is not NULL. It must
1199 * be NULL in all cases */
1200 CK_VOID_PTR pReserved;
1201 } CK_C_INITIALIZE_ARGS;
1202
1203 /* flags: bit flags that provide capabilities of the slot
1204 * Bit Flag Mask Meaning
1205 */
1206 #define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001
1207 #define CKF_OS_LOCKING_OK 0x00000002
1208
1209 typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR;
1210
1211
1212 /* additional flags for parameters to functions */
1213
1214 /* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */
1215 #define CKF_DONT_BLOCK 1
1216
1217 /* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10.
1218 * CK_RSA_PKCS_OAEP_MGF_TYPE is used to indicate the Message
1219 * Generation Function (MGF) applied to a message block when
1220 * formatting a message block for the PKCS #1 OAEP encryption
1221 * scheme. */
1222 typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE;
1223
1224 typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR;
1225
1226 /* The following MGFs are defined */
1227 /* CKG_MGF1_SHA256, CKG_MGF1_SHA384, and CKG_MGF1_SHA512
1228 * are new for v2.20 */
1229 #define CKG_MGF1_SHA1 0x00000001
1230 #define CKG_MGF1_SHA256 0x00000002
1231 #define CKG_MGF1_SHA384 0x00000003
1232 #define CKG_MGF1_SHA512 0x00000004
1233
1234 /* v2.20 amendment 3 */
1235 #define CKG_MGF1_SHA224 0x00000005
1236
1237 /* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10.
1238 * CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source
1239 * of the encoding parameter when formatting a message block
1240 * for the PKCS #1 OAEP encryption scheme. */
1241 typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE;
1242
1243 typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR;
1244
1245 /* The following encoding parameter sources are defined */
1246 #define CKZ_DATA_SPECIFIED 0x00000001
1247
1248 /* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10.
1249 * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the
1250 * CKM_RSA_PKCS_OAEP mechanism. */
1251 typedef struct CK_RSA_PKCS_OAEP_PARAMS {
1252 CK_MECHANISM_TYPE hashAlg;
1253 CK_RSA_PKCS_MGF_TYPE mgf;
1254 CK_RSA_PKCS_OAEP_SOURCE_TYPE source;
1255 CK_VOID_PTR pSourceData;
1256 CK_ULONG ulSourceDataLen;
1257 } CK_RSA_PKCS_OAEP_PARAMS;
1258
1259 typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR;
1260
1261 /* CK_RSA_PKCS_PSS_PARAMS is new for v2.11.
1262 * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the
1263 * CKM_RSA_PKCS_PSS mechanism(s). */
1264 typedef struct CK_RSA_PKCS_PSS_PARAMS {
1265 CK_MECHANISM_TYPE hashAlg;
1266 CK_RSA_PKCS_MGF_TYPE mgf;
1267 CK_ULONG sLen;
1268 } CK_RSA_PKCS_PSS_PARAMS;
1269
1270 typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR;
1271
1272 /* CK_EC_KDF_TYPE is new for v2.11. */
1273 typedef CK_ULONG CK_EC_KDF_TYPE;
1274
1275 /* The following EC Key Derivation Functions are defined */
1276 #define CKD_NULL 0x00000001
1277 #define CKD_SHA1_KDF 0x00000002
1278 #define CKD_SHA224_KDF 0x00000005
1279 #define CKD_SHA256_KDF 0x00000006
1280 #define CKD_SHA384_KDF 0x00000007
1281 #define CKD_SHA512_KDF 0x00000008
1282
1283 /* CK_ECDH1_DERIVE_PARAMS is new for v2.11.
1284 * CK_ECDH1_DERIVE_PARAMS provides the parameters to the
1285 * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms,
1286 * where each party contributes one key pair.
1287 */
1288 typedef struct CK_ECDH1_DERIVE_PARAMS {
1289 CK_EC_KDF_TYPE kdf;
1290 CK_ULONG ulSharedDataLen;
1291 CK_BYTE_PTR pSharedData;
1292 CK_ULONG ulPublicDataLen;
1293 CK_BYTE_PTR pPublicData;
1294 } CK_ECDH1_DERIVE_PARAMS;
1295
1296 typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR;
1297
1298
1299 /* CK_ECDH2_DERIVE_PARAMS is new for v2.11.
1300 * CK_ECDH2_DERIVE_PARAMS provides the parameters to the
1301 * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */
1302 typedef struct CK_ECDH2_DERIVE_PARAMS {
1303 CK_EC_KDF_TYPE kdf;
1304 CK_ULONG ulSharedDataLen;
1305 CK_BYTE_PTR pSharedData;
1306 CK_ULONG ulPublicDataLen;
1307 CK_BYTE_PTR pPublicData;
1308 CK_ULONG ulPrivateDataLen;
1309 CK_OBJECT_HANDLE hPrivateData;
1310 CK_ULONG ulPublicDataLen2;
1311 CK_BYTE_PTR pPublicData2;
1312 } CK_ECDH2_DERIVE_PARAMS;
1313
1314 typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR;
1315
1316 typedef struct CK_ECMQV_DERIVE_PARAMS {
1317 CK_EC_KDF_TYPE kdf;
1318 CK_ULONG ulSharedDataLen;
1319 CK_BYTE_PTR pSharedData;
1320 CK_ULONG ulPublicDataLen;
1321 CK_BYTE_PTR pPublicData;
1322 CK_ULONG ulPrivateDataLen;
1323 CK_OBJECT_HANDLE hPrivateData;
1324 CK_ULONG ulPublicDataLen2;
1325 CK_BYTE_PTR pPublicData2;
1326 CK_OBJECT_HANDLE publicKey;
1327 } CK_ECMQV_DERIVE_PARAMS;
1328
1329 typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR;
1330
1331 /* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the
1332 * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */
1333 typedef CK_ULONG CK_X9_42_DH_KDF_TYPE;
1334 typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR;
1335
1336 /* The following X9.42 DH key derivation functions are defined
1337 (besides CKD_NULL already defined : */
1338 #define CKD_SHA1_KDF_ASN1 0x00000003
1339 #define CKD_SHA1_KDF_CONCATENATE 0x00000004
1340
1341 /* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11.
1342 * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the
1343 * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party
1344 * contributes one key pair */
1345 typedef struct CK_X9_42_DH1_DERIVE_PARAMS {
1346 CK_X9_42_DH_KDF_TYPE kdf;
1347 CK_ULONG ulOtherInfoLen;
1348 CK_BYTE_PTR pOtherInfo;
1349 CK_ULONG ulPublicDataLen;
1350 CK_BYTE_PTR pPublicData;
1351 } CK_X9_42_DH1_DERIVE_PARAMS;
1352
1353 typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR;
1354
1355 /* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11.
1356 * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the
1357 * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation
1358 * mechanisms, where each party contributes two key pairs */
1359 typedef struct CK_X9_42_DH2_DERIVE_PARAMS {
1360 CK_X9_42_DH_KDF_TYPE kdf;
1361 CK_ULONG ulOtherInfoLen;
1362 CK_BYTE_PTR pOtherInfo;
1363 CK_ULONG ulPublicDataLen;
1364 CK_BYTE_PTR pPublicData;
1365 CK_ULONG ulPrivateDataLen;
1366 CK_OBJECT_HANDLE hPrivateData;
1367 CK_ULONG ulPublicDataLen2;
1368 CK_BYTE_PTR pPublicData2;
1369 } CK_X9_42_DH2_DERIVE_PARAMS;
1370
1371 typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR;
1372
1373 typedef struct CK_X9_42_MQV_DERIVE_PARAMS {
1374 CK_X9_42_DH_KDF_TYPE kdf;
1375 CK_ULONG ulOtherInfoLen;
1376 CK_BYTE_PTR pOtherInfo;
1377 CK_ULONG ulPublicDataLen;
1378 CK_BYTE_PTR pPublicData;
1379 CK_ULONG ulPrivateDataLen;
1380 CK_OBJECT_HANDLE hPrivateData;
1381 CK_ULONG ulPublicDataLen2;
1382 CK_BYTE_PTR pPublicData2;
1383 CK_OBJECT_HANDLE publicKey;
1384 } CK_X9_42_MQV_DERIVE_PARAMS;
1385
1386 typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR;
1387
1388 /* CK_KEA_DERIVE_PARAMS provides the parameters to the
1389 * CKM_KEA_DERIVE mechanism */
1390 /* CK_KEA_DERIVE_PARAMS is new for v2.0 */
1391 typedef struct CK_KEA_DERIVE_PARAMS {
1392 CK_BBOOL isSender;
1393 CK_ULONG ulRandomLen;
1394 CK_BYTE_PTR pRandomA;
1395 CK_BYTE_PTR pRandomB;
1396 CK_ULONG ulPublicDataLen;
1397 CK_BYTE_PTR pPublicData;
1398 } CK_KEA_DERIVE_PARAMS;
1399
1400 typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR;
1401
1402
1403 /* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and
1404 * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just
1405 * holds the effective keysize */
1406 typedef CK_ULONG CK_RC2_PARAMS;
1407
1408 typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR;
1409
1410
1411 /* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC
1412 * mechanism */
1413 typedef struct CK_RC2_CBC_PARAMS {
1414 /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for
1415 * v2.0 */
1416 CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */
1417
1418 CK_BYTE iv[8]; /* IV for CBC mode */
1419 } CK_RC2_CBC_PARAMS;
1420
1421 typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR;
1422
1423
1424 /* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the
1425 * CKM_RC2_MAC_GENERAL mechanism */
1426 /* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */
1427 typedef struct CK_RC2_MAC_GENERAL_PARAMS {
1428 CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */
1429 CK_ULONG ulMacLength; /* Length of MAC in bytes */
1430 } CK_RC2_MAC_GENERAL_PARAMS;
1431
1432 typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \
1433 CK_RC2_MAC_GENERAL_PARAMS_PTR;
1434
1435
1436 /* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and
1437 * CKM_RC5_MAC mechanisms */
1438 /* CK_RC5_PARAMS is new for v2.0 */
1439 typedef struct CK_RC5_PARAMS {
1440 CK_ULONG ulWordsize; /* wordsize in bits */
1441 CK_ULONG ulRounds; /* number of rounds */
1442 } CK_RC5_PARAMS;
1443
1444 typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR;
1445
1446
1447 /* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC
1448 * mechanism */
1449 /* CK_RC5_CBC_PARAMS is new for v2.0 */
1450 typedef struct CK_RC5_CBC_PARAMS {
1451 CK_ULONG ulWordsize; /* wordsize in bits */
1452 CK_ULONG ulRounds; /* number of rounds */
1453 CK_BYTE_PTR pIv; /* pointer to IV */
1454 CK_ULONG ulIvLen; /* length of IV in bytes */
1455 } CK_RC5_CBC_PARAMS;
1456
1457 typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR;
1458
1459
1460 /* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the
1461 * CKM_RC5_MAC_GENERAL mechanism */
1462 /* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */
1463 typedef struct CK_RC5_MAC_GENERAL_PARAMS {
1464 CK_ULONG ulWordsize; /* wordsize in bits */
1465 CK_ULONG ulRounds; /* number of rounds */
1466 CK_ULONG ulMacLength; /* Length of MAC in bytes */
1467 } CK_RC5_MAC_GENERAL_PARAMS;
1468
1469 typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \
1470 CK_RC5_MAC_GENERAL_PARAMS_PTR;
1471
1472
1473 /* CK_MAC_GENERAL_PARAMS provides the parameters to most block
1474 * ciphers' MAC_GENERAL mechanisms. Its value is the length of
1475 * the MAC */
1476 /* CK_MAC_GENERAL_PARAMS is new for v2.0 */
1477 typedef CK_ULONG CK_MAC_GENERAL_PARAMS;
1478
1479 typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR;
1480
1481 /* CK_DES/AES_ECB/CBC_ENCRYPT_DATA_PARAMS are new for v2.20 */
1482 typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS {
1483 CK_BYTE iv[8];
1484 CK_BYTE_PTR pData;
1485 CK_ULONG length;
1486 } CK_DES_CBC_ENCRYPT_DATA_PARAMS;
1487
1488 typedef CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR;
1489
1490 typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS {
1491 CK_BYTE iv[16];
1492 CK_BYTE_PTR pData;
1493 CK_ULONG length;
1494 } CK_AES_CBC_ENCRYPT_DATA_PARAMS;
1495
1496 typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR;
1497
1498 /* CK_AES_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */
1499 typedef struct CK_AES_CTR_PARAMS {
1500 CK_ULONG ulCounterBits;
1501 CK_BYTE cb[16];
1502 } CK_AES_CTR_PARAMS;
1503
1504 typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR;
1505
1506 /* CK_GCM_PARAMS is new for version 2.30 */
1507 typedef struct CK_GCM_PARAMS {
1508 CK_BYTE_PTR pIv;
1509 CK_ULONG ulIvLen;
1510 CK_BYTE_PTR pAAD;
1511 CK_ULONG ulAADLen;
1512 CK_ULONG ulTagBits;
1513 } CK_GCM_PARAMS;
1514
1515 typedef CK_GCM_PARAMS CK_PTR CK_GCM_PARAMS_PTR;
1516
1517 /* CK_CCM_PARAMS is new for version 2.30 */
1518 typedef struct CK_CCM_PARAMS {
1519 CK_ULONG ulDataLen;
1520 CK_BYTE_PTR pNonce;
1521 CK_ULONG ulNonceLen;
1522 CK_BYTE_PTR pAAD;
1523 CK_ULONG ulAADLen;
1524 CK_ULONG ulMACLen;
1525 } CK_CCM_PARAMS;
1526
1527 typedef CK_CCM_PARAMS CK_PTR CK_CCM_PARAMS_PTR;
1528
1529 /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the
1530 * CKM_SKIPJACK_PRIVATE_WRAP mechanism */
1531 /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */
1532 typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS {
1533 CK_ULONG ulPasswordLen;
1534 CK_BYTE_PTR pPassword;
1535 CK_ULONG ulPublicDataLen;
1536 CK_BYTE_PTR pPublicData;
1537 CK_ULONG ulPAndGLen;
1538 CK_ULONG ulQLen;
1539 CK_ULONG ulRandomLen;
1540 CK_BYTE_PTR pRandomA;
1541 CK_BYTE_PTR pPrimeP;
1542 CK_BYTE_PTR pBaseG;
1543 CK_BYTE_PTR pSubprimeQ;
1544 } CK_SKIPJACK_PRIVATE_WRAP_PARAMS;
1545
1546 typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \
1547 CK_SKIPJACK_PRIVATE_WRAP_PTR;
1548
1549
1550 /* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the
1551 * CKM_SKIPJACK_RELAYX mechanism */
1552 /* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */
1553 typedef struct CK_SKIPJACK_RELAYX_PARAMS {
1554 CK_ULONG ulOldWrappedXLen;
1555 CK_BYTE_PTR pOldWrappedX;
1556 CK_ULONG ulOldPasswordLen;
1557 CK_BYTE_PTR pOldPassword;
1558 CK_ULONG ulOldPublicDataLen;
1559 CK_BYTE_PTR pOldPublicData;
1560 CK_ULONG ulOldRandomLen;
1561 CK_BYTE_PTR pOldRandomA;
1562 CK_ULONG ulNewPasswordLen;
1563 CK_BYTE_PTR pNewPassword;
1564 CK_ULONG ulNewPublicDataLen;
1565 CK_BYTE_PTR pNewPublicData;
1566 CK_ULONG ulNewRandomLen;
1567 CK_BYTE_PTR pNewRandomA;
1568 } CK_SKIPJACK_RELAYX_PARAMS;
1569
1570 typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \
1571 CK_SKIPJACK_RELAYX_PARAMS_PTR;
1572
1573
1574 typedef struct CK_PBE_PARAMS {
1575 CK_BYTE_PTR pInitVector;
1576 CK_UTF8CHAR_PTR pPassword;
1577 CK_ULONG ulPasswordLen;
1578 CK_BYTE_PTR pSalt;
1579 CK_ULONG ulSaltLen;
1580 CK_ULONG ulIteration;
1581 } CK_PBE_PARAMS;
1582
1583 typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR;
1584
1585
1586 /* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the
1587 * CKM_KEY_WRAP_SET_OAEP mechanism */
1588 /* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */
1589 typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS {
1590 CK_BYTE bBC; /* block contents byte */
1591 CK_BYTE_PTR pX; /* extra data */
1592 CK_ULONG ulXLen; /* length of extra data in bytes */
1593 } CK_KEY_WRAP_SET_OAEP_PARAMS;
1594
1595 typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \
1596 CK_KEY_WRAP_SET_OAEP_PARAMS_PTR;
1597
1598
1599 typedef struct CK_SSL3_RANDOM_DATA {
1600 CK_BYTE_PTR pClientRandom;
1601 CK_ULONG ulClientRandomLen;
1602 CK_BYTE_PTR pServerRandom;
1603 CK_ULONG ulServerRandomLen;
1604 } CK_SSL3_RANDOM_DATA;
1605
1606
1607 typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS {
1608 CK_SSL3_RANDOM_DATA RandomInfo;
1609 CK_VERSION_PTR pVersion;
1610 } CK_SSL3_MASTER_KEY_DERIVE_PARAMS;
1611
1612 typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1613 CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR;
1614
1615
1616 typedef struct CK_SSL3_KEY_MAT_OUT {
1617 CK_OBJECT_HANDLE hClientMacSecret;
1618 CK_OBJECT_HANDLE hServerMacSecret;
1619 CK_OBJECT_HANDLE hClientKey;
1620 CK_OBJECT_HANDLE hServerKey;
1621 CK_BYTE_PTR pIVClient;
1622 CK_BYTE_PTR pIVServer;
1623 } CK_SSL3_KEY_MAT_OUT;
1624
1625 typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR;
1626
1627
1628 typedef struct CK_SSL3_KEY_MAT_PARAMS {
1629 CK_ULONG ulMacSizeInBits;
1630 CK_ULONG ulKeySizeInBits;
1631 CK_ULONG ulIVSizeInBits;
1632 CK_BBOOL bIsExport;
1633 CK_SSL3_RANDOM_DATA RandomInfo;
1634 CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
1635 } CK_SSL3_KEY_MAT_PARAMS;
1636
1637 typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR;
1638
1639 /* CK_TLS_PRF_PARAMS is new for version 2.20 */
1640 typedef struct CK_TLS_PRF_PARAMS {
1641 CK_BYTE_PTR pSeed;
1642 CK_ULONG ulSeedLen;
1643 CK_BYTE_PTR pLabel;
1644 CK_ULONG ulLabelLen;
1645 CK_BYTE_PTR pOutput;
1646 CK_ULONG_PTR pulOutputLen;
1647 } CK_TLS_PRF_PARAMS;
1648
1649 typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR;
1650
1651 /* WTLS is new for version 2.20 */
1652 typedef struct CK_WTLS_RANDOM_DATA {
1653 CK_BYTE_PTR pClientRandom;
1654 CK_ULONG ulClientRandomLen;
1655 CK_BYTE_PTR pServerRandom;
1656 CK_ULONG ulServerRandomLen;
1657 } CK_WTLS_RANDOM_DATA;
1658
1659 typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR;
1660
1661 typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS {
1662 CK_MECHANISM_TYPE DigestMechanism;
1663 CK_WTLS_RANDOM_DATA RandomInfo;
1664 CK_BYTE_PTR pVersion;
1665 } CK_WTLS_MASTER_KEY_DERIVE_PARAMS;
1666
1667 typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR \
1668 CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR;
1669
1670 typedef struct CK_WTLS_PRF_PARAMS {
1671 CK_MECHANISM_TYPE DigestMechanism;
1672 CK_BYTE_PTR pSeed;
1673 CK_ULONG ulSeedLen;
1674 CK_BYTE_PTR pLabel;
1675 CK_ULONG ulLabelLen;
1676 CK_BYTE_PTR pOutput;
1677 CK_ULONG_PTR pulOutputLen;
1678 } CK_WTLS_PRF_PARAMS;
1679
1680 typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR;
1681
1682 typedef struct CK_WTLS_KEY_MAT_OUT {
1683 CK_OBJECT_HANDLE hMacSecret;
1684 CK_OBJECT_HANDLE hKey;
1685 CK_BYTE_PTR pIV;
1686 } CK_WTLS_KEY_MAT_OUT;
1687
1688 typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR;
1689
1690 typedef struct CK_WTLS_KEY_MAT_PARAMS {
1691 CK_MECHANISM_TYPE DigestMechanism;
1692 CK_ULONG ulMacSizeInBits;
1693 CK_ULONG ulKeySizeInBits;
1694 CK_ULONG ulIVSizeInBits;
1695 CK_ULONG ulSequenceNumber;
1696 CK_BBOOL bIsExport;
1697 CK_WTLS_RANDOM_DATA RandomInfo;
1698 CK_WTLS_KEY_MAT_OUT_PTR pReturnedKeyMaterial;
1699 } CK_WTLS_KEY_MAT_PARAMS;
1700
1701 typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR;
1702
1703 /* CMS is new for version 2.20 */
1704 typedef struct CK_CMS_SIG_PARAMS {
1705 CK_OBJECT_HANDLE certificateHandle;
1706 CK_MECHANISM_PTR pSigningMechanism;
1707 CK_MECHANISM_PTR pDigestMechanism;
1708 CK_UTF8CHAR_PTR pContentType;
1709 CK_BYTE_PTR pRequestedAttributes;
1710 CK_ULONG ulRequestedAttributesLen;
1711 CK_BYTE_PTR pRequiredAttributes;
1712 CK_ULONG ulRequiredAttributesLen;
1713 } CK_CMS_SIG_PARAMS;
1714
1715 typedef CK_CMS_SIG_PARAMS CK_PTR CK_CMS_SIG_PARAMS_PTR;
1716
1717 typedef struct CK_KEY_DERIVATION_STRING_DATA {
1718 CK_BYTE_PTR pData;
1719 CK_ULONG ulLen;
1720 } CK_KEY_DERIVATION_STRING_DATA;
1721
1722 typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \
1723 CK_KEY_DERIVATION_STRING_DATA_PTR;
1724
1725
1726 /* The CK_EXTRACT_PARAMS is used for the
1727 * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit
1728 * of the base key should be used as the first bit of the
1729 * derived key */
1730 /* CK_EXTRACT_PARAMS is new for v2.0 */
1731 typedef CK_ULONG CK_EXTRACT_PARAMS;
1732
1733 typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR;
1734
1735 /* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10.
1736 * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to
1737 * indicate the Pseudo-Random Function (PRF) used to generate
1738 * key bits using PKCS #5 PBKDF2. */
1739 typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE;
1740
1741 typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR;
1742
1743 /* The following PRFs are defined in PKCS #5 v2.0. */
1744 #define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001
1745
1746
1747 /* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10.
1748 * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the
1749 * source of the salt value when deriving a key using PKCS #5
1750 * PBKDF2. */
1751 typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE;
1752
1753 typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR;
1754
1755 /* The following salt value sources are defined in PKCS #5 v2.0. */
1756 #define CKZ_SALT_SPECIFIED 0x00000001
1757
1758 /* CK_PKCS5_PBKD2_PARAMS is new for v2.10.
1759 * CK_PKCS5_PBKD2_PARAMS is a structure that provides the
1760 * parameters to the CKM_PKCS5_PBKD2 mechanism. */
1761 typedef struct CK_PKCS5_PBKD2_PARAMS {
1762 CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource;
1763 CK_VOID_PTR pSaltSourceData;
1764 CK_ULONG ulSaltSourceDataLen;
1765 CK_ULONG iterations;
1766 CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;
1767 CK_VOID_PTR pPrfData;
1768 CK_ULONG ulPrfDataLen;
1769 CK_UTF8CHAR_PTR pPassword;
1770 CK_ULONG_PTR ulPasswordLen;
1771 } CK_PKCS5_PBKD2_PARAMS;
1772
1773 typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR;
1774
1775 /* NSS Specific defines */
1776
1777 /* defines that have been deprecated in 2.20, but maintained in our
1778 * header file for backward compatibility */
1779 #define CKO_KG_PARAMETERS CKO_DOMAIN_PARAMETERS
1780 #define CKF_EC_FP CKF_EC_F_P
1781 /* new in v2.11 deprecated by 2.20 */
1782 #define CKR_KEY_PARAMS_INVALID 0x0000006B
1783
1784 /* stuff that for historic reasons is in this header file but should have
1785 * been in pkcs11n.h */
1786 #define CKK_INVALID_KEY_TYPE 0xffffffff
1787
1788 #include "pkcs11n.h"
1789
1790 /* undo packing */
1791 #include "pkcs11u.h"
1792
1793 #endif
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)