Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/security/pkcs11/wrapper/pkcs11t.h
38918 views
/* Copyright (c) OASIS Open 2016. All Rights Reserved./1* /Distributed under the terms of the OASIS IPR Policy,2* [http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY3* IMPLIED OR EXPRESS WARRANTY; there is no warranty of MERCHANTABILITY, FITNESS FOR A4* PARTICULAR PURPOSE or NONINFRINGEMENT of the rights of others.5*/67/* Latest version of the specification:8* http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html9*/1011/* See top of pkcs11.h for information about the macros that12* must be defined and the structure-packing conventions that13* must be set before including this file.14*/1516#ifndef _PKCS11T_H_17#define _PKCS11T_H_ 11819#define CRYPTOKI_VERSION_MAJOR 220#define CRYPTOKI_VERSION_MINOR 4021#define CRYPTOKI_VERSION_AMENDMENT 02223#define CK_TRUE 124#define CK_FALSE 02526#ifndef CK_DISABLE_TRUE_FALSE27#ifndef FALSE28#define FALSE CK_FALSE29#endif30#ifndef TRUE31#define TRUE CK_TRUE32#endif33#endif3435/* an unsigned 8-bit value */36typedef unsigned char CK_BYTE;3738/* an unsigned 8-bit character */39typedef CK_BYTE CK_CHAR;4041/* an 8-bit UTF-8 character */42typedef CK_BYTE CK_UTF8CHAR;4344/* a BYTE-sized Boolean flag */45typedef CK_BYTE CK_BBOOL;4647/* an unsigned value, at least 32 bits long */48typedef unsigned long int CK_ULONG;4950/* a signed value, the same size as a CK_ULONG */51typedef long int CK_LONG;5253/* at least 32 bits; each bit is a Boolean flag */54typedef CK_ULONG CK_FLAGS;555657/* some special values for certain CK_ULONG variables */58#define CK_UNAVAILABLE_INFORMATION (~0UL)59#define CK_EFFECTIVELY_INFINITE 0UL606162typedef CK_BYTE CK_PTR CK_BYTE_PTR;63typedef CK_CHAR CK_PTR CK_CHAR_PTR;64typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR;65typedef CK_ULONG CK_PTR CK_ULONG_PTR;66typedef void CK_PTR CK_VOID_PTR;6768/* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */69typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR;707172/* The following value is always invalid if used as a session73* handle or object handle74*/75#define CK_INVALID_HANDLE 0UL767778typedef struct CK_VERSION {79CK_BYTE major; /* integer portion of version number */80CK_BYTE minor; /* 1/100ths portion of version number */81} CK_VERSION;8283typedef CK_VERSION CK_PTR CK_VERSION_PTR;848586typedef struct CK_INFO {87CK_VERSION cryptokiVersion; /* Cryptoki interface ver */88CK_UTF8CHAR manufacturerID[32]; /* blank padded */89CK_FLAGS flags; /* must be zero */90CK_UTF8CHAR libraryDescription[32]; /* blank padded */91CK_VERSION libraryVersion; /* version of library */92} CK_INFO;9394typedef CK_INFO CK_PTR CK_INFO_PTR;959697/* CK_NOTIFICATION enumerates the types of notifications that98* Cryptoki provides to an application99*/100typedef CK_ULONG CK_NOTIFICATION;101#define CKN_SURRENDER 0UL102#define CKN_OTP_CHANGED 1UL103104typedef CK_ULONG CK_SLOT_ID;105106typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR;107108109/* CK_SLOT_INFO provides information about a slot */110typedef struct CK_SLOT_INFO {111CK_UTF8CHAR slotDescription[64]; /* blank padded */112CK_UTF8CHAR manufacturerID[32]; /* blank padded */113CK_FLAGS flags;114115CK_VERSION hardwareVersion; /* version of hardware */116CK_VERSION firmwareVersion; /* version of firmware */117} CK_SLOT_INFO;118119/* flags: bit flags that provide capabilities of the slot120* Bit Flag Mask Meaning121*/122#define CKF_TOKEN_PRESENT 0x00000001UL /* a token is there */123#define CKF_REMOVABLE_DEVICE 0x00000002UL /* removable devices*/124#define CKF_HW_SLOT 0x00000004UL /* hardware slot */125126typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR;127128129/* CK_TOKEN_INFO provides information about a token */130typedef struct CK_TOKEN_INFO {131CK_UTF8CHAR label[32]; /* blank padded */132CK_UTF8CHAR manufacturerID[32]; /* blank padded */133CK_UTF8CHAR model[16]; /* blank padded */134CK_CHAR serialNumber[16]; /* blank padded */135CK_FLAGS flags; /* see below */136137CK_ULONG ulMaxSessionCount; /* max open sessions */138CK_ULONG ulSessionCount; /* sess. now open */139CK_ULONG ulMaxRwSessionCount; /* max R/W sessions */140CK_ULONG ulRwSessionCount; /* R/W sess. now open */141CK_ULONG ulMaxPinLen; /* in bytes */142CK_ULONG ulMinPinLen; /* in bytes */143CK_ULONG ulTotalPublicMemory; /* in bytes */144CK_ULONG ulFreePublicMemory; /* in bytes */145CK_ULONG ulTotalPrivateMemory; /* in bytes */146CK_ULONG ulFreePrivateMemory; /* in bytes */147CK_VERSION hardwareVersion; /* version of hardware */148CK_VERSION firmwareVersion; /* version of firmware */149CK_CHAR utcTime[16]; /* time */150} CK_TOKEN_INFO;151152/* The flags parameter is defined as follows:153* Bit Flag Mask Meaning154*/155#define CKF_RNG 0x00000001UL /* has random # generator */156#define CKF_WRITE_PROTECTED 0x00000002UL /* token is write-protected */157#define CKF_LOGIN_REQUIRED 0x00000004UL /* user must login */158#define CKF_USER_PIN_INITIALIZED 0x00000008UL /* normal user's PIN is set */159160/* CKF_RESTORE_KEY_NOT_NEEDED. If it is set,161* that means that *every* time the state of cryptographic162* operations of a session is successfully saved, all keys163* needed to continue those operations are stored in the state164*/165#define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020UL166167/* CKF_CLOCK_ON_TOKEN. If it is set, that means168* that the token has some sort of clock. The time on that169* clock is returned in the token info structure170*/171#define CKF_CLOCK_ON_TOKEN 0x00000040UL172173/* CKF_PROTECTED_AUTHENTICATION_PATH. If it is174* set, that means that there is some way for the user to login175* without sending a PIN through the Cryptoki library itself176*/177#define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100UL178179/* CKF_DUAL_CRYPTO_OPERATIONS. If it is true,180* that means that a single session with the token can perform181* dual simultaneous cryptographic operations (digest and182* encrypt; decrypt and digest; sign and encrypt; and decrypt183* and sign)184*/185#define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200UL186187/* CKF_TOKEN_INITIALIZED. If it is true, the188* token has been initialized using C_InitializeToken or an189* equivalent mechanism outside the scope of PKCS #11.190* Calling C_InitializeToken when this flag is set will cause191* the token to be reinitialized.192*/193#define CKF_TOKEN_INITIALIZED 0x00000400UL194195/* CKF_SECONDARY_AUTHENTICATION. If it is196* true, the token supports secondary authentication for197* private key objects.198*/199#define CKF_SECONDARY_AUTHENTICATION 0x00000800UL200201/* CKF_USER_PIN_COUNT_LOW. If it is true, an202* incorrect user login PIN has been entered at least once203* since the last successful authentication.204*/205#define CKF_USER_PIN_COUNT_LOW 0x00010000UL206207/* CKF_USER_PIN_FINAL_TRY. If it is true,208* supplying an incorrect user PIN will it to become locked.209*/210#define CKF_USER_PIN_FINAL_TRY 0x00020000UL211212/* CKF_USER_PIN_LOCKED. If it is true, the213* user PIN has been locked. User login to the token is not214* possible.215*/216#define CKF_USER_PIN_LOCKED 0x00040000UL217218/* CKF_USER_PIN_TO_BE_CHANGED. If it is true,219* the user PIN value is the default value set by token220* initialization or manufacturing, or the PIN has been221* expired by the card.222*/223#define CKF_USER_PIN_TO_BE_CHANGED 0x00080000UL224225/* CKF_SO_PIN_COUNT_LOW. If it is true, an226* incorrect SO login PIN has been entered at least once since227* the last successful authentication.228*/229#define CKF_SO_PIN_COUNT_LOW 0x00100000UL230231/* CKF_SO_PIN_FINAL_TRY. If it is true,232* supplying an incorrect SO PIN will it to become locked.233*/234#define CKF_SO_PIN_FINAL_TRY 0x00200000UL235236/* CKF_SO_PIN_LOCKED. If it is true, the SO237* PIN has been locked. SO login to the token is not possible.238*/239#define CKF_SO_PIN_LOCKED 0x00400000UL240241/* CKF_SO_PIN_TO_BE_CHANGED. If it is true,242* the SO PIN value is the default value set by token243* initialization or manufacturing, or the PIN has been244* expired by the card.245*/246#define CKF_SO_PIN_TO_BE_CHANGED 0x00800000UL247248#define CKF_ERROR_STATE 0x01000000UL249250typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR;251252253/* CK_SESSION_HANDLE is a Cryptoki-assigned value that254* identifies a session255*/256typedef CK_ULONG CK_SESSION_HANDLE;257258typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR;259260261/* CK_USER_TYPE enumerates the types of Cryptoki users */262typedef CK_ULONG CK_USER_TYPE;263/* Security Officer */264#define CKU_SO 0UL265/* Normal user */266#define CKU_USER 1UL267/* Context specific */268#define CKU_CONTEXT_SPECIFIC 2UL269270/* CK_STATE enumerates the session states */271typedef CK_ULONG CK_STATE;272#define CKS_RO_PUBLIC_SESSION 0UL273#define CKS_RO_USER_FUNCTIONS 1UL274#define CKS_RW_PUBLIC_SESSION 2UL275#define CKS_RW_USER_FUNCTIONS 3UL276#define CKS_RW_SO_FUNCTIONS 4UL277278/* CK_SESSION_INFO provides information about a session */279typedef struct CK_SESSION_INFO {280CK_SLOT_ID slotID;281CK_STATE state;282CK_FLAGS flags; /* see below */283CK_ULONG ulDeviceError; /* device-dependent error code */284} CK_SESSION_INFO;285286/* The flags are defined in the following table:287* Bit Flag Mask Meaning288*/289#define CKF_RW_SESSION 0x00000002UL /* session is r/w */290#define CKF_SERIAL_SESSION 0x00000004UL /* no parallel */291292typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR;293294295/* CK_OBJECT_HANDLE is a token-specific identifier for an296* object297*/298typedef CK_ULONG CK_OBJECT_HANDLE;299300typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR;301302303/* CK_OBJECT_CLASS is a value that identifies the classes (or304* types) of objects that Cryptoki recognizes. It is defined305* as follows:306*/307typedef CK_ULONG CK_OBJECT_CLASS;308309/* The following classes of objects are defined: */310#define CKO_DATA 0x00000000UL311#define CKO_CERTIFICATE 0x00000001UL312#define CKO_PUBLIC_KEY 0x00000002UL313#define CKO_PRIVATE_KEY 0x00000003UL314#define CKO_SECRET_KEY 0x00000004UL315#define CKO_HW_FEATURE 0x00000005UL316#define CKO_DOMAIN_PARAMETERS 0x00000006UL317#define CKO_MECHANISM 0x00000007UL318#define CKO_OTP_KEY 0x00000008UL319320#define CKO_VENDOR_DEFINED 0x80000000UL321322typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR;323324/* CK_HW_FEATURE_TYPE is a value that identifies the hardware feature type325* of an object with CK_OBJECT_CLASS equal to CKO_HW_FEATURE.326*/327typedef CK_ULONG CK_HW_FEATURE_TYPE;328329/* The following hardware feature types are defined */330#define CKH_MONOTONIC_COUNTER 0x00000001UL331#define CKH_CLOCK 0x00000002UL332#define CKH_USER_INTERFACE 0x00000003UL333#define CKH_VENDOR_DEFINED 0x80000000UL334335/* CK_KEY_TYPE is a value that identifies a key type */336typedef CK_ULONG CK_KEY_TYPE;337338/* the following key types are defined: */339#define CKK_RSA 0x00000000UL340#define CKK_DSA 0x00000001UL341#define CKK_DH 0x00000002UL342#define CKK_ECDSA 0x00000003UL /* Deprecated */343#define CKK_EC 0x00000003UL344#define CKK_X9_42_DH 0x00000004UL345#define CKK_KEA 0x00000005UL346#define CKK_GENERIC_SECRET 0x00000010UL347#define CKK_RC2 0x00000011UL348#define CKK_RC4 0x00000012UL349#define CKK_DES 0x00000013UL350#define CKK_DES2 0x00000014UL351#define CKK_DES3 0x00000015UL352#define CKK_CAST 0x00000016UL353#define CKK_CAST3 0x00000017UL354#define CKK_CAST5 0x00000018UL /* Deprecated */355#define CKK_CAST128 0x00000018UL356#define CKK_RC5 0x00000019UL357#define CKK_IDEA 0x0000001AUL358#define CKK_SKIPJACK 0x0000001BUL359#define CKK_BATON 0x0000001CUL360#define CKK_JUNIPER 0x0000001DUL361#define CKK_CDMF 0x0000001EUL362#define CKK_AES 0x0000001FUL363#define CKK_BLOWFISH 0x00000020UL364#define CKK_TWOFISH 0x00000021UL365#define CKK_SECURID 0x00000022UL366#define CKK_HOTP 0x00000023UL367#define CKK_ACTI 0x00000024UL368#define CKK_CAMELLIA 0x00000025UL369#define CKK_ARIA 0x00000026UL370371#define CKK_MD5_HMAC 0x00000027UL372#define CKK_SHA_1_HMAC 0x00000028UL373#define CKK_RIPEMD128_HMAC 0x00000029UL374#define CKK_RIPEMD160_HMAC 0x0000002AUL375#define CKK_SHA256_HMAC 0x0000002BUL376#define CKK_SHA384_HMAC 0x0000002CUL377#define CKK_SHA512_HMAC 0x0000002DUL378#define CKK_SHA224_HMAC 0x0000002EUL379380#define CKK_SEED 0x0000002FUL381#define CKK_GOSTR3410 0x00000030UL382#define CKK_GOSTR3411 0x00000031UL383#define CKK_GOST28147 0x00000032UL384385386387#define CKK_VENDOR_DEFINED 0x80000000UL388389390/* CK_CERTIFICATE_TYPE is a value that identifies a certificate391* type392*/393typedef CK_ULONG CK_CERTIFICATE_TYPE;394395#define CK_CERTIFICATE_CATEGORY_UNSPECIFIED 0UL396#define CK_CERTIFICATE_CATEGORY_TOKEN_USER 1UL397#define CK_CERTIFICATE_CATEGORY_AUTHORITY 2UL398#define CK_CERTIFICATE_CATEGORY_OTHER_ENTITY 3UL399400#define CK_SECURITY_DOMAIN_UNSPECIFIED 0UL401#define CK_SECURITY_DOMAIN_MANUFACTURER 1UL402#define CK_SECURITY_DOMAIN_OPERATOR 2UL403#define CK_SECURITY_DOMAIN_THIRD_PARTY 3UL404405406/* The following certificate types are defined: */407#define CKC_X_509 0x00000000UL408#define CKC_X_509_ATTR_CERT 0x00000001UL409#define CKC_WTLS 0x00000002UL410#define CKC_VENDOR_DEFINED 0x80000000UL411412413/* CK_ATTRIBUTE_TYPE is a value that identifies an attribute414* type415*/416typedef CK_ULONG CK_ATTRIBUTE_TYPE;417418/* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which419* consists of an array of values.420*/421#define CKF_ARRAY_ATTRIBUTE 0x40000000UL422423/* The following OTP-related defines relate to the CKA_OTP_FORMAT attribute */424#define CK_OTP_FORMAT_DECIMAL 0UL425#define CK_OTP_FORMAT_HEXADECIMAL 1UL426#define CK_OTP_FORMAT_ALPHANUMERIC 2UL427#define CK_OTP_FORMAT_BINARY 3UL428429/* The following OTP-related defines relate to the CKA_OTP_..._REQUIREMENT430* attributes431*/432#define CK_OTP_PARAM_IGNORED 0UL433#define CK_OTP_PARAM_OPTIONAL 1UL434#define CK_OTP_PARAM_MANDATORY 2UL435436/* The following attribute types are defined: */437#define CKA_CLASS 0x00000000UL438#define CKA_TOKEN 0x00000001UL439#define CKA_PRIVATE 0x00000002UL440#define CKA_LABEL 0x00000003UL441#define CKA_APPLICATION 0x00000010UL442#define CKA_VALUE 0x00000011UL443#define CKA_OBJECT_ID 0x00000012UL444#define CKA_CERTIFICATE_TYPE 0x00000080UL445#define CKA_ISSUER 0x00000081UL446#define CKA_SERIAL_NUMBER 0x00000082UL447#define CKA_AC_ISSUER 0x00000083UL448#define CKA_OWNER 0x00000084UL449#define CKA_ATTR_TYPES 0x00000085UL450#define CKA_TRUSTED 0x00000086UL451#define CKA_CERTIFICATE_CATEGORY 0x00000087UL452#define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088UL453#define CKA_URL 0x00000089UL454#define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008AUL455#define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008BUL456#define CKA_NAME_HASH_ALGORITHM 0x0000008CUL457#define CKA_CHECK_VALUE 0x00000090UL458459#define CKA_KEY_TYPE 0x00000100UL460#define CKA_SUBJECT 0x00000101UL461#define CKA_ID 0x00000102UL462#define CKA_SENSITIVE 0x00000103UL463#define CKA_ENCRYPT 0x00000104UL464#define CKA_DECRYPT 0x00000105UL465#define CKA_WRAP 0x00000106UL466#define CKA_UNWRAP 0x00000107UL467#define CKA_SIGN 0x00000108UL468#define CKA_SIGN_RECOVER 0x00000109UL469#define CKA_VERIFY 0x0000010AUL470#define CKA_VERIFY_RECOVER 0x0000010BUL471#define CKA_DERIVE 0x0000010CUL472#define CKA_START_DATE 0x00000110UL473#define CKA_END_DATE 0x00000111UL474#define CKA_MODULUS 0x00000120UL475#define CKA_MODULUS_BITS 0x00000121UL476#define CKA_PUBLIC_EXPONENT 0x00000122UL477#define CKA_PRIVATE_EXPONENT 0x00000123UL478#define CKA_PRIME_1 0x00000124UL479#define CKA_PRIME_2 0x00000125UL480#define CKA_EXPONENT_1 0x00000126UL481#define CKA_EXPONENT_2 0x00000127UL482#define CKA_COEFFICIENT 0x00000128UL483#define CKA_PUBLIC_KEY_INFO 0x00000129UL484#define CKA_PRIME 0x00000130UL485#define CKA_SUBPRIME 0x00000131UL486#define CKA_BASE 0x00000132UL487488#define CKA_PRIME_BITS 0x00000133UL489#define CKA_SUBPRIME_BITS 0x00000134UL490#define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS491492#define CKA_VALUE_BITS 0x00000160UL493#define CKA_VALUE_LEN 0x00000161UL494#define CKA_EXTRACTABLE 0x00000162UL495#define CKA_LOCAL 0x00000163UL496#define CKA_NEVER_EXTRACTABLE 0x00000164UL497#define CKA_ALWAYS_SENSITIVE 0x00000165UL498#define CKA_KEY_GEN_MECHANISM 0x00000166UL499500#define CKA_MODIFIABLE 0x00000170UL501#define CKA_COPYABLE 0x00000171UL502503#define CKA_DESTROYABLE 0x00000172UL504505#define CKA_ECDSA_PARAMS 0x00000180UL /* Deprecated */506#define CKA_EC_PARAMS 0x00000180UL507508#define CKA_EC_POINT 0x00000181UL509510#define CKA_SECONDARY_AUTH 0x00000200UL /* Deprecated */511#define CKA_AUTH_PIN_FLAGS 0x00000201UL /* Deprecated */512513#define CKA_ALWAYS_AUTHENTICATE 0x00000202UL514515#define CKA_WRAP_WITH_TRUSTED 0x00000210UL516#define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211UL)517#define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212UL)518#define CKA_DERIVE_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000213UL)519520#define CKA_OTP_FORMAT 0x00000220UL521#define CKA_OTP_LENGTH 0x00000221UL522#define CKA_OTP_TIME_INTERVAL 0x00000222UL523#define CKA_OTP_USER_FRIENDLY_MODE 0x00000223UL524#define CKA_OTP_CHALLENGE_REQUIREMENT 0x00000224UL525#define CKA_OTP_TIME_REQUIREMENT 0x00000225UL526#define CKA_OTP_COUNTER_REQUIREMENT 0x00000226UL527#define CKA_OTP_PIN_REQUIREMENT 0x00000227UL528#define CKA_OTP_COUNTER 0x0000022EUL529#define CKA_OTP_TIME 0x0000022FUL530#define CKA_OTP_USER_IDENTIFIER 0x0000022AUL531#define CKA_OTP_SERVICE_IDENTIFIER 0x0000022BUL532#define CKA_OTP_SERVICE_LOGO 0x0000022CUL533#define CKA_OTP_SERVICE_LOGO_TYPE 0x0000022DUL534535#define CKA_GOSTR3410_PARAMS 0x00000250UL536#define CKA_GOSTR3411_PARAMS 0x00000251UL537#define CKA_GOST28147_PARAMS 0x00000252UL538539#define CKA_HW_FEATURE_TYPE 0x00000300UL540#define CKA_RESET_ON_INIT 0x00000301UL541#define CKA_HAS_RESET 0x00000302UL542543#define CKA_PIXEL_X 0x00000400UL544#define CKA_PIXEL_Y 0x00000401UL545#define CKA_RESOLUTION 0x00000402UL546#define CKA_CHAR_ROWS 0x00000403UL547#define CKA_CHAR_COLUMNS 0x00000404UL548#define CKA_COLOR 0x00000405UL549#define CKA_BITS_PER_PIXEL 0x00000406UL550#define CKA_CHAR_SETS 0x00000480UL551#define CKA_ENCODING_METHODS 0x00000481UL552#define CKA_MIME_TYPES 0x00000482UL553#define CKA_MECHANISM_TYPE 0x00000500UL554#define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501UL555#define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502UL556#define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503UL557#define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600UL)558559#define CKA_VENDOR_DEFINED 0x80000000UL560561/* CK_ATTRIBUTE is a structure that includes the type, length562* and value of an attribute563*/564typedef struct CK_ATTRIBUTE {565CK_ATTRIBUTE_TYPE type;566CK_VOID_PTR pValue;567CK_ULONG ulValueLen; /* in bytes */568} CK_ATTRIBUTE;569570typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR;571572/* CK_DATE is a structure that defines a date */573typedef struct CK_DATE{574CK_CHAR year[4]; /* the year ("1900" - "9999") */575CK_CHAR month[2]; /* the month ("01" - "12") */576CK_CHAR day[2]; /* the day ("01" - "31") */577} CK_DATE;578579580/* CK_MECHANISM_TYPE is a value that identifies a mechanism581* type582*/583typedef CK_ULONG CK_MECHANISM_TYPE;584585/* the following mechanism types are defined: */586#define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000UL587#define CKM_RSA_PKCS 0x00000001UL588#define CKM_RSA_9796 0x00000002UL589#define CKM_RSA_X_509 0x00000003UL590591#define CKM_MD2_RSA_PKCS 0x00000004UL592#define CKM_MD5_RSA_PKCS 0x00000005UL593#define CKM_SHA1_RSA_PKCS 0x00000006UL594595#define CKM_RIPEMD128_RSA_PKCS 0x00000007UL596#define CKM_RIPEMD160_RSA_PKCS 0x00000008UL597#define CKM_RSA_PKCS_OAEP 0x00000009UL598599#define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000AUL600#define CKM_RSA_X9_31 0x0000000BUL601#define CKM_SHA1_RSA_X9_31 0x0000000CUL602#define CKM_RSA_PKCS_PSS 0x0000000DUL603#define CKM_SHA1_RSA_PKCS_PSS 0x0000000EUL604605#define CKM_DSA_KEY_PAIR_GEN 0x00000010UL606#define CKM_DSA 0x00000011UL607#define CKM_DSA_SHA1 0x00000012UL608#define CKM_DSA_SHA224 0x00000013UL609#define CKM_DSA_SHA256 0x00000014UL610#define CKM_DSA_SHA384 0x00000015UL611#define CKM_DSA_SHA512 0x00000016UL612613#define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020UL614#define CKM_DH_PKCS_DERIVE 0x00000021UL615616#define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030UL617#define CKM_X9_42_DH_DERIVE 0x00000031UL618#define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032UL619#define CKM_X9_42_MQV_DERIVE 0x00000033UL620621#define CKM_SHA256_RSA_PKCS 0x00000040UL622#define CKM_SHA384_RSA_PKCS 0x00000041UL623#define CKM_SHA512_RSA_PKCS 0x00000042UL624#define CKM_SHA256_RSA_PKCS_PSS 0x00000043UL625#define CKM_SHA384_RSA_PKCS_PSS 0x00000044UL626#define CKM_SHA512_RSA_PKCS_PSS 0x00000045UL627628#define CKM_SHA224_RSA_PKCS 0x00000046UL629#define CKM_SHA224_RSA_PKCS_PSS 0x00000047UL630631#define CKM_SHA512_224 0x00000048UL632#define CKM_SHA512_224_HMAC 0x00000049UL633#define CKM_SHA512_224_HMAC_GENERAL 0x0000004AUL634#define CKM_SHA512_224_KEY_DERIVATION 0x0000004BUL635#define CKM_SHA512_256 0x0000004CUL636#define CKM_SHA512_256_HMAC 0x0000004DUL637#define CKM_SHA512_256_HMAC_GENERAL 0x0000004EUL638#define CKM_SHA512_256_KEY_DERIVATION 0x0000004FUL639640#define CKM_SHA512_T 0x00000050UL641#define CKM_SHA512_T_HMAC 0x00000051UL642#define CKM_SHA512_T_HMAC_GENERAL 0x00000052UL643#define CKM_SHA512_T_KEY_DERIVATION 0x00000053UL644645#define CKM_RC2_KEY_GEN 0x00000100UL646#define CKM_RC2_ECB 0x00000101UL647#define CKM_RC2_CBC 0x00000102UL648#define CKM_RC2_MAC 0x00000103UL649650#define CKM_RC2_MAC_GENERAL 0x00000104UL651#define CKM_RC2_CBC_PAD 0x00000105UL652653#define CKM_RC4_KEY_GEN 0x00000110UL654#define CKM_RC4 0x00000111UL655#define CKM_DES_KEY_GEN 0x00000120UL656#define CKM_DES_ECB 0x00000121UL657#define CKM_DES_CBC 0x00000122UL658#define CKM_DES_MAC 0x00000123UL659660#define CKM_DES_MAC_GENERAL 0x00000124UL661#define CKM_DES_CBC_PAD 0x00000125UL662663#define CKM_DES2_KEY_GEN 0x00000130UL664#define CKM_DES3_KEY_GEN 0x00000131UL665#define CKM_DES3_ECB 0x00000132UL666#define CKM_DES3_CBC 0x00000133UL667#define CKM_DES3_MAC 0x00000134UL668669#define CKM_DES3_MAC_GENERAL 0x00000135UL670#define CKM_DES3_CBC_PAD 0x00000136UL671#define CKM_DES3_CMAC_GENERAL 0x00000137UL672#define CKM_DES3_CMAC 0x00000138UL673#define CKM_CDMF_KEY_GEN 0x00000140UL674#define CKM_CDMF_ECB 0x00000141UL675#define CKM_CDMF_CBC 0x00000142UL676#define CKM_CDMF_MAC 0x00000143UL677#define CKM_CDMF_MAC_GENERAL 0x00000144UL678#define CKM_CDMF_CBC_PAD 0x00000145UL679680#define CKM_DES_OFB64 0x00000150UL681#define CKM_DES_OFB8 0x00000151UL682#define CKM_DES_CFB64 0x00000152UL683#define CKM_DES_CFB8 0x00000153UL684685#define CKM_MD2 0x00000200UL686687#define CKM_MD2_HMAC 0x00000201UL688#define CKM_MD2_HMAC_GENERAL 0x00000202UL689690#define CKM_MD5 0x00000210UL691692#define CKM_MD5_HMAC 0x00000211UL693#define CKM_MD5_HMAC_GENERAL 0x00000212UL694695#define CKM_SHA_1 0x00000220UL696697#define CKM_SHA_1_HMAC 0x00000221UL698#define CKM_SHA_1_HMAC_GENERAL 0x00000222UL699700#define CKM_RIPEMD128 0x00000230UL701#define CKM_RIPEMD128_HMAC 0x00000231UL702#define CKM_RIPEMD128_HMAC_GENERAL 0x00000232UL703#define CKM_RIPEMD160 0x00000240UL704#define CKM_RIPEMD160_HMAC 0x00000241UL705#define CKM_RIPEMD160_HMAC_GENERAL 0x00000242UL706707#define CKM_SHA256 0x00000250UL708#define CKM_SHA256_HMAC 0x00000251UL709#define CKM_SHA256_HMAC_GENERAL 0x00000252UL710#define CKM_SHA224 0x00000255UL711#define CKM_SHA224_HMAC 0x00000256UL712#define CKM_SHA224_HMAC_GENERAL 0x00000257UL713#define CKM_SHA384 0x00000260UL714#define CKM_SHA384_HMAC 0x00000261UL715#define CKM_SHA384_HMAC_GENERAL 0x00000262UL716#define CKM_SHA512 0x00000270UL717#define CKM_SHA512_HMAC 0x00000271UL718#define CKM_SHA512_HMAC_GENERAL 0x00000272UL719#define CKM_SECURID_KEY_GEN 0x00000280UL720#define CKM_SECURID 0x00000282UL721#define CKM_HOTP_KEY_GEN 0x00000290UL722#define CKM_HOTP 0x00000291UL723#define CKM_ACTI 0x000002A0UL724#define CKM_ACTI_KEY_GEN 0x000002A1UL725726#define CKM_CAST_KEY_GEN 0x00000300UL727#define CKM_CAST_ECB 0x00000301UL728#define CKM_CAST_CBC 0x00000302UL729#define CKM_CAST_MAC 0x00000303UL730#define CKM_CAST_MAC_GENERAL 0x00000304UL731#define CKM_CAST_CBC_PAD 0x00000305UL732#define CKM_CAST3_KEY_GEN 0x00000310UL733#define CKM_CAST3_ECB 0x00000311UL734#define CKM_CAST3_CBC 0x00000312UL735#define CKM_CAST3_MAC 0x00000313UL736#define CKM_CAST3_MAC_GENERAL 0x00000314UL737#define CKM_CAST3_CBC_PAD 0x00000315UL738/* Note that CAST128 and CAST5 are the same algorithm */739#define CKM_CAST5_KEY_GEN 0x00000320UL740#define CKM_CAST128_KEY_GEN 0x00000320UL741#define CKM_CAST5_ECB 0x00000321UL742#define CKM_CAST128_ECB 0x00000321UL743#define CKM_CAST5_CBC 0x00000322UL /* Deprecated */744#define CKM_CAST128_CBC 0x00000322UL745#define CKM_CAST5_MAC 0x00000323UL /* Deprecated */746#define CKM_CAST128_MAC 0x00000323UL747#define CKM_CAST5_MAC_GENERAL 0x00000324UL /* Deprecated */748#define CKM_CAST128_MAC_GENERAL 0x00000324UL749#define CKM_CAST5_CBC_PAD 0x00000325UL /* Deprecated */750#define CKM_CAST128_CBC_PAD 0x00000325UL751#define CKM_RC5_KEY_GEN 0x00000330UL752#define CKM_RC5_ECB 0x00000331UL753#define CKM_RC5_CBC 0x00000332UL754#define CKM_RC5_MAC 0x00000333UL755#define CKM_RC5_MAC_GENERAL 0x00000334UL756#define CKM_RC5_CBC_PAD 0x00000335UL757#define CKM_IDEA_KEY_GEN 0x00000340UL758#define CKM_IDEA_ECB 0x00000341UL759#define CKM_IDEA_CBC 0x00000342UL760#define CKM_IDEA_MAC 0x00000343UL761#define CKM_IDEA_MAC_GENERAL 0x00000344UL762#define CKM_IDEA_CBC_PAD 0x00000345UL763#define CKM_GENERIC_SECRET_KEY_GEN 0x00000350UL764#define CKM_CONCATENATE_BASE_AND_KEY 0x00000360UL765#define CKM_CONCATENATE_BASE_AND_DATA 0x00000362UL766#define CKM_CONCATENATE_DATA_AND_BASE 0x00000363UL767#define CKM_XOR_BASE_AND_DATA 0x00000364UL768#define CKM_EXTRACT_KEY_FROM_KEY 0x00000365UL769#define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370UL770#define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371UL771#define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372UL772773#define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373UL774#define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374UL775#define CKM_TLS_MASTER_KEY_DERIVE 0x00000375UL776#define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376UL777#define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377UL778779#define CKM_TLS_PRF 0x00000378UL780781#define CKM_SSL3_MD5_MAC 0x00000380UL782#define CKM_SSL3_SHA1_MAC 0x00000381UL783#define CKM_MD5_KEY_DERIVATION 0x00000390UL784#define CKM_MD2_KEY_DERIVATION 0x00000391UL785#define CKM_SHA1_KEY_DERIVATION 0x00000392UL786787#define CKM_SHA256_KEY_DERIVATION 0x00000393UL788#define CKM_SHA384_KEY_DERIVATION 0x00000394UL789#define CKM_SHA512_KEY_DERIVATION 0x00000395UL790#define CKM_SHA224_KEY_DERIVATION 0x00000396UL791792#define CKM_PBE_MD2_DES_CBC 0x000003A0UL793#define CKM_PBE_MD5_DES_CBC 0x000003A1UL794#define CKM_PBE_MD5_CAST_CBC 0x000003A2UL795#define CKM_PBE_MD5_CAST3_CBC 0x000003A3UL796#define CKM_PBE_MD5_CAST5_CBC 0x000003A4UL /* Deprecated */797#define CKM_PBE_MD5_CAST128_CBC 0x000003A4UL798#define CKM_PBE_SHA1_CAST5_CBC 0x000003A5UL /* Deprecated */799#define CKM_PBE_SHA1_CAST128_CBC 0x000003A5UL800#define CKM_PBE_SHA1_RC4_128 0x000003A6UL801#define CKM_PBE_SHA1_RC4_40 0x000003A7UL802#define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8UL803#define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9UL804#define CKM_PBE_SHA1_RC2_128_CBC 0x000003AAUL805#define CKM_PBE_SHA1_RC2_40_CBC 0x000003ABUL806807#define CKM_PKCS5_PBKD2 0x000003B0UL808809#define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0UL810811#define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003D0UL812#define CKM_WTLS_MASTER_KEY_DERIVE 0x000003D1UL813#define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003D2UL814#define CKM_WTLS_PRF 0x000003D3UL815#define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003D4UL816#define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003D5UL817818#define CKM_TLS10_MAC_SERVER 0x000003D6UL819#define CKM_TLS10_MAC_CLIENT 0x000003D7UL820#define CKM_TLS12_MAC 0x000003D8UL821#define CKM_TLS12_KDF 0x000003D9UL822#define CKM_TLS12_MASTER_KEY_DERIVE 0x000003E0UL823#define CKM_TLS12_KEY_AND_MAC_DERIVE 0x000003E1UL824#define CKM_TLS12_MASTER_KEY_DERIVE_DH 0x000003E2UL825#define CKM_TLS12_KEY_SAFE_DERIVE 0x000003E3UL826#define CKM_TLS_MAC 0x000003E4UL827#define CKM_TLS_KDF 0x000003E5UL828829#define CKM_KEY_WRAP_LYNKS 0x00000400UL830#define CKM_KEY_WRAP_SET_OAEP 0x00000401UL831832#define CKM_CMS_SIG 0x00000500UL833#define CKM_KIP_DERIVE 0x00000510UL834#define CKM_KIP_WRAP 0x00000511UL835#define CKM_KIP_MAC 0x00000512UL836837#define CKM_CAMELLIA_KEY_GEN 0x00000550UL838#define CKM_CAMELLIA_ECB 0x00000551UL839#define CKM_CAMELLIA_CBC 0x00000552UL840#define CKM_CAMELLIA_MAC 0x00000553UL841#define CKM_CAMELLIA_MAC_GENERAL 0x00000554UL842#define CKM_CAMELLIA_CBC_PAD 0x00000555UL843#define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556UL844#define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557UL845#define CKM_CAMELLIA_CTR 0x00000558UL846847#define CKM_ARIA_KEY_GEN 0x00000560UL848#define CKM_ARIA_ECB 0x00000561UL849#define CKM_ARIA_CBC 0x00000562UL850#define CKM_ARIA_MAC 0x00000563UL851#define CKM_ARIA_MAC_GENERAL 0x00000564UL852#define CKM_ARIA_CBC_PAD 0x00000565UL853#define CKM_ARIA_ECB_ENCRYPT_DATA 0x00000566UL854#define CKM_ARIA_CBC_ENCRYPT_DATA 0x00000567UL855856#define CKM_SEED_KEY_GEN 0x00000650UL857#define CKM_SEED_ECB 0x00000651UL858#define CKM_SEED_CBC 0x00000652UL859#define CKM_SEED_MAC 0x00000653UL860#define CKM_SEED_MAC_GENERAL 0x00000654UL861#define CKM_SEED_CBC_PAD 0x00000655UL862#define CKM_SEED_ECB_ENCRYPT_DATA 0x00000656UL863#define CKM_SEED_CBC_ENCRYPT_DATA 0x00000657UL864865#define CKM_SKIPJACK_KEY_GEN 0x00001000UL866#define CKM_SKIPJACK_ECB64 0x00001001UL867#define CKM_SKIPJACK_CBC64 0x00001002UL868#define CKM_SKIPJACK_OFB64 0x00001003UL869#define CKM_SKIPJACK_CFB64 0x00001004UL870#define CKM_SKIPJACK_CFB32 0x00001005UL871#define CKM_SKIPJACK_CFB16 0x00001006UL872#define CKM_SKIPJACK_CFB8 0x00001007UL873#define CKM_SKIPJACK_WRAP 0x00001008UL874#define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009UL875#define CKM_SKIPJACK_RELAYX 0x0000100aUL876#define CKM_KEA_KEY_PAIR_GEN 0x00001010UL877#define CKM_KEA_KEY_DERIVE 0x00001011UL878#define CKM_KEA_DERIVE 0x00001012UL879#define CKM_FORTEZZA_TIMESTAMP 0x00001020UL880#define CKM_BATON_KEY_GEN 0x00001030UL881#define CKM_BATON_ECB128 0x00001031UL882#define CKM_BATON_ECB96 0x00001032UL883#define CKM_BATON_CBC128 0x00001033UL884#define CKM_BATON_COUNTER 0x00001034UL885#define CKM_BATON_SHUFFLE 0x00001035UL886#define CKM_BATON_WRAP 0x00001036UL887888#define CKM_ECDSA_KEY_PAIR_GEN 0x00001040UL /* Deprecated */889#define CKM_EC_KEY_PAIR_GEN 0x00001040UL890891#define CKM_ECDSA 0x00001041UL892#define CKM_ECDSA_SHA1 0x00001042UL893#define CKM_ECDSA_SHA224 0x00001043UL894#define CKM_ECDSA_SHA256 0x00001044UL895#define CKM_ECDSA_SHA384 0x00001045UL896#define CKM_ECDSA_SHA512 0x00001046UL897898#define CKM_ECDH1_DERIVE 0x00001050UL899#define CKM_ECDH1_COFACTOR_DERIVE 0x00001051UL900#define CKM_ECMQV_DERIVE 0x00001052UL901902#define CKM_ECDH_AES_KEY_WRAP 0x00001053UL903#define CKM_RSA_AES_KEY_WRAP 0x00001054UL904905#define CKM_JUNIPER_KEY_GEN 0x00001060UL906#define CKM_JUNIPER_ECB128 0x00001061UL907#define CKM_JUNIPER_CBC128 0x00001062UL908#define CKM_JUNIPER_COUNTER 0x00001063UL909#define CKM_JUNIPER_SHUFFLE 0x00001064UL910#define CKM_JUNIPER_WRAP 0x00001065UL911#define CKM_FASTHASH 0x00001070UL912913#define CKM_AES_KEY_GEN 0x00001080UL914#define CKM_AES_ECB 0x00001081UL915#define CKM_AES_CBC 0x00001082UL916#define CKM_AES_MAC 0x00001083UL917#define CKM_AES_MAC_GENERAL 0x00001084UL918#define CKM_AES_CBC_PAD 0x00001085UL919#define CKM_AES_CTR 0x00001086UL920#define CKM_AES_GCM 0x00001087UL921#define CKM_AES_CCM 0x00001088UL922#define CKM_AES_CTS 0x00001089UL923#define CKM_AES_CMAC 0x0000108AUL924#define CKM_AES_CMAC_GENERAL 0x0000108BUL925926#define CKM_AES_XCBC_MAC 0x0000108CUL927#define CKM_AES_XCBC_MAC_96 0x0000108DUL928#define CKM_AES_GMAC 0x0000108EUL929930#define CKM_BLOWFISH_KEY_GEN 0x00001090UL931#define CKM_BLOWFISH_CBC 0x00001091UL932#define CKM_TWOFISH_KEY_GEN 0x00001092UL933#define CKM_TWOFISH_CBC 0x00001093UL934#define CKM_BLOWFISH_CBC_PAD 0x00001094UL935#define CKM_TWOFISH_CBC_PAD 0x00001095UL936937#define CKM_DES_ECB_ENCRYPT_DATA 0x00001100UL938#define CKM_DES_CBC_ENCRYPT_DATA 0x00001101UL939#define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102UL940#define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103UL941#define CKM_AES_ECB_ENCRYPT_DATA 0x00001104UL942#define CKM_AES_CBC_ENCRYPT_DATA 0x00001105UL943944#define CKM_GOSTR3410_KEY_PAIR_GEN 0x00001200UL945#define CKM_GOSTR3410 0x00001201UL946#define CKM_GOSTR3410_WITH_GOSTR3411 0x00001202UL947#define CKM_GOSTR3410_KEY_WRAP 0x00001203UL948#define CKM_GOSTR3410_DERIVE 0x00001204UL949#define CKM_GOSTR3411 0x00001210UL950#define CKM_GOSTR3411_HMAC 0x00001211UL951#define CKM_GOST28147_KEY_GEN 0x00001220UL952#define CKM_GOST28147_ECB 0x00001221UL953#define CKM_GOST28147 0x00001222UL954#define CKM_GOST28147_MAC 0x00001223UL955#define CKM_GOST28147_KEY_WRAP 0x00001224UL956957#define CKM_DSA_PARAMETER_GEN 0x00002000UL958#define CKM_DH_PKCS_PARAMETER_GEN 0x00002001UL959#define CKM_X9_42_DH_PARAMETER_GEN 0x00002002UL960#define CKM_DSA_PROBABLISTIC_PARAMETER_GEN 0x00002003UL961#define CKM_DSA_SHAWE_TAYLOR_PARAMETER_GEN 0x00002004UL962963#define CKM_AES_OFB 0x00002104UL964#define CKM_AES_CFB64 0x00002105UL965#define CKM_AES_CFB8 0x00002106UL966#define CKM_AES_CFB128 0x00002107UL967968#define CKM_AES_CFB1 0x00002108UL969#define CKM_AES_KEY_WRAP 0x00002109UL /* WAS: 0x00001090 */970#define CKM_AES_KEY_WRAP_PAD 0x0000210AUL /* WAS: 0x00001091 */971972#define CKM_RSA_PKCS_TPM_1_1 0x00004001UL973#define CKM_RSA_PKCS_OAEP_TPM_1_1 0x00004002UL974975#define CKM_VENDOR_DEFINED 0x80000000UL976977typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR;978979980/* CK_MECHANISM is a structure that specifies a particular981* mechanism982*/983typedef struct CK_MECHANISM {984CK_MECHANISM_TYPE mechanism;985CK_VOID_PTR pParameter;986CK_ULONG ulParameterLen; /* in bytes */987} CK_MECHANISM;988989typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR;990991992/* CK_MECHANISM_INFO provides information about a particular993* mechanism994*/995typedef struct CK_MECHANISM_INFO {996CK_ULONG ulMinKeySize;997CK_ULONG ulMaxKeySize;998CK_FLAGS flags;999} CK_MECHANISM_INFO;10001001/* The flags are defined as follows:1002* Bit Flag Mask Meaning */1003#define CKF_HW 0x00000001UL /* performed by HW */10041005/* Specify whether or not a mechanism can be used for a particular task */1006#define CKF_ENCRYPT 0x00000100UL1007#define CKF_DECRYPT 0x00000200UL1008#define CKF_DIGEST 0x00000400UL1009#define CKF_SIGN 0x00000800UL1010#define CKF_SIGN_RECOVER 0x00001000UL1011#define CKF_VERIFY 0x00002000UL1012#define CKF_VERIFY_RECOVER 0x00004000UL1013#define CKF_GENERATE 0x00008000UL1014#define CKF_GENERATE_KEY_PAIR 0x00010000UL1015#define CKF_WRAP 0x00020000UL1016#define CKF_UNWRAP 0x00040000UL1017#define CKF_DERIVE 0x00080000UL10181019/* Describe a token's EC capabilities not available in mechanism1020* information.1021*/1022#define CKF_EC_F_P 0x00100000UL1023#define CKF_EC_F_2M 0x00200000UL1024#define CKF_EC_ECPARAMETERS 0x00400000UL1025#define CKF_EC_NAMEDCURVE 0x00800000UL1026#define CKF_EC_UNCOMPRESS 0x01000000UL1027#define CKF_EC_COMPRESS 0x02000000UL10281029#define CKF_EXTENSION 0x80000000UL10301031typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR;10321033/* CK_RV is a value that identifies the return value of a1034* Cryptoki function1035*/1036typedef CK_ULONG CK_RV;10371038#define CKR_OK 0x00000000UL1039#define CKR_CANCEL 0x00000001UL1040#define CKR_HOST_MEMORY 0x00000002UL1041#define CKR_SLOT_ID_INVALID 0x00000003UL10421043#define CKR_GENERAL_ERROR 0x00000005UL1044#define CKR_FUNCTION_FAILED 0x00000006UL10451046#define CKR_ARGUMENTS_BAD 0x00000007UL1047#define CKR_NO_EVENT 0x00000008UL1048#define CKR_NEED_TO_CREATE_THREADS 0x00000009UL1049#define CKR_CANT_LOCK 0x0000000AUL10501051#define CKR_ATTRIBUTE_READ_ONLY 0x00000010UL1052#define CKR_ATTRIBUTE_SENSITIVE 0x00000011UL1053#define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012UL1054#define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013UL10551056#define CKR_ACTION_PROHIBITED 0x0000001BUL10571058#define CKR_DATA_INVALID 0x00000020UL1059#define CKR_DATA_LEN_RANGE 0x00000021UL1060#define CKR_DEVICE_ERROR 0x00000030UL1061#define CKR_DEVICE_MEMORY 0x00000031UL1062#define CKR_DEVICE_REMOVED 0x00000032UL1063#define CKR_ENCRYPTED_DATA_INVALID 0x00000040UL1064#define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041UL1065#define CKR_FUNCTION_CANCELED 0x00000050UL1066#define CKR_FUNCTION_NOT_PARALLEL 0x00000051UL10671068#define CKR_FUNCTION_NOT_SUPPORTED 0x00000054UL10691070#define CKR_KEY_HANDLE_INVALID 0x00000060UL10711072#define CKR_KEY_SIZE_RANGE 0x00000062UL1073#define CKR_KEY_TYPE_INCONSISTENT 0x00000063UL10741075#define CKR_KEY_NOT_NEEDED 0x00000064UL1076#define CKR_KEY_CHANGED 0x00000065UL1077#define CKR_KEY_NEEDED 0x00000066UL1078#define CKR_KEY_INDIGESTIBLE 0x00000067UL1079#define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068UL1080#define CKR_KEY_NOT_WRAPPABLE 0x00000069UL1081#define CKR_KEY_UNEXTRACTABLE 0x0000006AUL10821083#define CKR_MECHANISM_INVALID 0x00000070UL1084#define CKR_MECHANISM_PARAM_INVALID 0x00000071UL10851086#define CKR_OBJECT_HANDLE_INVALID 0x00000082UL1087#define CKR_OPERATION_ACTIVE 0x00000090UL1088#define CKR_OPERATION_NOT_INITIALIZED 0x00000091UL1089#define CKR_PIN_INCORRECT 0x000000A0UL1090#define CKR_PIN_INVALID 0x000000A1UL1091#define CKR_PIN_LEN_RANGE 0x000000A2UL10921093#define CKR_PIN_EXPIRED 0x000000A3UL1094#define CKR_PIN_LOCKED 0x000000A4UL10951096#define CKR_SESSION_CLOSED 0x000000B0UL1097#define CKR_SESSION_COUNT 0x000000B1UL1098#define CKR_SESSION_HANDLE_INVALID 0x000000B3UL1099#define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4UL1100#define CKR_SESSION_READ_ONLY 0x000000B5UL1101#define CKR_SESSION_EXISTS 0x000000B6UL11021103#define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7UL1104#define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8UL11051106#define CKR_SIGNATURE_INVALID 0x000000C0UL1107#define CKR_SIGNATURE_LEN_RANGE 0x000000C1UL1108#define CKR_TEMPLATE_INCOMPLETE 0x000000D0UL1109#define CKR_TEMPLATE_INCONSISTENT 0x000000D1UL1110#define CKR_TOKEN_NOT_PRESENT 0x000000E0UL1111#define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1UL1112#define CKR_TOKEN_WRITE_PROTECTED 0x000000E2UL1113#define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0UL1114#define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1UL1115#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2UL1116#define CKR_USER_ALREADY_LOGGED_IN 0x00000100UL1117#define CKR_USER_NOT_LOGGED_IN 0x00000101UL1118#define CKR_USER_PIN_NOT_INITIALIZED 0x00000102UL1119#define CKR_USER_TYPE_INVALID 0x00000103UL11201121#define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104UL1122#define CKR_USER_TOO_MANY_TYPES 0x00000105UL11231124#define CKR_WRAPPED_KEY_INVALID 0x00000110UL1125#define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112UL1126#define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113UL1127#define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114UL1128#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115UL1129#define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120UL11301131#define CKR_RANDOM_NO_RNG 0x00000121UL11321133#define CKR_DOMAIN_PARAMS_INVALID 0x00000130UL11341135#define CKR_CURVE_NOT_SUPPORTED 0x00000140UL11361137#define CKR_BUFFER_TOO_SMALL 0x00000150UL1138#define CKR_SAVED_STATE_INVALID 0x00000160UL1139#define CKR_INFORMATION_SENSITIVE 0x00000170UL1140#define CKR_STATE_UNSAVEABLE 0x00000180UL11411142#define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190UL1143#define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191UL1144#define CKR_MUTEX_BAD 0x000001A0UL1145#define CKR_MUTEX_NOT_LOCKED 0x000001A1UL11461147#define CKR_NEW_PIN_MODE 0x000001B0UL1148#define CKR_NEXT_OTP 0x000001B1UL11491150#define CKR_EXCEEDED_MAX_ITERATIONS 0x000001B5UL1151#define CKR_FIPS_SELF_TEST_FAILED 0x000001B6UL1152#define CKR_LIBRARY_LOAD_FAILED 0x000001B7UL1153#define CKR_PIN_TOO_WEAK 0x000001B8UL1154#define CKR_PUBLIC_KEY_INVALID 0x000001B9UL11551156#define CKR_FUNCTION_REJECTED 0x00000200UL11571158#define CKR_VENDOR_DEFINED 0x80000000UL115911601161/* CK_NOTIFY is an application callback that processes events */1162typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)(1163CK_SESSION_HANDLE hSession, /* the session's handle */1164CK_NOTIFICATION event,1165CK_VOID_PTR pApplication /* passed to C_OpenSession */1166);116711681169/* CK_FUNCTION_LIST is a structure holding a Cryptoki spec1170* version and pointers of appropriate types to all the1171* Cryptoki functions1172*/1173typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST;11741175typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR;11761177typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR;117811791180/* CK_CREATEMUTEX is an application callback for creating a1181* mutex object1182*/1183typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)(1184CK_VOID_PTR_PTR ppMutex /* location to receive ptr to mutex */1185);118611871188/* CK_DESTROYMUTEX is an application callback for destroying a1189* mutex object1190*/1191typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)(1192CK_VOID_PTR pMutex /* pointer to mutex */1193);119411951196/* CK_LOCKMUTEX is an application callback for locking a mutex */1197typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)(1198CK_VOID_PTR pMutex /* pointer to mutex */1199);120012011202/* CK_UNLOCKMUTEX is an application callback for unlocking a1203* mutex1204*/1205typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)(1206CK_VOID_PTR pMutex /* pointer to mutex */1207);120812091210/* CK_C_INITIALIZE_ARGS provides the optional arguments to1211* C_Initialize1212*/1213typedef struct CK_C_INITIALIZE_ARGS {1214CK_CREATEMUTEX CreateMutex;1215CK_DESTROYMUTEX DestroyMutex;1216CK_LOCKMUTEX LockMutex;1217CK_UNLOCKMUTEX UnlockMutex;1218CK_FLAGS flags;1219CK_VOID_PTR pReserved;1220} CK_C_INITIALIZE_ARGS;12211222/* flags: bit flags that provide capabilities of the slot1223* Bit Flag Mask Meaning1224*/1225#define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001UL1226#define CKF_OS_LOCKING_OK 0x00000002UL12271228typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR;122912301231/* additional flags for parameters to functions */12321233/* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */1234#define CKF_DONT_BLOCK 112351236/* CK_RSA_PKCS_MGF_TYPE is used to indicate the Message1237* Generation Function (MGF) applied to a message block when1238* formatting a message block for the PKCS #1 OAEP encryption1239* scheme.1240*/1241typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE;12421243typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR;12441245/* The following MGFs are defined */1246#define CKG_MGF1_SHA1 0x00000001UL1247#define CKG_MGF1_SHA256 0x00000002UL1248#define CKG_MGF1_SHA384 0x00000003UL1249#define CKG_MGF1_SHA512 0x00000004UL1250#define CKG_MGF1_SHA224 0x00000005UL12511252/* CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source1253* of the encoding parameter when formatting a message block1254* for the PKCS #1 OAEP encryption scheme.1255*/1256typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE;12571258typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR;12591260/* The following encoding parameter sources are defined */1261#define CKZ_DATA_SPECIFIED 0x00000001UL12621263/* CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the1264* CKM_RSA_PKCS_OAEP mechanism.1265*/1266typedef struct CK_RSA_PKCS_OAEP_PARAMS {1267CK_MECHANISM_TYPE hashAlg;1268CK_RSA_PKCS_MGF_TYPE mgf;1269CK_RSA_PKCS_OAEP_SOURCE_TYPE source;1270CK_VOID_PTR pSourceData;1271CK_ULONG ulSourceDataLen;1272} CK_RSA_PKCS_OAEP_PARAMS;12731274typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR;12751276/* CK_RSA_PKCS_PSS_PARAMS provides the parameters to the1277* CKM_RSA_PKCS_PSS mechanism(s).1278*/1279typedef struct CK_RSA_PKCS_PSS_PARAMS {1280CK_MECHANISM_TYPE hashAlg;1281CK_RSA_PKCS_MGF_TYPE mgf;1282CK_ULONG sLen;1283} CK_RSA_PKCS_PSS_PARAMS;12841285typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR;12861287typedef CK_ULONG CK_EC_KDF_TYPE;12881289/* The following EC Key Derivation Functions are defined */1290#define CKD_NULL 0x00000001UL1291#define CKD_SHA1_KDF 0x00000002UL12921293/* The following X9.42 DH key derivation functions are defined */1294#define CKD_SHA1_KDF_ASN1 0x00000003UL1295#define CKD_SHA1_KDF_CONCATENATE 0x00000004UL1296#define CKD_SHA224_KDF 0x00000005UL1297#define CKD_SHA256_KDF 0x00000006UL1298#define CKD_SHA384_KDF 0x00000007UL1299#define CKD_SHA512_KDF 0x00000008UL1300#define CKD_CPDIVERSIFY_KDF 0x00000009UL130113021303/* CK_ECDH1_DERIVE_PARAMS provides the parameters to the1304* CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms,1305* where each party contributes one key pair.1306*/1307typedef struct CK_ECDH1_DERIVE_PARAMS {1308CK_EC_KDF_TYPE kdf;1309CK_ULONG ulSharedDataLen;1310CK_BYTE_PTR pSharedData;1311CK_ULONG ulPublicDataLen;1312CK_BYTE_PTR pPublicData;1313} CK_ECDH1_DERIVE_PARAMS;13141315typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR;13161317/*1318* CK_ECDH2_DERIVE_PARAMS provides the parameters to the1319* CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs.1320*/1321typedef struct CK_ECDH2_DERIVE_PARAMS {1322CK_EC_KDF_TYPE kdf;1323CK_ULONG ulSharedDataLen;1324CK_BYTE_PTR pSharedData;1325CK_ULONG ulPublicDataLen;1326CK_BYTE_PTR pPublicData;1327CK_ULONG ulPrivateDataLen;1328CK_OBJECT_HANDLE hPrivateData;1329CK_ULONG ulPublicDataLen2;1330CK_BYTE_PTR pPublicData2;1331} CK_ECDH2_DERIVE_PARAMS;13321333typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR;13341335typedef struct CK_ECMQV_DERIVE_PARAMS {1336CK_EC_KDF_TYPE kdf;1337CK_ULONG ulSharedDataLen;1338CK_BYTE_PTR pSharedData;1339CK_ULONG ulPublicDataLen;1340CK_BYTE_PTR pPublicData;1341CK_ULONG ulPrivateDataLen;1342CK_OBJECT_HANDLE hPrivateData;1343CK_ULONG ulPublicDataLen2;1344CK_BYTE_PTR pPublicData2;1345CK_OBJECT_HANDLE publicKey;1346} CK_ECMQV_DERIVE_PARAMS;13471348typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR;13491350/* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the1351* CKM_X9_42_DH_PARAMETER_GEN mechanisms1352*/1353typedef CK_ULONG CK_X9_42_DH_KDF_TYPE;1354typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR;13551356/* CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the1357* CKM_X9_42_DH_DERIVE key derivation mechanism, where each party1358* contributes one key pair1359*/1360typedef struct CK_X9_42_DH1_DERIVE_PARAMS {1361CK_X9_42_DH_KDF_TYPE kdf;1362CK_ULONG ulOtherInfoLen;1363CK_BYTE_PTR pOtherInfo;1364CK_ULONG ulPublicDataLen;1365CK_BYTE_PTR pPublicData;1366} CK_X9_42_DH1_DERIVE_PARAMS;13671368typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR;13691370/* CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the1371* CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation1372* mechanisms, where each party contributes two key pairs1373*/1374typedef struct CK_X9_42_DH2_DERIVE_PARAMS {1375CK_X9_42_DH_KDF_TYPE kdf;1376CK_ULONG ulOtherInfoLen;1377CK_BYTE_PTR pOtherInfo;1378CK_ULONG ulPublicDataLen;1379CK_BYTE_PTR pPublicData;1380CK_ULONG ulPrivateDataLen;1381CK_OBJECT_HANDLE hPrivateData;1382CK_ULONG ulPublicDataLen2;1383CK_BYTE_PTR pPublicData2;1384} CK_X9_42_DH2_DERIVE_PARAMS;13851386typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR;13871388typedef struct CK_X9_42_MQV_DERIVE_PARAMS {1389CK_X9_42_DH_KDF_TYPE kdf;1390CK_ULONG ulOtherInfoLen;1391CK_BYTE_PTR pOtherInfo;1392CK_ULONG ulPublicDataLen;1393CK_BYTE_PTR pPublicData;1394CK_ULONG ulPrivateDataLen;1395CK_OBJECT_HANDLE hPrivateData;1396CK_ULONG ulPublicDataLen2;1397CK_BYTE_PTR pPublicData2;1398CK_OBJECT_HANDLE publicKey;1399} CK_X9_42_MQV_DERIVE_PARAMS;14001401typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR;14021403/* CK_KEA_DERIVE_PARAMS provides the parameters to the1404* CKM_KEA_DERIVE mechanism1405*/1406typedef struct CK_KEA_DERIVE_PARAMS {1407CK_BBOOL isSender;1408CK_ULONG ulRandomLen;1409CK_BYTE_PTR pRandomA;1410CK_BYTE_PTR pRandomB;1411CK_ULONG ulPublicDataLen;1412CK_BYTE_PTR pPublicData;1413} CK_KEA_DERIVE_PARAMS;14141415typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR;141614171418/* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and1419* CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just1420* holds the effective keysize1421*/1422typedef CK_ULONG CK_RC2_PARAMS;14231424typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR;142514261427/* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC1428* mechanism1429*/1430typedef struct CK_RC2_CBC_PARAMS {1431CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */1432CK_BYTE iv[8]; /* IV for CBC mode */1433} CK_RC2_CBC_PARAMS;14341435typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR;143614371438/* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the1439* CKM_RC2_MAC_GENERAL mechanism1440*/1441typedef struct CK_RC2_MAC_GENERAL_PARAMS {1442CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */1443CK_ULONG ulMacLength; /* Length of MAC in bytes */1444} CK_RC2_MAC_GENERAL_PARAMS;14451446typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \1447CK_RC2_MAC_GENERAL_PARAMS_PTR;144814491450/* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and1451* CKM_RC5_MAC mechanisms1452*/1453typedef struct CK_RC5_PARAMS {1454CK_ULONG ulWordsize; /* wordsize in bits */1455CK_ULONG ulRounds; /* number of rounds */1456} CK_RC5_PARAMS;14571458typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR;145914601461/* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC1462* mechanism1463*/1464typedef struct CK_RC5_CBC_PARAMS {1465CK_ULONG ulWordsize; /* wordsize in bits */1466CK_ULONG ulRounds; /* number of rounds */1467CK_BYTE_PTR pIv; /* pointer to IV */1468CK_ULONG ulIvLen; /* length of IV in bytes */1469} CK_RC5_CBC_PARAMS;14701471typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR;147214731474/* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the1475* CKM_RC5_MAC_GENERAL mechanism1476*/1477typedef struct CK_RC5_MAC_GENERAL_PARAMS {1478CK_ULONG ulWordsize; /* wordsize in bits */1479CK_ULONG ulRounds; /* number of rounds */1480CK_ULONG ulMacLength; /* Length of MAC in bytes */1481} CK_RC5_MAC_GENERAL_PARAMS;14821483typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \1484CK_RC5_MAC_GENERAL_PARAMS_PTR;14851486/* CK_MAC_GENERAL_PARAMS provides the parameters to most block1487* ciphers' MAC_GENERAL mechanisms. Its value is the length of1488* the MAC1489*/1490typedef CK_ULONG CK_MAC_GENERAL_PARAMS;14911492typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR;14931494typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS {1495CK_BYTE iv[8];1496CK_BYTE_PTR pData;1497CK_ULONG length;1498} CK_DES_CBC_ENCRYPT_DATA_PARAMS;14991500typedef CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR;15011502typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS {1503CK_BYTE iv[16];1504CK_BYTE_PTR pData;1505CK_ULONG length;1506} CK_AES_CBC_ENCRYPT_DATA_PARAMS;15071508typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR;15091510/* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the1511* CKM_SKIPJACK_PRIVATE_WRAP mechanism1512*/1513typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS {1514CK_ULONG ulPasswordLen;1515CK_BYTE_PTR pPassword;1516CK_ULONG ulPublicDataLen;1517CK_BYTE_PTR pPublicData;1518CK_ULONG ulPAndGLen;1519CK_ULONG ulQLen;1520CK_ULONG ulRandomLen;1521CK_BYTE_PTR pRandomA;1522CK_BYTE_PTR pPrimeP;1523CK_BYTE_PTR pBaseG;1524CK_BYTE_PTR pSubprimeQ;1525} CK_SKIPJACK_PRIVATE_WRAP_PARAMS;15261527typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \1528CK_SKIPJACK_PRIVATE_WRAP_PARAMS_PTR;152915301531/* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the1532* CKM_SKIPJACK_RELAYX mechanism1533*/1534typedef struct CK_SKIPJACK_RELAYX_PARAMS {1535CK_ULONG ulOldWrappedXLen;1536CK_BYTE_PTR pOldWrappedX;1537CK_ULONG ulOldPasswordLen;1538CK_BYTE_PTR pOldPassword;1539CK_ULONG ulOldPublicDataLen;1540CK_BYTE_PTR pOldPublicData;1541CK_ULONG ulOldRandomLen;1542CK_BYTE_PTR pOldRandomA;1543CK_ULONG ulNewPasswordLen;1544CK_BYTE_PTR pNewPassword;1545CK_ULONG ulNewPublicDataLen;1546CK_BYTE_PTR pNewPublicData;1547CK_ULONG ulNewRandomLen;1548CK_BYTE_PTR pNewRandomA;1549} CK_SKIPJACK_RELAYX_PARAMS;15501551typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \1552CK_SKIPJACK_RELAYX_PARAMS_PTR;155315541555typedef struct CK_PBE_PARAMS {1556CK_BYTE_PTR pInitVector;1557CK_UTF8CHAR_PTR pPassword;1558CK_ULONG ulPasswordLen;1559CK_BYTE_PTR pSalt;1560CK_ULONG ulSaltLen;1561CK_ULONG ulIteration;1562} CK_PBE_PARAMS;15631564typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR;156515661567/* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the1568* CKM_KEY_WRAP_SET_OAEP mechanism1569*/1570typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS {1571CK_BYTE bBC; /* block contents byte */1572CK_BYTE_PTR pX; /* extra data */1573CK_ULONG ulXLen; /* length of extra data in bytes */1574} CK_KEY_WRAP_SET_OAEP_PARAMS;15751576typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR CK_KEY_WRAP_SET_OAEP_PARAMS_PTR;15771578typedef struct CK_SSL3_RANDOM_DATA {1579CK_BYTE_PTR pClientRandom;1580CK_ULONG ulClientRandomLen;1581CK_BYTE_PTR pServerRandom;1582CK_ULONG ulServerRandomLen;1583} CK_SSL3_RANDOM_DATA;158415851586typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS {1587CK_SSL3_RANDOM_DATA RandomInfo;1588CK_VERSION_PTR pVersion;1589} CK_SSL3_MASTER_KEY_DERIVE_PARAMS;15901591typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \1592CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR;15931594typedef struct CK_SSL3_KEY_MAT_OUT {1595CK_OBJECT_HANDLE hClientMacSecret;1596CK_OBJECT_HANDLE hServerMacSecret;1597CK_OBJECT_HANDLE hClientKey;1598CK_OBJECT_HANDLE hServerKey;1599CK_BYTE_PTR pIVClient;1600CK_BYTE_PTR pIVServer;1601} CK_SSL3_KEY_MAT_OUT;16021603typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR;160416051606typedef struct CK_SSL3_KEY_MAT_PARAMS {1607CK_ULONG ulMacSizeInBits;1608CK_ULONG ulKeySizeInBits;1609CK_ULONG ulIVSizeInBits;1610CK_BBOOL bIsExport;1611CK_SSL3_RANDOM_DATA RandomInfo;1612CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial;1613} CK_SSL3_KEY_MAT_PARAMS;16141615typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR;16161617typedef struct CK_TLS_PRF_PARAMS {1618CK_BYTE_PTR pSeed;1619CK_ULONG ulSeedLen;1620CK_BYTE_PTR pLabel;1621CK_ULONG ulLabelLen;1622CK_BYTE_PTR pOutput;1623CK_ULONG_PTR pulOutputLen;1624} CK_TLS_PRF_PARAMS;16251626typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR;16271628typedef struct CK_WTLS_RANDOM_DATA {1629CK_BYTE_PTR pClientRandom;1630CK_ULONG ulClientRandomLen;1631CK_BYTE_PTR pServerRandom;1632CK_ULONG ulServerRandomLen;1633} CK_WTLS_RANDOM_DATA;16341635typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR;16361637typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS {1638CK_MECHANISM_TYPE DigestMechanism;1639CK_WTLS_RANDOM_DATA RandomInfo;1640CK_BYTE_PTR pVersion;1641} CK_WTLS_MASTER_KEY_DERIVE_PARAMS;16421643typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR \1644CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR;16451646typedef struct CK_WTLS_PRF_PARAMS {1647CK_MECHANISM_TYPE DigestMechanism;1648CK_BYTE_PTR pSeed;1649CK_ULONG ulSeedLen;1650CK_BYTE_PTR pLabel;1651CK_ULONG ulLabelLen;1652CK_BYTE_PTR pOutput;1653CK_ULONG_PTR pulOutputLen;1654} CK_WTLS_PRF_PARAMS;16551656typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR;16571658typedef struct CK_WTLS_KEY_MAT_OUT {1659CK_OBJECT_HANDLE hMacSecret;1660CK_OBJECT_HANDLE hKey;1661CK_BYTE_PTR pIV;1662} CK_WTLS_KEY_MAT_OUT;16631664typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR;16651666typedef struct CK_WTLS_KEY_MAT_PARAMS {1667CK_MECHANISM_TYPE DigestMechanism;1668CK_ULONG ulMacSizeInBits;1669CK_ULONG ulKeySizeInBits;1670CK_ULONG ulIVSizeInBits;1671CK_ULONG ulSequenceNumber;1672CK_BBOOL bIsExport;1673CK_WTLS_RANDOM_DATA RandomInfo;1674CK_WTLS_KEY_MAT_OUT_PTR pReturnedKeyMaterial;1675} CK_WTLS_KEY_MAT_PARAMS;16761677typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR;16781679typedef struct CK_CMS_SIG_PARAMS {1680CK_OBJECT_HANDLE certificateHandle;1681CK_MECHANISM_PTR pSigningMechanism;1682CK_MECHANISM_PTR pDigestMechanism;1683CK_UTF8CHAR_PTR pContentType;1684CK_BYTE_PTR pRequestedAttributes;1685CK_ULONG ulRequestedAttributesLen;1686CK_BYTE_PTR pRequiredAttributes;1687CK_ULONG ulRequiredAttributesLen;1688} CK_CMS_SIG_PARAMS;16891690typedef CK_CMS_SIG_PARAMS CK_PTR CK_CMS_SIG_PARAMS_PTR;16911692typedef struct CK_KEY_DERIVATION_STRING_DATA {1693CK_BYTE_PTR pData;1694CK_ULONG ulLen;1695} CK_KEY_DERIVATION_STRING_DATA;16961697typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \1698CK_KEY_DERIVATION_STRING_DATA_PTR;169917001701/* The CK_EXTRACT_PARAMS is used for the1702* CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit1703* of the base key should be used as the first bit of the1704* derived key1705*/1706typedef CK_ULONG CK_EXTRACT_PARAMS;17071708typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR;17091710/* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to1711* indicate the Pseudo-Random Function (PRF) used to generate1712* key bits using PKCS #5 PBKDF2.1713*/1714typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE;17151716typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR \1717CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR;17181719#define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001UL1720#define CKP_PKCS5_PBKD2_HMAC_GOSTR3411 0x00000002UL1721#define CKP_PKCS5_PBKD2_HMAC_SHA224 0x00000003UL1722#define CKP_PKCS5_PBKD2_HMAC_SHA256 0x00000004UL1723#define CKP_PKCS5_PBKD2_HMAC_SHA384 0x00000005UL1724#define CKP_PKCS5_PBKD2_HMAC_SHA512 0x00000006UL1725#define CKP_PKCS5_PBKD2_HMAC_SHA512_224 0x00000007UL1726#define CKP_PKCS5_PBKD2_HMAC_SHA512_256 0x00000008UL17271728/* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the1729* source of the salt value when deriving a key using PKCS #51730* PBKDF2.1731*/1732typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE;17331734typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR \1735CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR;17361737/* The following salt value sources are defined in PKCS #5 v2.0. */1738#define CKZ_SALT_SPECIFIED 0x00000001UL17391740/* CK_PKCS5_PBKD2_PARAMS is a structure that provides the1741* parameters to the CKM_PKCS5_PBKD2 mechanism.1742*/1743typedef struct CK_PKCS5_PBKD2_PARAMS {1744CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource;1745CK_VOID_PTR pSaltSourceData;1746CK_ULONG ulSaltSourceDataLen;1747CK_ULONG iterations;1748CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;1749CK_VOID_PTR pPrfData;1750CK_ULONG ulPrfDataLen;1751CK_UTF8CHAR_PTR pPassword;1752CK_ULONG_PTR ulPasswordLen;1753} CK_PKCS5_PBKD2_PARAMS;17541755typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR;17561757/* CK_PKCS5_PBKD2_PARAMS2 is a corrected version of the CK_PKCS5_PBKD2_PARAMS1758* structure that provides the parameters to the CKM_PKCS5_PBKD2 mechanism1759* noting that the ulPasswordLen field is a CK_ULONG and not a CK_ULONG_PTR.1760*/1761typedef struct CK_PKCS5_PBKD2_PARAMS2 {1762CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource;1763CK_VOID_PTR pSaltSourceData;1764CK_ULONG ulSaltSourceDataLen;1765CK_ULONG iterations;1766CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;1767CK_VOID_PTR pPrfData;1768CK_ULONG ulPrfDataLen;1769CK_UTF8CHAR_PTR pPassword;1770CK_ULONG ulPasswordLen;1771} CK_PKCS5_PBKD2_PARAMS2;17721773typedef CK_PKCS5_PBKD2_PARAMS2 CK_PTR CK_PKCS5_PBKD2_PARAMS2_PTR;17741775typedef CK_ULONG CK_OTP_PARAM_TYPE;1776typedef CK_OTP_PARAM_TYPE CK_PARAM_TYPE; /* backward compatibility */17771778typedef struct CK_OTP_PARAM {1779CK_OTP_PARAM_TYPE type;1780CK_VOID_PTR pValue;1781CK_ULONG ulValueLen;1782} CK_OTP_PARAM;17831784typedef CK_OTP_PARAM CK_PTR CK_OTP_PARAM_PTR;17851786typedef struct CK_OTP_PARAMS {1787CK_OTP_PARAM_PTR pParams;1788CK_ULONG ulCount;1789} CK_OTP_PARAMS;17901791typedef CK_OTP_PARAMS CK_PTR CK_OTP_PARAMS_PTR;17921793typedef struct CK_OTP_SIGNATURE_INFO {1794CK_OTP_PARAM_PTR pParams;1795CK_ULONG ulCount;1796} CK_OTP_SIGNATURE_INFO;17971798typedef CK_OTP_SIGNATURE_INFO CK_PTR CK_OTP_SIGNATURE_INFO_PTR;17991800#define CK_OTP_VALUE 0UL1801#define CK_OTP_PIN 1UL1802#define CK_OTP_CHALLENGE 2UL1803#define CK_OTP_TIME 3UL1804#define CK_OTP_COUNTER 4UL1805#define CK_OTP_FLAGS 5UL1806#define CK_OTP_OUTPUT_LENGTH 6UL1807#define CK_OTP_OUTPUT_FORMAT 7UL18081809#define CKF_NEXT_OTP 0x00000001UL1810#define CKF_EXCLUDE_TIME 0x00000002UL1811#define CKF_EXCLUDE_COUNTER 0x00000004UL1812#define CKF_EXCLUDE_CHALLENGE 0x00000008UL1813#define CKF_EXCLUDE_PIN 0x00000010UL1814#define CKF_USER_FRIENDLY_OTP 0x00000020UL18151816typedef struct CK_KIP_PARAMS {1817CK_MECHANISM_PTR pMechanism;1818CK_OBJECT_HANDLE hKey;1819CK_BYTE_PTR pSeed;1820CK_ULONG ulSeedLen;1821} CK_KIP_PARAMS;18221823typedef CK_KIP_PARAMS CK_PTR CK_KIP_PARAMS_PTR;18241825typedef struct CK_AES_CTR_PARAMS {1826CK_ULONG ulCounterBits;1827CK_BYTE cb[16];1828} CK_AES_CTR_PARAMS;18291830typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR;18311832typedef struct CK_GCM_PARAMS {1833CK_BYTE_PTR pIv;1834CK_ULONG ulIvLen;1835CK_BYTE_PTR pAAD;1836CK_ULONG ulAADLen;1837CK_ULONG ulTagBits;1838} CK_GCM_PARAMS;18391840typedef CK_GCM_PARAMS CK_PTR CK_GCM_PARAMS_PTR;18411842typedef struct CK_CCM_PARAMS {1843CK_ULONG ulDataLen;1844CK_BYTE_PTR pNonce;1845CK_ULONG ulNonceLen;1846CK_BYTE_PTR pAAD;1847CK_ULONG ulAADLen;1848CK_ULONG ulMACLen;1849} CK_CCM_PARAMS;18501851typedef CK_CCM_PARAMS CK_PTR CK_CCM_PARAMS_PTR;18521853/* Deprecated. Use CK_GCM_PARAMS */1854typedef struct CK_AES_GCM_PARAMS {1855CK_BYTE_PTR pIv;1856CK_ULONG ulIvLen;1857CK_ULONG ulIvBits;1858CK_BYTE_PTR pAAD;1859CK_ULONG ulAADLen;1860CK_ULONG ulTagBits;1861} CK_AES_GCM_PARAMS;18621863typedef CK_AES_GCM_PARAMS CK_PTR CK_AES_GCM_PARAMS_PTR;18641865/* Deprecated. Use CK_CCM_PARAMS */1866typedef struct CK_AES_CCM_PARAMS {1867CK_ULONG ulDataLen;1868CK_BYTE_PTR pNonce;1869CK_ULONG ulNonceLen;1870CK_BYTE_PTR pAAD;1871CK_ULONG ulAADLen;1872CK_ULONG ulMACLen;1873} CK_AES_CCM_PARAMS;18741875typedef CK_AES_CCM_PARAMS CK_PTR CK_AES_CCM_PARAMS_PTR;18761877typedef struct CK_CAMELLIA_CTR_PARAMS {1878CK_ULONG ulCounterBits;1879CK_BYTE cb[16];1880} CK_CAMELLIA_CTR_PARAMS;18811882typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR;18831884typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS {1885CK_BYTE iv[16];1886CK_BYTE_PTR pData;1887CK_ULONG length;1888} CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS;18891890typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR \1891CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR;18921893typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS {1894CK_BYTE iv[16];1895CK_BYTE_PTR pData;1896CK_ULONG length;1897} CK_ARIA_CBC_ENCRYPT_DATA_PARAMS;18981899typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR \1900CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR;19011902typedef struct CK_DSA_PARAMETER_GEN_PARAM {1903CK_MECHANISM_TYPE hash;1904CK_BYTE_PTR pSeed;1905CK_ULONG ulSeedLen;1906CK_ULONG ulIndex;1907} CK_DSA_PARAMETER_GEN_PARAM;19081909typedef CK_DSA_PARAMETER_GEN_PARAM CK_PTR CK_DSA_PARAMETER_GEN_PARAM_PTR;19101911typedef struct CK_ECDH_AES_KEY_WRAP_PARAMS {1912CK_ULONG ulAESKeyBits;1913CK_EC_KDF_TYPE kdf;1914CK_ULONG ulSharedDataLen;1915CK_BYTE_PTR pSharedData;1916} CK_ECDH_AES_KEY_WRAP_PARAMS;19171918typedef CK_ECDH_AES_KEY_WRAP_PARAMS CK_PTR CK_ECDH_AES_KEY_WRAP_PARAMS_PTR;19191920typedef CK_ULONG CK_JAVA_MIDP_SECURITY_DOMAIN;19211922typedef CK_ULONG CK_CERTIFICATE_CATEGORY;19231924typedef struct CK_RSA_AES_KEY_WRAP_PARAMS {1925CK_ULONG ulAESKeyBits;1926CK_RSA_PKCS_OAEP_PARAMS_PTR pOAEPParams;1927} CK_RSA_AES_KEY_WRAP_PARAMS;19281929typedef CK_RSA_AES_KEY_WRAP_PARAMS CK_PTR CK_RSA_AES_KEY_WRAP_PARAMS_PTR;19301931typedef struct CK_TLS12_MASTER_KEY_DERIVE_PARAMS {1932CK_SSL3_RANDOM_DATA RandomInfo;1933CK_VERSION_PTR pVersion;1934CK_MECHANISM_TYPE prfHashMechanism;1935} CK_TLS12_MASTER_KEY_DERIVE_PARAMS;19361937typedef CK_TLS12_MASTER_KEY_DERIVE_PARAMS CK_PTR \1938CK_TLS12_MASTER_KEY_DERIVE_PARAMS_PTR;19391940typedef struct CK_TLS12_KEY_MAT_PARAMS {1941CK_ULONG ulMacSizeInBits;1942CK_ULONG ulKeySizeInBits;1943CK_ULONG ulIVSizeInBits;1944CK_BBOOL bIsExport;1945CK_SSL3_RANDOM_DATA RandomInfo;1946CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial;1947CK_MECHANISM_TYPE prfHashMechanism;1948} CK_TLS12_KEY_MAT_PARAMS;19491950typedef CK_TLS12_KEY_MAT_PARAMS CK_PTR CK_TLS12_KEY_MAT_PARAMS_PTR;19511952typedef struct CK_TLS_KDF_PARAMS {1953CK_MECHANISM_TYPE prfMechanism;1954CK_BYTE_PTR pLabel;1955CK_ULONG ulLabelLength;1956CK_SSL3_RANDOM_DATA RandomInfo;1957CK_BYTE_PTR pContextData;1958CK_ULONG ulContextDataLength;1959} CK_TLS_KDF_PARAMS;19601961typedef CK_TLS_KDF_PARAMS CK_PTR CK_TLS_KDF_PARAMS_PTR;19621963typedef struct CK_TLS_MAC_PARAMS {1964CK_MECHANISM_TYPE prfMechanism;1965CK_ULONG ulMacLength;1966CK_ULONG ulServerOrClient;1967} CK_TLS_MAC_PARAMS;19681969typedef CK_TLS_MAC_PARAMS CK_PTR CK_TLS_MAC_PARAMS_PTR;19701971typedef struct CK_GOSTR3410_DERIVE_PARAMS {1972CK_EC_KDF_TYPE kdf;1973CK_BYTE_PTR pPublicData;1974CK_ULONG ulPublicDataLen;1975CK_BYTE_PTR pUKM;1976CK_ULONG ulUKMLen;1977} CK_GOSTR3410_DERIVE_PARAMS;19781979typedef CK_GOSTR3410_DERIVE_PARAMS CK_PTR CK_GOSTR3410_DERIVE_PARAMS_PTR;19801981typedef struct CK_GOSTR3410_KEY_WRAP_PARAMS {1982CK_BYTE_PTR pWrapOID;1983CK_ULONG ulWrapOIDLen;1984CK_BYTE_PTR pUKM;1985CK_ULONG ulUKMLen;1986CK_OBJECT_HANDLE hKey;1987} CK_GOSTR3410_KEY_WRAP_PARAMS;19881989typedef CK_GOSTR3410_KEY_WRAP_PARAMS CK_PTR CK_GOSTR3410_KEY_WRAP_PARAMS_PTR;19901991typedef struct CK_SEED_CBC_ENCRYPT_DATA_PARAMS {1992CK_BYTE iv[16];1993CK_BYTE_PTR pData;1994CK_ULONG length;1995} CK_SEED_CBC_ENCRYPT_DATA_PARAMS;19961997typedef CK_SEED_CBC_ENCRYPT_DATA_PARAMS CK_PTR \1998CK_SEED_CBC_ENCRYPT_DATA_PARAMS_PTR;19992000#endif /* _PKCS11T_H_ */2001200220032004