1*7f2fe78bSCy Schubert /* 2*7f2fe78bSCy Schubert Copyright 2006 g10 Code GmbH 3*7f2fe78bSCy Schubert Copyright 2006 Andreas Jellinghaus 4*7f2fe78bSCy Schubert 5*7f2fe78bSCy Schubert This file is free software; as a special exception the author gives 6*7f2fe78bSCy Schubert unlimited permission to copy and/or distribute it, with or without 7*7f2fe78bSCy Schubert modifications, as long as this notice is preserved. 8*7f2fe78bSCy Schubert 9*7f2fe78bSCy Schubert This file is distributed in the hope that it will be useful, but 10*7f2fe78bSCy Schubert WITHOUT ANY WARRANTY, to the extent permitted by law; without even 11*7f2fe78bSCy Schubert the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12*7f2fe78bSCy Schubert PURPOSE. */ 13*7f2fe78bSCy Schubert 14*7f2fe78bSCy Schubert /* Please submit changes back to the Scute project at 15*7f2fe78bSCy Schubert https://www.scute.org/ (or send them to marcus@g10code.com), so that 16*7f2fe78bSCy Schubert they can be picked up by other projects from there as well. */ 17*7f2fe78bSCy Schubert 18*7f2fe78bSCy Schubert /* This file is a modified implementation of the PKCS #11 standard by 19*7f2fe78bSCy Schubert RSA Security Inc. It is mostly a drop-in replacement, with the 20*7f2fe78bSCy Schubert following change: 21*7f2fe78bSCy Schubert 22*7f2fe78bSCy Schubert This header file does not require any macro definitions by the user 23*7f2fe78bSCy Schubert (like CK_DEFINE_FUNCTION etc). In fact, it defines those macros 24*7f2fe78bSCy Schubert for you (if useful, some are missing, let me know if you need 25*7f2fe78bSCy Schubert more). 26*7f2fe78bSCy Schubert 27*7f2fe78bSCy Schubert There is an additional API available that does comply better to the 28*7f2fe78bSCy Schubert GNU coding standard. It can be switched on by defining 29*7f2fe78bSCy Schubert CRYPTOKI_GNU before including this header file. For this, the 30*7f2fe78bSCy Schubert following changes are made to the specification: 31*7f2fe78bSCy Schubert 32*7f2fe78bSCy Schubert All structure types are changed to a "struct ck_foo" where CK_FOO 33*7f2fe78bSCy Schubert is the type name in PKCS #11. 34*7f2fe78bSCy Schubert 35*7f2fe78bSCy Schubert All non-structure types are changed to ck_foo_t where CK_FOO is the 36*7f2fe78bSCy Schubert lowercase version of the type name in PKCS #11. The basic types 37*7f2fe78bSCy Schubert (CK_ULONG et al.) are removed without substitute. 38*7f2fe78bSCy Schubert 39*7f2fe78bSCy Schubert All members of structures are modified in the following way: Type 40*7f2fe78bSCy Schubert indication prefixes are removed, and underscore characters are 41*7f2fe78bSCy Schubert inserted before words. Then the result is lowercased. 42*7f2fe78bSCy Schubert 43*7f2fe78bSCy Schubert Note that function names are still in the original case, as they 44*7f2fe78bSCy Schubert need for ABI compatibility. 45*7f2fe78bSCy Schubert 46*7f2fe78bSCy Schubert CK_FALSE, CK_TRUE and NULL_PTR are removed without substitute. Use 47*7f2fe78bSCy Schubert <stdbool.h>. 48*7f2fe78bSCy Schubert 49*7f2fe78bSCy Schubert If CRYPTOKI_COMPAT is defined before including this header file, 50*7f2fe78bSCy Schubert then none of the API changes above take place, and the API is the 51*7f2fe78bSCy Schubert one defined by the PKCS #11 standard. */ 52*7f2fe78bSCy Schubert 53*7f2fe78bSCy Schubert #ifndef PKCS11_H 54*7f2fe78bSCy Schubert #define PKCS11_H 1 55*7f2fe78bSCy Schubert 56*7f2fe78bSCy Schubert #if defined(__cplusplus) 57*7f2fe78bSCy Schubert extern "C" { 58*7f2fe78bSCy Schubert #endif 59*7f2fe78bSCy Schubert 60*7f2fe78bSCy Schubert 61*7f2fe78bSCy Schubert /* The version of cryptoki we implement. The revision is changed with 62*7f2fe78bSCy Schubert each modification of this file. If you do not use the "official" 63*7f2fe78bSCy Schubert version of this file, please consider deleting the revision macro 64*7f2fe78bSCy Schubert (you may use a macro with a different name to keep track of your 65*7f2fe78bSCy Schubert versions). */ 66*7f2fe78bSCy Schubert #define CRYPTOKI_VERSION_MAJOR 2 67*7f2fe78bSCy Schubert #define CRYPTOKI_VERSION_MINOR 20 68*7f2fe78bSCy Schubert #define CRYPTOKI_VERSION_REVISION 6 69*7f2fe78bSCy Schubert 70*7f2fe78bSCy Schubert 71*7f2fe78bSCy Schubert /* Compatibility interface is default, unless CRYPTOKI_GNU is 72*7f2fe78bSCy Schubert given. */ 73*7f2fe78bSCy Schubert #ifndef CRYPTOKI_GNU 74*7f2fe78bSCy Schubert #ifndef CRYPTOKI_COMPAT 75*7f2fe78bSCy Schubert #define CRYPTOKI_COMPAT 1 76*7f2fe78bSCy Schubert #endif 77*7f2fe78bSCy Schubert #endif 78*7f2fe78bSCy Schubert 79*7f2fe78bSCy Schubert /* System dependencies. */ 80*7f2fe78bSCy Schubert 81*7f2fe78bSCy Schubert #if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32) 82*7f2fe78bSCy Schubert 83*7f2fe78bSCy Schubert /* There is a matching pop below. */ 84*7f2fe78bSCy Schubert #pragma pack(push, cryptoki, 1) 85*7f2fe78bSCy Schubert 86*7f2fe78bSCy Schubert #ifdef CRYPTOKI_EXPORTS 87*7f2fe78bSCy Schubert #define CK_SPEC __declspec(dllexport) 88*7f2fe78bSCy Schubert #else 89*7f2fe78bSCy Schubert #define CK_SPEC __declspec(dllimport) 90*7f2fe78bSCy Schubert #endif 91*7f2fe78bSCy Schubert 92*7f2fe78bSCy Schubert #else 93*7f2fe78bSCy Schubert 94*7f2fe78bSCy Schubert #define CK_SPEC 95*7f2fe78bSCy Schubert 96*7f2fe78bSCy Schubert #endif 97*7f2fe78bSCy Schubert 98*7f2fe78bSCy Schubert #ifdef CRYPTOKI_COMPAT 99*7f2fe78bSCy Schubert /* If we are in compatibility mode, switch all exposed names to the 100*7f2fe78bSCy Schubert PKCS #11 variant. There are corresponding #undefs below. */ 101*7f2fe78bSCy Schubert 102*7f2fe78bSCy Schubert #define ck_flags_t CK_FLAGS 103*7f2fe78bSCy Schubert #define ck_version _CK_VERSION 104*7f2fe78bSCy Schubert 105*7f2fe78bSCy Schubert #define ck_info _CK_INFO 106*7f2fe78bSCy Schubert #define cryptoki_version cryptokiVersion 107*7f2fe78bSCy Schubert #define manufacturer_id manufacturerID 108*7f2fe78bSCy Schubert #define library_description libraryDescription 109*7f2fe78bSCy Schubert #define library_version libraryVersion 110*7f2fe78bSCy Schubert 111*7f2fe78bSCy Schubert #define ck_notification_t CK_NOTIFICATION 112*7f2fe78bSCy Schubert #define ck_slot_id_t CK_SLOT_ID 113*7f2fe78bSCy Schubert 114*7f2fe78bSCy Schubert #define ck_slot_info _CK_SLOT_INFO 115*7f2fe78bSCy Schubert #define slot_description slotDescription 116*7f2fe78bSCy Schubert #define hardware_version hardwareVersion 117*7f2fe78bSCy Schubert #define firmware_version firmwareVersion 118*7f2fe78bSCy Schubert 119*7f2fe78bSCy Schubert #define ck_token_info _CK_TOKEN_INFO 120*7f2fe78bSCy Schubert #define serial_number serialNumber 121*7f2fe78bSCy Schubert #define max_session_count ulMaxSessionCount 122*7f2fe78bSCy Schubert #define session_count ulSessionCount 123*7f2fe78bSCy Schubert #define max_rw_session_count ulMaxRwSessionCount 124*7f2fe78bSCy Schubert #define rw_session_count ulRwSessionCount 125*7f2fe78bSCy Schubert #define max_pin_len ulMaxPinLen 126*7f2fe78bSCy Schubert #define min_pin_len ulMinPinLen 127*7f2fe78bSCy Schubert #define total_public_memory ulTotalPublicMemory 128*7f2fe78bSCy Schubert #define free_public_memory ulFreePublicMemory 129*7f2fe78bSCy Schubert #define total_private_memory ulTotalPrivateMemory 130*7f2fe78bSCy Schubert #define free_private_memory ulFreePrivateMemory 131*7f2fe78bSCy Schubert #define utc_time utcTime 132*7f2fe78bSCy Schubert 133*7f2fe78bSCy Schubert #define ck_session_handle_t CK_SESSION_HANDLE 134*7f2fe78bSCy Schubert #define ck_user_type_t CK_USER_TYPE 135*7f2fe78bSCy Schubert #define ck_state_t CK_STATE 136*7f2fe78bSCy Schubert 137*7f2fe78bSCy Schubert #define ck_session_info _CK_SESSION_INFO 138*7f2fe78bSCy Schubert #define slot_id slotID 139*7f2fe78bSCy Schubert #define device_error ulDeviceError 140*7f2fe78bSCy Schubert 141*7f2fe78bSCy Schubert #define ck_object_handle_t CK_OBJECT_HANDLE 142*7f2fe78bSCy Schubert #define ck_object_class_t CK_OBJECT_CLASS 143*7f2fe78bSCy Schubert #define ck_hw_feature_type_t CK_HW_FEATURE_TYPE 144*7f2fe78bSCy Schubert #define ck_key_type_t CK_KEY_TYPE 145*7f2fe78bSCy Schubert #define ck_certificate_type_t CK_CERTIFICATE_TYPE 146*7f2fe78bSCy Schubert #define ck_attribute_type_t CK_ATTRIBUTE_TYPE 147*7f2fe78bSCy Schubert 148*7f2fe78bSCy Schubert #define ck_attribute _CK_ATTRIBUTE 149*7f2fe78bSCy Schubert #define value pValue 150*7f2fe78bSCy Schubert #define value_len ulValueLen 151*7f2fe78bSCy Schubert 152*7f2fe78bSCy Schubert #define ck_date _CK_DATE 153*7f2fe78bSCy Schubert 154*7f2fe78bSCy Schubert #define ck_mechanism_type_t CK_MECHANISM_TYPE 155*7f2fe78bSCy Schubert 156*7f2fe78bSCy Schubert #define ck_mechanism _CK_MECHANISM 157*7f2fe78bSCy Schubert #define parameter pParameter 158*7f2fe78bSCy Schubert #define parameter_len ulParameterLen 159*7f2fe78bSCy Schubert 160*7f2fe78bSCy Schubert #define ck_mechanism_info _CK_MECHANISM_INFO 161*7f2fe78bSCy Schubert #define min_key_size ulMinKeySize 162*7f2fe78bSCy Schubert #define max_key_size ulMaxKeySize 163*7f2fe78bSCy Schubert 164*7f2fe78bSCy Schubert #define ck_rv_t CK_RV 165*7f2fe78bSCy Schubert #define ck_notify_t CK_NOTIFY 166*7f2fe78bSCy Schubert 167*7f2fe78bSCy Schubert #define ck_function_list _CK_FUNCTION_LIST 168*7f2fe78bSCy Schubert 169*7f2fe78bSCy Schubert #define ck_createmutex_t CK_CREATEMUTEX 170*7f2fe78bSCy Schubert #define ck_destroymutex_t CK_DESTROYMUTEX 171*7f2fe78bSCy Schubert #define ck_lockmutex_t CK_LOCKMUTEX 172*7f2fe78bSCy Schubert #define ck_unlockmutex_t CK_UNLOCKMUTEX 173*7f2fe78bSCy Schubert 174*7f2fe78bSCy Schubert #define ck_c_initialize_args _CK_C_INITIALIZE_ARGS 175*7f2fe78bSCy Schubert #define create_mutex CreateMutex 176*7f2fe78bSCy Schubert #define destroy_mutex DestroyMutex 177*7f2fe78bSCy Schubert #define lock_mutex LockMutex 178*7f2fe78bSCy Schubert #define unlock_mutex UnlockMutex 179*7f2fe78bSCy Schubert #define reserved pReserved 180*7f2fe78bSCy Schubert 181*7f2fe78bSCy Schubert #endif /* CRYPTOKI_COMPAT */ 182*7f2fe78bSCy Schubert 183*7f2fe78bSCy Schubert 184*7f2fe78bSCy Schubert typedef unsigned long ck_flags_t; 185*7f2fe78bSCy Schubert 186*7f2fe78bSCy Schubert struct ck_version 187*7f2fe78bSCy Schubert { 188*7f2fe78bSCy Schubert unsigned char major; 189*7f2fe78bSCy Schubert unsigned char minor; 190*7f2fe78bSCy Schubert }; 191*7f2fe78bSCy Schubert 192*7f2fe78bSCy Schubert 193*7f2fe78bSCy Schubert struct ck_info 194*7f2fe78bSCy Schubert { 195*7f2fe78bSCy Schubert struct ck_version cryptoki_version; 196*7f2fe78bSCy Schubert unsigned char manufacturer_id[32]; 197*7f2fe78bSCy Schubert ck_flags_t flags; 198*7f2fe78bSCy Schubert unsigned char library_description[32]; 199*7f2fe78bSCy Schubert struct ck_version library_version; 200*7f2fe78bSCy Schubert }; 201*7f2fe78bSCy Schubert 202*7f2fe78bSCy Schubert 203*7f2fe78bSCy Schubert typedef unsigned long ck_notification_t; 204*7f2fe78bSCy Schubert 205*7f2fe78bSCy Schubert #define CKN_SURRENDER (0) 206*7f2fe78bSCy Schubert 207*7f2fe78bSCy Schubert 208*7f2fe78bSCy Schubert typedef unsigned long ck_slot_id_t; 209*7f2fe78bSCy Schubert 210*7f2fe78bSCy Schubert 211*7f2fe78bSCy Schubert struct ck_slot_info 212*7f2fe78bSCy Schubert { 213*7f2fe78bSCy Schubert unsigned char slot_description[64]; 214*7f2fe78bSCy Schubert unsigned char manufacturer_id[32]; 215*7f2fe78bSCy Schubert ck_flags_t flags; 216*7f2fe78bSCy Schubert struct ck_version hardware_version; 217*7f2fe78bSCy Schubert struct ck_version firmware_version; 218*7f2fe78bSCy Schubert }; 219*7f2fe78bSCy Schubert 220*7f2fe78bSCy Schubert 221*7f2fe78bSCy Schubert #define CKF_TOKEN_PRESENT (1 << 0) 222*7f2fe78bSCy Schubert #define CKF_REMOVABLE_DEVICE (1 << 1) 223*7f2fe78bSCy Schubert #define CKF_HW_SLOT (1 << 2) 224*7f2fe78bSCy Schubert #define CKF_ARRAY_ATTRIBUTE (1 << 30) 225*7f2fe78bSCy Schubert 226*7f2fe78bSCy Schubert 227*7f2fe78bSCy Schubert struct ck_token_info 228*7f2fe78bSCy Schubert { 229*7f2fe78bSCy Schubert unsigned char label[32]; 230*7f2fe78bSCy Schubert unsigned char manufacturer_id[32]; 231*7f2fe78bSCy Schubert unsigned char model[16]; 232*7f2fe78bSCy Schubert unsigned char serial_number[16]; 233*7f2fe78bSCy Schubert ck_flags_t flags; 234*7f2fe78bSCy Schubert unsigned long max_session_count; 235*7f2fe78bSCy Schubert unsigned long session_count; 236*7f2fe78bSCy Schubert unsigned long max_rw_session_count; 237*7f2fe78bSCy Schubert unsigned long rw_session_count; 238*7f2fe78bSCy Schubert unsigned long max_pin_len; 239*7f2fe78bSCy Schubert unsigned long min_pin_len; 240*7f2fe78bSCy Schubert unsigned long total_public_memory; 241*7f2fe78bSCy Schubert unsigned long free_public_memory; 242*7f2fe78bSCy Schubert unsigned long total_private_memory; 243*7f2fe78bSCy Schubert unsigned long free_private_memory; 244*7f2fe78bSCy Schubert struct ck_version hardware_version; 245*7f2fe78bSCy Schubert struct ck_version firmware_version; 246*7f2fe78bSCy Schubert unsigned char utc_time[16]; 247*7f2fe78bSCy Schubert }; 248*7f2fe78bSCy Schubert 249*7f2fe78bSCy Schubert 250*7f2fe78bSCy Schubert #define CKF_RNG (1 << 0) 251*7f2fe78bSCy Schubert #define CKF_WRITE_PROTECTED (1 << 1) 252*7f2fe78bSCy Schubert #define CKF_LOGIN_REQUIRED (1 << 2) 253*7f2fe78bSCy Schubert #define CKF_USER_PIN_INITIALIZED (1 << 3) 254*7f2fe78bSCy Schubert #define CKF_RESTORE_KEY_NOT_NEEDED (1 << 5) 255*7f2fe78bSCy Schubert #define CKF_CLOCK_ON_TOKEN (1 << 6) 256*7f2fe78bSCy Schubert #define CKF_PROTECTED_AUTHENTICATION_PATH (1 << 8) 257*7f2fe78bSCy Schubert #define CKF_DUAL_CRYPTO_OPERATIONS (1 << 9) 258*7f2fe78bSCy Schubert #define CKF_TOKEN_INITIALIZED (1 << 10) 259*7f2fe78bSCy Schubert #define CKF_SECONDARY_AUTHENTICATION (1 << 11) 260*7f2fe78bSCy Schubert #define CKF_USER_PIN_COUNT_LOW (1 << 16) 261*7f2fe78bSCy Schubert #define CKF_USER_PIN_FINAL_TRY (1 << 17) 262*7f2fe78bSCy Schubert #define CKF_USER_PIN_LOCKED (1 << 18) 263*7f2fe78bSCy Schubert #define CKF_USER_PIN_TO_BE_CHANGED (1 << 19) 264*7f2fe78bSCy Schubert #define CKF_SO_PIN_COUNT_LOW (1 << 20) 265*7f2fe78bSCy Schubert #define CKF_SO_PIN_FINAL_TRY (1 << 21) 266*7f2fe78bSCy Schubert #define CKF_SO_PIN_LOCKED (1 << 22) 267*7f2fe78bSCy Schubert #define CKF_SO_PIN_TO_BE_CHANGED (1 << 23) 268*7f2fe78bSCy Schubert 269*7f2fe78bSCy Schubert #define CK_UNAVAILABLE_INFORMATION ((unsigned long) -1) 270*7f2fe78bSCy Schubert #define CK_EFFECTIVELY_INFINITE (0) 271*7f2fe78bSCy Schubert 272*7f2fe78bSCy Schubert 273*7f2fe78bSCy Schubert typedef unsigned long ck_session_handle_t; 274*7f2fe78bSCy Schubert 275*7f2fe78bSCy Schubert #define CK_INVALID_HANDLE (0) 276*7f2fe78bSCy Schubert 277*7f2fe78bSCy Schubert 278*7f2fe78bSCy Schubert typedef unsigned long ck_user_type_t; 279*7f2fe78bSCy Schubert 280*7f2fe78bSCy Schubert #define CKU_SO (0) 281*7f2fe78bSCy Schubert #define CKU_USER (1) 282*7f2fe78bSCy Schubert #define CKU_CONTEXT_SPECIFIC (2) 283*7f2fe78bSCy Schubert 284*7f2fe78bSCy Schubert 285*7f2fe78bSCy Schubert typedef unsigned long ck_state_t; 286*7f2fe78bSCy Schubert 287*7f2fe78bSCy Schubert #define CKS_RO_PUBLIC_SESSION (0) 288*7f2fe78bSCy Schubert #define CKS_RO_USER_FUNCTIONS (1) 289*7f2fe78bSCy Schubert #define CKS_RW_PUBLIC_SESSION (2) 290*7f2fe78bSCy Schubert #define CKS_RW_USER_FUNCTIONS (3) 291*7f2fe78bSCy Schubert #define CKS_RW_SO_FUNCTIONS (4) 292*7f2fe78bSCy Schubert 293*7f2fe78bSCy Schubert 294*7f2fe78bSCy Schubert struct ck_session_info 295*7f2fe78bSCy Schubert { 296*7f2fe78bSCy Schubert ck_slot_id_t slot_id; 297*7f2fe78bSCy Schubert ck_state_t state; 298*7f2fe78bSCy Schubert ck_flags_t flags; 299*7f2fe78bSCy Schubert unsigned long device_error; 300*7f2fe78bSCy Schubert }; 301*7f2fe78bSCy Schubert 302*7f2fe78bSCy Schubert #define CKF_RW_SESSION (1 << 1) 303*7f2fe78bSCy Schubert #define CKF_SERIAL_SESSION (1 << 2) 304*7f2fe78bSCy Schubert 305*7f2fe78bSCy Schubert 306*7f2fe78bSCy Schubert typedef unsigned long ck_object_handle_t; 307*7f2fe78bSCy Schubert 308*7f2fe78bSCy Schubert 309*7f2fe78bSCy Schubert typedef unsigned long ck_object_class_t; 310*7f2fe78bSCy Schubert 311*7f2fe78bSCy Schubert #define CKO_DATA (0) 312*7f2fe78bSCy Schubert #define CKO_CERTIFICATE (1) 313*7f2fe78bSCy Schubert #define CKO_PUBLIC_KEY (2) 314*7f2fe78bSCy Schubert #define CKO_PRIVATE_KEY (3) 315*7f2fe78bSCy Schubert #define CKO_SECRET_KEY (4) 316*7f2fe78bSCy Schubert #define CKO_HW_FEATURE (5) 317*7f2fe78bSCy Schubert #define CKO_DOMAIN_PARAMETERS (6) 318*7f2fe78bSCy Schubert #define CKO_MECHANISM (7) 319*7f2fe78bSCy Schubert #define CKO_VENDOR_DEFINED ((unsigned long) (1 << 31)) 320*7f2fe78bSCy Schubert 321*7f2fe78bSCy Schubert 322*7f2fe78bSCy Schubert typedef unsigned long ck_hw_feature_type_t; 323*7f2fe78bSCy Schubert 324*7f2fe78bSCy Schubert #define CKH_MONOTONIC_COUNTER (1) 325*7f2fe78bSCy Schubert #define CKH_CLOCK (2) 326*7f2fe78bSCy Schubert #define CKH_USER_INTERFACE (3) 327*7f2fe78bSCy Schubert #define CKH_VENDOR_DEFINED ((unsigned long) (1 << 31)) 328*7f2fe78bSCy Schubert 329*7f2fe78bSCy Schubert 330*7f2fe78bSCy Schubert typedef unsigned long ck_key_type_t; 331*7f2fe78bSCy Schubert 332*7f2fe78bSCy Schubert #define CKK_RSA (0) 333*7f2fe78bSCy Schubert #define CKK_DSA (1) 334*7f2fe78bSCy Schubert #define CKK_DH (2) 335*7f2fe78bSCy Schubert #define CKK_ECDSA (3) 336*7f2fe78bSCy Schubert #define CKK_EC (3) 337*7f2fe78bSCy Schubert #define CKK_X9_42_DH (4) 338*7f2fe78bSCy Schubert #define CKK_KEA (5) 339*7f2fe78bSCy Schubert #define CKK_GENERIC_SECRET (0x10) 340*7f2fe78bSCy Schubert #define CKK_RC2 (0x11) 341*7f2fe78bSCy Schubert #define CKK_RC4 (0x12) 342*7f2fe78bSCy Schubert #define CKK_DES (0x13) 343*7f2fe78bSCy Schubert #define CKK_DES2 (0x14) 344*7f2fe78bSCy Schubert #define CKK_DES3 (0x15) 345*7f2fe78bSCy Schubert #define CKK_CAST (0x16) 346*7f2fe78bSCy Schubert #define CKK_CAST3 (0x17) 347*7f2fe78bSCy Schubert #define CKK_CAST128 (0x18) 348*7f2fe78bSCy Schubert #define CKK_RC5 (0x19) 349*7f2fe78bSCy Schubert #define CKK_IDEA (0x1a) 350*7f2fe78bSCy Schubert #define CKK_SKIPJACK (0x1b) 351*7f2fe78bSCy Schubert #define CKK_BATON (0x1c) 352*7f2fe78bSCy Schubert #define CKK_JUNIPER (0x1d) 353*7f2fe78bSCy Schubert #define CKK_CDMF (0x1e) 354*7f2fe78bSCy Schubert #define CKK_AES (0x1f) 355*7f2fe78bSCy Schubert #define CKK_BLOWFISH (0x20) 356*7f2fe78bSCy Schubert #define CKK_TWOFISH (0x21) 357*7f2fe78bSCy Schubert #define CKK_VENDOR_DEFINED ((unsigned long) (1 << 31)) 358*7f2fe78bSCy Schubert 359*7f2fe78bSCy Schubert 360*7f2fe78bSCy Schubert typedef unsigned long ck_certificate_type_t; 361*7f2fe78bSCy Schubert 362*7f2fe78bSCy Schubert #define CKC_X_509 (0) 363*7f2fe78bSCy Schubert #define CKC_X_509_ATTR_CERT (1) 364*7f2fe78bSCy Schubert #define CKC_WTLS (2) 365*7f2fe78bSCy Schubert #define CKC_VENDOR_DEFINED ((unsigned long) (1 << 31)) 366*7f2fe78bSCy Schubert 367*7f2fe78bSCy Schubert 368*7f2fe78bSCy Schubert typedef unsigned long ck_attribute_type_t; 369*7f2fe78bSCy Schubert 370*7f2fe78bSCy Schubert #define CKA_CLASS (0) 371*7f2fe78bSCy Schubert #define CKA_TOKEN (1) 372*7f2fe78bSCy Schubert #define CKA_PRIVATE (2) 373*7f2fe78bSCy Schubert #define CKA_LABEL (3) 374*7f2fe78bSCy Schubert #define CKA_APPLICATION (0x10) 375*7f2fe78bSCy Schubert #define CKA_VALUE (0x11) 376*7f2fe78bSCy Schubert #define CKA_OBJECT_ID (0x12) 377*7f2fe78bSCy Schubert #define CKA_CERTIFICATE_TYPE (0x80) 378*7f2fe78bSCy Schubert #define CKA_ISSUER (0x81) 379*7f2fe78bSCy Schubert #define CKA_SERIAL_NUMBER (0x82) 380*7f2fe78bSCy Schubert #define CKA_AC_ISSUER (0x83) 381*7f2fe78bSCy Schubert #define CKA_OWNER (0x84) 382*7f2fe78bSCy Schubert #define CKA_ATTR_TYPES (0x85) 383*7f2fe78bSCy Schubert #define CKA_TRUSTED (0x86) 384*7f2fe78bSCy Schubert #define CKA_CERTIFICATE_CATEGORY (0x87) 385*7f2fe78bSCy Schubert #define CKA_JAVA_MIDP_SECURITY_DOMAIN (0x88) 386*7f2fe78bSCy Schubert #define CKA_URL (0x89) 387*7f2fe78bSCy Schubert #define CKA_HASH_OF_SUBJECT_PUBLIC_KEY (0x8a) 388*7f2fe78bSCy Schubert #define CKA_HASH_OF_ISSUER_PUBLIC_KEY (0x8b) 389*7f2fe78bSCy Schubert #define CKA_CHECK_VALUE (0x90) 390*7f2fe78bSCy Schubert #define CKA_KEY_TYPE (0x100) 391*7f2fe78bSCy Schubert #define CKA_SUBJECT (0x101) 392*7f2fe78bSCy Schubert #define CKA_ID (0x102) 393*7f2fe78bSCy Schubert #define CKA_SENSITIVE (0x103) 394*7f2fe78bSCy Schubert #define CKA_ENCRYPT (0x104) 395*7f2fe78bSCy Schubert #define CKA_DECRYPT (0x105) 396*7f2fe78bSCy Schubert #define CKA_WRAP (0x106) 397*7f2fe78bSCy Schubert #define CKA_UNWRAP (0x107) 398*7f2fe78bSCy Schubert #define CKA_SIGN (0x108) 399*7f2fe78bSCy Schubert #define CKA_SIGN_RECOVER (0x109) 400*7f2fe78bSCy Schubert #define CKA_VERIFY (0x10a) 401*7f2fe78bSCy Schubert #define CKA_VERIFY_RECOVER (0x10b) 402*7f2fe78bSCy Schubert #define CKA_DERIVE (0x10c) 403*7f2fe78bSCy Schubert #define CKA_START_DATE (0x110) 404*7f2fe78bSCy Schubert #define CKA_END_DATE (0x111) 405*7f2fe78bSCy Schubert #define CKA_MODULUS (0x120) 406*7f2fe78bSCy Schubert #define CKA_MODULUS_BITS (0x121) 407*7f2fe78bSCy Schubert #define CKA_PUBLIC_EXPONENT (0x122) 408*7f2fe78bSCy Schubert #define CKA_PRIVATE_EXPONENT (0x123) 409*7f2fe78bSCy Schubert #define CKA_PRIME_1 (0x124) 410*7f2fe78bSCy Schubert #define CKA_PRIME_2 (0x125) 411*7f2fe78bSCy Schubert #define CKA_EXPONENT_1 (0x126) 412*7f2fe78bSCy Schubert #define CKA_EXPONENT_2 (0x127) 413*7f2fe78bSCy Schubert #define CKA_COEFFICIENT (0x128) 414*7f2fe78bSCy Schubert #define CKA_PRIME (0x130) 415*7f2fe78bSCy Schubert #define CKA_SUBPRIME (0x131) 416*7f2fe78bSCy Schubert #define CKA_BASE (0x132) 417*7f2fe78bSCy Schubert #define CKA_PRIME_BITS (0x133) 418*7f2fe78bSCy Schubert #define CKA_SUB_PRIME_BITS (0x134) 419*7f2fe78bSCy Schubert #define CKA_VALUE_BITS (0x160) 420*7f2fe78bSCy Schubert #define CKA_VALUE_LEN (0x161) 421*7f2fe78bSCy Schubert #define CKA_EXTRACTABLE (0x162) 422*7f2fe78bSCy Schubert #define CKA_LOCAL (0x163) 423*7f2fe78bSCy Schubert #define CKA_NEVER_EXTRACTABLE (0x164) 424*7f2fe78bSCy Schubert #define CKA_ALWAYS_SENSITIVE (0x165) 425*7f2fe78bSCy Schubert #define CKA_KEY_GEN_MECHANISM (0x166) 426*7f2fe78bSCy Schubert #define CKA_MODIFIABLE (0x170) 427*7f2fe78bSCy Schubert #define CKA_ECDSA_PARAMS (0x180) 428*7f2fe78bSCy Schubert #define CKA_EC_PARAMS (0x180) 429*7f2fe78bSCy Schubert #define CKA_EC_POINT (0x181) 430*7f2fe78bSCy Schubert #define CKA_SECONDARY_AUTH (0x200) 431*7f2fe78bSCy Schubert #define CKA_AUTH_PIN_FLAGS (0x201) 432*7f2fe78bSCy Schubert #define CKA_ALWAYS_AUTHENTICATE (0x202) 433*7f2fe78bSCy Schubert #define CKA_WRAP_WITH_TRUSTED (0x210) 434*7f2fe78bSCy Schubert #define CKA_HW_FEATURE_TYPE (0x300) 435*7f2fe78bSCy Schubert #define CKA_RESET_ON_INIT (0x301) 436*7f2fe78bSCy Schubert #define CKA_HAS_RESET (0x302) 437*7f2fe78bSCy Schubert #define CKA_PIXEL_X (0x400) 438*7f2fe78bSCy Schubert #define CKA_PIXEL_Y (0x401) 439*7f2fe78bSCy Schubert #define CKA_RESOLUTION (0x402) 440*7f2fe78bSCy Schubert #define CKA_CHAR_ROWS (0x403) 441*7f2fe78bSCy Schubert #define CKA_CHAR_COLUMNS (0x404) 442*7f2fe78bSCy Schubert #define CKA_COLOR (0x405) 443*7f2fe78bSCy Schubert #define CKA_BITS_PER_PIXEL (0x406) 444*7f2fe78bSCy Schubert #define CKA_CHAR_SETS (0x480) 445*7f2fe78bSCy Schubert #define CKA_ENCODING_METHODS (0x481) 446*7f2fe78bSCy Schubert #define CKA_MIME_TYPES (0x482) 447*7f2fe78bSCy Schubert #define CKA_MECHANISM_TYPE (0x500) 448*7f2fe78bSCy Schubert #define CKA_REQUIRED_CMS_ATTRIBUTES (0x501) 449*7f2fe78bSCy Schubert #define CKA_DEFAULT_CMS_ATTRIBUTES (0x502) 450*7f2fe78bSCy Schubert #define CKA_SUPPORTED_CMS_ATTRIBUTES (0x503) 451*7f2fe78bSCy Schubert #define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE | 0x211) 452*7f2fe78bSCy Schubert #define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE | 0x212) 453*7f2fe78bSCy Schubert #define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE | 0x600) 454*7f2fe78bSCy Schubert #define CKA_VENDOR_DEFINED ((unsigned long) (1 << 31)) 455*7f2fe78bSCy Schubert 456*7f2fe78bSCy Schubert 457*7f2fe78bSCy Schubert struct ck_attribute 458*7f2fe78bSCy Schubert { 459*7f2fe78bSCy Schubert ck_attribute_type_t type; 460*7f2fe78bSCy Schubert void *value; 461*7f2fe78bSCy Schubert unsigned long value_len; 462*7f2fe78bSCy Schubert }; 463*7f2fe78bSCy Schubert 464*7f2fe78bSCy Schubert 465*7f2fe78bSCy Schubert struct ck_date 466*7f2fe78bSCy Schubert { 467*7f2fe78bSCy Schubert unsigned char year[4]; 468*7f2fe78bSCy Schubert unsigned char month[2]; 469*7f2fe78bSCy Schubert unsigned char day[2]; 470*7f2fe78bSCy Schubert }; 471*7f2fe78bSCy Schubert 472*7f2fe78bSCy Schubert 473*7f2fe78bSCy Schubert typedef unsigned long ck_mechanism_type_t; 474*7f2fe78bSCy Schubert 475*7f2fe78bSCy Schubert #define CKM_RSA_PKCS_KEY_PAIR_GEN (0) 476*7f2fe78bSCy Schubert #define CKM_RSA_PKCS (1) 477*7f2fe78bSCy Schubert #define CKM_RSA_9796 (2) 478*7f2fe78bSCy Schubert #define CKM_RSA_X_509 (3) 479*7f2fe78bSCy Schubert #define CKM_MD2_RSA_PKCS (4) 480*7f2fe78bSCy Schubert #define CKM_MD5_RSA_PKCS (5) 481*7f2fe78bSCy Schubert #define CKM_SHA1_RSA_PKCS (6) 482*7f2fe78bSCy Schubert #define CKM_RIPEMD128_RSA_PKCS (7) 483*7f2fe78bSCy Schubert #define CKM_RIPEMD160_RSA_PKCS (8) 484*7f2fe78bSCy Schubert #define CKM_RSA_PKCS_OAEP (9) 485*7f2fe78bSCy Schubert #define CKM_RSA_X9_31_KEY_PAIR_GEN (0xa) 486*7f2fe78bSCy Schubert #define CKM_RSA_X9_31 (0xb) 487*7f2fe78bSCy Schubert #define CKM_SHA1_RSA_X9_31 (0xc) 488*7f2fe78bSCy Schubert #define CKM_RSA_PKCS_PSS (0xd) 489*7f2fe78bSCy Schubert #define CKM_SHA1_RSA_PKCS_PSS (0xe) 490*7f2fe78bSCy Schubert #define CKM_DSA_KEY_PAIR_GEN (0x10) 491*7f2fe78bSCy Schubert #define CKM_DSA (0x11) 492*7f2fe78bSCy Schubert #define CKM_DSA_SHA1 (0x12) 493*7f2fe78bSCy Schubert #define CKM_DH_PKCS_KEY_PAIR_GEN (0x20) 494*7f2fe78bSCy Schubert #define CKM_DH_PKCS_DERIVE (0x21) 495*7f2fe78bSCy Schubert #define CKM_X9_42_DH_KEY_PAIR_GEN (0x30) 496*7f2fe78bSCy Schubert #define CKM_X9_42_DH_DERIVE (0x31) 497*7f2fe78bSCy Schubert #define CKM_X9_42_DH_HYBRID_DERIVE (0x32) 498*7f2fe78bSCy Schubert #define CKM_X9_42_MQV_DERIVE (0x33) 499*7f2fe78bSCy Schubert #define CKM_SHA256_RSA_PKCS (0x40) 500*7f2fe78bSCy Schubert #define CKM_SHA384_RSA_PKCS (0x41) 501*7f2fe78bSCy Schubert #define CKM_SHA512_RSA_PKCS (0x42) 502*7f2fe78bSCy Schubert #define CKM_SHA256_RSA_PKCS_PSS (0x43) 503*7f2fe78bSCy Schubert #define CKM_SHA384_RSA_PKCS_PSS (0x44) 504*7f2fe78bSCy Schubert #define CKM_SHA512_RSA_PKCS_PSS (0x45) 505*7f2fe78bSCy Schubert #define CKM_RC2_KEY_GEN (0x100) 506*7f2fe78bSCy Schubert #define CKM_RC2_ECB (0x101) 507*7f2fe78bSCy Schubert #define CKM_RC2_CBC (0x102) 508*7f2fe78bSCy Schubert #define CKM_RC2_MAC (0x103) 509*7f2fe78bSCy Schubert #define CKM_RC2_MAC_GENERAL (0x104) 510*7f2fe78bSCy Schubert #define CKM_RC2_CBC_PAD (0x105) 511*7f2fe78bSCy Schubert #define CKM_RC4_KEY_GEN (0x110) 512*7f2fe78bSCy Schubert #define CKM_RC4 (0x111) 513*7f2fe78bSCy Schubert #define CKM_DES_KEY_GEN (0x120) 514*7f2fe78bSCy Schubert #define CKM_DES_ECB (0x121) 515*7f2fe78bSCy Schubert #define CKM_DES_CBC (0x122) 516*7f2fe78bSCy Schubert #define CKM_DES_MAC (0x123) 517*7f2fe78bSCy Schubert #define CKM_DES_MAC_GENERAL (0x124) 518*7f2fe78bSCy Schubert #define CKM_DES_CBC_PAD (0x125) 519*7f2fe78bSCy Schubert #define CKM_DES2_KEY_GEN (0x130) 520*7f2fe78bSCy Schubert #define CKM_DES3_KEY_GEN (0x131) 521*7f2fe78bSCy Schubert #define CKM_DES3_ECB (0x132) 522*7f2fe78bSCy Schubert #define CKM_DES3_CBC (0x133) 523*7f2fe78bSCy Schubert #define CKM_DES3_MAC (0x134) 524*7f2fe78bSCy Schubert #define CKM_DES3_MAC_GENERAL (0x135) 525*7f2fe78bSCy Schubert #define CKM_DES3_CBC_PAD (0x136) 526*7f2fe78bSCy Schubert #define CKM_CDMF_KEY_GEN (0x140) 527*7f2fe78bSCy Schubert #define CKM_CDMF_ECB (0x141) 528*7f2fe78bSCy Schubert #define CKM_CDMF_CBC (0x142) 529*7f2fe78bSCy Schubert #define CKM_CDMF_MAC (0x143) 530*7f2fe78bSCy Schubert #define CKM_CDMF_MAC_GENERAL (0x144) 531*7f2fe78bSCy Schubert #define CKM_CDMF_CBC_PAD (0x145) 532*7f2fe78bSCy Schubert #define CKM_MD2 (0x200) 533*7f2fe78bSCy Schubert #define CKM_MD2_HMAC (0x201) 534*7f2fe78bSCy Schubert #define CKM_MD2_HMAC_GENERAL (0x202) 535*7f2fe78bSCy Schubert #define CKM_MD5 (0x210) 536*7f2fe78bSCy Schubert #define CKM_MD5_HMAC (0x211) 537*7f2fe78bSCy Schubert #define CKM_MD5_HMAC_GENERAL (0x212) 538*7f2fe78bSCy Schubert #define CKM_SHA_1 (0x220) 539*7f2fe78bSCy Schubert #define CKM_SHA_1_HMAC (0x221) 540*7f2fe78bSCy Schubert #define CKM_SHA_1_HMAC_GENERAL (0x222) 541*7f2fe78bSCy Schubert #define CKM_RIPEMD128 (0x230) 542*7f2fe78bSCy Schubert #define CKM_RIPEMD128_HMAC (0x231) 543*7f2fe78bSCy Schubert #define CKM_RIPEMD128_HMAC_GENERAL (0x232) 544*7f2fe78bSCy Schubert #define CKM_RIPEMD160 (0x240) 545*7f2fe78bSCy Schubert #define CKM_RIPEMD160_HMAC (0x241) 546*7f2fe78bSCy Schubert #define CKM_RIPEMD160_HMAC_GENERAL (0x242) 547*7f2fe78bSCy Schubert #define CKM_SHA256 (0x250) 548*7f2fe78bSCy Schubert #define CKM_SHA256_HMAC (0x251) 549*7f2fe78bSCy Schubert #define CKM_SHA256_HMAC_GENERAL (0x252) 550*7f2fe78bSCy Schubert #define CKM_SHA384 (0x260) 551*7f2fe78bSCy Schubert #define CKM_SHA384_HMAC (0x261) 552*7f2fe78bSCy Schubert #define CKM_SHA384_HMAC_GENERAL (0x262) 553*7f2fe78bSCy Schubert #define CKM_SHA512 (0x270) 554*7f2fe78bSCy Schubert #define CKM_SHA512_HMAC (0x271) 555*7f2fe78bSCy Schubert #define CKM_SHA512_HMAC_GENERAL (0x272) 556*7f2fe78bSCy Schubert #define CKM_CAST_KEY_GEN (0x300) 557*7f2fe78bSCy Schubert #define CKM_CAST_ECB (0x301) 558*7f2fe78bSCy Schubert #define CKM_CAST_CBC (0x302) 559*7f2fe78bSCy Schubert #define CKM_CAST_MAC (0x303) 560*7f2fe78bSCy Schubert #define CKM_CAST_MAC_GENERAL (0x304) 561*7f2fe78bSCy Schubert #define CKM_CAST_CBC_PAD (0x305) 562*7f2fe78bSCy Schubert #define CKM_CAST3_KEY_GEN (0x310) 563*7f2fe78bSCy Schubert #define CKM_CAST3_ECB (0x311) 564*7f2fe78bSCy Schubert #define CKM_CAST3_CBC (0x312) 565*7f2fe78bSCy Schubert #define CKM_CAST3_MAC (0x313) 566*7f2fe78bSCy Schubert #define CKM_CAST3_MAC_GENERAL (0x314) 567*7f2fe78bSCy Schubert #define CKM_CAST3_CBC_PAD (0x315) 568*7f2fe78bSCy Schubert #define CKM_CAST5_KEY_GEN (0x320) 569*7f2fe78bSCy Schubert #define CKM_CAST128_KEY_GEN (0x320) 570*7f2fe78bSCy Schubert #define CKM_CAST5_ECB (0x321) 571*7f2fe78bSCy Schubert #define CKM_CAST128_ECB (0x321) 572*7f2fe78bSCy Schubert #define CKM_CAST5_CBC (0x322) 573*7f2fe78bSCy Schubert #define CKM_CAST128_CBC (0x322) 574*7f2fe78bSCy Schubert #define CKM_CAST5_MAC (0x323) 575*7f2fe78bSCy Schubert #define CKM_CAST128_MAC (0x323) 576*7f2fe78bSCy Schubert #define CKM_CAST5_MAC_GENERAL (0x324) 577*7f2fe78bSCy Schubert #define CKM_CAST128_MAC_GENERAL (0x324) 578*7f2fe78bSCy Schubert #define CKM_CAST5_CBC_PAD (0x325) 579*7f2fe78bSCy Schubert #define CKM_CAST128_CBC_PAD (0x325) 580*7f2fe78bSCy Schubert #define CKM_RC5_KEY_GEN (0x330) 581*7f2fe78bSCy Schubert #define CKM_RC5_ECB (0x331) 582*7f2fe78bSCy Schubert #define CKM_RC5_CBC (0x332) 583*7f2fe78bSCy Schubert #define CKM_RC5_MAC (0x333) 584*7f2fe78bSCy Schubert #define CKM_RC5_MAC_GENERAL (0x334) 585*7f2fe78bSCy Schubert #define CKM_RC5_CBC_PAD (0x335) 586*7f2fe78bSCy Schubert #define CKM_IDEA_KEY_GEN (0x340) 587*7f2fe78bSCy Schubert #define CKM_IDEA_ECB (0x341) 588*7f2fe78bSCy Schubert #define CKM_IDEA_CBC (0x342) 589*7f2fe78bSCy Schubert #define CKM_IDEA_MAC (0x343) 590*7f2fe78bSCy Schubert #define CKM_IDEA_MAC_GENERAL (0x344) 591*7f2fe78bSCy Schubert #define CKM_IDEA_CBC_PAD (0x345) 592*7f2fe78bSCy Schubert #define CKM_GENERIC_SECRET_KEY_GEN (0x350) 593*7f2fe78bSCy Schubert #define CKM_CONCATENATE_BASE_AND_KEY (0x360) 594*7f2fe78bSCy Schubert #define CKM_CONCATENATE_BASE_AND_DATA (0x362) 595*7f2fe78bSCy Schubert #define CKM_CONCATENATE_DATA_AND_BASE (0x363) 596*7f2fe78bSCy Schubert #define CKM_XOR_BASE_AND_DATA (0x364) 597*7f2fe78bSCy Schubert #define CKM_EXTRACT_KEY_FROM_KEY (0x365) 598*7f2fe78bSCy Schubert #define CKM_SSL3_PRE_MASTER_KEY_GEN (0x370) 599*7f2fe78bSCy Schubert #define CKM_SSL3_MASTER_KEY_DERIVE (0x371) 600*7f2fe78bSCy Schubert #define CKM_SSL3_KEY_AND_MAC_DERIVE (0x372) 601*7f2fe78bSCy Schubert #define CKM_SSL3_MASTER_KEY_DERIVE_DH (0x373) 602*7f2fe78bSCy Schubert #define CKM_TLS_PRE_MASTER_KEY_GEN (0x374) 603*7f2fe78bSCy Schubert #define CKM_TLS_MASTER_KEY_DERIVE (0x375) 604*7f2fe78bSCy Schubert #define CKM_TLS_KEY_AND_MAC_DERIVE (0x376) 605*7f2fe78bSCy Schubert #define CKM_TLS_MASTER_KEY_DERIVE_DH (0x377) 606*7f2fe78bSCy Schubert #define CKM_SSL3_MD5_MAC (0x380) 607*7f2fe78bSCy Schubert #define CKM_SSL3_SHA1_MAC (0x381) 608*7f2fe78bSCy Schubert #define CKM_MD5_KEY_DERIVATION (0x390) 609*7f2fe78bSCy Schubert #define CKM_MD2_KEY_DERIVATION (0x391) 610*7f2fe78bSCy Schubert #define CKM_SHA1_KEY_DERIVATION (0x392) 611*7f2fe78bSCy Schubert #define CKM_PBE_MD2_DES_CBC (0x3a0) 612*7f2fe78bSCy Schubert #define CKM_PBE_MD5_DES_CBC (0x3a1) 613*7f2fe78bSCy Schubert #define CKM_PBE_MD5_CAST_CBC (0x3a2) 614*7f2fe78bSCy Schubert #define CKM_PBE_MD5_CAST3_CBC (0x3a3) 615*7f2fe78bSCy Schubert #define CKM_PBE_MD5_CAST5_CBC (0x3a4) 616*7f2fe78bSCy Schubert #define CKM_PBE_MD5_CAST128_CBC (0x3a4) 617*7f2fe78bSCy Schubert #define CKM_PBE_SHA1_CAST5_CBC (0x3a5) 618*7f2fe78bSCy Schubert #define CKM_PBE_SHA1_CAST128_CBC (0x3a5) 619*7f2fe78bSCy Schubert #define CKM_PBE_SHA1_RC4_128 (0x3a6) 620*7f2fe78bSCy Schubert #define CKM_PBE_SHA1_RC4_40 (0x3a7) 621*7f2fe78bSCy Schubert #define CKM_PBE_SHA1_DES3_EDE_CBC (0x3a8) 622*7f2fe78bSCy Schubert #define CKM_PBE_SHA1_DES2_EDE_CBC (0x3a9) 623*7f2fe78bSCy Schubert #define CKM_PBE_SHA1_RC2_128_CBC (0x3aa) 624*7f2fe78bSCy Schubert #define CKM_PBE_SHA1_RC2_40_CBC (0x3ab) 625*7f2fe78bSCy Schubert #define CKM_PKCS5_PBKD2 (0x3b0) 626*7f2fe78bSCy Schubert #define CKM_PBA_SHA1_WITH_SHA1_HMAC (0x3c0) 627*7f2fe78bSCy Schubert #define CKM_KEY_WRAP_LYNKS (0x400) 628*7f2fe78bSCy Schubert #define CKM_KEY_WRAP_SET_OAEP (0x401) 629*7f2fe78bSCy Schubert #define CKM_SKIPJACK_KEY_GEN (0x1000) 630*7f2fe78bSCy Schubert #define CKM_SKIPJACK_ECB64 (0x1001) 631*7f2fe78bSCy Schubert #define CKM_SKIPJACK_CBC64 (0x1002) 632*7f2fe78bSCy Schubert #define CKM_SKIPJACK_OFB64 (0x1003) 633*7f2fe78bSCy Schubert #define CKM_SKIPJACK_CFB64 (0x1004) 634*7f2fe78bSCy Schubert #define CKM_SKIPJACK_CFB32 (0x1005) 635*7f2fe78bSCy Schubert #define CKM_SKIPJACK_CFB16 (0x1006) 636*7f2fe78bSCy Schubert #define CKM_SKIPJACK_CFB8 (0x1007) 637*7f2fe78bSCy Schubert #define CKM_SKIPJACK_WRAP (0x1008) 638*7f2fe78bSCy Schubert #define CKM_SKIPJACK_PRIVATE_WRAP (0x1009) 639*7f2fe78bSCy Schubert #define CKM_SKIPJACK_RELAYX (0x100a) 640*7f2fe78bSCy Schubert #define CKM_KEA_KEY_PAIR_GEN (0x1010) 641*7f2fe78bSCy Schubert #define CKM_KEA_KEY_DERIVE (0x1011) 642*7f2fe78bSCy Schubert #define CKM_FORTEZZA_TIMESTAMP (0x1020) 643*7f2fe78bSCy Schubert #define CKM_BATON_KEY_GEN (0x1030) 644*7f2fe78bSCy Schubert #define CKM_BATON_ECB128 (0x1031) 645*7f2fe78bSCy Schubert #define CKM_BATON_ECB96 (0x1032) 646*7f2fe78bSCy Schubert #define CKM_BATON_CBC128 (0x1033) 647*7f2fe78bSCy Schubert #define CKM_BATON_COUNTER (0x1034) 648*7f2fe78bSCy Schubert #define CKM_BATON_SHUFFLE (0x1035) 649*7f2fe78bSCy Schubert #define CKM_BATON_WRAP (0x1036) 650*7f2fe78bSCy Schubert #define CKM_ECDSA_KEY_PAIR_GEN (0x1040) 651*7f2fe78bSCy Schubert #define CKM_EC_KEY_PAIR_GEN (0x1040) 652*7f2fe78bSCy Schubert #define CKM_ECDSA (0x1041) 653*7f2fe78bSCy Schubert #define CKM_ECDSA_SHA1 (0x1042) 654*7f2fe78bSCy Schubert #define CKM_ECDH1_DERIVE (0x1050) 655*7f2fe78bSCy Schubert #define CKM_ECDH1_COFACTOR_DERIVE (0x1051) 656*7f2fe78bSCy Schubert #define CKM_ECMQV_DERIVE (0x1052) 657*7f2fe78bSCy Schubert #define CKM_JUNIPER_KEY_GEN (0x1060) 658*7f2fe78bSCy Schubert #define CKM_JUNIPER_ECB128 (0x1061) 659*7f2fe78bSCy Schubert #define CKM_JUNIPER_CBC128 (0x1062) 660*7f2fe78bSCy Schubert #define CKM_JUNIPER_COUNTER (0x1063) 661*7f2fe78bSCy Schubert #define CKM_JUNIPER_SHUFFLE (0x1064) 662*7f2fe78bSCy Schubert #define CKM_JUNIPER_WRAP (0x1065) 663*7f2fe78bSCy Schubert #define CKM_FASTHASH (0x1070) 664*7f2fe78bSCy Schubert #define CKM_AES_KEY_GEN (0x1080) 665*7f2fe78bSCy Schubert #define CKM_AES_ECB (0x1081) 666*7f2fe78bSCy Schubert #define CKM_AES_CBC (0x1082) 667*7f2fe78bSCy Schubert #define CKM_AES_MAC (0x1083) 668*7f2fe78bSCy Schubert #define CKM_AES_MAC_GENERAL (0x1084) 669*7f2fe78bSCy Schubert #define CKM_AES_CBC_PAD (0x1085) 670*7f2fe78bSCy Schubert #define CKM_DSA_PARAMETER_GEN (0x2000) 671*7f2fe78bSCy Schubert #define CKM_DH_PKCS_PARAMETER_GEN (0x2001) 672*7f2fe78bSCy Schubert #define CKM_X9_42_DH_PARAMETER_GEN (0x2002) 673*7f2fe78bSCy Schubert #define CKM_VENDOR_DEFINED ((unsigned long) (1 << 31)) 674*7f2fe78bSCy Schubert 675*7f2fe78bSCy Schubert 676*7f2fe78bSCy Schubert struct ck_mechanism 677*7f2fe78bSCy Schubert { 678*7f2fe78bSCy Schubert ck_mechanism_type_t mechanism; 679*7f2fe78bSCy Schubert void *parameter; 680*7f2fe78bSCy Schubert unsigned long parameter_len; 681*7f2fe78bSCy Schubert }; 682*7f2fe78bSCy Schubert 683*7f2fe78bSCy Schubert 684*7f2fe78bSCy Schubert struct ck_mechanism_info 685*7f2fe78bSCy Schubert { 686*7f2fe78bSCy Schubert unsigned long min_key_size; 687*7f2fe78bSCy Schubert unsigned long max_key_size; 688*7f2fe78bSCy Schubert ck_flags_t flags; 689*7f2fe78bSCy Schubert }; 690*7f2fe78bSCy Schubert 691*7f2fe78bSCy Schubert #define CKF_HW (1 << 0) 692*7f2fe78bSCy Schubert #define CKF_ENCRYPT (1 << 8) 693*7f2fe78bSCy Schubert #define CKF_DECRYPT (1 << 9) 694*7f2fe78bSCy Schubert #define CKF_DIGEST (1 << 10) 695*7f2fe78bSCy Schubert #define CKF_SIGN (1 << 11) 696*7f2fe78bSCy Schubert #define CKF_SIGN_RECOVER (1 << 12) 697*7f2fe78bSCy Schubert #define CKF_VERIFY (1 << 13) 698*7f2fe78bSCy Schubert #define CKF_VERIFY_RECOVER (1 << 14) 699*7f2fe78bSCy Schubert #define CKF_GENERATE (1 << 15) 700*7f2fe78bSCy Schubert #define CKF_GENERATE_KEY_PAIR (1 << 16) 701*7f2fe78bSCy Schubert #define CKF_WRAP (1 << 17) 702*7f2fe78bSCy Schubert #define CKF_UNWRAP (1 << 18) 703*7f2fe78bSCy Schubert #define CKF_DERIVE (1 << 19) 704*7f2fe78bSCy Schubert #define CKF_EXTENSION ((unsigned long) (1 << 31)) 705*7f2fe78bSCy Schubert 706*7f2fe78bSCy Schubert 707*7f2fe78bSCy Schubert /* Flags for C_WaitForSlotEvent. */ 708*7f2fe78bSCy Schubert #define CKF_DONT_BLOCK (1) 709*7f2fe78bSCy Schubert 710*7f2fe78bSCy Schubert 711*7f2fe78bSCy Schubert typedef unsigned long ck_rv_t; 712*7f2fe78bSCy Schubert 713*7f2fe78bSCy Schubert 714*7f2fe78bSCy Schubert typedef ck_rv_t (*ck_notify_t) (ck_session_handle_t session, 715*7f2fe78bSCy Schubert ck_notification_t event, void *application); 716*7f2fe78bSCy Schubert 717*7f2fe78bSCy Schubert /* Forward reference. */ 718*7f2fe78bSCy Schubert struct ck_function_list; 719*7f2fe78bSCy Schubert 720*7f2fe78bSCy Schubert #define _CK_DECLARE_FUNCTION(name, args) \ 721*7f2fe78bSCy Schubert typedef ck_rv_t (*CK_ ## name) args; \ 722*7f2fe78bSCy Schubert ck_rv_t CK_SPEC name args 723*7f2fe78bSCy Schubert 724*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Initialize, (void *init_args)); 725*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Finalize, (void *reserved)); 726*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetInfo, (struct ck_info *info)); 727*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetFunctionList, 728*7f2fe78bSCy Schubert (struct ck_function_list **function_list)); 729*7f2fe78bSCy Schubert 730*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetSlotList, 731*7f2fe78bSCy Schubert (unsigned char token_present, ck_slot_id_t *slot_list, 732*7f2fe78bSCy Schubert unsigned long *count)); 733*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetSlotInfo, 734*7f2fe78bSCy Schubert (ck_slot_id_t slot_id, struct ck_slot_info *info)); 735*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetTokenInfo, 736*7f2fe78bSCy Schubert (ck_slot_id_t slot_id, struct ck_token_info *info)); 737*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_WaitForSlotEvent, 738*7f2fe78bSCy Schubert (ck_flags_t flags, ck_slot_id_t *slot, void *reserved)); 739*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetMechanismList, 740*7f2fe78bSCy Schubert (ck_slot_id_t slot_id, 741*7f2fe78bSCy Schubert ck_mechanism_type_t *mechanism_list, 742*7f2fe78bSCy Schubert unsigned long *count)); 743*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetMechanismInfo, 744*7f2fe78bSCy Schubert (ck_slot_id_t slot_id, ck_mechanism_type_t type, 745*7f2fe78bSCy Schubert struct ck_mechanism_info *info)); 746*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_InitToken, 747*7f2fe78bSCy Schubert (ck_slot_id_t slot_id, unsigned char *pin, 748*7f2fe78bSCy Schubert unsigned long pin_len, unsigned char *label)); 749*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_InitPIN, 750*7f2fe78bSCy Schubert (ck_session_handle_t session, unsigned char *pin, 751*7f2fe78bSCy Schubert unsigned long pin_len)); 752*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SetPIN, 753*7f2fe78bSCy Schubert (ck_session_handle_t session, unsigned char *old_pin, 754*7f2fe78bSCy Schubert unsigned long old_len, unsigned char *new_pin, 755*7f2fe78bSCy Schubert unsigned long new_len)); 756*7f2fe78bSCy Schubert 757*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_OpenSession, 758*7f2fe78bSCy Schubert (ck_slot_id_t slot_id, ck_flags_t flags, 759*7f2fe78bSCy Schubert void *application, ck_notify_t notify, 760*7f2fe78bSCy Schubert ck_session_handle_t *session)); 761*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_CloseSession, (ck_session_handle_t session)); 762*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_CloseAllSessions, (ck_slot_id_t slot_id)); 763*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetSessionInfo, 764*7f2fe78bSCy Schubert (ck_session_handle_t session, 765*7f2fe78bSCy Schubert struct ck_session_info *info)); 766*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetOperationState, 767*7f2fe78bSCy Schubert (ck_session_handle_t session, 768*7f2fe78bSCy Schubert unsigned char *operation_state, 769*7f2fe78bSCy Schubert unsigned long *operation_state_len)); 770*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SetOperationState, 771*7f2fe78bSCy Schubert (ck_session_handle_t session, 772*7f2fe78bSCy Schubert unsigned char *operation_state, 773*7f2fe78bSCy Schubert unsigned long operation_state_len, 774*7f2fe78bSCy Schubert ck_object_handle_t encryption_key, 775*7f2fe78bSCy Schubert ck_object_handle_t authentiation_key)); 776*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Login, 777*7f2fe78bSCy Schubert (ck_session_handle_t session, ck_user_type_t user_type, 778*7f2fe78bSCy Schubert unsigned char *pin, unsigned long pin_len)); 779*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Logout, (ck_session_handle_t session)); 780*7f2fe78bSCy Schubert 781*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_CreateObject, 782*7f2fe78bSCy Schubert (ck_session_handle_t session, 783*7f2fe78bSCy Schubert struct ck_attribute *templ, 784*7f2fe78bSCy Schubert unsigned long count, ck_object_handle_t *object)); 785*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_CopyObject, 786*7f2fe78bSCy Schubert (ck_session_handle_t session, ck_object_handle_t object, 787*7f2fe78bSCy Schubert struct ck_attribute *templ, unsigned long count, 788*7f2fe78bSCy Schubert ck_object_handle_t *new_object)); 789*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DestroyObject, 790*7f2fe78bSCy Schubert (ck_session_handle_t session, 791*7f2fe78bSCy Schubert ck_object_handle_t object)); 792*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetObjectSize, 793*7f2fe78bSCy Schubert (ck_session_handle_t session, 794*7f2fe78bSCy Schubert ck_object_handle_t object, 795*7f2fe78bSCy Schubert unsigned long *size)); 796*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetAttributeValue, 797*7f2fe78bSCy Schubert (ck_session_handle_t session, 798*7f2fe78bSCy Schubert ck_object_handle_t object, 799*7f2fe78bSCy Schubert struct ck_attribute *templ, 800*7f2fe78bSCy Schubert unsigned long count)); 801*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SetAttributeValue, 802*7f2fe78bSCy Schubert (ck_session_handle_t session, 803*7f2fe78bSCy Schubert ck_object_handle_t object, 804*7f2fe78bSCy Schubert struct ck_attribute *templ, 805*7f2fe78bSCy Schubert unsigned long count)); 806*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_FindObjectsInit, 807*7f2fe78bSCy Schubert (ck_session_handle_t session, 808*7f2fe78bSCy Schubert struct ck_attribute *templ, 809*7f2fe78bSCy Schubert unsigned long count)); 810*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_FindObjects, 811*7f2fe78bSCy Schubert (ck_session_handle_t session, 812*7f2fe78bSCy Schubert ck_object_handle_t *object, 813*7f2fe78bSCy Schubert unsigned long max_object_count, 814*7f2fe78bSCy Schubert unsigned long *object_count)); 815*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_FindObjectsFinal, 816*7f2fe78bSCy Schubert (ck_session_handle_t session)); 817*7f2fe78bSCy Schubert 818*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_EncryptInit, 819*7f2fe78bSCy Schubert (ck_session_handle_t session, 820*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 821*7f2fe78bSCy Schubert ck_object_handle_t key)); 822*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Encrypt, 823*7f2fe78bSCy Schubert (ck_session_handle_t session, 824*7f2fe78bSCy Schubert unsigned char *data, unsigned long data_len, 825*7f2fe78bSCy Schubert unsigned char *encrypted_data, 826*7f2fe78bSCy Schubert unsigned long *encrypted_data_len)); 827*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_EncryptUpdate, 828*7f2fe78bSCy Schubert (ck_session_handle_t session, 829*7f2fe78bSCy Schubert unsigned char *part, unsigned long part_len, 830*7f2fe78bSCy Schubert unsigned char *encrypted_part, 831*7f2fe78bSCy Schubert unsigned long *encrypted_part_len)); 832*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_EncryptFinal, 833*7f2fe78bSCy Schubert (ck_session_handle_t session, 834*7f2fe78bSCy Schubert unsigned char *last_encrypted_part, 835*7f2fe78bSCy Schubert unsigned long *last_encrypted_part_len)); 836*7f2fe78bSCy Schubert 837*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DecryptInit, 838*7f2fe78bSCy Schubert (ck_session_handle_t session, 839*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 840*7f2fe78bSCy Schubert ck_object_handle_t key)); 841*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Decrypt, 842*7f2fe78bSCy Schubert (ck_session_handle_t session, 843*7f2fe78bSCy Schubert unsigned char *encrypted_data, 844*7f2fe78bSCy Schubert unsigned long encrypted_data_len, 845*7f2fe78bSCy Schubert unsigned char *data, unsigned long *data_len)); 846*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DecryptUpdate, 847*7f2fe78bSCy Schubert (ck_session_handle_t session, 848*7f2fe78bSCy Schubert unsigned char *encrypted_part, 849*7f2fe78bSCy Schubert unsigned long encrypted_part_len, 850*7f2fe78bSCy Schubert unsigned char *part, unsigned long *part_len)); 851*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DecryptFinal, 852*7f2fe78bSCy Schubert (ck_session_handle_t session, 853*7f2fe78bSCy Schubert unsigned char *last_part, 854*7f2fe78bSCy Schubert unsigned long *last_part_len)); 855*7f2fe78bSCy Schubert 856*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DigestInit, 857*7f2fe78bSCy Schubert (ck_session_handle_t session, 858*7f2fe78bSCy Schubert struct ck_mechanism *mechanism)); 859*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Digest, 860*7f2fe78bSCy Schubert (ck_session_handle_t session, 861*7f2fe78bSCy Schubert unsigned char *data, unsigned long data_len, 862*7f2fe78bSCy Schubert unsigned char *digest, 863*7f2fe78bSCy Schubert unsigned long *digest_len)); 864*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DigestUpdate, 865*7f2fe78bSCy Schubert (ck_session_handle_t session, 866*7f2fe78bSCy Schubert unsigned char *part, unsigned long part_len)); 867*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DigestKey, 868*7f2fe78bSCy Schubert (ck_session_handle_t session, ck_object_handle_t key)); 869*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DigestFinal, 870*7f2fe78bSCy Schubert (ck_session_handle_t session, 871*7f2fe78bSCy Schubert unsigned char *digest, 872*7f2fe78bSCy Schubert unsigned long *digest_len)); 873*7f2fe78bSCy Schubert 874*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SignInit, 875*7f2fe78bSCy Schubert (ck_session_handle_t session, 876*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 877*7f2fe78bSCy Schubert ck_object_handle_t key)); 878*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Sign, 879*7f2fe78bSCy Schubert (ck_session_handle_t session, 880*7f2fe78bSCy Schubert unsigned char *data, unsigned long data_len, 881*7f2fe78bSCy Schubert unsigned char *signature, 882*7f2fe78bSCy Schubert unsigned long *signature_len)); 883*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SignUpdate, 884*7f2fe78bSCy Schubert (ck_session_handle_t session, 885*7f2fe78bSCy Schubert unsigned char *part, unsigned long part_len)); 886*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SignFinal, 887*7f2fe78bSCy Schubert (ck_session_handle_t session, 888*7f2fe78bSCy Schubert unsigned char *signature, 889*7f2fe78bSCy Schubert unsigned long *signature_len)); 890*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SignRecoverInit, 891*7f2fe78bSCy Schubert (ck_session_handle_t session, 892*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 893*7f2fe78bSCy Schubert ck_object_handle_t key)); 894*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SignRecover, 895*7f2fe78bSCy Schubert (ck_session_handle_t session, 896*7f2fe78bSCy Schubert unsigned char *data, unsigned long data_len, 897*7f2fe78bSCy Schubert unsigned char *signature, 898*7f2fe78bSCy Schubert unsigned long *signature_len)); 899*7f2fe78bSCy Schubert 900*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_VerifyInit, 901*7f2fe78bSCy Schubert (ck_session_handle_t session, 902*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 903*7f2fe78bSCy Schubert ck_object_handle_t key)); 904*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_Verify, 905*7f2fe78bSCy Schubert (ck_session_handle_t session, 906*7f2fe78bSCy Schubert unsigned char *data, unsigned long data_len, 907*7f2fe78bSCy Schubert unsigned char *signature, 908*7f2fe78bSCy Schubert unsigned long signature_len)); 909*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_VerifyUpdate, 910*7f2fe78bSCy Schubert (ck_session_handle_t session, 911*7f2fe78bSCy Schubert unsigned char *part, unsigned long part_len)); 912*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_VerifyFinal, 913*7f2fe78bSCy Schubert (ck_session_handle_t session, 914*7f2fe78bSCy Schubert unsigned char *signature, 915*7f2fe78bSCy Schubert unsigned long signature_len)); 916*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_VerifyRecoverInit, 917*7f2fe78bSCy Schubert (ck_session_handle_t session, 918*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 919*7f2fe78bSCy Schubert ck_object_handle_t key)); 920*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_VerifyRecover, 921*7f2fe78bSCy Schubert (ck_session_handle_t session, 922*7f2fe78bSCy Schubert unsigned char *signature, 923*7f2fe78bSCy Schubert unsigned long signature_len, 924*7f2fe78bSCy Schubert unsigned char *data, 925*7f2fe78bSCy Schubert unsigned long *data_len)); 926*7f2fe78bSCy Schubert 927*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DigestEncryptUpdate, 928*7f2fe78bSCy Schubert (ck_session_handle_t session, 929*7f2fe78bSCy Schubert unsigned char *part, unsigned long part_len, 930*7f2fe78bSCy Schubert unsigned char *encrypted_part, 931*7f2fe78bSCy Schubert unsigned long *encrypted_part_len)); 932*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DecryptDigestUpdate, 933*7f2fe78bSCy Schubert (ck_session_handle_t session, 934*7f2fe78bSCy Schubert unsigned char *encrypted_part, 935*7f2fe78bSCy Schubert unsigned long encrypted_part_len, 936*7f2fe78bSCy Schubert unsigned char *part, 937*7f2fe78bSCy Schubert unsigned long *part_len)); 938*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SignEncryptUpdate, 939*7f2fe78bSCy Schubert (ck_session_handle_t session, 940*7f2fe78bSCy Schubert unsigned char *part, unsigned long part_len, 941*7f2fe78bSCy Schubert unsigned char *encrypted_part, 942*7f2fe78bSCy Schubert unsigned long *encrypted_part_len)); 943*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DecryptVerifyUpdate, 944*7f2fe78bSCy Schubert (ck_session_handle_t session, 945*7f2fe78bSCy Schubert unsigned char *encrypted_part, 946*7f2fe78bSCy Schubert unsigned long encrypted_part_len, 947*7f2fe78bSCy Schubert unsigned char *part, 948*7f2fe78bSCy Schubert unsigned long *part_len)); 949*7f2fe78bSCy Schubert 950*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GenerateKey, 951*7f2fe78bSCy Schubert (ck_session_handle_t session, 952*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 953*7f2fe78bSCy Schubert struct ck_attribute *templ, 954*7f2fe78bSCy Schubert unsigned long count, 955*7f2fe78bSCy Schubert ck_object_handle_t *key)); 956*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GenerateKeyPair, 957*7f2fe78bSCy Schubert (ck_session_handle_t session, 958*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 959*7f2fe78bSCy Schubert struct ck_attribute *public_key_template, 960*7f2fe78bSCy Schubert unsigned long public_key_attribute_count, 961*7f2fe78bSCy Schubert struct ck_attribute *private_key_template, 962*7f2fe78bSCy Schubert unsigned long private_key_attribute_count, 963*7f2fe78bSCy Schubert ck_object_handle_t *public_key, 964*7f2fe78bSCy Schubert ck_object_handle_t *private_key)); 965*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_WrapKey, 966*7f2fe78bSCy Schubert (ck_session_handle_t session, 967*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 968*7f2fe78bSCy Schubert ck_object_handle_t wrapping_key, 969*7f2fe78bSCy Schubert ck_object_handle_t key, 970*7f2fe78bSCy Schubert unsigned char *wrapped_key, 971*7f2fe78bSCy Schubert unsigned long *wrapped_key_len)); 972*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_UnwrapKey, 973*7f2fe78bSCy Schubert (ck_session_handle_t session, 974*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 975*7f2fe78bSCy Schubert ck_object_handle_t unwrapping_key, 976*7f2fe78bSCy Schubert unsigned char *wrapped_key, 977*7f2fe78bSCy Schubert unsigned long wrapped_key_len, 978*7f2fe78bSCy Schubert struct ck_attribute *templ, 979*7f2fe78bSCy Schubert unsigned long attribute_count, 980*7f2fe78bSCy Schubert ck_object_handle_t *key)); 981*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_DeriveKey, 982*7f2fe78bSCy Schubert (ck_session_handle_t session, 983*7f2fe78bSCy Schubert struct ck_mechanism *mechanism, 984*7f2fe78bSCy Schubert ck_object_handle_t base_key, 985*7f2fe78bSCy Schubert struct ck_attribute *templ, 986*7f2fe78bSCy Schubert unsigned long attribute_count, 987*7f2fe78bSCy Schubert ck_object_handle_t *key)); 988*7f2fe78bSCy Schubert 989*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_SeedRandom, 990*7f2fe78bSCy Schubert (ck_session_handle_t session, unsigned char *seed, 991*7f2fe78bSCy Schubert unsigned long seed_len)); 992*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GenerateRandom, 993*7f2fe78bSCy Schubert (ck_session_handle_t session, 994*7f2fe78bSCy Schubert unsigned char *random_data, 995*7f2fe78bSCy Schubert unsigned long random_len)); 996*7f2fe78bSCy Schubert 997*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_GetFunctionStatus, (ck_session_handle_t session)); 998*7f2fe78bSCy Schubert _CK_DECLARE_FUNCTION (C_CancelFunction, (ck_session_handle_t session)); 999*7f2fe78bSCy Schubert 1000*7f2fe78bSCy Schubert 1001*7f2fe78bSCy Schubert struct ck_function_list 1002*7f2fe78bSCy Schubert { 1003*7f2fe78bSCy Schubert struct ck_version version; 1004*7f2fe78bSCy Schubert CK_C_Initialize C_Initialize; 1005*7f2fe78bSCy Schubert CK_C_Finalize C_Finalize; 1006*7f2fe78bSCy Schubert CK_C_GetInfo C_GetInfo; 1007*7f2fe78bSCy Schubert CK_C_GetFunctionList C_GetFunctionList; 1008*7f2fe78bSCy Schubert CK_C_GetSlotList C_GetSlotList; 1009*7f2fe78bSCy Schubert CK_C_GetSlotInfo C_GetSlotInfo; 1010*7f2fe78bSCy Schubert CK_C_GetTokenInfo C_GetTokenInfo; 1011*7f2fe78bSCy Schubert CK_C_GetMechanismList C_GetMechanismList; 1012*7f2fe78bSCy Schubert CK_C_GetMechanismInfo C_GetMechanismInfo; 1013*7f2fe78bSCy Schubert CK_C_InitToken C_InitToken; 1014*7f2fe78bSCy Schubert CK_C_InitPIN C_InitPIN; 1015*7f2fe78bSCy Schubert CK_C_SetPIN C_SetPIN; 1016*7f2fe78bSCy Schubert CK_C_OpenSession C_OpenSession; 1017*7f2fe78bSCy Schubert CK_C_CloseSession C_CloseSession; 1018*7f2fe78bSCy Schubert CK_C_CloseAllSessions C_CloseAllSessions; 1019*7f2fe78bSCy Schubert CK_C_GetSessionInfo C_GetSessionInfo; 1020*7f2fe78bSCy Schubert CK_C_GetOperationState C_GetOperationState; 1021*7f2fe78bSCy Schubert CK_C_SetOperationState C_SetOperationState; 1022*7f2fe78bSCy Schubert CK_C_Login C_Login; 1023*7f2fe78bSCy Schubert CK_C_Logout C_Logout; 1024*7f2fe78bSCy Schubert CK_C_CreateObject C_CreateObject; 1025*7f2fe78bSCy Schubert CK_C_CopyObject C_CopyObject; 1026*7f2fe78bSCy Schubert CK_C_DestroyObject C_DestroyObject; 1027*7f2fe78bSCy Schubert CK_C_GetObjectSize C_GetObjectSize; 1028*7f2fe78bSCy Schubert CK_C_GetAttributeValue C_GetAttributeValue; 1029*7f2fe78bSCy Schubert CK_C_SetAttributeValue C_SetAttributeValue; 1030*7f2fe78bSCy Schubert CK_C_FindObjectsInit C_FindObjectsInit; 1031*7f2fe78bSCy Schubert CK_C_FindObjects C_FindObjects; 1032*7f2fe78bSCy Schubert CK_C_FindObjectsFinal C_FindObjectsFinal; 1033*7f2fe78bSCy Schubert CK_C_EncryptInit C_EncryptInit; 1034*7f2fe78bSCy Schubert CK_C_Encrypt C_Encrypt; 1035*7f2fe78bSCy Schubert CK_C_EncryptUpdate C_EncryptUpdate; 1036*7f2fe78bSCy Schubert CK_C_EncryptFinal C_EncryptFinal; 1037*7f2fe78bSCy Schubert CK_C_DecryptInit C_DecryptInit; 1038*7f2fe78bSCy Schubert CK_C_Decrypt C_Decrypt; 1039*7f2fe78bSCy Schubert CK_C_DecryptUpdate C_DecryptUpdate; 1040*7f2fe78bSCy Schubert CK_C_DecryptFinal C_DecryptFinal; 1041*7f2fe78bSCy Schubert CK_C_DigestInit C_DigestInit; 1042*7f2fe78bSCy Schubert CK_C_Digest C_Digest; 1043*7f2fe78bSCy Schubert CK_C_DigestUpdate C_DigestUpdate; 1044*7f2fe78bSCy Schubert CK_C_DigestKey C_DigestKey; 1045*7f2fe78bSCy Schubert CK_C_DigestFinal C_DigestFinal; 1046*7f2fe78bSCy Schubert CK_C_SignInit C_SignInit; 1047*7f2fe78bSCy Schubert CK_C_Sign C_Sign; 1048*7f2fe78bSCy Schubert CK_C_SignUpdate C_SignUpdate; 1049*7f2fe78bSCy Schubert CK_C_SignFinal C_SignFinal; 1050*7f2fe78bSCy Schubert CK_C_SignRecoverInit C_SignRecoverInit; 1051*7f2fe78bSCy Schubert CK_C_SignRecover C_SignRecover; 1052*7f2fe78bSCy Schubert CK_C_VerifyInit C_VerifyInit; 1053*7f2fe78bSCy Schubert CK_C_Verify C_Verify; 1054*7f2fe78bSCy Schubert CK_C_VerifyUpdate C_VerifyUpdate; 1055*7f2fe78bSCy Schubert CK_C_VerifyFinal C_VerifyFinal; 1056*7f2fe78bSCy Schubert CK_C_VerifyRecoverInit C_VerifyRecoverInit; 1057*7f2fe78bSCy Schubert CK_C_VerifyRecover C_VerifyRecover; 1058*7f2fe78bSCy Schubert CK_C_DigestEncryptUpdate C_DigestEncryptUpdate; 1059*7f2fe78bSCy Schubert CK_C_DecryptDigestUpdate C_DecryptDigestUpdate; 1060*7f2fe78bSCy Schubert CK_C_SignEncryptUpdate C_SignEncryptUpdate; 1061*7f2fe78bSCy Schubert CK_C_DecryptVerifyUpdate C_DecryptVerifyUpdate; 1062*7f2fe78bSCy Schubert CK_C_GenerateKey C_GenerateKey; 1063*7f2fe78bSCy Schubert CK_C_GenerateKeyPair C_GenerateKeyPair; 1064*7f2fe78bSCy Schubert CK_C_WrapKey C_WrapKey; 1065*7f2fe78bSCy Schubert CK_C_UnwrapKey C_UnwrapKey; 1066*7f2fe78bSCy Schubert CK_C_DeriveKey C_DeriveKey; 1067*7f2fe78bSCy Schubert CK_C_SeedRandom C_SeedRandom; 1068*7f2fe78bSCy Schubert CK_C_GenerateRandom C_GenerateRandom; 1069*7f2fe78bSCy Schubert CK_C_GetFunctionStatus C_GetFunctionStatus; 1070*7f2fe78bSCy Schubert CK_C_CancelFunction C_CancelFunction; 1071*7f2fe78bSCy Schubert CK_C_WaitForSlotEvent C_WaitForSlotEvent; 1072*7f2fe78bSCy Schubert }; 1073*7f2fe78bSCy Schubert 1074*7f2fe78bSCy Schubert 1075*7f2fe78bSCy Schubert typedef ck_rv_t (*ck_createmutex_t) (void **mutex); 1076*7f2fe78bSCy Schubert typedef ck_rv_t (*ck_destroymutex_t) (void *mutex); 1077*7f2fe78bSCy Schubert typedef ck_rv_t (*ck_lockmutex_t) (void *mutex); 1078*7f2fe78bSCy Schubert typedef ck_rv_t (*ck_unlockmutex_t) (void *mutex); 1079*7f2fe78bSCy Schubert 1080*7f2fe78bSCy Schubert 1081*7f2fe78bSCy Schubert struct ck_c_initialize_args 1082*7f2fe78bSCy Schubert { 1083*7f2fe78bSCy Schubert ck_createmutex_t create_mutex; 1084*7f2fe78bSCy Schubert ck_destroymutex_t destroy_mutex; 1085*7f2fe78bSCy Schubert ck_lockmutex_t lock_mutex; 1086*7f2fe78bSCy Schubert ck_unlockmutex_t unlock_mutex; 1087*7f2fe78bSCy Schubert ck_flags_t flags; 1088*7f2fe78bSCy Schubert void *reserved; 1089*7f2fe78bSCy Schubert }; 1090*7f2fe78bSCy Schubert 1091*7f2fe78bSCy Schubert 1092*7f2fe78bSCy Schubert #define CKF_LIBRARY_CANT_CREATE_OS_THREADS (1 << 0) 1093*7f2fe78bSCy Schubert #define CKF_OS_LOCKING_OK (1 << 1) 1094*7f2fe78bSCy Schubert 1095*7f2fe78bSCy Schubert #define CKR_OK (0) 1096*7f2fe78bSCy Schubert #define CKR_CANCEL (1) 1097*7f2fe78bSCy Schubert #define CKR_HOST_MEMORY (2) 1098*7f2fe78bSCy Schubert #define CKR_SLOT_ID_INVALID (3) 1099*7f2fe78bSCy Schubert #define CKR_GENERAL_ERROR (5) 1100*7f2fe78bSCy Schubert #define CKR_FUNCTION_FAILED (6) 1101*7f2fe78bSCy Schubert #define CKR_ARGUMENTS_BAD (7) 1102*7f2fe78bSCy Schubert #define CKR_NO_EVENT (8) 1103*7f2fe78bSCy Schubert #define CKR_NEED_TO_CREATE_THREADS (9) 1104*7f2fe78bSCy Schubert #define CKR_CANT_LOCK (0xa) 1105*7f2fe78bSCy Schubert #define CKR_ATTRIBUTE_READ_ONLY (0x10) 1106*7f2fe78bSCy Schubert #define CKR_ATTRIBUTE_SENSITIVE (0x11) 1107*7f2fe78bSCy Schubert #define CKR_ATTRIBUTE_TYPE_INVALID (0x12) 1108*7f2fe78bSCy Schubert #define CKR_ATTRIBUTE_VALUE_INVALID (0x13) 1109*7f2fe78bSCy Schubert #define CKR_DATA_INVALID (0x20) 1110*7f2fe78bSCy Schubert #define CKR_DATA_LEN_RANGE (0x21) 1111*7f2fe78bSCy Schubert #define CKR_DEVICE_ERROR (0x30) 1112*7f2fe78bSCy Schubert #define CKR_DEVICE_MEMORY (0x31) 1113*7f2fe78bSCy Schubert #define CKR_DEVICE_REMOVED (0x32) 1114*7f2fe78bSCy Schubert #define CKR_ENCRYPTED_DATA_INVALID (0x40) 1115*7f2fe78bSCy Schubert #define CKR_ENCRYPTED_DATA_LEN_RANGE (0x41) 1116*7f2fe78bSCy Schubert #define CKR_FUNCTION_CANCELED (0x50) 1117*7f2fe78bSCy Schubert #define CKR_FUNCTION_NOT_PARALLEL (0x51) 1118*7f2fe78bSCy Schubert #define CKR_FUNCTION_NOT_SUPPORTED (0x54) 1119*7f2fe78bSCy Schubert #define CKR_KEY_HANDLE_INVALID (0x60) 1120*7f2fe78bSCy Schubert #define CKR_KEY_SIZE_RANGE (0x62) 1121*7f2fe78bSCy Schubert #define CKR_KEY_TYPE_INCONSISTENT (0x63) 1122*7f2fe78bSCy Schubert #define CKR_KEY_NOT_NEEDED (0x64) 1123*7f2fe78bSCy Schubert #define CKR_KEY_CHANGED (0x65) 1124*7f2fe78bSCy Schubert #define CKR_KEY_NEEDED (0x66) 1125*7f2fe78bSCy Schubert #define CKR_KEY_INDIGESTIBLE (0x67) 1126*7f2fe78bSCy Schubert #define CKR_KEY_FUNCTION_NOT_PERMITTED (0x68) 1127*7f2fe78bSCy Schubert #define CKR_KEY_NOT_WRAPPABLE (0x69) 1128*7f2fe78bSCy Schubert #define CKR_KEY_UNEXTRACTABLE (0x6a) 1129*7f2fe78bSCy Schubert #define CKR_MECHANISM_INVALID (0x70) 1130*7f2fe78bSCy Schubert #define CKR_MECHANISM_PARAM_INVALID (0x71) 1131*7f2fe78bSCy Schubert #define CKR_OBJECT_HANDLE_INVALID (0x82) 1132*7f2fe78bSCy Schubert #define CKR_OPERATION_ACTIVE (0x90) 1133*7f2fe78bSCy Schubert #define CKR_OPERATION_NOT_INITIALIZED (0x91) 1134*7f2fe78bSCy Schubert #define CKR_PIN_INCORRECT (0xa0) 1135*7f2fe78bSCy Schubert #define CKR_PIN_INVALID (0xa1) 1136*7f2fe78bSCy Schubert #define CKR_PIN_LEN_RANGE (0xa2) 1137*7f2fe78bSCy Schubert #define CKR_PIN_EXPIRED (0xa3) 1138*7f2fe78bSCy Schubert #define CKR_PIN_LOCKED (0xa4) 1139*7f2fe78bSCy Schubert #define CKR_SESSION_CLOSED (0xb0) 1140*7f2fe78bSCy Schubert #define CKR_SESSION_COUNT (0xb1) 1141*7f2fe78bSCy Schubert #define CKR_SESSION_HANDLE_INVALID (0xb3) 1142*7f2fe78bSCy Schubert #define CKR_SESSION_PARALLEL_NOT_SUPPORTED (0xb4) 1143*7f2fe78bSCy Schubert #define CKR_SESSION_READ_ONLY (0xb5) 1144*7f2fe78bSCy Schubert #define CKR_SESSION_EXISTS (0xb6) 1145*7f2fe78bSCy Schubert #define CKR_SESSION_READ_ONLY_EXISTS (0xb7) 1146*7f2fe78bSCy Schubert #define CKR_SESSION_READ_WRITE_SO_EXISTS (0xb8) 1147*7f2fe78bSCy Schubert #define CKR_SIGNATURE_INVALID (0xc0) 1148*7f2fe78bSCy Schubert #define CKR_SIGNATURE_LEN_RANGE (0xc1) 1149*7f2fe78bSCy Schubert #define CKR_TEMPLATE_INCOMPLETE (0xd0) 1150*7f2fe78bSCy Schubert #define CKR_TEMPLATE_INCONSISTENT (0xd1) 1151*7f2fe78bSCy Schubert #define CKR_TOKEN_NOT_PRESENT (0xe0) 1152*7f2fe78bSCy Schubert #define CKR_TOKEN_NOT_RECOGNIZED (0xe1) 1153*7f2fe78bSCy Schubert #define CKR_TOKEN_WRITE_PROTECTED (0xe2) 1154*7f2fe78bSCy Schubert #define CKR_UNWRAPPING_KEY_HANDLE_INVALID (0xf0) 1155*7f2fe78bSCy Schubert #define CKR_UNWRAPPING_KEY_SIZE_RANGE (0xf1) 1156*7f2fe78bSCy Schubert #define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT (0xf2) 1157*7f2fe78bSCy Schubert #define CKR_USER_ALREADY_LOGGED_IN (0x100) 1158*7f2fe78bSCy Schubert #define CKR_USER_NOT_LOGGED_IN (0x101) 1159*7f2fe78bSCy Schubert #define CKR_USER_PIN_NOT_INITIALIZED (0x102) 1160*7f2fe78bSCy Schubert #define CKR_USER_TYPE_INVALID (0x103) 1161*7f2fe78bSCy Schubert #define CKR_USER_ANOTHER_ALREADY_LOGGED_IN (0x104) 1162*7f2fe78bSCy Schubert #define CKR_USER_TOO_MANY_TYPES (0x105) 1163*7f2fe78bSCy Schubert #define CKR_WRAPPED_KEY_INVALID (0x110) 1164*7f2fe78bSCy Schubert #define CKR_WRAPPED_KEY_LEN_RANGE (0x112) 1165*7f2fe78bSCy Schubert #define CKR_WRAPPING_KEY_HANDLE_INVALID (0x113) 1166*7f2fe78bSCy Schubert #define CKR_WRAPPING_KEY_SIZE_RANGE (0x114) 1167*7f2fe78bSCy Schubert #define CKR_WRAPPING_KEY_TYPE_INCONSISTENT (0x115) 1168*7f2fe78bSCy Schubert #define CKR_RANDOM_SEED_NOT_SUPPORTED (0x120) 1169*7f2fe78bSCy Schubert #define CKR_RANDOM_NO_RNG (0x121) 1170*7f2fe78bSCy Schubert #define CKR_DOMAIN_PARAMS_INVALID (0x130) 1171*7f2fe78bSCy Schubert #define CKR_BUFFER_TOO_SMALL (0x150) 1172*7f2fe78bSCy Schubert #define CKR_SAVED_STATE_INVALID (0x160) 1173*7f2fe78bSCy Schubert #define CKR_INFORMATION_SENSITIVE (0x170) 1174*7f2fe78bSCy Schubert #define CKR_STATE_UNSAVEABLE (0x180) 1175*7f2fe78bSCy Schubert #define CKR_CRYPTOKI_NOT_INITIALIZED (0x190) 1176*7f2fe78bSCy Schubert #define CKR_CRYPTOKI_ALREADY_INITIALIZED (0x191) 1177*7f2fe78bSCy Schubert #define CKR_MUTEX_BAD (0x1a0) 1178*7f2fe78bSCy Schubert #define CKR_MUTEX_NOT_LOCKED (0x1a1) 1179*7f2fe78bSCy Schubert #define CKR_FUNCTION_REJECTED (0x200) 1180*7f2fe78bSCy Schubert #define CKR_VENDOR_DEFINED ((unsigned long) (1 << 31)) 1181*7f2fe78bSCy Schubert 1182*7f2fe78bSCy Schubert 1183*7f2fe78bSCy Schubert /* Compatibility layer. */ 1184*7f2fe78bSCy Schubert 1185*7f2fe78bSCy Schubert #ifdef CRYPTOKI_COMPAT 1186*7f2fe78bSCy Schubert 1187*7f2fe78bSCy Schubert #undef CK_DEFINE_FUNCTION 1188*7f2fe78bSCy Schubert #define CK_DEFINE_FUNCTION(retval, name) retval CK_SPEC name 1189*7f2fe78bSCy Schubert 1190*7f2fe78bSCy Schubert /* For NULL. */ 1191*7f2fe78bSCy Schubert #include <stddef.h> 1192*7f2fe78bSCy Schubert 1193*7f2fe78bSCy Schubert typedef unsigned char CK_BYTE; 1194*7f2fe78bSCy Schubert typedef unsigned char CK_CHAR; 1195*7f2fe78bSCy Schubert typedef unsigned char CK_UTF8CHAR; 1196*7f2fe78bSCy Schubert typedef unsigned char CK_BBOOL; 1197*7f2fe78bSCy Schubert typedef unsigned long int CK_ULONG; 1198*7f2fe78bSCy Schubert typedef long int CK_LONG; 1199*7f2fe78bSCy Schubert typedef CK_BYTE *CK_BYTE_PTR; 1200*7f2fe78bSCy Schubert typedef CK_CHAR *CK_CHAR_PTR; 1201*7f2fe78bSCy Schubert typedef CK_UTF8CHAR *CK_UTF8CHAR_PTR; 1202*7f2fe78bSCy Schubert typedef CK_ULONG *CK_ULONG_PTR; 1203*7f2fe78bSCy Schubert typedef void *CK_VOID_PTR; 1204*7f2fe78bSCy Schubert typedef void **CK_VOID_PTR_PTR; 1205*7f2fe78bSCy Schubert #define CK_FALSE 0 1206*7f2fe78bSCy Schubert #define CK_TRUE 1 1207*7f2fe78bSCy Schubert #ifndef CK_DISABLE_TRUE_FALSE 1208*7f2fe78bSCy Schubert #ifndef FALSE 1209*7f2fe78bSCy Schubert #define FALSE 0 1210*7f2fe78bSCy Schubert #endif 1211*7f2fe78bSCy Schubert #ifndef TRUE 1212*7f2fe78bSCy Schubert #define TRUE 1 1213*7f2fe78bSCy Schubert #endif 1214*7f2fe78bSCy Schubert #endif 1215*7f2fe78bSCy Schubert 1216*7f2fe78bSCy Schubert typedef struct ck_version CK_VERSION; 1217*7f2fe78bSCy Schubert typedef struct ck_version *CK_VERSION_PTR; 1218*7f2fe78bSCy Schubert 1219*7f2fe78bSCy Schubert typedef struct ck_info CK_INFO; 1220*7f2fe78bSCy Schubert typedef struct ck_info *CK_INFO_PTR; 1221*7f2fe78bSCy Schubert 1222*7f2fe78bSCy Schubert typedef ck_slot_id_t *CK_SLOT_ID_PTR; 1223*7f2fe78bSCy Schubert 1224*7f2fe78bSCy Schubert typedef struct ck_slot_info CK_SLOT_INFO; 1225*7f2fe78bSCy Schubert typedef struct ck_slot_info *CK_SLOT_INFO_PTR; 1226*7f2fe78bSCy Schubert 1227*7f2fe78bSCy Schubert typedef struct ck_token_info CK_TOKEN_INFO; 1228*7f2fe78bSCy Schubert typedef struct ck_token_info *CK_TOKEN_INFO_PTR; 1229*7f2fe78bSCy Schubert 1230*7f2fe78bSCy Schubert typedef ck_session_handle_t *CK_SESSION_HANDLE_PTR; 1231*7f2fe78bSCy Schubert 1232*7f2fe78bSCy Schubert typedef struct ck_session_info CK_SESSION_INFO; 1233*7f2fe78bSCy Schubert typedef struct ck_session_info *CK_SESSION_INFO_PTR; 1234*7f2fe78bSCy Schubert 1235*7f2fe78bSCy Schubert typedef ck_object_handle_t *CK_OBJECT_HANDLE_PTR; 1236*7f2fe78bSCy Schubert 1237*7f2fe78bSCy Schubert typedef ck_object_class_t *CK_OBJECT_CLASS_PTR; 1238*7f2fe78bSCy Schubert 1239*7f2fe78bSCy Schubert typedef struct ck_attribute CK_ATTRIBUTE; 1240*7f2fe78bSCy Schubert typedef struct ck_attribute *CK_ATTRIBUTE_PTR; 1241*7f2fe78bSCy Schubert 1242*7f2fe78bSCy Schubert typedef struct ck_date CK_DATE; 1243*7f2fe78bSCy Schubert typedef struct ck_date *CK_DATE_PTR; 1244*7f2fe78bSCy Schubert 1245*7f2fe78bSCy Schubert typedef ck_mechanism_type_t *CK_MECHANISM_TYPE_PTR; 1246*7f2fe78bSCy Schubert 1247*7f2fe78bSCy Schubert typedef struct ck_mechanism CK_MECHANISM; 1248*7f2fe78bSCy Schubert typedef struct ck_mechanism *CK_MECHANISM_PTR; 1249*7f2fe78bSCy Schubert 1250*7f2fe78bSCy Schubert typedef struct ck_mechanism_info CK_MECHANISM_INFO; 1251*7f2fe78bSCy Schubert typedef struct ck_mechanism_info *CK_MECHANISM_INFO_PTR; 1252*7f2fe78bSCy Schubert 1253*7f2fe78bSCy Schubert typedef struct ck_function_list CK_FUNCTION_LIST; 1254*7f2fe78bSCy Schubert typedef struct ck_function_list *CK_FUNCTION_LIST_PTR; 1255*7f2fe78bSCy Schubert typedef struct ck_function_list **CK_FUNCTION_LIST_PTR_PTR; 1256*7f2fe78bSCy Schubert 1257*7f2fe78bSCy Schubert typedef struct ck_c_initialize_args CK_C_INITIALIZE_ARGS; 1258*7f2fe78bSCy Schubert typedef struct ck_c_initialize_args *CK_C_INITIALIZE_ARGS_PTR; 1259*7f2fe78bSCy Schubert 1260*7f2fe78bSCy Schubert #define NULL_PTR NULL 1261*7f2fe78bSCy Schubert 1262*7f2fe78bSCy Schubert /* Delete the helper macros defined at the top of the file. */ 1263*7f2fe78bSCy Schubert #undef ck_flags_t 1264*7f2fe78bSCy Schubert #undef ck_version 1265*7f2fe78bSCy Schubert 1266*7f2fe78bSCy Schubert #undef ck_info 1267*7f2fe78bSCy Schubert #undef cryptoki_version 1268*7f2fe78bSCy Schubert #undef manufacturer_id 1269*7f2fe78bSCy Schubert #undef library_description 1270*7f2fe78bSCy Schubert #undef library_version 1271*7f2fe78bSCy Schubert 1272*7f2fe78bSCy Schubert #undef ck_notification_t 1273*7f2fe78bSCy Schubert #undef ck_slot_id_t 1274*7f2fe78bSCy Schubert 1275*7f2fe78bSCy Schubert #undef ck_slot_info 1276*7f2fe78bSCy Schubert #undef slot_description 1277*7f2fe78bSCy Schubert #undef hardware_version 1278*7f2fe78bSCy Schubert #undef firmware_version 1279*7f2fe78bSCy Schubert 1280*7f2fe78bSCy Schubert #undef ck_token_info 1281*7f2fe78bSCy Schubert #undef serial_number 1282*7f2fe78bSCy Schubert #undef max_session_count 1283*7f2fe78bSCy Schubert #undef session_count 1284*7f2fe78bSCy Schubert #undef max_rw_session_count 1285*7f2fe78bSCy Schubert #undef rw_session_count 1286*7f2fe78bSCy Schubert #undef max_pin_len 1287*7f2fe78bSCy Schubert #undef min_pin_len 1288*7f2fe78bSCy Schubert #undef total_public_memory 1289*7f2fe78bSCy Schubert #undef free_public_memory 1290*7f2fe78bSCy Schubert #undef total_private_memory 1291*7f2fe78bSCy Schubert #undef free_private_memory 1292*7f2fe78bSCy Schubert #undef utc_time 1293*7f2fe78bSCy Schubert 1294*7f2fe78bSCy Schubert #undef ck_session_handle_t 1295*7f2fe78bSCy Schubert #undef ck_user_type_t 1296*7f2fe78bSCy Schubert #undef ck_state_t 1297*7f2fe78bSCy Schubert 1298*7f2fe78bSCy Schubert #undef ck_session_info 1299*7f2fe78bSCy Schubert #undef slot_id 1300*7f2fe78bSCy Schubert #undef device_error 1301*7f2fe78bSCy Schubert 1302*7f2fe78bSCy Schubert #undef ck_object_handle_t 1303*7f2fe78bSCy Schubert #undef ck_object_class_t 1304*7f2fe78bSCy Schubert #undef ck_hw_feature_type_t 1305*7f2fe78bSCy Schubert #undef ck_key_type_t 1306*7f2fe78bSCy Schubert #undef ck_certificate_type_t 1307*7f2fe78bSCy Schubert #undef ck_attribute_type_t 1308*7f2fe78bSCy Schubert 1309*7f2fe78bSCy Schubert #undef ck_attribute 1310*7f2fe78bSCy Schubert #undef value 1311*7f2fe78bSCy Schubert #undef value_len 1312*7f2fe78bSCy Schubert 1313*7f2fe78bSCy Schubert #undef ck_date 1314*7f2fe78bSCy Schubert 1315*7f2fe78bSCy Schubert #undef ck_mechanism_type_t 1316*7f2fe78bSCy Schubert 1317*7f2fe78bSCy Schubert #undef ck_mechanism 1318*7f2fe78bSCy Schubert #undef parameter 1319*7f2fe78bSCy Schubert #undef parameter_len 1320*7f2fe78bSCy Schubert 1321*7f2fe78bSCy Schubert #undef ck_mechanism_info 1322*7f2fe78bSCy Schubert #undef min_key_size 1323*7f2fe78bSCy Schubert #undef max_key_size 1324*7f2fe78bSCy Schubert 1325*7f2fe78bSCy Schubert #undef ck_rv_t 1326*7f2fe78bSCy Schubert #undef ck_notify_t 1327*7f2fe78bSCy Schubert 1328*7f2fe78bSCy Schubert #undef ck_function_list 1329*7f2fe78bSCy Schubert 1330*7f2fe78bSCy Schubert #undef ck_createmutex_t 1331*7f2fe78bSCy Schubert #undef ck_destroymutex_t 1332*7f2fe78bSCy Schubert #undef ck_lockmutex_t 1333*7f2fe78bSCy Schubert #undef ck_unlockmutex_t 1334*7f2fe78bSCy Schubert 1335*7f2fe78bSCy Schubert #undef ck_c_initialize_args 1336*7f2fe78bSCy Schubert #undef create_mutex 1337*7f2fe78bSCy Schubert #undef destroy_mutex 1338*7f2fe78bSCy Schubert #undef lock_mutex 1339*7f2fe78bSCy Schubert #undef unlock_mutex 1340*7f2fe78bSCy Schubert #undef reserved 1341*7f2fe78bSCy Schubert 1342*7f2fe78bSCy Schubert #endif /* CRYPTOKI_COMPAT */ 1343*7f2fe78bSCy Schubert 1344*7f2fe78bSCy Schubert /* System dependencies. */ 1345*7f2fe78bSCy Schubert #if defined(_WIN32) || defined(CRYPTOKI_FORCE_WIN32) 1346*7f2fe78bSCy Schubert #pragma pack(pop, cryptoki) 1347*7f2fe78bSCy Schubert #endif 1348*7f2fe78bSCy Schubert 1349*7f2fe78bSCy Schubert #if defined(__cplusplus) 1350*7f2fe78bSCy Schubert } 1351*7f2fe78bSCy Schubert #endif 1352*7f2fe78bSCy Schubert 1353*7f2fe78bSCy Schubert #endif /* PKCS11_H */ 1354