56#if defined(__cplusplus)
65#define CRYPTOKI_VERSION_MAJOR 2
66#define CRYPTOKI_VERSION_MINOR 40
67#define CRYPTOKI_VERSION_REVISION 0
72#ifndef CRYPTOKI_COMPAT
73#define CRYPTOKI_COMPAT 1
79#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32)
82#pragma pack(push, cryptoki, 1)
84#ifdef CRYPTOKI_EXPORTS
85#define CK_SPEC __declspec(dllexport)
98#ifdef CRYPTOKI_EXPORTS
99#define CK_SPEC __attribute__((visibility("default")))
106#ifdef CRYPTOKI_COMPAT
110#define ck_flags_t CK_FLAGS
111#define ck_version _CK_VERSION
113#define ck_info _CK_INFO
114#define cryptoki_version cryptokiVersion
115#define manufacturer_id manufacturerID
116#define library_description libraryDescription
117#define library_version libraryVersion
119#define ck_notification_t CK_NOTIFICATION
120#define ck_slot_id_t CK_SLOT_ID
122#define ck_slot_info _CK_SLOT_INFO
123#define slot_description slotDescription
124#define hardware_version hardwareVersion
125#define firmware_version firmwareVersion
127#define ck_token_info _CK_TOKEN_INFO
128#define serial_number serialNumber
129#define max_session_count ulMaxSessionCount
130#define session_count ulSessionCount
131#define max_rw_session_count ulMaxRwSessionCount
132#define rw_session_count ulRwSessionCount
133#define max_pin_len ulMaxPinLen
134#define min_pin_len ulMinPinLen
135#define total_public_memory ulTotalPublicMemory
136#define free_public_memory ulFreePublicMemory
137#define total_private_memory ulTotalPrivateMemory
138#define free_private_memory ulFreePrivateMemory
139#define utc_time utcTime
141#define ck_session_handle_t CK_SESSION_HANDLE
142#define ck_user_type_t CK_USER_TYPE
143#define ck_state_t CK_STATE
145#define ck_session_info _CK_SESSION_INFO
146#define slot_id slotID
147#define device_error ulDeviceError
149#define ck_object_handle_t CK_OBJECT_HANDLE
150#define ck_object_class_t CK_OBJECT_CLASS
151#define ck_hw_feature_type_t CK_HW_FEATURE_TYPE
152#define ck_key_type_t CK_KEY_TYPE
153#define ck_certificate_type_t CK_CERTIFICATE_TYPE
154#define ck_attribute_type_t CK_ATTRIBUTE_TYPE
156#define ck_attribute _CK_ATTRIBUTE
158#define value_len ulValueLen
160#define ck_date _CK_DATE
162#define ck_mechanism_type_t CK_MECHANISM_TYPE
164#define ck_mechanism _CK_MECHANISM
165#define parameter pParameter
166#define parameter_len ulParameterLen
168#define ck_mechanism_info _CK_MECHANISM_INFO
169#define min_key_size ulMinKeySize
170#define max_key_size ulMaxKeySize
173#define ck_notify_t CK_NOTIFY
175#define ck_function_list _CK_FUNCTION_LIST
177#define ck_createmutex_t CK_CREATEMUTEX
178#define ck_destroymutex_t CK_DESTROYMUTEX
179#define ck_lockmutex_t CK_LOCKMUTEX
180#define ck_unlockmutex_t CK_UNLOCKMUTEX
182#define ck_c_initialize_args _CK_C_INITIALIZE_ARGS
183#define create_mutex CreateMutex
184#define destroy_mutex DestroyMutex
185#define lock_mutex LockMutex
186#define unlock_mutex UnlockMutex
187#define reserved pReserved
208#define CKN_SURRENDER (0UL)
220#define CKF_TOKEN_PRESENT (1UL << 0)
221#define CKF_REMOVABLE_DEVICE (1UL << 1)
222#define CKF_HW_SLOT (1UL << 2)
223#define CKF_ARRAY_ATTRIBUTE (1UL << 30)
246#define CKF_RNG (1UL << 0)
247#define CKF_WRITE_PROTECTED (1UL << 1)
248#define CKF_LOGIN_REQUIRED (1UL << 2)
249#define CKF_USER_PIN_INITIALIZED (1UL << 3)
250#define CKF_RESTORE_KEY_NOT_NEEDED (1UL << 5)
251#define CKF_CLOCK_ON_TOKEN (1UL << 6)
252#define CKF_PROTECTED_AUTHENTICATION_PATH (1UL << 8)
253#define CKF_DUAL_CRYPTO_OPERATIONS (1UL << 9)
254#define CKF_TOKEN_INITIALIZED (1UL << 10)
255#define CKF_SECONDARY_AUTHENTICATION (1UL << 11)
256#define CKF_USER_PIN_COUNT_LOW (1UL << 16)
257#define CKF_USER_PIN_FINAL_TRY (1UL << 17)
258#define CKF_USER_PIN_LOCKED (1UL << 18)
259#define CKF_USER_PIN_TO_BE_CHANGED (1UL << 19)
260#define CKF_SO_PIN_COUNT_LOW (1UL << 20)
261#define CKF_SO_PIN_FINAL_TRY (1UL << 21)
262#define CKF_SO_PIN_LOCKED (1UL << 22)
263#define CKF_SO_PIN_TO_BE_CHANGED (1UL << 23)
265#define CK_UNAVAILABLE_INFORMATION ((unsigned long) -1)
266#define CK_EFFECTIVELY_INFINITE (0UL)
270#define CK_INVALID_HANDLE (0UL)
275#define CKU_USER (1UL)
276#define CKU_CONTEXT_SPECIFIC (2UL)
280#define CKS_RO_PUBLIC_SESSION (0UL)
281#define CKS_RO_USER_FUNCTIONS (1UL)
282#define CKS_RW_PUBLIC_SESSION (2UL)
283#define CKS_RW_USER_FUNCTIONS (3UL)
284#define CKS_RW_SO_FUNCTIONS (4UL)
293#define CKF_RW_SESSION (1UL << 1)
294#define CKF_SERIAL_SESSION (1UL << 2)
300#define CKO_DATA (0UL)
301#define CKO_CERTIFICATE (1UL)
302#define CKO_PUBLIC_KEY (2UL)
303#define CKO_PRIVATE_KEY (3UL)
304#define CKO_SECRET_KEY (4UL)
305#define CKO_HW_FEATURE (5UL)
306#define CKO_DOMAIN_PARAMETERS (6UL)
307#define CKO_MECHANISM (7UL)
308#define CKO_VENDOR_DEFINED (1UL << 31)
312#define CKH_MONOTONIC_COUNTER (1UL)
313#define CKH_CLOCK (2UL)
314#define CKH_USER_INTERFACE (3UL)
315#define CKH_VENDOR_DEFINED (1UL << 31)
322#define CKK_ECDSA (3UL)
324#define CKK_X9_42_DH (4UL)
326#define CKK_GENERIC_SECRET (0x10UL)
327#define CKK_RC2 (0x11UL)
328#define CKK_RC4 (0x12UL)
329#define CKK_DES (0x13UL)
330#define CKK_DES2 (0x14UL)
331#define CKK_DES3 (0x15UL)
332#define CKK_CAST (0x16UL)
333#define CKK_CAST3 (0x17UL)
334#define CKK_CAST128 (0x18UL)
335#define CKK_RC5 (0x19UL)
336#define CKK_IDEA (0x1aUL)
337#define CKK_SKIPJACK (0x1bUL)
338#define CKK_BATON (0x1cUL)
339#define CKK_JUNIPER (0x1dUL)
340#define CKK_CDMF (0x1eUL)
341#define CKK_AES (0x1fUL)
342#define CKK_BLOWFISH (0x20UL)
343#define CKK_TWOFISH (0x21UL)
344#define CKK_SHA_1_HMAC (0x28UL)
345#define CKK_SHA256_HMAC (0x2bUL)
346#define CKK_SHA384_HMAC (0x2cUL)
347#define CKK_SHA512_HMAC (0x2dUL)
348#define CKK_SHA224_HMAC (0x2eUL)
349#define CKK_GOSTR3410 (0x30UL)
350#define CKK_GOSTR3411 (0x31UL)
351#define CKK_GOST28147 (0x32UL)
352#define CKK_VENDOR_DEFINED (1UL << 31)
356#define CKC_X_509 (0UL)
357#define CKC_X_509_ATTR_CERT (1UL)
358#define CKC_WTLS (2UL)
359#define CKC_VENDOR_DEFINED (1UL << 31)
363#define CKA_CLASS (0UL)
364#define CKA_TOKEN (1UL)
365#define CKA_PRIVATE (2UL)
366#define CKA_LABEL (3UL)
367#define CKA_APPLICATION (0x10UL)
368#define CKA_VALUE (0x11UL)
369#define CKA_OBJECT_ID (0x12UL)
370#define CKA_CERTIFICATE_TYPE (0x80UL)
371#define CKA_ISSUER (0x81UL)
372#define CKA_SERIAL_NUMBER (0x82UL)
373#define CKA_AC_ISSUER (0x83UL)
374#define CKA_OWNER (0x84UL)
375#define CKA_ATTR_TYPES (0x85UL)
376#define CKA_TRUSTED (0x86UL)
377#define CKA_CERTIFICATE_CATEGORY (0x87UL)
378#define CKA_JAVA_MIDP_SECURITY_DOMAIN (0x88UL)
379#define CKA_URL (0x89UL)
380#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY (0x8aUL)
381#define CKA_HASH_OF_ISSUER_PUBLIC_KEY (0x8bUL)
382#define CKA_CHECK_VALUE (0x90UL)
383#define CKA_KEY_TYPE (0x100UL)
384#define CKA_SUBJECT (0x101UL)
385#define CKA_ID (0x102UL)
386#define CKA_SENSITIVE (0x103UL)
387#define CKA_ENCRYPT (0x104UL)
388#define CKA_DECRYPT (0x105UL)
389#define CKA_WRAP (0x106UL)
390#define CKA_UNWRAP (0x107UL)
391#define CKA_SIGN (0x108UL)
392#define CKA_SIGN_RECOVER (0x109UL)
393#define CKA_VERIFY (0x10aUL)
394#define CKA_VERIFY_RECOVER (0x10bUL)
395#define CKA_DERIVE (0x10cUL)
396#define CKA_START_DATE (0x110UL)
397#define CKA_END_DATE (0x111UL)
398#define CKA_MODULUS (0x120UL)
399#define CKA_MODULUS_BITS (0x121UL)
400#define CKA_PUBLIC_EXPONENT (0x122UL)
401#define CKA_PRIVATE_EXPONENT (0x123UL)
402#define CKA_PRIME_1 (0x124UL)
403#define CKA_PRIME_2 (0x125UL)
404#define CKA_EXPONENT_1 (0x126UL)
405#define CKA_EXPONENT_2 (0x127UL)
406#define CKA_COEFFICIENT (0x128UL)
407#define CKA_PUBLIC_KEY_INFO (0x129UL)
408#define CKA_PRIME (0x130UL)
409#define CKA_SUBPRIME (0x131UL)
410#define CKA_BASE (0x132UL)
411#define CKA_PRIME_BITS (0x133UL)
412#define CKA_SUB_PRIME_BITS (0x134UL)
413#define CKA_VALUE_BITS (0x160UL)
414#define CKA_VALUE_LEN (0x161UL)
415#define CKA_EXTRACTABLE (0x162UL)
416#define CKA_LOCAL (0x163UL)
417#define CKA_NEVER_EXTRACTABLE (0x164UL)
418#define CKA_ALWAYS_SENSITIVE (0x165UL)
419#define CKA_KEY_GEN_MECHANISM (0x166UL)
420#define CKA_MODIFIABLE (0x170UL)
421#define CKA_COPYABLE (0x171UL)
422#define CKA_DESTROYABLE (0x172UL)
423#define CKA_ECDSA_PARAMS (0x180UL)
424#define CKA_EC_PARAMS (0x180UL)
425#define CKA_EC_POINT (0x181UL)
426#define CKA_SECONDARY_AUTH (0x200UL)
427#define CKA_AUTH_PIN_FLAGS (0x201UL)
428#define CKA_ALWAYS_AUTHENTICATE (0x202UL)
429#define CKA_WRAP_WITH_TRUSTED (0x210UL)
430#define CKA_GOSTR3410_PARAMS (0x250UL)
431#define CKA_GOSTR3411_PARAMS (0x251UL)
432#define CKA_GOST28147_PARAMS (0x252UL)
433#define CKA_HW_FEATURE_TYPE (0x300UL)
434#define CKA_RESET_ON_INIT (0x301UL)
435#define CKA_HAS_RESET (0x302UL)
436#define CKA_PIXEL_X (0x400UL)
437#define CKA_PIXEL_Y (0x401UL)
438#define CKA_RESOLUTION (0x402UL)
439#define CKA_CHAR_ROWS (0x403UL)
440#define CKA_CHAR_COLUMNS (0x404UL)
441#define CKA_COLOR (0x405UL)
442#define CKA_BITS_PER_PIXEL (0x406UL)
443#define CKA_CHAR_SETS (0x480UL)
444#define CKA_ENCODING_METHODS (0x481UL)
445#define CKA_MIME_TYPES (0x482UL)
446#define CKA_MECHANISM_TYPE (0x500UL)
447#define CKA_REQUIRED_CMS_ATTRIBUTES (0x501UL)
448#define CKA_DEFAULT_CMS_ATTRIBUTES (0x502UL)
449#define CKA_SUPPORTED_CMS_ATTRIBUTES (0x503UL)
450#define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE | 0x211UL)
451#define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE | 0x212UL)
452#define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE | 0x600UL)
453#define CKA_VENDOR_DEFINED (1UL << 31)
469#define CKM_RSA_PKCS_KEY_PAIR_GEN (0UL)
470#define CKM_RSA_PKCS (1UL)
471#define CKM_RSA_9796 (2UL)
472#define CKM_RSA_X_509 (3UL)
473#define CKM_MD2_RSA_PKCS (4UL)
474#define CKM_MD5_RSA_PKCS (5UL)
475#define CKM_SHA1_RSA_PKCS (6UL)
476#define CKM_RIPEMD128_RSA_PKCS (7UL)
477#define CKM_RIPEMD160_RSA_PKCS (8UL)
478#define CKM_RSA_PKCS_OAEP (9UL)
479#define CKM_RSA_X9_31_KEY_PAIR_GEN (0xaUL)
480#define CKM_RSA_X9_31 (0xbUL)
481#define CKM_SHA1_RSA_X9_31 (0xcUL)
482#define CKM_RSA_PKCS_PSS (0xdUL)
483#define CKM_SHA1_RSA_PKCS_PSS (0xeUL)
484#define CKM_DSA_KEY_PAIR_GEN (0x10UL)
485#define CKM_DSA (0x11UL)
486#define CKM_DSA_SHA1 (0x12UL)
487#define CKM_DH_PKCS_KEY_PAIR_GEN (0x20UL)
488#define CKM_DH_PKCS_DERIVE (0x21UL)
489#define CKM_X9_42_DH_KEY_PAIR_GEN (0x30UL)
490#define CKM_X9_42_DH_DERIVE (0x31UL)
491#define CKM_X9_42_DH_HYBRID_DERIVE (0x32UL)
492#define CKM_X9_42_MQV_DERIVE (0x33UL)
493#define CKM_SHA256_RSA_PKCS (0x40UL)
494#define CKM_SHA384_RSA_PKCS (0x41UL)
495#define CKM_SHA512_RSA_PKCS (0x42UL)
496#define CKM_SHA256_RSA_PKCS_PSS (0x43UL)
497#define CKM_SHA384_RSA_PKCS_PSS (0x44UL)
498#define CKM_SHA512_RSA_PKCS_PSS (0x45UL)
499#define CKM_RC2_KEY_GEN (0x100UL)
500#define CKM_RC2_ECB (0x101UL)
501#define CKM_RC2_CBC (0x102UL)
502#define CKM_RC2_MAC (0x103UL)
503#define CKM_RC2_MAC_GENERAL (0x104UL)
504#define CKM_RC2_CBC_PAD (0x105UL)
505#define CKM_RC4_KEY_GEN (0x110UL)
506#define CKM_RC4 (0x111UL)
507#define CKM_DES_KEY_GEN (0x120UL)
508#define CKM_DES_ECB (0x121UL)
509#define CKM_DES_CBC (0x122UL)
510#define CKM_DES_MAC (0x123UL)
511#define CKM_DES_MAC_GENERAL (0x124UL)
512#define CKM_DES_CBC_PAD (0x125UL)
513#define CKM_DES2_KEY_GEN (0x130UL)
514#define CKM_DES3_KEY_GEN (0x131UL)
515#define CKM_DES3_ECB (0x132UL)
516#define CKM_DES3_CBC (0x133UL)
517#define CKM_DES3_MAC (0x134UL)
518#define CKM_DES3_MAC_GENERAL (0x135UL)
519#define CKM_DES3_CBC_PAD (0x136UL)
520#define CKM_CDMF_KEY_GEN (0x140UL)
521#define CKM_CDMF_ECB (0x141UL)
522#define CKM_CDMF_CBC (0x142UL)
523#define CKM_CDMF_MAC (0x143UL)
524#define CKM_CDMF_MAC_GENERAL (0x144UL)
525#define CKM_CDMF_CBC_PAD (0x145UL)
526#define CKM_MD2 (0x200UL)
527#define CKM_MD2_HMAC (0x201UL)
528#define CKM_MD2_HMAC_GENERAL (0x202UL)
529#define CKM_MD5 (0x210UL)
530#define CKM_MD5_HMAC (0x211UL)
531#define CKM_MD5_HMAC_GENERAL (0x212UL)
532#define CKM_SHA_1 (0x220UL)
533#define CKM_SHA_1_HMAC (0x221UL)
534#define CKM_SHA_1_HMAC_GENERAL (0x222UL)
535#define CKM_RIPEMD128 (0x230UL)
536#define CKM_RIPEMD128_HMAC (0x231UL)
537#define CKM_RIPEMD128_HMAC_GENERAL (0x232UL)
538#define CKM_RIPEMD160 (0x240UL)
539#define CKM_RIPEMD160_HMAC (0x241UL)
540#define CKM_RIPEMD160_HMAC_GENERAL (0x242UL)
541#define CKM_SHA256 (0x250UL)
542#define CKM_SHA256_HMAC (0x251UL)
543#define CKM_SHA256_HMAC_GENERAL (0x252UL)
544#define CKM_SHA384 (0x260UL)
545#define CKM_SHA384_HMAC (0x261UL)
546#define CKM_SHA384_HMAC_GENERAL (0x262UL)
547#define CKM_SHA512 (0x270UL)
548#define CKM_SHA512_HMAC (0x271UL)
549#define CKM_SHA512_HMAC_GENERAL (0x272UL)
550#define CKM_CAST_KEY_GEN (0x300UL)
551#define CKM_CAST_ECB (0x301UL)
552#define CKM_CAST_CBC (0x302UL)
553#define CKM_CAST_MAC (0x303UL)
554#define CKM_CAST_MAC_GENERAL (0x304UL)
555#define CKM_CAST_CBC_PAD (0x305UL)
556#define CKM_CAST3_KEY_GEN (0x310UL)
557#define CKM_CAST3_ECB (0x311UL)
558#define CKM_CAST3_CBC (0x312UL)
559#define CKM_CAST3_MAC (0x313UL)
560#define CKM_CAST3_MAC_GENERAL (0x314UL)
561#define CKM_CAST3_CBC_PAD (0x315UL)
562#define CKM_CAST5_KEY_GEN (0x320UL)
563#define CKM_CAST128_KEY_GEN (0x320UL)
564#define CKM_CAST5_ECB (0x321UL)
565#define CKM_CAST128_ECB (0x321UL)
566#define CKM_CAST5_CBC (0x322UL)
567#define CKM_CAST128_CBC (0x322UL)
568#define CKM_CAST5_MAC (0x323UL)
569#define CKM_CAST128_MAC (0x323UL)
570#define CKM_CAST5_MAC_GENERAL (0x324UL)
571#define CKM_CAST128_MAC_GENERAL (0x324UL)
572#define CKM_CAST5_CBC_PAD (0x325UL)
573#define CKM_CAST128_CBC_PAD (0x325UL)
574#define CKM_RC5_KEY_GEN (0x330UL)
575#define CKM_RC5_ECB (0x331UL)
576#define CKM_RC5_CBC (0x332UL)
577#define CKM_RC5_MAC (0x333UL)
578#define CKM_RC5_MAC_GENERAL (0x334UL)
579#define CKM_RC5_CBC_PAD (0x335UL)
580#define CKM_IDEA_KEY_GEN (0x340UL)
581#define CKM_IDEA_ECB (0x341UL)
582#define CKM_IDEA_CBC (0x342UL)
583#define CKM_IDEA_MAC (0x343UL)
584#define CKM_IDEA_MAC_GENERAL (0x344UL)
585#define CKM_IDEA_CBC_PAD (0x345UL)
586#define CKM_GENERIC_SECRET_KEY_GEN (0x350UL)
587#define CKM_CONCATENATE_BASE_AND_KEY (0x360UL)
588#define CKM_CONCATENATE_BASE_AND_DATA (0x362UL)
589#define CKM_CONCATENATE_DATA_AND_BASE (0x363UL)
590#define CKM_XOR_BASE_AND_DATA (0x364UL)
591#define CKM_EXTRACT_KEY_FROM_KEY (0x365UL)
592#define CKM_SSL3_PRE_MASTER_KEY_GEN (0x370UL)
593#define CKM_SSL3_MASTER_KEY_DERIVE (0x371UL)
594#define CKM_SSL3_KEY_AND_MAC_DERIVE (0x372UL)
595#define CKM_SSL3_MASTER_KEY_DERIVE_DH (0x373UL)
596#define CKM_TLS_PRE_MASTER_KEY_GEN (0x374UL)
597#define CKM_TLS_MASTER_KEY_DERIVE (0x375UL)
598#define CKM_TLS_KEY_AND_MAC_DERIVE (0x376UL)
599#define CKM_TLS_MASTER_KEY_DERIVE_DH (0x377UL)
600#define CKM_SSL3_MD5_MAC (0x380UL)
601#define CKM_SSL3_SHA1_MAC (0x381UL)
602#define CKM_MD5_KEY_DERIVATION (0x390UL)
603#define CKM_MD2_KEY_DERIVATION (0x391UL)
604#define CKM_SHA1_KEY_DERIVATION (0x392UL)
605#define CKM_PBE_MD2_DES_CBC (0x3a0UL)
606#define CKM_PBE_MD5_DES_CBC (0x3a1UL)
607#define CKM_PBE_MD5_CAST_CBC (0x3a2UL)
608#define CKM_PBE_MD5_CAST3_CBC (0x3a3UL)
609#define CKM_PBE_MD5_CAST5_CBC (0x3a4UL)
610#define CKM_PBE_MD5_CAST128_CBC (0x3a4UL)
611#define CKM_PBE_SHA1_CAST5_CBC (0x3a5UL)
612#define CKM_PBE_SHA1_CAST128_CBC (0x3a5UL)
613#define CKM_PBE_SHA1_RC4_128 (0x3a6UL)
614#define CKM_PBE_SHA1_RC4_40 (0x3a7UL)
615#define CKM_PBE_SHA1_DES3_EDE_CBC (0x3a8UL)
616#define CKM_PBE_SHA1_DES2_EDE_CBC (0x3a9UL)
617#define CKM_PBE_SHA1_RC2_128_CBC (0x3aaUL)
618#define CKM_PBE_SHA1_RC2_40_CBC (0x3abUL)
619#define CKM_PKCS5_PBKD2 (0x3b0UL)
620#define CKM_PBA_SHA1_WITH_SHA1_HMAC (0x3c0UL)
621#define CKM_KEY_WRAP_LYNKS (0x400UL)
622#define CKM_KEY_WRAP_SET_OAEP (0x401UL)
623#define CKM_SKIPJACK_KEY_GEN (0x1000UL)
624#define CKM_SKIPJACK_ECB64 (0x1001UL)
625#define CKM_SKIPJACK_CBC64 (0x1002UL)
626#define CKM_SKIPJACK_OFB64 (0x1003UL)
627#define CKM_SKIPJACK_CFB64 (0x1004UL)
628#define CKM_SKIPJACK_CFB32 (0x1005UL)
629#define CKM_SKIPJACK_CFB16 (0x1006UL)
630#define CKM_SKIPJACK_CFB8 (0x1007UL)
631#define CKM_SKIPJACK_WRAP (0x1008UL)
632#define CKM_SKIPJACK_PRIVATE_WRAP (0x1009UL)
633#define CKM_SKIPJACK_RELAYX (0x100aUL)
634#define CKM_KEA_KEY_PAIR_GEN (0x1010UL)
635#define CKM_KEA_KEY_DERIVE (0x1011UL)
636#define CKM_FORTEZZA_TIMESTAMP (0x1020UL)
637#define CKM_BATON_KEY_GEN (0x1030UL)
638#define CKM_BATON_ECB128 (0x1031UL)
639#define CKM_BATON_ECB96 (0x1032UL)
640#define CKM_BATON_CBC128 (0x1033UL)
641#define CKM_BATON_COUNTER (0x1034UL)
642#define CKM_BATON_SHUFFLE (0x1035UL)
643#define CKM_BATON_WRAP (0x1036UL)
644#define CKM_ECDSA_KEY_PAIR_GEN (0x1040UL)
645#define CKM_EC_KEY_PAIR_GEN (0x1040UL)
646#define CKM_ECDSA (0x1041UL)
647#define CKM_ECDSA_SHA1 (0x1042UL)
648#define CKM_ECDSA_SHA224 (0x1043UL)
649#define CKM_ECDSA_SHA256 (0x1044UL)
650#define CKM_ECDSA_SHA384 (0x1045UL)
651#define CKM_ECDSA_SHA512 (0x1046UL)
652#define CKM_ECDH1_DERIVE (0x1050UL)
653#define CKM_ECDH1_COFACTOR_DERIVE (0x1051UL)
654#define CKM_ECMQV_DERIVE (0x1052UL)
655#define CKM_JUNIPER_KEY_GEN (0x1060UL)
656#define CKM_JUNIPER_ECB128 (0x1061UL)
657#define CKM_JUNIPER_CBC128 (0x1062UL)
658#define CKM_JUNIPER_COUNTER (0x1063UL)
659#define CKM_JUNIPER_SHUFFLE (0x1064UL)
660#define CKM_JUNIPER_WRAP (0x1065UL)
661#define CKM_FASTHASH (0x1070UL)
662#define CKM_AES_KEY_GEN (0x1080UL)
663#define CKM_AES_ECB (0x1081UL)
664#define CKM_AES_CBC (0x1082UL)
665#define CKM_AES_MAC (0x1083UL)
666#define CKM_AES_MAC_GENERAL (0x1084UL)
667#define CKM_AES_CBC_PAD (0x1085UL)
668#define CKM_AES_CTR (0x1086UL)
669#define CKM_AES_GCM (0x1087UL)
670#define CKM_AES_CCM (0x1088UL)
671#define CKM_AES_CTS (0x1089UL)
672#define CKM_BLOWFISH_KEY_GEN (0x1090UL)
673#define CKM_BLOWFISH_CBC (0x1091UL)
674#define CKM_TWOFISH_KEY_GEN (0x1092UL)
675#define CKM_TWOFISH_CBC (0x1093UL)
676#define CKM_GOSTR3410_KEY_PAIR_GEN (0x1200UL)
677#define CKM_GOSTR3410 (0x1201UL)
678#define CKM_GOSTR3410_WITH_GOSTR3411 (0x1202UL)
679#define CKM_GOSTR3410_KEY_WRAP (0x1203UL)
680#define CKM_GOSTR3410_DERIVE (0x1204UL)
681#define CKM_GOSTR3411 (0x1210UL)
682#define CKM_GOSTR3411_HMAC (0x1211UL)
683#define CKM_GOST28147_KEY_GEN (0x1220UL)
684#define CKM_GOST28147_ECB (0x1221UL)
685#define CKM_GOST28147 (0x1222UL)
686#define CKM_GOST28147_MAC (0x1223UL)
687#define CKM_GOST28147_KEY_WRAP (0x1224UL)
689#define CKM_DSA_PARAMETER_GEN (0x2000UL)
690#define CKM_DH_PKCS_PARAMETER_GEN (0x2001UL)
691#define CKM_X9_42_DH_PARAMETER_GEN (0x2002UL)
692#define CKM_VENDOR_DEFINED (1UL << 31)
706#define CKF_HW (1UL << 0)
707#define CKF_ENCRYPT (1UL << 8)
708#define CKF_DECRYPT (1UL << 9)
709#define CKF_DIGEST (1UL << 10)
710#define CKF_SIGN (1UL << 11)
711#define CKF_SIGN_RECOVER (1UL << 12)
712#define CKF_VERIFY (1UL << 13)
713#define CKF_VERIFY_RECOVER (1UL << 14)
714#define CKF_GENERATE (1UL << 15)
715#define CKF_GENERATE_KEY_PAIR (1UL << 16)
716#define CKF_WRAP (1UL << 17)
717#define CKF_UNWRAP (1UL << 18)
718#define CKF_DERIVE (1UL << 19)
719#define CKF_EXTENSION (1UL << 31)
721#define CKF_EC_F_P (1UL << 20)
722#define CKF_EC_F_2M (1UL << 21)
723#define CKF_EC_ECPARAMETERS (1UL << 22)
724#define CKF_EC_NAMEDCURVE (1UL << 23)
725#define CKF_EC_UNCOMPRESS (1UL << 24)
726#define CKF_EC_COMPRESS (1UL << 25)
729#define CKF_DONT_BLOCK (1UL)
732#define CKD_NULL (1UL << 0)
744#define CKG_MGF1_SHA1 0x00000001UL
745#define CKG_MGF1_SHA224 0x00000005UL
746#define CKG_MGF1_SHA256 0x00000002UL
747#define CKG_MGF1_SHA384 0x00000003UL
748#define CKG_MGF1_SHA512 0x00000004UL
752#define CKZ_DATA_SPECIFIED (1UL << 0)
776#define _CK_DECLARE_FUNCTION(name, args) \
777 typedef ck_rv_t(*CK_##name) args; \
778 ck_rv_t CK_SPEC name args
788 unsigned long *
count));
797 unsigned long *
count));
803 unsigned long pin_len,
unsigned char *
label));
805 unsigned char *pin,
unsigned long pin_len));
807 unsigned char *old_pin,
unsigned long old_len,
808 unsigned char *new_pin,
unsigned long new_len));
818 unsigned char *operation_state,
819 unsigned long *operation_state_len));
822 unsigned char *operation_state,
823 unsigned long operation_state_len,
828 unsigned char *pin,
unsigned long pin_len));
842 unsigned long *size));
851 unsigned long count));
854 unsigned long max_object_count,
855 unsigned long *object_count));
863 unsigned long data_len,
unsigned char *encrypted_data,
864 unsigned long *encrypted_data_len));
867 unsigned long part_len,
unsigned char *encrypted_part,
868 unsigned long *encrypted_part_len));
870 unsigned char *last_encrypted_part,
871 unsigned long *last_encrypted_part_len));
877 unsigned char *encrypted_data,
878 unsigned long encrypted_data_len,
879 unsigned char *data,
unsigned long *data_len));
882 unsigned char *encrypted_part,
883 unsigned long encrypted_part_len,
unsigned char *part,
884 unsigned long *part_len));
887 unsigned long *last_part_len));
893 unsigned long data_len,
unsigned char *digest,
897 unsigned long part_len));
908 unsigned long data_len,
unsigned char *signature,
909 unsigned long *signature_len));
912 unsigned long part_len));
915 unsigned long *signature_len));
921 unsigned long data_len,
unsigned char *signature,
922 unsigned long *signature_len));
929 unsigned long data_len,
unsigned char *signature,
930 unsigned long signature_len));
933 unsigned long part_len));
936 unsigned long signature_len));
942 unsigned long signature_len,
unsigned char *data,
943 unsigned long *data_len));
947 unsigned long part_len,
unsigned char *encrypted_part,
948 unsigned long *encrypted_part_len));
951 unsigned char *encrypted_part,
952 unsigned long encrypted_part_len,
unsigned char *part,
953 unsigned long *part_len));
956 unsigned long part_len,
unsigned char *encrypted_part,
957 unsigned long *encrypted_part_len));
960 unsigned char *encrypted_part,
961 unsigned long encrypted_part_len,
unsigned char *part,
962 unsigned long *part_len));
973 unsigned long public_key_attribute_count,
975 unsigned long private_key_attribute_count,
981 unsigned char *wrapped_key,
unsigned long *wrapped_key_len));
985 unsigned long wrapped_key_len,
struct ck_attribute *templ,
995 unsigned long seed_len));
998 unsigned long random_len));
1089#define CKF_LIBRARY_CANT_CREATE_OS_THREADS (1UL << 0)
1090#define CKF_OS_LOCKING_OK (1UL << 1)
1093#define CKR_CANCEL (1UL)
1094#define CKR_HOST_MEMORY (2UL)
1095#define CKR_SLOT_ID_INVALID (3UL)
1096#define CKR_GENERAL_ERROR (5UL)
1097#define CKR_FUNCTION_FAILED (6UL)
1098#define CKR_ARGUMENTS_BAD (7UL)
1099#define CKR_NO_EVENT (8UL)
1100#define CKR_NEED_TO_CREATE_THREADS (9UL)
1101#define CKR_CANT_LOCK (0xaUL)
1102#define CKR_ATTRIBUTE_READ_ONLY (0x10UL)
1103#define CKR_ATTRIBUTE_SENSITIVE (0x11UL)
1104#define CKR_ATTRIBUTE_TYPE_INVALID (0x12UL)
1105#define CKR_ATTRIBUTE_VALUE_INVALID (0x13UL)
1106#define CKR_DATA_INVALID (0x20UL)
1107#define CKR_DATA_LEN_RANGE (0x21UL)
1108#define CKR_DEVICE_ERROR (0x30UL)
1109#define CKR_DEVICE_MEMORY (0x31UL)
1110#define CKR_DEVICE_REMOVED (0x32UL)
1111#define CKR_ENCRYPTED_DATA_INVALID (0x40UL)
1112#define CKR_ENCRYPTED_DATA_LEN_RANGE (0x41UL)
1113#define CKR_FUNCTION_CANCELED (0x50UL)
1114#define CKR_FUNCTION_NOT_PARALLEL (0x51UL)
1115#define CKR_FUNCTION_NOT_SUPPORTED (0x54UL)
1116#define CKR_KEY_HANDLE_INVALID (0x60UL)
1117#define CKR_KEY_SIZE_RANGE (0x62UL)
1118#define CKR_KEY_TYPE_INCONSISTENT (0x63UL)
1119#define CKR_KEY_NOT_NEEDED (0x64UL)
1120#define CKR_KEY_CHANGED (0x65UL)
1121#define CKR_KEY_NEEDED (0x66UL)
1122#define CKR_KEY_INDIGESTIBLE (0x67UL)
1123#define CKR_KEY_FUNCTION_NOT_PERMITTED (0x68UL)
1124#define CKR_KEY_NOT_WRAPPABLE (0x69UL)
1125#define CKR_KEY_UNEXTRACTABLE (0x6aUL)
1126#define CKR_MECHANISM_INVALID (0x70UL)
1127#define CKR_MECHANISM_PARAM_INVALID (0x71UL)
1128#define CKR_OBJECT_HANDLE_INVALID (0x82UL)
1129#define CKR_OPERATION_ACTIVE (0x90UL)
1130#define CKR_OPERATION_NOT_INITIALIZED (0x91UL)
1131#define CKR_PIN_INCORRECT (0xa0UL)
1132#define CKR_PIN_INVALID (0xa1UL)
1133#define CKR_PIN_LEN_RANGE (0xa2UL)
1134#define CKR_PIN_EXPIRED (0xa3UL)
1135#define CKR_PIN_LOCKED (0xa4UL)
1136#define CKR_SESSION_CLOSED (0xb0UL)
1137#define CKR_SESSION_COUNT (0xb1UL)
1138#define CKR_SESSION_HANDLE_INVALID (0xb3UL)
1139#define CKR_SESSION_PARALLEL_NOT_SUPPORTED (0xb4UL)
1140#define CKR_SESSION_READ_ONLY (0xb5UL)
1141#define CKR_SESSION_EXISTS (0xb6UL)
1142#define CKR_SESSION_READ_ONLY_EXISTS (0xb7UL)
1143#define CKR_SESSION_READ_WRITE_SO_EXISTS (0xb8UL)
1144#define CKR_SIGNATURE_INVALID (0xc0UL)
1145#define CKR_SIGNATURE_LEN_RANGE (0xc1UL)
1146#define CKR_TEMPLATE_INCOMPLETE (0xd0UL)
1147#define CKR_TEMPLATE_INCONSISTENT (0xd1UL)
1148#define CKR_TOKEN_NOT_PRESENT (0xe0UL)
1149#define CKR_TOKEN_NOT_RECOGNIZED (0xe1UL)
1150#define CKR_TOKEN_WRITE_PROTECTED (0xe2UL)
1151#define CKR_UNWRAPPING_KEY_HANDLE_INVALID (0xf0UL)
1152#define CKR_UNWRAPPING_KEY_SIZE_RANGE (0xf1UL)
1153#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT (0xf2UL)
1154#define CKR_USER_ALREADY_LOGGED_IN (0x100UL)
1155#define CKR_USER_NOT_LOGGED_IN (0x101UL)
1156#define CKR_USER_PIN_NOT_INITIALIZED (0x102UL)
1157#define CKR_USER_TYPE_INVALID (0x103UL)
1158#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN (0x104UL)
1159#define CKR_USER_TOO_MANY_TYPES (0x105UL)
1160#define CKR_WRAPPED_KEY_INVALID (0x110UL)
1161#define CKR_WRAPPED_KEY_LEN_RANGE (0x112UL)
1162#define CKR_WRAPPING_KEY_HANDLE_INVALID (0x113UL)
1163#define CKR_WRAPPING_KEY_SIZE_RANGE (0x114UL)
1164#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT (0x115UL)
1165#define CKR_RANDOM_SEED_NOT_SUPPORTED (0x120UL)
1166#define CKR_RANDOM_NO_RNG (0x121UL)
1167#define CKR_DOMAIN_PARAMS_INVALID (0x130UL)
1168#define CKR_CURVE_NOT_SUPPORTED (0x140UL)
1169#define CKR_BUFFER_TOO_SMALL (0x150UL)
1170#define CKR_SAVED_STATE_INVALID (0x160UL)
1171#define CKR_INFORMATION_SENSITIVE (0x170UL)
1172#define CKR_STATE_UNSAVEABLE (0x180UL)
1173#define CKR_CRYPTOKI_NOT_INITIALIZED (0x190UL)
1174#define CKR_CRYPTOKI_ALREADY_INITIALIZED (0x191UL)
1175#define CKR_MUTEX_BAD (0x1a0UL)
1176#define CKR_MUTEX_NOT_LOCKED (0x1a1UL)
1177#define CKR_FUNCTION_REJECTED (0x200UL)
1178#define CKR_VENDOR_DEFINED (1UL << 31)
1182#ifdef CRYPTOKI_COMPAT
1184#undef CK_DEFINE_FUNCTION
1185#define CK_DEFINE_FUNCTION(retval, name) retval CK_SPEC name
1204#ifndef CK_DISABLE_TRUE_FALSE
1257#define NULL_PTR NULL
1264#undef cryptoki_version
1265#undef manufacturer_id
1266#undef library_description
1267#undef library_version
1269#undef ck_notification_t
1273#undef slot_description
1274#undef hardware_version
1275#undef firmware_version
1279#undef max_session_count
1281#undef max_rw_session_count
1282#undef rw_session_count
1285#undef total_public_memory
1286#undef free_public_memory
1287#undef total_private_memory
1288#undef free_private_memory
1291#undef ck_session_handle_t
1292#undef ck_user_type_t
1295#undef ck_session_info
1299#undef ck_object_handle_t
1300#undef ck_object_class_t
1301#undef ck_hw_feature_type_t
1303#undef ck_certificate_type_t
1304#undef ck_attribute_type_t
1312#undef ck_mechanism_type_t
1318#undef ck_mechanism_info
1325#undef ck_function_list
1327#undef ck_createmutex_t
1328#undef ck_destroymutex_t
1329#undef ck_lockmutex_t
1330#undef ck_unlockmutex_t
1332#undef ck_c_initialize_args
1342#if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32)
1343#pragma pack(pop, cryptoki)
1346#if defined(__cplusplus)
CK_SESSION_HANDLE session
#define ck_hw_feature_type_t
struct ck_mechanism_info * CK_MECHANISM_INFO_PTR
struct ck_date * CK_DATE_PTR
ck_session_handle_t * CK_SESSION_HANDLE_PTR
unsigned long ck_object_handle_t
ck_mechanism_type_t * CK_MECHANISM_TYPE_PTR
unsigned long ck_object_class_t
#define ck_mechanism_type_t
unsigned long int CK_ULONG
unsigned long ck_mechanism_type_t
#define ck_object_handle_t
struct ck_session_info * CK_SESSION_INFO_PTR
struct ck_function_list * CK_FUNCTION_LIST_PTR
ck_slot_id_t * CK_SLOT_ID_PTR
unsigned long ck_session_handle_t
struct ck_attribute * CK_ATTRIBUTE_PTR
struct ck_version * CK_VERSION_PTR
unsigned long CK_RSA_PKCS_OAEP_SOURCE_TYPE
#define ck_object_class_t
ck_object_handle_t * CK_OBJECT_HANDLE_PTR
#define ck_attribute_type_t
#define library_description
struct ck_slot_info * CK_SLOT_INFO_PTR
#define ck_certificate_type_t
struct ck_function_list ** CK_FUNCTION_LIST_PTR_PTR
unsigned long ck_user_type_t
struct ck_token_info * CK_TOKEN_INFO_PTR
ck_object_class_t * CK_OBJECT_CLASS_PTR
struct ck_mechanism * CK_MECHANISM_PTR
#define ck_session_handle_t
struct ck_info * CK_INFO_PTR
#define ck_destroymutex_t
struct CK_RSA_PKCS_PSS_PARAMS CK_RSA_PKCS_PSS_PARAMS
unsigned long ck_slot_id_t
#define _CK_DECLARE_FUNCTION(name, args)
unsigned long ck_attribute_type_t
unsigned long ck_notification_t
unsigned char CK_UTF8CHAR
CK_UTF8CHAR * CK_UTF8CHAR_PTR
#define ck_notification_t
struct ck_c_initialize_args * CK_C_INITIALIZE_ARGS_PTR
struct CK_ECDH1_DERIVE_PARAMS CK_ECDH1_DERIVE_PARAMS
struct CK_RSA_PKCS_OAEP_PARAMS CK_RSA_PKCS_OAEP_PARAMS
unsigned long CK_RSA_PKCS_MGF_TYPE
unsigned char * pSharedData
unsigned long ulPublicDataLen
unsigned char * pPublicData
unsigned long ulSharedDataLen
CK_MECHANISM_TYPE hashAlg
unsigned long ulSourceDataLen
CK_RSA_PKCS_OAEP_SOURCE_TYPE source
CK_MECHANISM_TYPE hashAlg
ck_lockmutex_t lock_mutex
ck_destroymutex_t destroy_mutex
ck_createmutex_t create_mutex
ck_unlockmutex_t unlock_mutex
CK_C_OpenSession C_OpenSession
CK_C_GetSlotList C_GetSlotList
CK_C_GetFunctionList C_GetFunctionList
CK_C_SignUpdate C_SignUpdate
CK_C_GenerateRandom C_GenerateRandom
CK_C_EncryptFinal C_EncryptFinal
CK_C_SignRecover C_SignRecover
CK_C_WaitForSlotEvent C_WaitForSlotEvent
CK_C_GenerateKeyPair C_GenerateKeyPair
CK_C_GetMechanismInfo C_GetMechanismInfo
CK_C_FindObjectsFinal C_FindObjectsFinal
CK_C_SignRecoverInit C_SignRecoverInit
CK_C_CloseSession C_CloseSession
CK_C_DestroyObject C_DestroyObject
CK_C_UnwrapKey C_UnwrapKey
CK_C_FindObjectsInit C_FindObjectsInit
CK_C_GetMechanismList C_GetMechanismList
CK_C_EncryptUpdate C_EncryptUpdate
CK_C_EncryptInit C_EncryptInit
CK_C_SetAttributeValue C_SetAttributeValue
CK_C_DigestUpdate C_DigestUpdate
CK_C_SeedRandom C_SeedRandom
CK_C_DecryptFinal C_DecryptFinal
CK_C_FindObjects C_FindObjects
CK_C_DeriveKey C_DeriveKey
struct ck_version version
CK_C_DigestFinal C_DigestFinal
CK_C_SignEncryptUpdate C_SignEncryptUpdate
CK_C_VerifyUpdate C_VerifyUpdate
CK_C_CopyObject C_CopyObject
CK_C_DecryptDigestUpdate C_DecryptDigestUpdate
CK_C_CancelFunction C_CancelFunction
CK_C_GenerateKey C_GenerateKey
CK_C_SignFinal C_SignFinal
CK_C_DigestKey C_DigestKey
CK_C_GetFunctionStatus C_GetFunctionStatus
CK_C_Initialize C_Initialize
CK_C_DigestInit C_DigestInit
CK_C_GetOperationState C_GetOperationState
CK_C_GetAttributeValue C_GetAttributeValue
CK_C_DigestEncryptUpdate C_DigestEncryptUpdate
CK_C_DecryptUpdate C_DecryptUpdate
CK_C_DecryptVerifyUpdate C_DecryptVerifyUpdate
CK_C_DecryptInit C_DecryptInit
CK_C_InitToken C_InitToken
CK_C_CreateObject C_CreateObject
CK_C_GetTokenInfo C_GetTokenInfo
CK_C_CloseAllSessions C_CloseAllSessions
CK_C_VerifyFinal C_VerifyFinal
CK_C_GetObjectSize C_GetObjectSize
CK_C_VerifyRecoverInit C_VerifyRecoverInit
CK_C_GetSessionInfo C_GetSessionInfo
CK_C_SetOperationState C_SetOperationState
CK_C_VerifyRecover C_VerifyRecover
CK_C_VerifyInit C_VerifyInit
CK_C_GetSlotInfo C_GetSlotInfo
unsigned long max_key_size
unsigned long min_key_size
ck_mechanism_type_t mechanism
unsigned long parameter_len
unsigned long device_error
unsigned long total_public_memory
unsigned long free_public_memory
unsigned long max_rw_session_count
unsigned long max_session_count
unsigned long free_private_memory
unsigned long total_private_memory
unsigned long rw_session_count
unsigned long session_count
unsigned long max_pin_len
unsigned long min_pin_len
yubihsm_pkcs11_slot * slot
CK_FUNCTION_LIST function_list
session operation op digest digest_len