Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/qat/qat_api/common/crypto/sym/include/lac_sym_cipher_defs.h
Show All 39 Lines | |||||
*/ | */ | ||||
/* ARC4 algorithm block size */ | /* ARC4 algorithm block size */ | ||||
#define LAC_CIPHER_ARC4_BLOCK_LEN_BYTES 8 | #define LAC_CIPHER_ARC4_BLOCK_LEN_BYTES 8 | ||||
/* ARC4 key matrix size (bytes) */ | /* ARC4 key matrix size (bytes) */ | ||||
#define LAC_CIPHER_ARC4_KEY_MATRIX_LEN_BYTES 256 | #define LAC_CIPHER_ARC4_KEY_MATRIX_LEN_BYTES 256 | ||||
/* ARC4 256 bytes for key matrix, 2 for i and j and 6 bytes for padding */ | /* ARC4 256 bytes for key matrix, 2 for i and j and 6 bytes for padding */ | ||||
#define LAC_CIPHER_ARC4_STATE_LEN_BYTES 264 | #define LAC_CIPHER_ARC4_STATE_LEN_BYTES 264 | ||||
/* | |||||
* Constant values for CCM AAD buffer | |||||
*/ | |||||
#define LAC_CIPHER_CCM_B0_SIZE 16 | |||||
#define LAC_CIPHER_CCM_ENCODED_AAD_LEN_SIZE 2 | |||||
#define LAC_CIPHER_CCM_AAD_OFFSET \ | |||||
(LAC_CIPHER_CCM_B0_SIZE + LAC_CIPHER_CCM_ENCODED_AAD_LEN_SIZE) | |||||
#define LAC_SYM_SNOW3G_CIPHER_CONFIG_FOR_HASH_SZ 40 | #define LAC_SYM_SNOW3G_CIPHER_CONFIG_FOR_HASH_SZ 40 | ||||
/* Snow3g cipher config required for performing a Snow3g hash operation. | /* Snow3g cipher config required for performing a Snow3g hash operation. | ||||
* It contains 8 Bytes of config for hardware, 16 Bytes of Key and requires | * It contains 8 Bytes of config for hardware, 16 Bytes of Key and requires | ||||
* 16 Bytes for the IV. | * 16 Bytes for the IV. | ||||
*/ | */ | ||||
/* Key Modifier (KM) 4 bytes used in Kasumi algorithm in F8 mode to XOR | /* Key Modifier (KM) 4 bytes used in Kasumi algorithm in F8 mode to XOR | ||||
* Cipher Key (CK) */ | * Cipher Key (CK) */ | ||||
#define LAC_CIPHER_KASUMI_F8_KEY_MODIFIER_4_BYTES 0x55555555 | #define LAC_CIPHER_KASUMI_F8_KEY_MODIFIER_4_BYTES 0x55555555 | ||||
/* The IV length for Kasumi Kgcore is 8 bytes */ | /* The IV length for Kasumi Kgcore is 8 bytes */ | ||||
#define LAC_CIPHER_KASUMI_F8_IV_LENGTH 8 | #define LAC_CIPHER_KASUMI_F8_IV_LENGTH 8 | ||||
/* The Counter length for Kasumi Kgcore is 8 bytes */ | /* The Counter length for Kasumi Kgcore is 8 bytes */ | ||||
#define LAC_CIPHER_KASUMI_F8_COUNTER_LENGTH 8 | #define LAC_CIPHER_KASUMI_F8_COUNTER_LENGTH 8 | ||||
/* The IV length for AES F8 is 16 bytes */ | /* The IV length for AES F8 is 16 bytes */ | ||||
#define LAC_CIPHER_AES_F8_IV_LENGTH 16 | #define LAC_CIPHER_AES_F8_IV_LENGTH 16 | ||||
/* The max key length for AES XTS 32 is bytes*/ | |||||
#define LAC_CIPHER_AES_XTS_KEY_MAX_LENGTH 32 | |||||
/* For Snow3G UEA2, need to make sure last 8 Bytes of IV buffer are | /* For Snow3G UEA2, need to make sure last 8 Bytes of IV buffer are | ||||
* zero. */ | * zero. */ | ||||
#define LAC_CIPHER_SNOW3G_UEA2_IV_BUFFER_ZERO_LENGTH 8 | #define LAC_CIPHER_SNOW3G_UEA2_IV_BUFFER_ZERO_LENGTH 8 | ||||
/* Reserve enough space for max length cipher state | /* Reserve enough space for max length cipher state | ||||
* (can be IV , counter or ARC4 state) */ | * (can be IV , counter or ARC4 state) */ | ||||
#define LAC_CIPHER_STATE_SIZE_MAX LAC_CIPHER_ARC4_STATE_LEN_BYTES | #define LAC_CIPHER_STATE_SIZE_MAX LAC_CIPHER_ARC4_STATE_LEN_BYTES | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
#define LAC_CIPHER_IS_GCM(algo) (algo == CPA_CY_SYM_CIPHER_AES_GCM) | #define LAC_CIPHER_IS_GCM(algo) (algo == CPA_CY_SYM_CIPHER_AES_GCM) | ||||
/* Macro to check if the Algorithm is AES-F8 */ | /* Macro to check if the Algorithm is AES-F8 */ | ||||
#define LAC_CIPHER_IS_AES_F8(algo) (algo == CPA_CY_SYM_CIPHER_AES_F8) | #define LAC_CIPHER_IS_AES_F8(algo) (algo == CPA_CY_SYM_CIPHER_AES_F8) | ||||
/* Macro to check if the Algorithm Mode is XTS */ | /* Macro to check if the Algorithm Mode is XTS */ | ||||
#define LAC_CIPHER_IS_XTS_MODE(algo) (algo == CPA_CY_SYM_CIPHER_AES_XTS) | #define LAC_CIPHER_IS_XTS_MODE(algo) (algo == CPA_CY_SYM_CIPHER_AES_XTS) | ||||
/* Macro to check if the accelerator has AES V2 capability */ | |||||
#define LAC_CIPHER_AES_V2(mask) ((mask)&ICP_ACCEL_CAPABILITIES_AES_V2) | |||||
/* Macro to check if the Algorithm is single pass */ | /* Macro to check if the Algorithm is single pass */ | ||||
#define LAC_CIPHER_IS_SPC(cipher, hash, mask) \ | #define LAC_CIPHER_IS_SPC(cipher, hash, mask) \ | ||||
((LAC_CIPHER_IS_CHACHA(cipher) && (CPA_CY_SYM_HASH_POLY == hash) && \ | (((mask)&ICP_ACCEL_CAPABILITIES_CHACHA_POLY && \ | ||||
((mask)&ICP_ACCEL_CAPABILITIES_CHACHA_POLY)) || \ | LAC_CIPHER_IS_CHACHA(cipher) && (CPA_CY_SYM_HASH_POLY == hash)) || \ | ||||
(LAC_CIPHER_IS_GCM(cipher) && ((CPA_CY_SYM_HASH_AES_GCM == hash) || \ | (((mask)&ICP_ACCEL_CAPABILITIES_AESGCM_SPC) && \ | ||||
(CPA_CY_SYM_HASH_AES_GMAC == hash)) && \ | LAC_CIPHER_IS_GCM(cipher) && \ | ||||
((mask)&ICP_ACCEL_CAPABILITIES_AESGCM_SPC))) | ((CPA_CY_SYM_HASH_AES_GCM == hash) || \ | ||||
(CPA_CY_SYM_HASH_AES_GMAC == hash))) || \ | |||||
(LAC_CIPHER_IS_CCM(cipher) && LAC_CIPHER_AES_V2(mask))) | |||||
#endif /* LAC_CIPHER_DEFS_H */ | #endif /* LAC_CIPHER_DEFS_H */ |