michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: /* License to copy and use this software is granted provided that it is michael@0: * identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface michael@0: * (Cryptoki)" in all material mentioning or referencing this software. michael@0: michael@0: * License is also granted to make and use derivative works provided that michael@0: * such works are identified as "derived from the RSA Security Inc. PKCS #11 michael@0: * Cryptographic Token Interface (Cryptoki)" in all material mentioning or michael@0: * referencing the derived work. michael@0: michael@0: * RSA Security Inc. makes no representations concerning either the michael@0: * merchantability of this software or the suitability of this software for michael@0: * any particular purpose. It is provided "as is" without express or implied michael@0: * warranty of any kind. michael@0: */ michael@0: michael@0: michael@0: #ifndef _PKCS11T_H_ michael@0: #define _PKCS11T_H_ 1 michael@0: michael@0: #define CK_TRUE 1 michael@0: #define CK_FALSE 0 michael@0: michael@0: #include "prtypes.h" michael@0: michael@0: #define CK_PTR * michael@0: #define CK_NULL_PTR 0 michael@0: #define CK_CALLBACK_FUNCTION(rtype,func) rtype (PR_CALLBACK * func) michael@0: #define CK_DECLARE_FUNCTION(rtype,func) extern rtype func michael@0: #define CK_DECLARE_FUNCTION_POINTER(rtype,func) rtype (PR_CALLBACK * func) michael@0: michael@0: #define CK_INVALID_SESSION 0 michael@0: michael@0: /* an unsigned 8-bit value */ michael@0: typedef unsigned char CK_BYTE; michael@0: michael@0: /* an unsigned 8-bit character */ michael@0: typedef CK_BYTE CK_CHAR; michael@0: michael@0: /* an 8-bit UTF-8 character */ michael@0: typedef CK_BYTE CK_UTF8CHAR; michael@0: michael@0: /* a BYTE-sized Boolean flag */ michael@0: typedef CK_BYTE CK_BBOOL; michael@0: michael@0: /* an unsigned value, at least 32 bits long */ michael@0: typedef unsigned long int CK_ULONG; michael@0: michael@0: /* a signed value, the same size as a CK_ULONG */ michael@0: /* CK_LONG is new for v2.0 */ michael@0: typedef long int CK_LONG; michael@0: michael@0: /* at least 32 bits; each bit is a Boolean flag */ michael@0: typedef CK_ULONG CK_FLAGS; michael@0: michael@0: michael@0: /* some special values for certain CK_ULONG variables */ michael@0: #define CK_UNAVAILABLE_INFORMATION (~0UL) michael@0: #define CK_EFFECTIVELY_INFINITE 0 michael@0: michael@0: michael@0: typedef CK_BYTE CK_PTR CK_BYTE_PTR; michael@0: typedef CK_CHAR CK_PTR CK_CHAR_PTR; michael@0: typedef CK_UTF8CHAR CK_PTR CK_UTF8CHAR_PTR; michael@0: typedef CK_ULONG CK_PTR CK_ULONG_PTR; michael@0: typedef void CK_PTR CK_VOID_PTR; michael@0: michael@0: /* Pointer to a CK_VOID_PTR-- i.e., pointer to pointer to void */ michael@0: typedef CK_VOID_PTR CK_PTR CK_VOID_PTR_PTR; michael@0: michael@0: michael@0: /* The following value is always invalid if used as a session */ michael@0: /* handle or object handle */ michael@0: #define CK_INVALID_HANDLE 0 michael@0: michael@0: michael@0: /* pack */ michael@0: #include "pkcs11p.h" michael@0: michael@0: typedef struct CK_VERSION { michael@0: CK_BYTE major; /* integer portion of version number */ michael@0: CK_BYTE minor; /* 1/100ths portion of version number */ michael@0: } CK_VERSION; michael@0: michael@0: typedef CK_VERSION CK_PTR CK_VERSION_PTR; michael@0: michael@0: michael@0: typedef struct CK_INFO { michael@0: /* manufacturerID and libraryDecription have been changed from michael@0: * CK_CHAR to CK_UTF8CHAR for v2.10 */ michael@0: CK_VERSION cryptokiVersion; /* PKCS #11 interface ver */ michael@0: CK_UTF8CHAR manufacturerID[32]; /* blank padded */ michael@0: CK_FLAGS flags; /* must be zero */ michael@0: michael@0: /* libraryDescription and libraryVersion are new for v2.0 */ michael@0: CK_UTF8CHAR libraryDescription[32]; /* blank padded */ michael@0: CK_VERSION libraryVersion; /* version of library */ michael@0: } CK_INFO; michael@0: michael@0: typedef CK_INFO CK_PTR CK_INFO_PTR; michael@0: michael@0: michael@0: /* CK_NOTIFICATION enumerates the types of notifications that michael@0: * PKCS #11 provides to an application */ michael@0: /* CK_NOTIFICATION has been changed from an enum to a CK_ULONG michael@0: * for v2.0 */ michael@0: typedef CK_ULONG CK_NOTIFICATION; michael@0: #define CKN_SURRENDER 0 michael@0: michael@0: michael@0: typedef CK_ULONG CK_SLOT_ID; michael@0: michael@0: typedef CK_SLOT_ID CK_PTR CK_SLOT_ID_PTR; michael@0: michael@0: michael@0: /* CK_SLOT_INFO provides information about a slot */ michael@0: typedef struct CK_SLOT_INFO { michael@0: /* slotDescription and manufacturerID have been changed from michael@0: * CK_CHAR to CK_UTF8CHAR for v2.10 */ michael@0: CK_UTF8CHAR slotDescription[64]; /* blank padded */ michael@0: CK_UTF8CHAR manufacturerID[32]; /* blank padded */ michael@0: CK_FLAGS flags; michael@0: michael@0: /* hardwareVersion and firmwareVersion are new for v2.0 */ michael@0: CK_VERSION hardwareVersion; /* version of hardware */ michael@0: CK_VERSION firmwareVersion; /* version of firmware */ michael@0: } CK_SLOT_INFO; michael@0: michael@0: /* flags: bit flags that provide capabilities of the slot michael@0: * Bit Flag Mask Meaning michael@0: */ michael@0: #define CKF_TOKEN_PRESENT 0x00000001 /* a token is there */ michael@0: #define CKF_REMOVABLE_DEVICE 0x00000002 /* removable devices*/ michael@0: #define CKF_HW_SLOT 0x00000004 /* hardware slot */ michael@0: michael@0: typedef CK_SLOT_INFO CK_PTR CK_SLOT_INFO_PTR; michael@0: michael@0: michael@0: /* CK_TOKEN_INFO provides information about a token */ michael@0: typedef struct CK_TOKEN_INFO { michael@0: /* label, manufacturerID, and model have been changed from michael@0: * CK_CHAR to CK_UTF8CHAR for v2.10 */ michael@0: CK_UTF8CHAR label[32]; /* blank padded */ michael@0: CK_UTF8CHAR manufacturerID[32]; /* blank padded */ michael@0: CK_UTF8CHAR model[16]; /* blank padded */ michael@0: CK_CHAR serialNumber[16]; /* blank padded */ michael@0: CK_FLAGS flags; /* see below */ michael@0: michael@0: /* ulMaxSessionCount, ulSessionCount, ulMaxRwSessionCount, michael@0: * ulRwSessionCount, ulMaxPinLen, and ulMinPinLen have all been michael@0: * changed from CK_USHORT to CK_ULONG for v2.0 */ michael@0: CK_ULONG ulMaxSessionCount; /* max open sessions */ michael@0: CK_ULONG ulSessionCount; /* sess. now open */ michael@0: CK_ULONG ulMaxRwSessionCount; /* max R/W sessions */ michael@0: CK_ULONG ulRwSessionCount; /* R/W sess. now open */ michael@0: CK_ULONG ulMaxPinLen; /* in bytes */ michael@0: CK_ULONG ulMinPinLen; /* in bytes */ michael@0: CK_ULONG ulTotalPublicMemory; /* in bytes */ michael@0: CK_ULONG ulFreePublicMemory; /* in bytes */ michael@0: CK_ULONG ulTotalPrivateMemory; /* in bytes */ michael@0: CK_ULONG ulFreePrivateMemory; /* in bytes */ michael@0: michael@0: /* hardwareVersion, firmwareVersion, and time are new for michael@0: * v2.0 */ michael@0: CK_VERSION hardwareVersion; /* version of hardware */ michael@0: CK_VERSION firmwareVersion; /* version of firmware */ michael@0: CK_CHAR utcTime[16]; /* time */ michael@0: } CK_TOKEN_INFO; michael@0: michael@0: /* The flags parameter is defined as follows: michael@0: * Bit Flag Mask Meaning michael@0: */ michael@0: #define CKF_RNG 0x00000001 /* has random # michael@0: * generator */ michael@0: #define CKF_WRITE_PROTECTED 0x00000002 /* token is michael@0: * write- michael@0: * protected */ michael@0: #define CKF_LOGIN_REQUIRED 0x00000004 /* user must michael@0: * login */ michael@0: #define CKF_USER_PIN_INITIALIZED 0x00000008 /* normal user's michael@0: * PIN is set */ michael@0: michael@0: /* CKF_RESTORE_KEY_NOT_NEEDED is new for v2.0. If it is set, michael@0: * that means that *every* time the state of cryptographic michael@0: * operations of a session is successfully saved, all keys michael@0: * needed to continue those operations are stored in the state */ michael@0: #define CKF_RESTORE_KEY_NOT_NEEDED 0x00000020 michael@0: michael@0: /* CKF_CLOCK_ON_TOKEN is new for v2.0. If it is set, that means michael@0: * that the token has some sort of clock. The time on that michael@0: * clock is returned in the token info structure */ michael@0: #define CKF_CLOCK_ON_TOKEN 0x00000040 michael@0: michael@0: /* CKF_PROTECTED_AUTHENTICATION_PATH is new for v2.0. If it is michael@0: * set, that means that there is some way for the user to login michael@0: * without sending a PIN through the PKCS #11 library itself */ michael@0: #define CKF_PROTECTED_AUTHENTICATION_PATH 0x00000100 michael@0: michael@0: /* CKF_DUAL_CRYPTO_OPERATIONS is new for v2.0. If it is true, michael@0: * that means that a single session with the token can perform michael@0: * dual simultaneous cryptographic operations (digest and michael@0: * encrypt; decrypt and digest; sign and encrypt; and decrypt michael@0: * and sign) */ michael@0: #define CKF_DUAL_CRYPTO_OPERATIONS 0x00000200 michael@0: michael@0: /* CKF_TOKEN_INITIALIZED if new for v2.10. If it is true, the michael@0: * token has been initialized using C_InitializeToken or an michael@0: * equivalent mechanism outside the scope of PKCS #11. michael@0: * Calling C_InitializeToken when this flag is set will cause michael@0: * the token to be reinitialized. */ michael@0: #define CKF_TOKEN_INITIALIZED 0x00000400 michael@0: michael@0: /* CKF_SECONDARY_AUTHENTICATION if new for v2.10. If it is michael@0: * true, the token supports secondary authentication for michael@0: * private key objects. This flag is deprecated in v2.11 and michael@0: onwards. */ michael@0: #define CKF_SECONDARY_AUTHENTICATION 0x00000800 michael@0: michael@0: /* CKF_USER_PIN_COUNT_LOW if new for v2.10. If it is true, an michael@0: * incorrect user login PIN has been entered at least once michael@0: * since the last successful authentication. */ michael@0: #define CKF_USER_PIN_COUNT_LOW 0x00010000 michael@0: michael@0: /* CKF_USER_PIN_FINAL_TRY if new for v2.10. If it is true, michael@0: * supplying an incorrect user PIN will it to become locked. */ michael@0: #define CKF_USER_PIN_FINAL_TRY 0x00020000 michael@0: michael@0: /* CKF_USER_PIN_LOCKED if new for v2.10. If it is true, the michael@0: * user PIN has been locked. User login to the token is not michael@0: * possible. */ michael@0: #define CKF_USER_PIN_LOCKED 0x00040000 michael@0: michael@0: /* CKF_USER_PIN_TO_BE_CHANGED if new for v2.10. If it is true, michael@0: * the user PIN value is the default value set by token michael@0: * initialization or manufacturing, or the PIN has been michael@0: * expired by the card. */ michael@0: #define CKF_USER_PIN_TO_BE_CHANGED 0x00080000 michael@0: michael@0: /* CKF_SO_PIN_COUNT_LOW if new for v2.10. If it is true, an michael@0: * incorrect SO login PIN has been entered at least once since michael@0: * the last successful authentication. */ michael@0: #define CKF_SO_PIN_COUNT_LOW 0x00100000 michael@0: michael@0: /* CKF_SO_PIN_FINAL_TRY if new for v2.10. If it is true, michael@0: * supplying an incorrect SO PIN will it to become locked. */ michael@0: #define CKF_SO_PIN_FINAL_TRY 0x00200000 michael@0: michael@0: /* CKF_SO_PIN_LOCKED if new for v2.10. If it is true, the SO michael@0: * PIN has been locked. SO login to the token is not possible. michael@0: */ michael@0: #define CKF_SO_PIN_LOCKED 0x00400000 michael@0: michael@0: /* CKF_SO_PIN_TO_BE_CHANGED if new for v2.10. If it is true, michael@0: * the SO PIN value is the default value set by token michael@0: * initialization or manufacturing, or the PIN has been michael@0: * expired by the card. */ michael@0: #define CKF_SO_PIN_TO_BE_CHANGED 0x00800000 michael@0: michael@0: typedef CK_TOKEN_INFO CK_PTR CK_TOKEN_INFO_PTR; michael@0: michael@0: michael@0: /* CK_SESSION_HANDLE is a PKCS #11-assigned value that michael@0: * identifies a session */ michael@0: typedef CK_ULONG CK_SESSION_HANDLE; michael@0: michael@0: typedef CK_SESSION_HANDLE CK_PTR CK_SESSION_HANDLE_PTR; michael@0: michael@0: michael@0: /* CK_USER_TYPE enumerates the types of PKCS #11 users */ michael@0: /* CK_USER_TYPE has been changed from an enum to a CK_ULONG for michael@0: * v2.0 */ michael@0: typedef CK_ULONG CK_USER_TYPE; michael@0: /* Security Officer */ michael@0: #define CKU_SO 0 michael@0: /* Normal user */ michael@0: #define CKU_USER 1 michael@0: /* Context specific (added in v2.20) */ michael@0: #define CKU_CONTEXT_SPECIFIC 2 michael@0: michael@0: /* CK_STATE enumerates the session states */ michael@0: /* CK_STATE has been changed from an enum to a CK_ULONG for michael@0: * v2.0 */ michael@0: typedef CK_ULONG CK_STATE; michael@0: #define CKS_RO_PUBLIC_SESSION 0 michael@0: #define CKS_RO_USER_FUNCTIONS 1 michael@0: #define CKS_RW_PUBLIC_SESSION 2 michael@0: #define CKS_RW_USER_FUNCTIONS 3 michael@0: #define CKS_RW_SO_FUNCTIONS 4 michael@0: michael@0: michael@0: /* CK_SESSION_INFO provides information about a session */ michael@0: typedef struct CK_SESSION_INFO { michael@0: CK_SLOT_ID slotID; michael@0: CK_STATE state; michael@0: CK_FLAGS flags; /* see below */ michael@0: michael@0: /* ulDeviceError was changed from CK_USHORT to CK_ULONG for michael@0: * v2.0 */ michael@0: CK_ULONG ulDeviceError; /* device-dependent error code */ michael@0: } CK_SESSION_INFO; michael@0: michael@0: /* The flags are defined in the following table: michael@0: * Bit Flag Mask Meaning michael@0: */ michael@0: #define CKF_RW_SESSION 0x00000002 /* session is r/w */ michael@0: #define CKF_SERIAL_SESSION 0x00000004 /* no parallel */ michael@0: michael@0: typedef CK_SESSION_INFO CK_PTR CK_SESSION_INFO_PTR; michael@0: michael@0: michael@0: /* CK_OBJECT_HANDLE is a token-specific identifier for an michael@0: * object */ michael@0: typedef CK_ULONG CK_OBJECT_HANDLE; michael@0: michael@0: typedef CK_OBJECT_HANDLE CK_PTR CK_OBJECT_HANDLE_PTR; michael@0: michael@0: michael@0: /* CK_OBJECT_CLASS is a value that identifies the classes (or michael@0: * types) of objects that PKCS #11 recognizes. It is defined michael@0: * as follows: */ michael@0: /* CK_OBJECT_CLASS was changed from CK_USHORT to CK_ULONG for michael@0: * v2.0 */ michael@0: typedef CK_ULONG CK_OBJECT_CLASS; michael@0: michael@0: /* The following classes of objects are defined: */ michael@0: /* CKO_HW_FEATURE is new for v2.10 */ michael@0: /* CKO_DOMAIN_PARAMETERS is new for v2.11 */ michael@0: /* CKO_MECHANISM is new for v2.20 */ michael@0: #define CKO_DATA 0x00000000 michael@0: #define CKO_CERTIFICATE 0x00000001 michael@0: #define CKO_PUBLIC_KEY 0x00000002 michael@0: #define CKO_PRIVATE_KEY 0x00000003 michael@0: #define CKO_SECRET_KEY 0x00000004 michael@0: #define CKO_HW_FEATURE 0x00000005 michael@0: #define CKO_DOMAIN_PARAMETERS 0x00000006 michael@0: #define CKO_MECHANISM 0x00000007 michael@0: #define CKO_VENDOR_DEFINED 0x80000000 michael@0: michael@0: typedef CK_OBJECT_CLASS CK_PTR CK_OBJECT_CLASS_PTR; michael@0: michael@0: /* CK_HW_FEATURE_TYPE is new for v2.10. CK_HW_FEATURE_TYPE is a michael@0: * value that identifies the hardware feature type of an object michael@0: * with CK_OBJECT_CLASS equal to CKO_HW_FEATURE. */ michael@0: typedef CK_ULONG CK_HW_FEATURE_TYPE; michael@0: michael@0: /* The following hardware feature types are defined */ michael@0: /* CKH_USER_INTERFACE is new for v2.20 */ michael@0: #define CKH_MONOTONIC_COUNTER 0x00000001 michael@0: #define CKH_CLOCK 0x00000002 michael@0: #define CKH_USER_INTERFACE 0x00000003 michael@0: #define CKH_VENDOR_DEFINED 0x80000000 michael@0: michael@0: /* CK_KEY_TYPE is a value that identifies a key type */ michael@0: /* CK_KEY_TYPE was changed from CK_USHORT to CK_ULONG for v2.0 */ michael@0: typedef CK_ULONG CK_KEY_TYPE; michael@0: michael@0: /* the following key types are defined: */ michael@0: #define CKK_RSA 0x00000000 michael@0: #define CKK_DSA 0x00000001 michael@0: #define CKK_DH 0x00000002 michael@0: michael@0: /* CKK_ECDSA and CKK_KEA are new for v2.0 */ michael@0: /* CKK_ECDSA is deprecated in v2.11, CKK_EC is preferred. */ michael@0: #define CKK_ECDSA 0x00000003 michael@0: #define CKK_EC 0x00000003 michael@0: #define CKK_X9_42_DH 0x00000004 michael@0: #define CKK_KEA 0x00000005 michael@0: michael@0: #define CKK_GENERIC_SECRET 0x00000010 michael@0: #define CKK_RC2 0x00000011 michael@0: #define CKK_RC4 0x00000012 michael@0: #define CKK_DES 0x00000013 michael@0: #define CKK_DES2 0x00000014 michael@0: #define CKK_DES3 0x00000015 michael@0: michael@0: /* all these key types are new for v2.0 */ michael@0: #define CKK_CAST 0x00000016 michael@0: #define CKK_CAST3 0x00000017 michael@0: /* CKK_CAST5 is deprecated in v2.11, CKK_CAST128 is preferred. */ michael@0: #define CKK_CAST5 0x00000018 michael@0: #define CKK_CAST128 0x00000018 michael@0: #define CKK_RC5 0x00000019 michael@0: #define CKK_IDEA 0x0000001A michael@0: #define CKK_SKIPJACK 0x0000001B michael@0: #define CKK_BATON 0x0000001C michael@0: #define CKK_JUNIPER 0x0000001D michael@0: #define CKK_CDMF 0x0000001E michael@0: #define CKK_AES 0x0000001F michael@0: michael@0: /* BlowFish and TwoFish are new for v2.20 */ michael@0: #define CKK_BLOWFISH 0x00000020 michael@0: #define CKK_TWOFISH 0x00000021 michael@0: michael@0: /* Camellia is proposed for v2.20 Amendment 3 */ michael@0: #define CKK_CAMELLIA 0x00000025 michael@0: michael@0: #define CKK_SEED 0x00000026 michael@0: michael@0: #define CKK_VENDOR_DEFINED 0x80000000 michael@0: michael@0: michael@0: /* CK_CERTIFICATE_TYPE is a value that identifies a certificate michael@0: * type */ michael@0: /* CK_CERTIFICATE_TYPE was changed from CK_USHORT to CK_ULONG michael@0: * for v2.0 */ michael@0: typedef CK_ULONG CK_CERTIFICATE_TYPE; michael@0: michael@0: /* The following certificate types are defined: */ michael@0: /* CKC_X_509_ATTR_CERT is new for v2.10 */ michael@0: /* CKC_WTLS is new for v2.20 */ michael@0: #define CKC_X_509 0x00000000 michael@0: #define CKC_X_509_ATTR_CERT 0x00000001 michael@0: #define CKC_WTLS 0x00000002 michael@0: #define CKC_VENDOR_DEFINED 0x80000000 michael@0: michael@0: michael@0: /* CK_ATTRIBUTE_TYPE is a value that identifies an attribute michael@0: * type */ michael@0: /* CK_ATTRIBUTE_TYPE was changed from CK_USHORT to CK_ULONG for michael@0: * v2.0 */ michael@0: typedef CK_ULONG CK_ATTRIBUTE_TYPE; michael@0: michael@0: /* The CKF_ARRAY_ATTRIBUTE flag identifies an attribute which michael@0: consists of an array of values. */ michael@0: #define CKF_ARRAY_ATTRIBUTE 0x40000000 michael@0: michael@0: /* The following attribute types are defined: */ michael@0: #define CKA_CLASS 0x00000000 michael@0: #define CKA_TOKEN 0x00000001 michael@0: #define CKA_PRIVATE 0x00000002 michael@0: #define CKA_LABEL 0x00000003 michael@0: #define CKA_APPLICATION 0x00000010 michael@0: #define CKA_VALUE 0x00000011 michael@0: michael@0: /* CKA_OBJECT_ID is new for v2.10 */ michael@0: #define CKA_OBJECT_ID 0x00000012 michael@0: michael@0: #define CKA_CERTIFICATE_TYPE 0x00000080 michael@0: #define CKA_ISSUER 0x00000081 michael@0: #define CKA_SERIAL_NUMBER 0x00000082 michael@0: michael@0: /* CKA_AC_ISSUER, CKA_OWNER, and CKA_ATTR_TYPES are new michael@0: * for v2.10 */ michael@0: #define CKA_AC_ISSUER 0x00000083 michael@0: #define CKA_OWNER 0x00000084 michael@0: #define CKA_ATTR_TYPES 0x00000085 michael@0: michael@0: /* CKA_TRUSTED is new for v2.11 */ michael@0: #define CKA_TRUSTED 0x00000086 michael@0: michael@0: /* CKA_CERTIFICATE_CATEGORY ... michael@0: * CKA_CHECK_VALUE are new for v2.20 */ michael@0: #define CKA_CERTIFICATE_CATEGORY 0x00000087 michael@0: #define CKA_JAVA_MIDP_SECURITY_DOMAIN 0x00000088 michael@0: #define CKA_URL 0x00000089 michael@0: #define CKA_HASH_OF_SUBJECT_PUBLIC_KEY 0x0000008A michael@0: #define CKA_HASH_OF_ISSUER_PUBLIC_KEY 0x0000008B michael@0: #define CKA_CHECK_VALUE 0x00000090 michael@0: michael@0: #define CKA_KEY_TYPE 0x00000100 michael@0: #define CKA_SUBJECT 0x00000101 michael@0: #define CKA_ID 0x00000102 michael@0: #define CKA_SENSITIVE 0x00000103 michael@0: #define CKA_ENCRYPT 0x00000104 michael@0: #define CKA_DECRYPT 0x00000105 michael@0: #define CKA_WRAP 0x00000106 michael@0: #define CKA_UNWRAP 0x00000107 michael@0: #define CKA_SIGN 0x00000108 michael@0: #define CKA_SIGN_RECOVER 0x00000109 michael@0: #define CKA_VERIFY 0x0000010A michael@0: #define CKA_VERIFY_RECOVER 0x0000010B michael@0: #define CKA_DERIVE 0x0000010C michael@0: #define CKA_START_DATE 0x00000110 michael@0: #define CKA_END_DATE 0x00000111 michael@0: #define CKA_MODULUS 0x00000120 michael@0: #define CKA_MODULUS_BITS 0x00000121 michael@0: #define CKA_PUBLIC_EXPONENT 0x00000122 michael@0: #define CKA_PRIVATE_EXPONENT 0x00000123 michael@0: #define CKA_PRIME_1 0x00000124 michael@0: #define CKA_PRIME_2 0x00000125 michael@0: #define CKA_EXPONENT_1 0x00000126 michael@0: #define CKA_EXPONENT_2 0x00000127 michael@0: #define CKA_COEFFICIENT 0x00000128 michael@0: #define CKA_PRIME 0x00000130 michael@0: #define CKA_SUBPRIME 0x00000131 michael@0: #define CKA_BASE 0x00000132 michael@0: michael@0: /* CKA_PRIME_BITS and CKA_SUB_PRIME_BITS are new for v2.11 */ michael@0: #define CKA_PRIME_BITS 0x00000133 michael@0: #define CKA_SUBPRIME_BITS 0x00000134 michael@0: #define CKA_SUB_PRIME_BITS CKA_SUBPRIME_BITS michael@0: /* (To retain backwards-compatibility) */ michael@0: michael@0: #define CKA_VALUE_BITS 0x00000160 michael@0: #define CKA_VALUE_LEN 0x00000161 michael@0: michael@0: /* CKA_EXTRACTABLE, CKA_LOCAL, CKA_NEVER_EXTRACTABLE, michael@0: * CKA_ALWAYS_SENSITIVE, CKA_MODIFIABLE, CKA_ECDSA_PARAMS, michael@0: * and CKA_EC_POINT are new for v2.0 */ michael@0: #define CKA_EXTRACTABLE 0x00000162 michael@0: #define CKA_LOCAL 0x00000163 michael@0: #define CKA_NEVER_EXTRACTABLE 0x00000164 michael@0: #define CKA_ALWAYS_SENSITIVE 0x00000165 michael@0: michael@0: /* CKA_KEY_GEN_MECHANISM is new for v2.11 */ michael@0: #define CKA_KEY_GEN_MECHANISM 0x00000166 michael@0: michael@0: #define CKA_MODIFIABLE 0x00000170 michael@0: michael@0: /* CKA_ECDSA_PARAMS is deprecated in v2.11, michael@0: * CKA_EC_PARAMS is preferred. */ michael@0: #define CKA_ECDSA_PARAMS 0x00000180 michael@0: #define CKA_EC_PARAMS 0x00000180 michael@0: michael@0: #define CKA_EC_POINT 0x00000181 michael@0: michael@0: /* CKA_SECONDARY_AUTH, CKA_AUTH_PIN_FLAGS, michael@0: * are new for v2.10. Deprecated in v2.11 and onwards. */ michael@0: #define CKA_SECONDARY_AUTH 0x00000200 michael@0: #define CKA_AUTH_PIN_FLAGS 0x00000201 michael@0: michael@0: /* CKA_ALWAYS_AUTHENTICATE ... michael@0: * CKA_UNWRAP_TEMPLATE are new for v2.20 */ michael@0: #define CKA_ALWAYS_AUTHENTICATE 0x00000202 michael@0: michael@0: #define CKA_WRAP_WITH_TRUSTED 0x00000210 michael@0: #define CKA_WRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000211) michael@0: #define CKA_UNWRAP_TEMPLATE (CKF_ARRAY_ATTRIBUTE|0x00000212) michael@0: michael@0: /* CKA_HW_FEATURE_TYPE, CKA_RESET_ON_INIT, and CKA_HAS_RESET michael@0: * are new for v2.10 */ michael@0: #define CKA_HW_FEATURE_TYPE 0x00000300 michael@0: #define CKA_RESET_ON_INIT 0x00000301 michael@0: #define CKA_HAS_RESET 0x00000302 michael@0: michael@0: /* The following attributes are new for v2.20 */ michael@0: #define CKA_PIXEL_X 0x00000400 michael@0: #define CKA_PIXEL_Y 0x00000401 michael@0: #define CKA_RESOLUTION 0x00000402 michael@0: #define CKA_CHAR_ROWS 0x00000403 michael@0: #define CKA_CHAR_COLUMNS 0x00000404 michael@0: #define CKA_COLOR 0x00000405 michael@0: #define CKA_BITS_PER_PIXEL 0x00000406 michael@0: #define CKA_CHAR_SETS 0x00000480 michael@0: #define CKA_ENCODING_METHODS 0x00000481 michael@0: #define CKA_MIME_TYPES 0x00000482 michael@0: #define CKA_MECHANISM_TYPE 0x00000500 michael@0: #define CKA_REQUIRED_CMS_ATTRIBUTES 0x00000501 michael@0: #define CKA_DEFAULT_CMS_ATTRIBUTES 0x00000502 michael@0: #define CKA_SUPPORTED_CMS_ATTRIBUTES 0x00000503 michael@0: #define CKA_ALLOWED_MECHANISMS (CKF_ARRAY_ATTRIBUTE|0x00000600) michael@0: michael@0: #define CKA_VENDOR_DEFINED 0x80000000 michael@0: michael@0: michael@0: /* CK_ATTRIBUTE is a structure that includes the type, length michael@0: * and value of an attribute */ michael@0: typedef struct CK_ATTRIBUTE { michael@0: CK_ATTRIBUTE_TYPE type; michael@0: CK_VOID_PTR pValue; michael@0: michael@0: /* ulValueLen went from CK_USHORT to CK_ULONG for v2.0 */ michael@0: CK_ULONG ulValueLen; /* in bytes */ michael@0: } CK_ATTRIBUTE; michael@0: michael@0: typedef CK_ATTRIBUTE CK_PTR CK_ATTRIBUTE_PTR; michael@0: michael@0: michael@0: /* CK_DATE is a structure that defines a date */ michael@0: typedef struct CK_DATE{ michael@0: CK_CHAR year[4]; /* the year ("1900" - "9999") */ michael@0: CK_CHAR month[2]; /* the month ("01" - "12") */ michael@0: CK_CHAR day[2]; /* the day ("01" - "31") */ michael@0: } CK_DATE; michael@0: michael@0: michael@0: /* CK_MECHANISM_TYPE is a value that identifies a mechanism michael@0: * type */ michael@0: /* CK_MECHANISM_TYPE was changed from CK_USHORT to CK_ULONG for michael@0: * v2.0 */ michael@0: typedef CK_ULONG CK_MECHANISM_TYPE; michael@0: michael@0: /* the following mechanism types are defined: */ michael@0: #define CKM_RSA_PKCS_KEY_PAIR_GEN 0x00000000 michael@0: #define CKM_RSA_PKCS 0x00000001 michael@0: #define CKM_RSA_9796 0x00000002 michael@0: #define CKM_RSA_X_509 0x00000003 michael@0: michael@0: /* CKM_MD2_RSA_PKCS, CKM_MD5_RSA_PKCS, and CKM_SHA1_RSA_PKCS michael@0: * are new for v2.0. They are mechanisms which hash and sign */ michael@0: #define CKM_MD2_RSA_PKCS 0x00000004 michael@0: #define CKM_MD5_RSA_PKCS 0x00000005 michael@0: #define CKM_SHA1_RSA_PKCS 0x00000006 michael@0: michael@0: /* CKM_RIPEMD128_RSA_PKCS, CKM_RIPEMD160_RSA_PKCS, and michael@0: * CKM_RSA_PKCS_OAEP are new for v2.10 */ michael@0: #define CKM_RIPEMD128_RSA_PKCS 0x00000007 michael@0: #define CKM_RIPEMD160_RSA_PKCS 0x00000008 michael@0: #define CKM_RSA_PKCS_OAEP 0x00000009 michael@0: michael@0: /* CKM_RSA_X9_31_KEY_PAIR_GEN, CKM_RSA_X9_31, CKM_SHA1_RSA_X9_31, michael@0: * CKM_RSA_PKCS_PSS, and CKM_SHA1_RSA_PKCS_PSS are new for v2.11 */ michael@0: #define CKM_RSA_X9_31_KEY_PAIR_GEN 0x0000000A michael@0: #define CKM_RSA_X9_31 0x0000000B michael@0: #define CKM_SHA1_RSA_X9_31 0x0000000C michael@0: #define CKM_RSA_PKCS_PSS 0x0000000D michael@0: #define CKM_SHA1_RSA_PKCS_PSS 0x0000000E michael@0: michael@0: #define CKM_DSA_KEY_PAIR_GEN 0x00000010 michael@0: #define CKM_DSA 0x00000011 michael@0: #define CKM_DSA_SHA1 0x00000012 michael@0: #define CKM_DH_PKCS_KEY_PAIR_GEN 0x00000020 michael@0: #define CKM_DH_PKCS_DERIVE 0x00000021 michael@0: michael@0: /* CKM_X9_42_DH_KEY_PAIR_GEN, CKM_X9_42_DH_DERIVE, michael@0: * CKM_X9_42_DH_HYBRID_DERIVE, and CKM_X9_42_MQV_DERIVE are new for michael@0: * v2.11 */ michael@0: #define CKM_X9_42_DH_KEY_PAIR_GEN 0x00000030 michael@0: #define CKM_X9_42_DH_DERIVE 0x00000031 michael@0: #define CKM_X9_42_DH_HYBRID_DERIVE 0x00000032 michael@0: #define CKM_X9_42_MQV_DERIVE 0x00000033 michael@0: michael@0: /* CKM_SHA256/384/512 are new for v2.20 */ michael@0: #define CKM_SHA256_RSA_PKCS 0x00000040 michael@0: #define CKM_SHA384_RSA_PKCS 0x00000041 michael@0: #define CKM_SHA512_RSA_PKCS 0x00000042 michael@0: #define CKM_SHA256_RSA_PKCS_PSS 0x00000043 michael@0: #define CKM_SHA384_RSA_PKCS_PSS 0x00000044 michael@0: #define CKM_SHA512_RSA_PKCS_PSS 0x00000045 michael@0: michael@0: /* CKM_SHA224 new for v2.20 amendment 3 */ michael@0: #define CKM_SHA224_RSA_PKCS 0x00000046 michael@0: #define CKM_SHA224_RSA_PKCS_PSS 0x00000047 michael@0: michael@0: #define CKM_RC2_KEY_GEN 0x00000100 michael@0: #define CKM_RC2_ECB 0x00000101 michael@0: #define CKM_RC2_CBC 0x00000102 michael@0: #define CKM_RC2_MAC 0x00000103 michael@0: michael@0: /* CKM_RC2_MAC_GENERAL and CKM_RC2_CBC_PAD are new for v2.0 */ michael@0: #define CKM_RC2_MAC_GENERAL 0x00000104 michael@0: #define CKM_RC2_CBC_PAD 0x00000105 michael@0: michael@0: #define CKM_RC4_KEY_GEN 0x00000110 michael@0: #define CKM_RC4 0x00000111 michael@0: #define CKM_DES_KEY_GEN 0x00000120 michael@0: #define CKM_DES_ECB 0x00000121 michael@0: #define CKM_DES_CBC 0x00000122 michael@0: #define CKM_DES_MAC 0x00000123 michael@0: michael@0: /* CKM_DES_MAC_GENERAL and CKM_DES_CBC_PAD are new for v2.0 */ michael@0: #define CKM_DES_MAC_GENERAL 0x00000124 michael@0: #define CKM_DES_CBC_PAD 0x00000125 michael@0: michael@0: #define CKM_DES2_KEY_GEN 0x00000130 michael@0: #define CKM_DES3_KEY_GEN 0x00000131 michael@0: #define CKM_DES3_ECB 0x00000132 michael@0: #define CKM_DES3_CBC 0x00000133 michael@0: #define CKM_DES3_MAC 0x00000134 michael@0: michael@0: /* CKM_DES3_MAC_GENERAL, CKM_DES3_CBC_PAD, CKM_CDMF_KEY_GEN, michael@0: * CKM_CDMF_ECB, CKM_CDMF_CBC, CKM_CDMF_MAC, michael@0: * CKM_CDMF_MAC_GENERAL, and CKM_CDMF_CBC_PAD are new for v2.0 */ michael@0: #define CKM_DES3_MAC_GENERAL 0x00000135 michael@0: #define CKM_DES3_CBC_PAD 0x00000136 michael@0: #define CKM_CDMF_KEY_GEN 0x00000140 michael@0: #define CKM_CDMF_ECB 0x00000141 michael@0: #define CKM_CDMF_CBC 0x00000142 michael@0: #define CKM_CDMF_MAC 0x00000143 michael@0: #define CKM_CDMF_MAC_GENERAL 0x00000144 michael@0: #define CKM_CDMF_CBC_PAD 0x00000145 michael@0: michael@0: /* the following four DES mechanisms are new for v2.20 */ michael@0: #define CKM_DES_OFB64 0x00000150 michael@0: #define CKM_DES_OFB8 0x00000151 michael@0: #define CKM_DES_CFB64 0x00000152 michael@0: #define CKM_DES_CFB8 0x00000153 michael@0: michael@0: #define CKM_MD2 0x00000200 michael@0: michael@0: /* CKM_MD2_HMAC and CKM_MD2_HMAC_GENERAL are new for v2.0 */ michael@0: #define CKM_MD2_HMAC 0x00000201 michael@0: #define CKM_MD2_HMAC_GENERAL 0x00000202 michael@0: michael@0: #define CKM_MD5 0x00000210 michael@0: michael@0: /* CKM_MD5_HMAC and CKM_MD5_HMAC_GENERAL are new for v2.0 */ michael@0: #define CKM_MD5_HMAC 0x00000211 michael@0: #define CKM_MD5_HMAC_GENERAL 0x00000212 michael@0: michael@0: #define CKM_SHA_1 0x00000220 michael@0: michael@0: /* CKM_SHA_1_HMAC and CKM_SHA_1_HMAC_GENERAL are new for v2.0 */ michael@0: #define CKM_SHA_1_HMAC 0x00000221 michael@0: #define CKM_SHA_1_HMAC_GENERAL 0x00000222 michael@0: michael@0: /* CKM_RIPEMD128, CKM_RIPEMD128_HMAC, michael@0: * CKM_RIPEMD128_HMAC_GENERAL, CKM_RIPEMD160, CKM_RIPEMD160_HMAC, michael@0: * and CKM_RIPEMD160_HMAC_GENERAL are new for v2.10 */ michael@0: #define CKM_RIPEMD128 0x00000230 michael@0: #define CKM_RIPEMD128_HMAC 0x00000231 michael@0: #define CKM_RIPEMD128_HMAC_GENERAL 0x00000232 michael@0: #define CKM_RIPEMD160 0x00000240 michael@0: #define CKM_RIPEMD160_HMAC 0x00000241 michael@0: #define CKM_RIPEMD160_HMAC_GENERAL 0x00000242 michael@0: michael@0: /* CKM_SHA256/384/512 are new for v2.20 */ michael@0: #define CKM_SHA256 0x00000250 michael@0: #define CKM_SHA256_HMAC 0x00000251 michael@0: #define CKM_SHA256_HMAC_GENERAL 0x00000252 michael@0: #define CKM_SHA384 0x00000260 michael@0: #define CKM_SHA384_HMAC 0x00000261 michael@0: #define CKM_SHA384_HMAC_GENERAL 0x00000262 michael@0: #define CKM_SHA512 0x00000270 michael@0: #define CKM_SHA512_HMAC 0x00000271 michael@0: #define CKM_SHA512_HMAC_GENERAL 0x00000272 michael@0: michael@0: /* CKM_SHA224 new for v2.20 amendment 3 */ michael@0: #define CKM_SHA224 0x00000255 michael@0: #define CKM_SHA224_HMAC 0x00000256 michael@0: #define CKM_SHA224_HMAC_GENERAL 0x00000257 michael@0: michael@0: /* All of the following mechanisms are new for v2.0 */ michael@0: /* Note that CAST128 and CAST5 are the same algorithm */ michael@0: #define CKM_CAST_KEY_GEN 0x00000300 michael@0: #define CKM_CAST_ECB 0x00000301 michael@0: #define CKM_CAST_CBC 0x00000302 michael@0: #define CKM_CAST_MAC 0x00000303 michael@0: #define CKM_CAST_MAC_GENERAL 0x00000304 michael@0: #define CKM_CAST_CBC_PAD 0x00000305 michael@0: #define CKM_CAST3_KEY_GEN 0x00000310 michael@0: #define CKM_CAST3_ECB 0x00000311 michael@0: #define CKM_CAST3_CBC 0x00000312 michael@0: #define CKM_CAST3_MAC 0x00000313 michael@0: #define CKM_CAST3_MAC_GENERAL 0x00000314 michael@0: #define CKM_CAST3_CBC_PAD 0x00000315 michael@0: #define CKM_CAST5_KEY_GEN 0x00000320 michael@0: #define CKM_CAST128_KEY_GEN 0x00000320 michael@0: #define CKM_CAST5_ECB 0x00000321 michael@0: #define CKM_CAST128_ECB 0x00000321 michael@0: #define CKM_CAST5_CBC 0x00000322 michael@0: #define CKM_CAST128_CBC 0x00000322 michael@0: #define CKM_CAST5_MAC 0x00000323 michael@0: #define CKM_CAST128_MAC 0x00000323 michael@0: #define CKM_CAST5_MAC_GENERAL 0x00000324 michael@0: #define CKM_CAST128_MAC_GENERAL 0x00000324 michael@0: #define CKM_CAST5_CBC_PAD 0x00000325 michael@0: #define CKM_CAST128_CBC_PAD 0x00000325 michael@0: #define CKM_RC5_KEY_GEN 0x00000330 michael@0: #define CKM_RC5_ECB 0x00000331 michael@0: #define CKM_RC5_CBC 0x00000332 michael@0: #define CKM_RC5_MAC 0x00000333 michael@0: #define CKM_RC5_MAC_GENERAL 0x00000334 michael@0: #define CKM_RC5_CBC_PAD 0x00000335 michael@0: #define CKM_IDEA_KEY_GEN 0x00000340 michael@0: #define CKM_IDEA_ECB 0x00000341 michael@0: #define CKM_IDEA_CBC 0x00000342 michael@0: #define CKM_IDEA_MAC 0x00000343 michael@0: #define CKM_IDEA_MAC_GENERAL 0x00000344 michael@0: #define CKM_IDEA_CBC_PAD 0x00000345 michael@0: #define CKM_GENERIC_SECRET_KEY_GEN 0x00000350 michael@0: #define CKM_CONCATENATE_BASE_AND_KEY 0x00000360 michael@0: #define CKM_CONCATENATE_BASE_AND_DATA 0x00000362 michael@0: #define CKM_CONCATENATE_DATA_AND_BASE 0x00000363 michael@0: #define CKM_XOR_BASE_AND_DATA 0x00000364 michael@0: #define CKM_EXTRACT_KEY_FROM_KEY 0x00000365 michael@0: #define CKM_SSL3_PRE_MASTER_KEY_GEN 0x00000370 michael@0: #define CKM_SSL3_MASTER_KEY_DERIVE 0x00000371 michael@0: #define CKM_SSL3_KEY_AND_MAC_DERIVE 0x00000372 michael@0: michael@0: /* CKM_SSL3_MASTER_KEY_DERIVE_DH, CKM_TLS_PRE_MASTER_KEY_GEN, michael@0: * CKM_TLS_MASTER_KEY_DERIVE, CKM_TLS_KEY_AND_MAC_DERIVE, and michael@0: * CKM_TLS_MASTER_KEY_DERIVE_DH are new for v2.11 */ michael@0: #define CKM_SSL3_MASTER_KEY_DERIVE_DH 0x00000373 michael@0: #define CKM_TLS_PRE_MASTER_KEY_GEN 0x00000374 michael@0: #define CKM_TLS_MASTER_KEY_DERIVE 0x00000375 michael@0: #define CKM_TLS_KEY_AND_MAC_DERIVE 0x00000376 michael@0: #define CKM_TLS_MASTER_KEY_DERIVE_DH 0x00000377 michael@0: michael@0: /* CKM_TLS_PRF is new for v2.20 */ michael@0: #define CKM_TLS_PRF 0x00000378 michael@0: michael@0: #define CKM_SSL3_MD5_MAC 0x00000380 michael@0: #define CKM_SSL3_SHA1_MAC 0x00000381 michael@0: #define CKM_MD5_KEY_DERIVATION 0x00000390 michael@0: #define CKM_MD2_KEY_DERIVATION 0x00000391 michael@0: #define CKM_SHA1_KEY_DERIVATION 0x00000392 michael@0: michael@0: /* CKM_SHA256/384/512 are new for v2.20 */ michael@0: #define CKM_SHA256_KEY_DERIVATION 0x00000393 michael@0: #define CKM_SHA384_KEY_DERIVATION 0x00000394 michael@0: #define CKM_SHA512_KEY_DERIVATION 0x00000395 michael@0: michael@0: /* CKM_SHA224 new for v2.20 amendment 3 */ michael@0: #define CKM_SHA224_KEY_DERIVATION 0x00000396 michael@0: michael@0: #define CKM_PBE_MD2_DES_CBC 0x000003A0 michael@0: #define CKM_PBE_MD5_DES_CBC 0x000003A1 michael@0: #define CKM_PBE_MD5_CAST_CBC 0x000003A2 michael@0: #define CKM_PBE_MD5_CAST3_CBC 0x000003A3 michael@0: #define CKM_PBE_MD5_CAST5_CBC 0x000003A4 michael@0: #define CKM_PBE_MD5_CAST128_CBC 0x000003A4 michael@0: #define CKM_PBE_SHA1_CAST5_CBC 0x000003A5 michael@0: #define CKM_PBE_SHA1_CAST128_CBC 0x000003A5 michael@0: #define CKM_PBE_SHA1_RC4_128 0x000003A6 michael@0: #define CKM_PBE_SHA1_RC4_40 0x000003A7 michael@0: #define CKM_PBE_SHA1_DES3_EDE_CBC 0x000003A8 michael@0: #define CKM_PBE_SHA1_DES2_EDE_CBC 0x000003A9 michael@0: #define CKM_PBE_SHA1_RC2_128_CBC 0x000003AA michael@0: #define CKM_PBE_SHA1_RC2_40_CBC 0x000003AB michael@0: michael@0: /* CKM_PKCS5_PBKD2 is new for v2.10 */ michael@0: #define CKM_PKCS5_PBKD2 0x000003B0 michael@0: michael@0: #define CKM_PBA_SHA1_WITH_SHA1_HMAC 0x000003C0 michael@0: michael@0: /* WTLS mechanisms are new for v2.20 */ michael@0: #define CKM_WTLS_PRE_MASTER_KEY_GEN 0x000003D0 michael@0: #define CKM_WTLS_MASTER_KEY_DERIVE 0x000003D1 michael@0: #define CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC 0x000003D2 michael@0: #define CKM_WTLS_PRF 0x000003D3 michael@0: #define CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE 0x000003D4 michael@0: #define CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE 0x000003D5 michael@0: michael@0: #define CKM_KEY_WRAP_LYNKS 0x00000400 michael@0: #define CKM_KEY_WRAP_SET_OAEP 0x00000401 michael@0: michael@0: /* CKM_CMS_SIG is new for v2.20 */ michael@0: #define CKM_CMS_SIG 0x00000500 michael@0: michael@0: /* Fortezza mechanisms */ michael@0: #define CKM_SKIPJACK_KEY_GEN 0x00001000 michael@0: #define CKM_SKIPJACK_ECB64 0x00001001 michael@0: #define CKM_SKIPJACK_CBC64 0x00001002 michael@0: #define CKM_SKIPJACK_OFB64 0x00001003 michael@0: #define CKM_SKIPJACK_CFB64 0x00001004 michael@0: #define CKM_SKIPJACK_CFB32 0x00001005 michael@0: #define CKM_SKIPJACK_CFB16 0x00001006 michael@0: #define CKM_SKIPJACK_CFB8 0x00001007 michael@0: #define CKM_SKIPJACK_WRAP 0x00001008 michael@0: #define CKM_SKIPJACK_PRIVATE_WRAP 0x00001009 michael@0: #define CKM_SKIPJACK_RELAYX 0x0000100a michael@0: #define CKM_KEA_KEY_PAIR_GEN 0x00001010 michael@0: #define CKM_KEA_KEY_DERIVE 0x00001011 michael@0: #define CKM_FORTEZZA_TIMESTAMP 0x00001020 michael@0: #define CKM_BATON_KEY_GEN 0x00001030 michael@0: #define CKM_BATON_ECB128 0x00001031 michael@0: #define CKM_BATON_ECB96 0x00001032 michael@0: #define CKM_BATON_CBC128 0x00001033 michael@0: #define CKM_BATON_COUNTER 0x00001034 michael@0: #define CKM_BATON_SHUFFLE 0x00001035 michael@0: #define CKM_BATON_WRAP 0x00001036 michael@0: michael@0: /* CKM_ECDSA_KEY_PAIR_GEN is deprecated in v2.11, michael@0: * CKM_EC_KEY_PAIR_GEN is preferred */ michael@0: #define CKM_ECDSA_KEY_PAIR_GEN 0x00001040 michael@0: #define CKM_EC_KEY_PAIR_GEN 0x00001040 michael@0: michael@0: #define CKM_ECDSA 0x00001041 michael@0: #define CKM_ECDSA_SHA1 0x00001042 michael@0: michael@0: /* CKM_ECDH1_DERIVE, CKM_ECDH1_COFACTOR_DERIVE, and CKM_ECMQV_DERIVE michael@0: * are new for v2.11 */ michael@0: #define CKM_ECDH1_DERIVE 0x00001050 michael@0: #define CKM_ECDH1_COFACTOR_DERIVE 0x00001051 michael@0: #define CKM_ECMQV_DERIVE 0x00001052 michael@0: michael@0: #define CKM_JUNIPER_KEY_GEN 0x00001060 michael@0: #define CKM_JUNIPER_ECB128 0x00001061 michael@0: #define CKM_JUNIPER_CBC128 0x00001062 michael@0: #define CKM_JUNIPER_COUNTER 0x00001063 michael@0: #define CKM_JUNIPER_SHUFFLE 0x00001064 michael@0: #define CKM_JUNIPER_WRAP 0x00001065 michael@0: #define CKM_FASTHASH 0x00001070 michael@0: michael@0: /* CKM_AES_KEY_GEN, CKM_AES_ECB, CKM_AES_CBC, CKM_AES_MAC, michael@0: * CKM_AES_MAC_GENERAL, CKM_AES_CBC_PAD, CKM_DSA_PARAMETER_GEN, michael@0: * CKM_DH_PKCS_PARAMETER_GEN, and CKM_X9_42_DH_PARAMETER_GEN are michael@0: * new for v2.11 */ michael@0: #define CKM_AES_KEY_GEN 0x00001080 michael@0: #define CKM_AES_ECB 0x00001081 michael@0: #define CKM_AES_CBC 0x00001082 michael@0: #define CKM_AES_MAC 0x00001083 michael@0: #define CKM_AES_MAC_GENERAL 0x00001084 michael@0: #define CKM_AES_CBC_PAD 0x00001085 michael@0: /* new for v2.20 amendment 3 */ michael@0: #define CKM_AES_CTR 0x00001086 michael@0: /* new for v2.30 */ michael@0: #define CKM_AES_GCM 0x00001087 michael@0: #define CKM_AES_CCM 0x00001088 michael@0: #define CKM_AES_CTS 0x00001089 michael@0: michael@0: /* BlowFish and TwoFish are new for v2.20 */ michael@0: #define CKM_BLOWFISH_KEY_GEN 0x00001090 michael@0: #define CKM_BLOWFISH_CBC 0x00001091 michael@0: #define CKM_TWOFISH_KEY_GEN 0x00001092 michael@0: #define CKM_TWOFISH_CBC 0x00001093 michael@0: michael@0: /* Camellia is proposed for v2.20 Amendment 3 */ michael@0: #define CKM_CAMELLIA_KEY_GEN 0x00000550 michael@0: #define CKM_CAMELLIA_ECB 0x00000551 michael@0: #define CKM_CAMELLIA_CBC 0x00000552 michael@0: #define CKM_CAMELLIA_MAC 0x00000553 michael@0: #define CKM_CAMELLIA_MAC_GENERAL 0x00000554 michael@0: #define CKM_CAMELLIA_CBC_PAD 0x00000555 michael@0: #define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556 michael@0: #define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557 michael@0: michael@0: #define CKM_SEED_KEY_GEN 0x00000650 michael@0: #define CKM_SEED_ECB 0x00000651 michael@0: #define CKM_SEED_CBC 0x00000652 michael@0: #define CKM_SEED_MAC 0x00000653 michael@0: #define CKM_SEED_MAC_GENERAL 0x00000654 michael@0: #define CKM_SEED_CBC_PAD 0x00000655 michael@0: #define CKM_SEED_ECB_ENCRYPT_DATA 0x00000656 michael@0: #define CKM_SEED_CBC_ENCRYPT_DATA 0x00000657 michael@0: michael@0: /* CKM_xxx_ENCRYPT_DATA mechanisms are new for v2.20 */ michael@0: #define CKM_DES_ECB_ENCRYPT_DATA 0x00001100 michael@0: #define CKM_DES_CBC_ENCRYPT_DATA 0x00001101 michael@0: #define CKM_DES3_ECB_ENCRYPT_DATA 0x00001102 michael@0: #define CKM_DES3_CBC_ENCRYPT_DATA 0x00001103 michael@0: #define CKM_AES_ECB_ENCRYPT_DATA 0x00001104 michael@0: #define CKM_AES_CBC_ENCRYPT_DATA 0x00001105 michael@0: michael@0: #define CKM_DSA_PARAMETER_GEN 0x00002000 michael@0: #define CKM_DH_PKCS_PARAMETER_GEN 0x00002001 michael@0: #define CKM_X9_42_DH_PARAMETER_GEN 0x00002002 michael@0: michael@0: #define CKM_VENDOR_DEFINED 0x80000000 michael@0: michael@0: typedef CK_MECHANISM_TYPE CK_PTR CK_MECHANISM_TYPE_PTR; michael@0: michael@0: michael@0: /* CK_MECHANISM is a structure that specifies a particular michael@0: * mechanism */ michael@0: typedef struct CK_MECHANISM { michael@0: CK_MECHANISM_TYPE mechanism; michael@0: CK_VOID_PTR pParameter; michael@0: michael@0: /* ulParameterLen was changed from CK_USHORT to CK_ULONG for michael@0: * v2.0 */ michael@0: CK_ULONG ulParameterLen; /* in bytes */ michael@0: } CK_MECHANISM; michael@0: michael@0: typedef CK_MECHANISM CK_PTR CK_MECHANISM_PTR; michael@0: michael@0: michael@0: /* CK_MECHANISM_INFO provides information about a particular michael@0: * mechanism */ michael@0: typedef struct CK_MECHANISM_INFO { michael@0: CK_ULONG ulMinKeySize; michael@0: CK_ULONG ulMaxKeySize; michael@0: CK_FLAGS flags; michael@0: } CK_MECHANISM_INFO; michael@0: michael@0: /* The flags are defined as follows: michael@0: * Bit Flag Mask Meaning */ michael@0: #define CKF_HW 0x00000001 /* performed by HW */ michael@0: michael@0: /* The flags CKF_ENCRYPT, CKF_DECRYPT, CKF_DIGEST, CKF_SIGN, michael@0: * CKG_SIGN_RECOVER, CKF_VERIFY, CKF_VERIFY_RECOVER, michael@0: * CKF_GENERATE, CKF_GENERATE_KEY_PAIR, CKF_WRAP, CKF_UNWRAP, michael@0: * and CKF_DERIVE are new for v2.0. They specify whether or not michael@0: * a mechanism can be used for a particular task */ michael@0: #define CKF_ENCRYPT 0x00000100 michael@0: #define CKF_DECRYPT 0x00000200 michael@0: #define CKF_DIGEST 0x00000400 michael@0: #define CKF_SIGN 0x00000800 michael@0: #define CKF_SIGN_RECOVER 0x00001000 michael@0: #define CKF_VERIFY 0x00002000 michael@0: #define CKF_VERIFY_RECOVER 0x00004000 michael@0: #define CKF_GENERATE 0x00008000 michael@0: #define CKF_GENERATE_KEY_PAIR 0x00010000 michael@0: #define CKF_WRAP 0x00020000 michael@0: #define CKF_UNWRAP 0x00040000 michael@0: #define CKF_DERIVE 0x00080000 michael@0: michael@0: /* CKF_EC_F_P, CKF_EC_F_2M, CKF_EC_ECPARAMETERS, CKF_EC_NAMEDCURVE, michael@0: * CKF_EC_UNCOMPRESS, and CKF_EC_COMPRESS are new for v2.11. They michael@0: * describe a token's EC capabilities not available in mechanism michael@0: * information. */ michael@0: #define CKF_EC_F_P 0x00100000 michael@0: #define CKF_EC_F_2M 0x00200000 michael@0: #define CKF_EC_ECPARAMETERS 0x00400000 michael@0: #define CKF_EC_NAMEDCURVE 0x00800000 michael@0: #define CKF_EC_UNCOMPRESS 0x01000000 michael@0: #define CKF_EC_COMPRESS 0x02000000 michael@0: michael@0: #define CKF_EXTENSION 0x80000000 /* FALSE for this version */ michael@0: michael@0: typedef CK_MECHANISM_INFO CK_PTR CK_MECHANISM_INFO_PTR; michael@0: michael@0: michael@0: /* CK_RV is a value that identifies the return value of a michael@0: * PKCS #11 function */ michael@0: /* CK_RV was changed from CK_USHORT to CK_ULONG for v2.0 */ michael@0: typedef CK_ULONG CK_RV; michael@0: michael@0: #define CKR_OK 0x00000000 michael@0: #define CKR_CANCEL 0x00000001 michael@0: #define CKR_HOST_MEMORY 0x00000002 michael@0: #define CKR_SLOT_ID_INVALID 0x00000003 michael@0: michael@0: /* CKR_FLAGS_INVALID was removed for v2.0 */ michael@0: michael@0: /* CKR_GENERAL_ERROR and CKR_FUNCTION_FAILED are new for v2.0 */ michael@0: #define CKR_GENERAL_ERROR 0x00000005 michael@0: #define CKR_FUNCTION_FAILED 0x00000006 michael@0: michael@0: /* CKR_ARGUMENTS_BAD, CKR_NO_EVENT, CKR_NEED_TO_CREATE_THREADS, michael@0: * and CKR_CANT_LOCK are new for v2.01 */ michael@0: #define CKR_ARGUMENTS_BAD 0x00000007 michael@0: #define CKR_NO_EVENT 0x00000008 michael@0: #define CKR_NEED_TO_CREATE_THREADS 0x00000009 michael@0: #define CKR_CANT_LOCK 0x0000000A michael@0: michael@0: #define CKR_ATTRIBUTE_READ_ONLY 0x00000010 michael@0: #define CKR_ATTRIBUTE_SENSITIVE 0x00000011 michael@0: #define CKR_ATTRIBUTE_TYPE_INVALID 0x00000012 michael@0: #define CKR_ATTRIBUTE_VALUE_INVALID 0x00000013 michael@0: #define CKR_DATA_INVALID 0x00000020 michael@0: #define CKR_DATA_LEN_RANGE 0x00000021 michael@0: #define CKR_DEVICE_ERROR 0x00000030 michael@0: #define CKR_DEVICE_MEMORY 0x00000031 michael@0: #define CKR_DEVICE_REMOVED 0x00000032 michael@0: #define CKR_ENCRYPTED_DATA_INVALID 0x00000040 michael@0: #define CKR_ENCRYPTED_DATA_LEN_RANGE 0x00000041 michael@0: #define CKR_FUNCTION_CANCELED 0x00000050 michael@0: #define CKR_FUNCTION_NOT_PARALLEL 0x00000051 michael@0: michael@0: /* CKR_FUNCTION_NOT_SUPPORTED is new for v2.0 */ michael@0: #define CKR_FUNCTION_NOT_SUPPORTED 0x00000054 michael@0: michael@0: #define CKR_KEY_HANDLE_INVALID 0x00000060 michael@0: michael@0: /* CKR_KEY_SENSITIVE was removed for v2.0 */ michael@0: michael@0: #define CKR_KEY_SIZE_RANGE 0x00000062 michael@0: #define CKR_KEY_TYPE_INCONSISTENT 0x00000063 michael@0: michael@0: /* CKR_KEY_NOT_NEEDED, CKR_KEY_CHANGED, CKR_KEY_NEEDED, michael@0: * CKR_KEY_INDIGESTIBLE, CKR_KEY_FUNCTION_NOT_PERMITTED, michael@0: * CKR_KEY_NOT_WRAPPABLE, and CKR_KEY_UNEXTRACTABLE are new for michael@0: * v2.0 */ michael@0: #define CKR_KEY_NOT_NEEDED 0x00000064 michael@0: #define CKR_KEY_CHANGED 0x00000065 michael@0: #define CKR_KEY_NEEDED 0x00000066 michael@0: #define CKR_KEY_INDIGESTIBLE 0x00000067 michael@0: #define CKR_KEY_FUNCTION_NOT_PERMITTED 0x00000068 michael@0: #define CKR_KEY_NOT_WRAPPABLE 0x00000069 michael@0: #define CKR_KEY_UNEXTRACTABLE 0x0000006A michael@0: michael@0: #define CKR_MECHANISM_INVALID 0x00000070 michael@0: #define CKR_MECHANISM_PARAM_INVALID 0x00000071 michael@0: michael@0: /* CKR_OBJECT_CLASS_INCONSISTENT and CKR_OBJECT_CLASS_INVALID michael@0: * were removed for v2.0 */ michael@0: #define CKR_OBJECT_HANDLE_INVALID 0x00000082 michael@0: #define CKR_OPERATION_ACTIVE 0x00000090 michael@0: #define CKR_OPERATION_NOT_INITIALIZED 0x00000091 michael@0: #define CKR_PIN_INCORRECT 0x000000A0 michael@0: #define CKR_PIN_INVALID 0x000000A1 michael@0: #define CKR_PIN_LEN_RANGE 0x000000A2 michael@0: michael@0: /* CKR_PIN_EXPIRED and CKR_PIN_LOCKED are new for v2.0 */ michael@0: #define CKR_PIN_EXPIRED 0x000000A3 michael@0: #define CKR_PIN_LOCKED 0x000000A4 michael@0: michael@0: #define CKR_SESSION_CLOSED 0x000000B0 michael@0: #define CKR_SESSION_COUNT 0x000000B1 michael@0: #define CKR_SESSION_HANDLE_INVALID 0x000000B3 michael@0: #define CKR_SESSION_PARALLEL_NOT_SUPPORTED 0x000000B4 michael@0: #define CKR_SESSION_READ_ONLY 0x000000B5 michael@0: #define CKR_SESSION_EXISTS 0x000000B6 michael@0: michael@0: /* CKR_SESSION_READ_ONLY_EXISTS and michael@0: * CKR_SESSION_READ_WRITE_SO_EXISTS are new for v2.0 */ michael@0: #define CKR_SESSION_READ_ONLY_EXISTS 0x000000B7 michael@0: #define CKR_SESSION_READ_WRITE_SO_EXISTS 0x000000B8 michael@0: michael@0: #define CKR_SIGNATURE_INVALID 0x000000C0 michael@0: #define CKR_SIGNATURE_LEN_RANGE 0x000000C1 michael@0: #define CKR_TEMPLATE_INCOMPLETE 0x000000D0 michael@0: #define CKR_TEMPLATE_INCONSISTENT 0x000000D1 michael@0: #define CKR_TOKEN_NOT_PRESENT 0x000000E0 michael@0: #define CKR_TOKEN_NOT_RECOGNIZED 0x000000E1 michael@0: #define CKR_TOKEN_WRITE_PROTECTED 0x000000E2 michael@0: #define CKR_UNWRAPPING_KEY_HANDLE_INVALID 0x000000F0 michael@0: #define CKR_UNWRAPPING_KEY_SIZE_RANGE 0x000000F1 michael@0: #define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x000000F2 michael@0: #define CKR_USER_ALREADY_LOGGED_IN 0x00000100 michael@0: #define CKR_USER_NOT_LOGGED_IN 0x00000101 michael@0: #define CKR_USER_PIN_NOT_INITIALIZED 0x00000102 michael@0: #define CKR_USER_TYPE_INVALID 0x00000103 michael@0: michael@0: /* CKR_USER_ANOTHER_ALREADY_LOGGED_IN and CKR_USER_TOO_MANY_TYPES michael@0: * are new to v2.01 */ michael@0: #define CKR_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000104 michael@0: #define CKR_USER_TOO_MANY_TYPES 0x00000105 michael@0: michael@0: #define CKR_WRAPPED_KEY_INVALID 0x00000110 michael@0: #define CKR_WRAPPED_KEY_LEN_RANGE 0x00000112 michael@0: #define CKR_WRAPPING_KEY_HANDLE_INVALID 0x00000113 michael@0: #define CKR_WRAPPING_KEY_SIZE_RANGE 0x00000114 michael@0: #define CKR_WRAPPING_KEY_TYPE_INCONSISTENT 0x00000115 michael@0: #define CKR_RANDOM_SEED_NOT_SUPPORTED 0x00000120 michael@0: michael@0: /* These are new to v2.0 */ michael@0: #define CKR_RANDOM_NO_RNG 0x00000121 michael@0: michael@0: /* These are new to v2.11 */ michael@0: #define CKR_DOMAIN_PARAMS_INVALID 0x00000130 michael@0: michael@0: /* These are new to v2.0 */ michael@0: #define CKR_BUFFER_TOO_SMALL 0x00000150 michael@0: #define CKR_SAVED_STATE_INVALID 0x00000160 michael@0: #define CKR_INFORMATION_SENSITIVE 0x00000170 michael@0: #define CKR_STATE_UNSAVEABLE 0x00000180 michael@0: michael@0: /* These are new to v2.01 */ michael@0: #define CKR_CRYPTOKI_NOT_INITIALIZED 0x00000190 michael@0: #define CKR_CRYPTOKI_ALREADY_INITIALIZED 0x00000191 michael@0: #define CKR_MUTEX_BAD 0x000001A0 michael@0: #define CKR_MUTEX_NOT_LOCKED 0x000001A1 michael@0: michael@0: /* This is new to v2.20 */ michael@0: #define CKR_FUNCTION_REJECTED 0x00000200 michael@0: michael@0: #define CKR_VENDOR_DEFINED 0x80000000 michael@0: michael@0: michael@0: /* CK_NOTIFY is an application callback that processes events */ michael@0: typedef CK_CALLBACK_FUNCTION(CK_RV, CK_NOTIFY)( michael@0: CK_SESSION_HANDLE hSession, /* the session's handle */ michael@0: CK_NOTIFICATION event, michael@0: CK_VOID_PTR pApplication /* passed to C_OpenSession */ michael@0: ); michael@0: michael@0: michael@0: /* CK_FUNCTION_LIST is a structure holding a PKCS #11 spec michael@0: * version and pointers of appropriate types to all the michael@0: * PKCS #11 functions */ michael@0: /* CK_FUNCTION_LIST is new for v2.0 */ michael@0: typedef struct CK_FUNCTION_LIST CK_FUNCTION_LIST; michael@0: michael@0: typedef CK_FUNCTION_LIST CK_PTR CK_FUNCTION_LIST_PTR; michael@0: michael@0: typedef CK_FUNCTION_LIST_PTR CK_PTR CK_FUNCTION_LIST_PTR_PTR; michael@0: michael@0: michael@0: /* CK_CREATEMUTEX is an application callback for creating a michael@0: * mutex object */ michael@0: typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)( michael@0: CK_VOID_PTR_PTR ppMutex /* location to receive ptr to mutex */ michael@0: ); michael@0: michael@0: michael@0: /* CK_DESTROYMUTEX is an application callback for destroying a michael@0: * mutex object */ michael@0: typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)( michael@0: CK_VOID_PTR pMutex /* pointer to mutex */ michael@0: ); michael@0: michael@0: michael@0: /* CK_LOCKMUTEX is an application callback for locking a mutex */ michael@0: typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)( michael@0: CK_VOID_PTR pMutex /* pointer to mutex */ michael@0: ); michael@0: michael@0: michael@0: /* CK_UNLOCKMUTEX is an application callback for unlocking a michael@0: * mutex */ michael@0: typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)( michael@0: CK_VOID_PTR pMutex /* pointer to mutex */ michael@0: ); michael@0: michael@0: michael@0: /* CK_C_INITIALIZE_ARGS provides the optional arguments to michael@0: * C_Initialize */ michael@0: typedef struct CK_C_INITIALIZE_ARGS { michael@0: CK_CREATEMUTEX CreateMutex; michael@0: CK_DESTROYMUTEX DestroyMutex; michael@0: CK_LOCKMUTEX LockMutex; michael@0: CK_UNLOCKMUTEX UnlockMutex; michael@0: CK_FLAGS flags; michael@0: /* The official PKCS #11 spec does not have a 'LibraryParameters' field, but michael@0: * a reserved field. NSS needs a way to pass instance-specific information michael@0: * to the library (like where to find its config files, etc). This michael@0: * information is usually provided by the installer and passed uninterpreted michael@0: * by NSS to the library, though NSS does know the specifics of the softoken michael@0: * version of this parameter. Most compliant PKCS#11 modules expect this michael@0: * parameter to be NULL, and will return CKR_ARGUMENTS_BAD from michael@0: * C_Initialize if Library parameters is supplied. */ michael@0: CK_CHAR_PTR *LibraryParameters; michael@0: /* This field is only present if the LibraryParameters is not NULL. It must michael@0: * be NULL in all cases */ michael@0: CK_VOID_PTR pReserved; michael@0: } CK_C_INITIALIZE_ARGS; michael@0: michael@0: /* flags: bit flags that provide capabilities of the slot michael@0: * Bit Flag Mask Meaning michael@0: */ michael@0: #define CKF_LIBRARY_CANT_CREATE_OS_THREADS 0x00000001 michael@0: #define CKF_OS_LOCKING_OK 0x00000002 michael@0: michael@0: typedef CK_C_INITIALIZE_ARGS CK_PTR CK_C_INITIALIZE_ARGS_PTR; michael@0: michael@0: michael@0: /* additional flags for parameters to functions */ michael@0: michael@0: /* CKF_DONT_BLOCK is for the function C_WaitForSlotEvent */ michael@0: #define CKF_DONT_BLOCK 1 michael@0: michael@0: /* CK_RSA_PKCS_OAEP_MGF_TYPE is new for v2.10. michael@0: * CK_RSA_PKCS_OAEP_MGF_TYPE is used to indicate the Message michael@0: * Generation Function (MGF) applied to a message block when michael@0: * formatting a message block for the PKCS #1 OAEP encryption michael@0: * scheme. */ michael@0: typedef CK_ULONG CK_RSA_PKCS_MGF_TYPE; michael@0: michael@0: typedef CK_RSA_PKCS_MGF_TYPE CK_PTR CK_RSA_PKCS_MGF_TYPE_PTR; michael@0: michael@0: /* The following MGFs are defined */ michael@0: /* CKG_MGF1_SHA256, CKG_MGF1_SHA384, and CKG_MGF1_SHA512 michael@0: * are new for v2.20 */ michael@0: #define CKG_MGF1_SHA1 0x00000001 michael@0: #define CKG_MGF1_SHA256 0x00000002 michael@0: #define CKG_MGF1_SHA384 0x00000003 michael@0: #define CKG_MGF1_SHA512 0x00000004 michael@0: michael@0: /* v2.20 amendment 3 */ michael@0: #define CKG_MGF1_SHA224 0x00000005 michael@0: michael@0: /* CK_RSA_PKCS_OAEP_SOURCE_TYPE is new for v2.10. michael@0: * CK_RSA_PKCS_OAEP_SOURCE_TYPE is used to indicate the source michael@0: * of the encoding parameter when formatting a message block michael@0: * for the PKCS #1 OAEP encryption scheme. */ michael@0: typedef CK_ULONG CK_RSA_PKCS_OAEP_SOURCE_TYPE; michael@0: michael@0: typedef CK_RSA_PKCS_OAEP_SOURCE_TYPE CK_PTR CK_RSA_PKCS_OAEP_SOURCE_TYPE_PTR; michael@0: michael@0: /* The following encoding parameter sources are defined */ michael@0: #define CKZ_DATA_SPECIFIED 0x00000001 michael@0: michael@0: /* CK_RSA_PKCS_OAEP_PARAMS is new for v2.10. michael@0: * CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the michael@0: * CKM_RSA_PKCS_OAEP mechanism. */ michael@0: typedef struct CK_RSA_PKCS_OAEP_PARAMS { michael@0: CK_MECHANISM_TYPE hashAlg; michael@0: CK_RSA_PKCS_MGF_TYPE mgf; michael@0: CK_RSA_PKCS_OAEP_SOURCE_TYPE source; michael@0: CK_VOID_PTR pSourceData; michael@0: CK_ULONG ulSourceDataLen; michael@0: } CK_RSA_PKCS_OAEP_PARAMS; michael@0: michael@0: typedef CK_RSA_PKCS_OAEP_PARAMS CK_PTR CK_RSA_PKCS_OAEP_PARAMS_PTR; michael@0: michael@0: /* CK_RSA_PKCS_PSS_PARAMS is new for v2.11. michael@0: * CK_RSA_PKCS_PSS_PARAMS provides the parameters to the michael@0: * CKM_RSA_PKCS_PSS mechanism(s). */ michael@0: typedef struct CK_RSA_PKCS_PSS_PARAMS { michael@0: CK_MECHANISM_TYPE hashAlg; michael@0: CK_RSA_PKCS_MGF_TYPE mgf; michael@0: CK_ULONG sLen; michael@0: } CK_RSA_PKCS_PSS_PARAMS; michael@0: michael@0: typedef CK_RSA_PKCS_PSS_PARAMS CK_PTR CK_RSA_PKCS_PSS_PARAMS_PTR; michael@0: michael@0: /* CK_EC_KDF_TYPE is new for v2.11. */ michael@0: typedef CK_ULONG CK_EC_KDF_TYPE; michael@0: michael@0: /* The following EC Key Derivation Functions are defined */ michael@0: #define CKD_NULL 0x00000001 michael@0: #define CKD_SHA1_KDF 0x00000002 michael@0: #define CKD_SHA224_KDF 0x00000005 michael@0: #define CKD_SHA256_KDF 0x00000006 michael@0: #define CKD_SHA384_KDF 0x00000007 michael@0: #define CKD_SHA512_KDF 0x00000008 michael@0: michael@0: /* CK_ECDH1_DERIVE_PARAMS is new for v2.11. michael@0: * CK_ECDH1_DERIVE_PARAMS provides the parameters to the michael@0: * CKM_ECDH1_DERIVE and CKM_ECDH1_COFACTOR_DERIVE mechanisms, michael@0: * where each party contributes one key pair. michael@0: */ michael@0: typedef struct CK_ECDH1_DERIVE_PARAMS { michael@0: CK_EC_KDF_TYPE kdf; michael@0: CK_ULONG ulSharedDataLen; michael@0: CK_BYTE_PTR pSharedData; michael@0: CK_ULONG ulPublicDataLen; michael@0: CK_BYTE_PTR pPublicData; michael@0: } CK_ECDH1_DERIVE_PARAMS; michael@0: michael@0: typedef CK_ECDH1_DERIVE_PARAMS CK_PTR CK_ECDH1_DERIVE_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_ECDH2_DERIVE_PARAMS is new for v2.11. michael@0: * CK_ECDH2_DERIVE_PARAMS provides the parameters to the michael@0: * CKM_ECMQV_DERIVE mechanism, where each party contributes two key pairs. */ michael@0: typedef struct CK_ECDH2_DERIVE_PARAMS { michael@0: CK_EC_KDF_TYPE kdf; michael@0: CK_ULONG ulSharedDataLen; michael@0: CK_BYTE_PTR pSharedData; michael@0: CK_ULONG ulPublicDataLen; michael@0: CK_BYTE_PTR pPublicData; michael@0: CK_ULONG ulPrivateDataLen; michael@0: CK_OBJECT_HANDLE hPrivateData; michael@0: CK_ULONG ulPublicDataLen2; michael@0: CK_BYTE_PTR pPublicData2; michael@0: } CK_ECDH2_DERIVE_PARAMS; michael@0: michael@0: typedef CK_ECDH2_DERIVE_PARAMS CK_PTR CK_ECDH2_DERIVE_PARAMS_PTR; michael@0: michael@0: typedef struct CK_ECMQV_DERIVE_PARAMS { michael@0: CK_EC_KDF_TYPE kdf; michael@0: CK_ULONG ulSharedDataLen; michael@0: CK_BYTE_PTR pSharedData; michael@0: CK_ULONG ulPublicDataLen; michael@0: CK_BYTE_PTR pPublicData; michael@0: CK_ULONG ulPrivateDataLen; michael@0: CK_OBJECT_HANDLE hPrivateData; michael@0: CK_ULONG ulPublicDataLen2; michael@0: CK_BYTE_PTR pPublicData2; michael@0: CK_OBJECT_HANDLE publicKey; michael@0: } CK_ECMQV_DERIVE_PARAMS; michael@0: michael@0: typedef CK_ECMQV_DERIVE_PARAMS CK_PTR CK_ECMQV_DERIVE_PARAMS_PTR; michael@0: michael@0: /* Typedefs and defines for the CKM_X9_42_DH_KEY_PAIR_GEN and the michael@0: * CKM_X9_42_DH_PARAMETER_GEN mechanisms (new for PKCS #11 v2.11) */ michael@0: typedef CK_ULONG CK_X9_42_DH_KDF_TYPE; michael@0: typedef CK_X9_42_DH_KDF_TYPE CK_PTR CK_X9_42_DH_KDF_TYPE_PTR; michael@0: michael@0: /* The following X9.42 DH key derivation functions are defined michael@0: (besides CKD_NULL already defined : */ michael@0: #define CKD_SHA1_KDF_ASN1 0x00000003 michael@0: #define CKD_SHA1_KDF_CONCATENATE 0x00000004 michael@0: michael@0: /* CK_X9_42_DH1_DERIVE_PARAMS is new for v2.11. michael@0: * CK_X9_42_DH1_DERIVE_PARAMS provides the parameters to the michael@0: * CKM_X9_42_DH_DERIVE key derivation mechanism, where each party michael@0: * contributes one key pair */ michael@0: typedef struct CK_X9_42_DH1_DERIVE_PARAMS { michael@0: CK_X9_42_DH_KDF_TYPE kdf; michael@0: CK_ULONG ulOtherInfoLen; michael@0: CK_BYTE_PTR pOtherInfo; michael@0: CK_ULONG ulPublicDataLen; michael@0: CK_BYTE_PTR pPublicData; michael@0: } CK_X9_42_DH1_DERIVE_PARAMS; michael@0: michael@0: typedef struct CK_X9_42_DH1_DERIVE_PARAMS CK_PTR CK_X9_42_DH1_DERIVE_PARAMS_PTR; michael@0: michael@0: /* CK_X9_42_DH2_DERIVE_PARAMS is new for v2.11. michael@0: * CK_X9_42_DH2_DERIVE_PARAMS provides the parameters to the michael@0: * CKM_X9_42_DH_HYBRID_DERIVE and CKM_X9_42_MQV_DERIVE key derivation michael@0: * mechanisms, where each party contributes two key pairs */ michael@0: typedef struct CK_X9_42_DH2_DERIVE_PARAMS { michael@0: CK_X9_42_DH_KDF_TYPE kdf; michael@0: CK_ULONG ulOtherInfoLen; michael@0: CK_BYTE_PTR pOtherInfo; michael@0: CK_ULONG ulPublicDataLen; michael@0: CK_BYTE_PTR pPublicData; michael@0: CK_ULONG ulPrivateDataLen; michael@0: CK_OBJECT_HANDLE hPrivateData; michael@0: CK_ULONG ulPublicDataLen2; michael@0: CK_BYTE_PTR pPublicData2; michael@0: } CK_X9_42_DH2_DERIVE_PARAMS; michael@0: michael@0: typedef CK_X9_42_DH2_DERIVE_PARAMS CK_PTR CK_X9_42_DH2_DERIVE_PARAMS_PTR; michael@0: michael@0: typedef struct CK_X9_42_MQV_DERIVE_PARAMS { michael@0: CK_X9_42_DH_KDF_TYPE kdf; michael@0: CK_ULONG ulOtherInfoLen; michael@0: CK_BYTE_PTR pOtherInfo; michael@0: CK_ULONG ulPublicDataLen; michael@0: CK_BYTE_PTR pPublicData; michael@0: CK_ULONG ulPrivateDataLen; michael@0: CK_OBJECT_HANDLE hPrivateData; michael@0: CK_ULONG ulPublicDataLen2; michael@0: CK_BYTE_PTR pPublicData2; michael@0: CK_OBJECT_HANDLE publicKey; michael@0: } CK_X9_42_MQV_DERIVE_PARAMS; michael@0: michael@0: typedef CK_X9_42_MQV_DERIVE_PARAMS CK_PTR CK_X9_42_MQV_DERIVE_PARAMS_PTR; michael@0: michael@0: /* CK_KEA_DERIVE_PARAMS provides the parameters to the michael@0: * CKM_KEA_DERIVE mechanism */ michael@0: /* CK_KEA_DERIVE_PARAMS is new for v2.0 */ michael@0: typedef struct CK_KEA_DERIVE_PARAMS { michael@0: CK_BBOOL isSender; michael@0: CK_ULONG ulRandomLen; michael@0: CK_BYTE_PTR pRandomA; michael@0: CK_BYTE_PTR pRandomB; michael@0: CK_ULONG ulPublicDataLen; michael@0: CK_BYTE_PTR pPublicData; michael@0: } CK_KEA_DERIVE_PARAMS; michael@0: michael@0: typedef CK_KEA_DERIVE_PARAMS CK_PTR CK_KEA_DERIVE_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_RC2_PARAMS provides the parameters to the CKM_RC2_ECB and michael@0: * CKM_RC2_MAC mechanisms. An instance of CK_RC2_PARAMS just michael@0: * holds the effective keysize */ michael@0: typedef CK_ULONG CK_RC2_PARAMS; michael@0: michael@0: typedef CK_RC2_PARAMS CK_PTR CK_RC2_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_RC2_CBC_PARAMS provides the parameters to the CKM_RC2_CBC michael@0: * mechanism */ michael@0: typedef struct CK_RC2_CBC_PARAMS { michael@0: /* ulEffectiveBits was changed from CK_USHORT to CK_ULONG for michael@0: * v2.0 */ michael@0: CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ michael@0: michael@0: CK_BYTE iv[8]; /* IV for CBC mode */ michael@0: } CK_RC2_CBC_PARAMS; michael@0: michael@0: typedef CK_RC2_CBC_PARAMS CK_PTR CK_RC2_CBC_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_RC2_MAC_GENERAL_PARAMS provides the parameters for the michael@0: * CKM_RC2_MAC_GENERAL mechanism */ michael@0: /* CK_RC2_MAC_GENERAL_PARAMS is new for v2.0 */ michael@0: typedef struct CK_RC2_MAC_GENERAL_PARAMS { michael@0: CK_ULONG ulEffectiveBits; /* effective bits (1-1024) */ michael@0: CK_ULONG ulMacLength; /* Length of MAC in bytes */ michael@0: } CK_RC2_MAC_GENERAL_PARAMS; michael@0: michael@0: typedef CK_RC2_MAC_GENERAL_PARAMS CK_PTR \ michael@0: CK_RC2_MAC_GENERAL_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_RC5_PARAMS provides the parameters to the CKM_RC5_ECB and michael@0: * CKM_RC5_MAC mechanisms */ michael@0: /* CK_RC5_PARAMS is new for v2.0 */ michael@0: typedef struct CK_RC5_PARAMS { michael@0: CK_ULONG ulWordsize; /* wordsize in bits */ michael@0: CK_ULONG ulRounds; /* number of rounds */ michael@0: } CK_RC5_PARAMS; michael@0: michael@0: typedef CK_RC5_PARAMS CK_PTR CK_RC5_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_RC5_CBC_PARAMS provides the parameters to the CKM_RC5_CBC michael@0: * mechanism */ michael@0: /* CK_RC5_CBC_PARAMS is new for v2.0 */ michael@0: typedef struct CK_RC5_CBC_PARAMS { michael@0: CK_ULONG ulWordsize; /* wordsize in bits */ michael@0: CK_ULONG ulRounds; /* number of rounds */ michael@0: CK_BYTE_PTR pIv; /* pointer to IV */ michael@0: CK_ULONG ulIvLen; /* length of IV in bytes */ michael@0: } CK_RC5_CBC_PARAMS; michael@0: michael@0: typedef CK_RC5_CBC_PARAMS CK_PTR CK_RC5_CBC_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_RC5_MAC_GENERAL_PARAMS provides the parameters for the michael@0: * CKM_RC5_MAC_GENERAL mechanism */ michael@0: /* CK_RC5_MAC_GENERAL_PARAMS is new for v2.0 */ michael@0: typedef struct CK_RC5_MAC_GENERAL_PARAMS { michael@0: CK_ULONG ulWordsize; /* wordsize in bits */ michael@0: CK_ULONG ulRounds; /* number of rounds */ michael@0: CK_ULONG ulMacLength; /* Length of MAC in bytes */ michael@0: } CK_RC5_MAC_GENERAL_PARAMS; michael@0: michael@0: typedef CK_RC5_MAC_GENERAL_PARAMS CK_PTR \ michael@0: CK_RC5_MAC_GENERAL_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_MAC_GENERAL_PARAMS provides the parameters to most block michael@0: * ciphers' MAC_GENERAL mechanisms. Its value is the length of michael@0: * the MAC */ michael@0: /* CK_MAC_GENERAL_PARAMS is new for v2.0 */ michael@0: typedef CK_ULONG CK_MAC_GENERAL_PARAMS; michael@0: michael@0: typedef CK_MAC_GENERAL_PARAMS CK_PTR CK_MAC_GENERAL_PARAMS_PTR; michael@0: michael@0: /* CK_DES/AES_ECB/CBC_ENCRYPT_DATA_PARAMS are new for v2.20 */ michael@0: typedef struct CK_DES_CBC_ENCRYPT_DATA_PARAMS { michael@0: CK_BYTE iv[8]; michael@0: CK_BYTE_PTR pData; michael@0: CK_ULONG length; michael@0: } CK_DES_CBC_ENCRYPT_DATA_PARAMS; michael@0: michael@0: typedef CK_DES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR; michael@0: michael@0: typedef struct CK_AES_CBC_ENCRYPT_DATA_PARAMS { michael@0: CK_BYTE iv[16]; michael@0: CK_BYTE_PTR pData; michael@0: CK_ULONG length; michael@0: } CK_AES_CBC_ENCRYPT_DATA_PARAMS; michael@0: michael@0: typedef CK_AES_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR; michael@0: michael@0: /* CK_AES_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */ michael@0: typedef struct CK_AES_CTR_PARAMS { michael@0: CK_ULONG ulCounterBits; michael@0: CK_BYTE cb[16]; michael@0: } CK_AES_CTR_PARAMS; michael@0: michael@0: typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR; michael@0: michael@0: /* CK_GCM_PARAMS is new for version 2.30 */ michael@0: typedef struct CK_GCM_PARAMS { michael@0: CK_BYTE_PTR pIv; michael@0: CK_ULONG ulIvLen; michael@0: CK_BYTE_PTR pAAD; michael@0: CK_ULONG ulAADLen; michael@0: CK_ULONG ulTagBits; michael@0: } CK_GCM_PARAMS; michael@0: michael@0: typedef CK_GCM_PARAMS CK_PTR CK_GCM_PARAMS_PTR; michael@0: michael@0: /* CK_CCM_PARAMS is new for version 2.30 */ michael@0: typedef struct CK_CCM_PARAMS { michael@0: CK_ULONG ulDataLen; michael@0: CK_BYTE_PTR pNonce; michael@0: CK_ULONG ulNonceLen; michael@0: CK_BYTE_PTR pAAD; michael@0: CK_ULONG ulAADLen; michael@0: CK_ULONG ulMACLen; michael@0: } CK_CCM_PARAMS; michael@0: michael@0: typedef CK_CCM_PARAMS CK_PTR CK_CCM_PARAMS_PTR; michael@0: michael@0: /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS provides the parameters to the michael@0: * CKM_SKIPJACK_PRIVATE_WRAP mechanism */ michael@0: /* CK_SKIPJACK_PRIVATE_WRAP_PARAMS is new for v2.0 */ michael@0: typedef struct CK_SKIPJACK_PRIVATE_WRAP_PARAMS { michael@0: CK_ULONG ulPasswordLen; michael@0: CK_BYTE_PTR pPassword; michael@0: CK_ULONG ulPublicDataLen; michael@0: CK_BYTE_PTR pPublicData; michael@0: CK_ULONG ulPAndGLen; michael@0: CK_ULONG ulQLen; michael@0: CK_ULONG ulRandomLen; michael@0: CK_BYTE_PTR pRandomA; michael@0: CK_BYTE_PTR pPrimeP; michael@0: CK_BYTE_PTR pBaseG; michael@0: CK_BYTE_PTR pSubprimeQ; michael@0: } CK_SKIPJACK_PRIVATE_WRAP_PARAMS; michael@0: michael@0: typedef CK_SKIPJACK_PRIVATE_WRAP_PARAMS CK_PTR \ michael@0: CK_SKIPJACK_PRIVATE_WRAP_PTR; michael@0: michael@0: michael@0: /* CK_SKIPJACK_RELAYX_PARAMS provides the parameters to the michael@0: * CKM_SKIPJACK_RELAYX mechanism */ michael@0: /* CK_SKIPJACK_RELAYX_PARAMS is new for v2.0 */ michael@0: typedef struct CK_SKIPJACK_RELAYX_PARAMS { michael@0: CK_ULONG ulOldWrappedXLen; michael@0: CK_BYTE_PTR pOldWrappedX; michael@0: CK_ULONG ulOldPasswordLen; michael@0: CK_BYTE_PTR pOldPassword; michael@0: CK_ULONG ulOldPublicDataLen; michael@0: CK_BYTE_PTR pOldPublicData; michael@0: CK_ULONG ulOldRandomLen; michael@0: CK_BYTE_PTR pOldRandomA; michael@0: CK_ULONG ulNewPasswordLen; michael@0: CK_BYTE_PTR pNewPassword; michael@0: CK_ULONG ulNewPublicDataLen; michael@0: CK_BYTE_PTR pNewPublicData; michael@0: CK_ULONG ulNewRandomLen; michael@0: CK_BYTE_PTR pNewRandomA; michael@0: } CK_SKIPJACK_RELAYX_PARAMS; michael@0: michael@0: typedef CK_SKIPJACK_RELAYX_PARAMS CK_PTR \ michael@0: CK_SKIPJACK_RELAYX_PARAMS_PTR; michael@0: michael@0: michael@0: typedef struct CK_PBE_PARAMS { michael@0: CK_BYTE_PTR pInitVector; michael@0: CK_UTF8CHAR_PTR pPassword; michael@0: CK_ULONG ulPasswordLen; michael@0: CK_BYTE_PTR pSalt; michael@0: CK_ULONG ulSaltLen; michael@0: CK_ULONG ulIteration; michael@0: } CK_PBE_PARAMS; michael@0: michael@0: typedef CK_PBE_PARAMS CK_PTR CK_PBE_PARAMS_PTR; michael@0: michael@0: michael@0: /* CK_KEY_WRAP_SET_OAEP_PARAMS provides the parameters to the michael@0: * CKM_KEY_WRAP_SET_OAEP mechanism */ michael@0: /* CK_KEY_WRAP_SET_OAEP_PARAMS is new for v2.0 */ michael@0: typedef struct CK_KEY_WRAP_SET_OAEP_PARAMS { michael@0: CK_BYTE bBC; /* block contents byte */ michael@0: CK_BYTE_PTR pX; /* extra data */ michael@0: CK_ULONG ulXLen; /* length of extra data in bytes */ michael@0: } CK_KEY_WRAP_SET_OAEP_PARAMS; michael@0: michael@0: typedef CK_KEY_WRAP_SET_OAEP_PARAMS CK_PTR \ michael@0: CK_KEY_WRAP_SET_OAEP_PARAMS_PTR; michael@0: michael@0: michael@0: typedef struct CK_SSL3_RANDOM_DATA { michael@0: CK_BYTE_PTR pClientRandom; michael@0: CK_ULONG ulClientRandomLen; michael@0: CK_BYTE_PTR pServerRandom; michael@0: CK_ULONG ulServerRandomLen; michael@0: } CK_SSL3_RANDOM_DATA; michael@0: michael@0: michael@0: typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS { michael@0: CK_SSL3_RANDOM_DATA RandomInfo; michael@0: CK_VERSION_PTR pVersion; michael@0: } CK_SSL3_MASTER_KEY_DERIVE_PARAMS; michael@0: michael@0: typedef struct CK_SSL3_MASTER_KEY_DERIVE_PARAMS CK_PTR \ michael@0: CK_SSL3_MASTER_KEY_DERIVE_PARAMS_PTR; michael@0: michael@0: michael@0: typedef struct CK_SSL3_KEY_MAT_OUT { michael@0: CK_OBJECT_HANDLE hClientMacSecret; michael@0: CK_OBJECT_HANDLE hServerMacSecret; michael@0: CK_OBJECT_HANDLE hClientKey; michael@0: CK_OBJECT_HANDLE hServerKey; michael@0: CK_BYTE_PTR pIVClient; michael@0: CK_BYTE_PTR pIVServer; michael@0: } CK_SSL3_KEY_MAT_OUT; michael@0: michael@0: typedef CK_SSL3_KEY_MAT_OUT CK_PTR CK_SSL3_KEY_MAT_OUT_PTR; michael@0: michael@0: michael@0: typedef struct CK_SSL3_KEY_MAT_PARAMS { michael@0: CK_ULONG ulMacSizeInBits; michael@0: CK_ULONG ulKeySizeInBits; michael@0: CK_ULONG ulIVSizeInBits; michael@0: CK_BBOOL bIsExport; michael@0: CK_SSL3_RANDOM_DATA RandomInfo; michael@0: CK_SSL3_KEY_MAT_OUT_PTR pReturnedKeyMaterial; michael@0: } CK_SSL3_KEY_MAT_PARAMS; michael@0: michael@0: typedef CK_SSL3_KEY_MAT_PARAMS CK_PTR CK_SSL3_KEY_MAT_PARAMS_PTR; michael@0: michael@0: /* CK_TLS_PRF_PARAMS is new for version 2.20 */ michael@0: typedef struct CK_TLS_PRF_PARAMS { michael@0: CK_BYTE_PTR pSeed; michael@0: CK_ULONG ulSeedLen; michael@0: CK_BYTE_PTR pLabel; michael@0: CK_ULONG ulLabelLen; michael@0: CK_BYTE_PTR pOutput; michael@0: CK_ULONG_PTR pulOutputLen; michael@0: } CK_TLS_PRF_PARAMS; michael@0: michael@0: typedef CK_TLS_PRF_PARAMS CK_PTR CK_TLS_PRF_PARAMS_PTR; michael@0: michael@0: /* WTLS is new for version 2.20 */ michael@0: typedef struct CK_WTLS_RANDOM_DATA { michael@0: CK_BYTE_PTR pClientRandom; michael@0: CK_ULONG ulClientRandomLen; michael@0: CK_BYTE_PTR pServerRandom; michael@0: CK_ULONG ulServerRandomLen; michael@0: } CK_WTLS_RANDOM_DATA; michael@0: michael@0: typedef CK_WTLS_RANDOM_DATA CK_PTR CK_WTLS_RANDOM_DATA_PTR; michael@0: michael@0: typedef struct CK_WTLS_MASTER_KEY_DERIVE_PARAMS { michael@0: CK_MECHANISM_TYPE DigestMechanism; michael@0: CK_WTLS_RANDOM_DATA RandomInfo; michael@0: CK_BYTE_PTR pVersion; michael@0: } CK_WTLS_MASTER_KEY_DERIVE_PARAMS; michael@0: michael@0: typedef CK_WTLS_MASTER_KEY_DERIVE_PARAMS CK_PTR \ michael@0: CK_WTLS_MASTER_KEY_DERIVE_PARAMS_PTR; michael@0: michael@0: typedef struct CK_WTLS_PRF_PARAMS { michael@0: CK_MECHANISM_TYPE DigestMechanism; michael@0: CK_BYTE_PTR pSeed; michael@0: CK_ULONG ulSeedLen; michael@0: CK_BYTE_PTR pLabel; michael@0: CK_ULONG ulLabelLen; michael@0: CK_BYTE_PTR pOutput; michael@0: CK_ULONG_PTR pulOutputLen; michael@0: } CK_WTLS_PRF_PARAMS; michael@0: michael@0: typedef CK_WTLS_PRF_PARAMS CK_PTR CK_WTLS_PRF_PARAMS_PTR; michael@0: michael@0: typedef struct CK_WTLS_KEY_MAT_OUT { michael@0: CK_OBJECT_HANDLE hMacSecret; michael@0: CK_OBJECT_HANDLE hKey; michael@0: CK_BYTE_PTR pIV; michael@0: } CK_WTLS_KEY_MAT_OUT; michael@0: michael@0: typedef CK_WTLS_KEY_MAT_OUT CK_PTR CK_WTLS_KEY_MAT_OUT_PTR; michael@0: michael@0: typedef struct CK_WTLS_KEY_MAT_PARAMS { michael@0: CK_MECHANISM_TYPE DigestMechanism; michael@0: CK_ULONG ulMacSizeInBits; michael@0: CK_ULONG ulKeySizeInBits; michael@0: CK_ULONG ulIVSizeInBits; michael@0: CK_ULONG ulSequenceNumber; michael@0: CK_BBOOL bIsExport; michael@0: CK_WTLS_RANDOM_DATA RandomInfo; michael@0: CK_WTLS_KEY_MAT_OUT_PTR pReturnedKeyMaterial; michael@0: } CK_WTLS_KEY_MAT_PARAMS; michael@0: michael@0: typedef CK_WTLS_KEY_MAT_PARAMS CK_PTR CK_WTLS_KEY_MAT_PARAMS_PTR; michael@0: michael@0: /* CMS is new for version 2.20 */ michael@0: typedef struct CK_CMS_SIG_PARAMS { michael@0: CK_OBJECT_HANDLE certificateHandle; michael@0: CK_MECHANISM_PTR pSigningMechanism; michael@0: CK_MECHANISM_PTR pDigestMechanism; michael@0: CK_UTF8CHAR_PTR pContentType; michael@0: CK_BYTE_PTR pRequestedAttributes; michael@0: CK_ULONG ulRequestedAttributesLen; michael@0: CK_BYTE_PTR pRequiredAttributes; michael@0: CK_ULONG ulRequiredAttributesLen; michael@0: } CK_CMS_SIG_PARAMS; michael@0: michael@0: typedef CK_CMS_SIG_PARAMS CK_PTR CK_CMS_SIG_PARAMS_PTR; michael@0: michael@0: typedef struct CK_KEY_DERIVATION_STRING_DATA { michael@0: CK_BYTE_PTR pData; michael@0: CK_ULONG ulLen; michael@0: } CK_KEY_DERIVATION_STRING_DATA; michael@0: michael@0: typedef CK_KEY_DERIVATION_STRING_DATA CK_PTR \ michael@0: CK_KEY_DERIVATION_STRING_DATA_PTR; michael@0: michael@0: michael@0: /* The CK_EXTRACT_PARAMS is used for the michael@0: * CKM_EXTRACT_KEY_FROM_KEY mechanism. It specifies which bit michael@0: * of the base key should be used as the first bit of the michael@0: * derived key */ michael@0: /* CK_EXTRACT_PARAMS is new for v2.0 */ michael@0: typedef CK_ULONG CK_EXTRACT_PARAMS; michael@0: michael@0: typedef CK_EXTRACT_PARAMS CK_PTR CK_EXTRACT_PARAMS_PTR; michael@0: michael@0: /* CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is new for v2.10. michael@0: * CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE is used to michael@0: * indicate the Pseudo-Random Function (PRF) used to generate michael@0: * key bits using PKCS #5 PBKDF2. */ michael@0: typedef CK_ULONG CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE; michael@0: michael@0: typedef CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE CK_PTR CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE_PTR; michael@0: michael@0: /* The following PRFs are defined in PKCS #5 v2.0. */ michael@0: #define CKP_PKCS5_PBKD2_HMAC_SHA1 0x00000001 michael@0: michael@0: michael@0: /* CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is new for v2.10. michael@0: * CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE is used to indicate the michael@0: * source of the salt value when deriving a key using PKCS #5 michael@0: * PBKDF2. */ michael@0: typedef CK_ULONG CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE; michael@0: michael@0: typedef CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE CK_PTR CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE_PTR; michael@0: michael@0: /* The following salt value sources are defined in PKCS #5 v2.0. */ michael@0: #define CKZ_SALT_SPECIFIED 0x00000001 michael@0: michael@0: /* CK_PKCS5_PBKD2_PARAMS is new for v2.10. michael@0: * CK_PKCS5_PBKD2_PARAMS is a structure that provides the michael@0: * parameters to the CKM_PKCS5_PBKD2 mechanism. */ michael@0: typedef struct CK_PKCS5_PBKD2_PARAMS { michael@0: CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource; michael@0: CK_VOID_PTR pSaltSourceData; michael@0: CK_ULONG ulSaltSourceDataLen; michael@0: CK_ULONG iterations; michael@0: CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf; michael@0: CK_VOID_PTR pPrfData; michael@0: CK_ULONG ulPrfDataLen; michael@0: CK_UTF8CHAR_PTR pPassword; michael@0: CK_ULONG_PTR ulPasswordLen; michael@0: } CK_PKCS5_PBKD2_PARAMS; michael@0: michael@0: typedef CK_PKCS5_PBKD2_PARAMS CK_PTR CK_PKCS5_PBKD2_PARAMS_PTR; michael@0: michael@0: /* NSS Specific defines */ michael@0: michael@0: /* defines that have been deprecated in 2.20, but maintained in our michael@0: * header file for backward compatibility */ michael@0: #define CKO_KG_PARAMETERS CKO_DOMAIN_PARAMETERS michael@0: #define CKF_EC_FP CKF_EC_F_P michael@0: /* new in v2.11 deprecated by 2.20 */ michael@0: #define CKR_KEY_PARAMS_INVALID 0x0000006B michael@0: michael@0: /* stuff that for historic reasons is in this header file but should have michael@0: * been in pkcs11n.h */ michael@0: #define CKK_INVALID_KEY_TYPE 0xffffffff michael@0: michael@0: #include "pkcs11n.h" michael@0: michael@0: /* undo packing */ michael@0: #include "pkcs11u.h" michael@0: michael@0: #endif