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