ECIES general
EC IES mechanism (X9.63)
#define CKM_ECIES (CKM_VENDOR_DEFINED + 0xA00)
#define CKM_XOR_BASE_AND_DATA_W_KDF (CKM_VENDOR_DEFINED + 0xA01)
#define CKM_NIST_PRF_KDF (CKM_VENDOR_DEFINED + 0xA02)
#define CKM_PRF_KDF (CKM_VENDOR_DEFINED + 0xA03)
#define CKM_AES_XTS_OLD (CKM_VENDOR_DEFINED + 0xA04)
Mechanism parameters for CKM_ECIES.
EC Diffie-Hellman (DH) primitive to use for shared secret derivation
typedef CK_ULONG CK_EC_DH_PRIMITIVE;
EC DH primitives
#define CKDHP_STANDARD 0x00000001
#define CKDHP_ECDH1_COFACTOR 0x00000001
#define CKDHP_MODIFIED 0x00000002 /* Not implemented */
#define CKDHP_ECDH1 0x00000003
Inner encryption scheme to use for ECIES
typedef CK_ULONG CK_EC_ENC_SCHEME;
Inner encryption schemes
#define CKES_XOR 0x00000001
#define CKES_DES3_CBC_PAD 0x00000002
#define CKES_AES_CBC_PAD 0x00000003
#define CKES_DES3_CBC 0x00000004
#define CKES_AES_CBC 0x00000005
#define CKES_AES_CTR 0x00000006
#define CKES_AES_GCM 0x00000007
#define CKES_AES_KW 0x00000008
#define CKES_AES_KWP 0x00000009
Message Authentication Code (MAC) scheme to use for ECIES */
typedef CK_ULONG CK_EC_MAC_SCHEME;
MAC schemes
#define CKMS_HMAC_SHA1 0x00000001
#define CKMS_SHA1 0x00000002
#define CKMS_HMAC_SHA224 0x00000003
#define CKMS_SHA224 0x00000004
#define CKMS_HMAC_SHA256 0x00000005
#define CKMS_SHA256 0x00000006
#define CKMS_HMAC_SHA384 0x00000007
#define CKMS_SHA384 0x00000008
#define CKMS_HMAC_SHA512 0x00000009
#define CKMS_SHA512 0x0000000a
#define CKMS_HMAC_RIPEMD160 0x0000000b
#define CKMS_RIPEMD160 0x0000000c
Mechanism parameter structure for ECIES
typedef struct CK_ECIES_PARAMS
{
Diffie-Hellman primitive used to derive the shared secret value
CK_EC_DH_PRIMITIVE dhPrimitive;
Key derivation function used on the shared secret value
CK_EC_KDF_TYPE kdf;
The length in bytes of the key derivation shared data
CK_ULONG ulSharedDataLen1;
The key derivation padding data shared between the two parties
CK_BYTE_PTR pSharedData1;
The encryption scheme used to transform the input data
CK_EC_ENC_SCHEME encScheme;
The bit length of the key to use for the encryption scheme
CK_ULONG ulEncKeyLenInBits;
The MAC scheme used for MAC generation or validation
CK_EC_MAC_SCHEME macScheme;
The bit length of the key to use for the MAC scheme
CK_ULONG ulMacKeyLenInBits;
The bit length of the MAC scheme output
CK_ULONG ulMacLenInBits;
The length in bytes of the MAC shared data
CK_ULONG ulSharedDataLen2;
The MAC padding data shared between the two parties
CK_BYTE_PTR pSharedData2;
} CK_ECIES_PARAMS;
typedef CK_ECIES_PARAMS CK_PTR CK_ECIES_PARAMS_PTR;
typedef struct CK_ECIES_PARAMS_EXT
{
Legacy ECIES parameters
CK_ECIES_PARAMS eciesParams;
Reference encryption scheme structure extension
CK_VOID_PTR pEncSchemeMechanismParameter;
Length encryption scheme structure extension
CK_ULONG ulEncSchemeMechanismParameterLen;
} CK_ECIES_PARAMS_EXT;
typedef CK_ECIES_PARAMS_EXT CK_PTR CK_ECIES_PARAMS_EXT_PTR;
typedef struct CK_ECIES_PARAMS_EXT2
{
Legacy ECIES parameters
CK_ECIES_PARAMS eciesParams;
Reference encryption scheme structure extension
CK_VOID_PTR pEncSchemeMechanismParameter;
Length encryption scheme structure extension
CK_ULONG ulEncSchemeMechanismParameterLen;
Flags for KDF additional shared data (sharedData1)
0 = no addition to shared data
1 = shared data | ephemeral public key
2 = shared data | compressed ephemeral public key
3 = ephemeral public key | shared data
4 = compressed ephemeral public key | shared data
CK_ULONG ulKDFSharedDataFlags;
} CK_ECIES_PARAMS_EXT2;
typedef CK_ECIES_PARAMS_EXT2 CK_PTR CK_ECIES_PARAMS_EXT2_PTR;
Parameter and values used with CKM_PRF_KDF and CKM_NIST_PRF_KDF
typedef CK_ULONG CK_KDF_PRF_TYPE;
typedef CK_ULONG CK_KDF_PRF_ENCODING_SCHEME;
Pseudorandom Function(PRF) Key Derivation Function (KDF) schemes
#define CK_NIST_PRF_KDF_DES3_CMAC 0x00000001
#define CK_NIST_PRF_KDF_AES_CMAC 0x00000002
#define CK_PRF_KDF_ARIA_CMAC 0x00000003
#define CK_PRF_KDF_SEED_CMAC 0x00000004
#define CK_NIST_PRF_KDF_HMAC_SHA1 0x00000005
#define CK_NIST_PRF_KDF_HMAC_SHA224 0x00000006
#define CK_NIST_PRF_KDF_HMAC_SHA256 0x00000007
#define CK_NIST_PRF_KDF_HMAC_SHA384 0x00000008
#define CK_NIST_PRF_KDF_HMAC_SHA512 0x00000009
#define CK_PRF_KDF_HMAC_RIPEMD160 0x0000000A
#define CK_NIST_PRF_KDF_HMAC_SHA3_224 0x0000000B
#define CK_NIST_PRF_KDF_HMAC_SHA3_256 0x0000000C
#define CK_NIST_PRF_KDF_HMAC_SHA3_384 0x0000000D
#define CK_NIST_PRF_KDF_HMAC_SHA3_512 0x0000000E
Mask Generation Function MGF SHA3
#define CKG_MGF1_SHA3_224 0x80000006
#define CKG_MGF1_SHA3_256 0x80000007
#define CKG_MGF1_SHA3_384 0x80000008
#define CKG_MGF1_SHA3_512 0x80000009
Affects the format of the fixed data passed to the PRF.
Scheme #3 is the one described in NIST SP 800-108.
#define LUNA_PRF_KDF_ENCODING_SCHEME_1 0x00000000 // Context || 0x00 || Label || Length
#define LUNA_PRF_KDF_ENCODING_SCHEME_2 0x00000001 // Context || Label
#define LUNA_PRF_KDF_ENCODING_SCHEME_3 0x00000002 // Label || 0x00 || Context || Length
#define LUNA_PRF_KDF_ENCODING_SCHEME_4 0x00000003 // Label || Context
#define LUNA_PRF_KDF_ENCODING_SCHEME_SCP03 0x00000004
#define LUNA_PRF_KDF_ENCODING_SCHEME_HID_KD 0x00000005
typedef struct CK_KDF_PRF_PARAMS {
CK_KDF_PRF_TYPE prfType;
CK_BYTE_PTR pLabel;
CK_ULONG ulLabelLen;
CK_BYTE_PTR pContext;
CK_ULONG ulContextLen;
CK_ULONG ulCounter;
CK_KDF_PRF_ENCODING_SCHEME ulEncodingScheme;
} CK_PRF_KDF_PARAMS;
typedef CK_PRF_KDF_PARAMS CK_PTR CK_KDF_PRF_PARAMS_PTR;