Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/qat/qat_api/common/ctrl/sal_crypto.c
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
#include "lac_sal_ctrl.h" | #include "lac_sal_ctrl.h" | ||||
#include "sal_string_parse.h" | #include "sal_string_parse.h" | ||||
#include "sal_service_state.h" | #include "sal_service_state.h" | ||||
#include "icp_sal_poll.h" | #include "icp_sal_poll.h" | ||||
#include "lac_sync.h" | #include "lac_sync.h" | ||||
#include "lac_sym_qat.h" | #include "lac_sym_qat.h" | ||||
#include "icp_sal_versions.h" | #include "icp_sal_versions.h" | ||||
#include "icp_sal_user.h" | #include "icp_sal_user.h" | ||||
#include "sal_hw_gen.h" | |||||
#define HMAC_MODE_1 1 | |||||
#define HMAC_MODE_2 2 | |||||
#define TH_CY_RX_0 0 | #define TH_CY_RX_0 0 | ||||
#define TH_CY_RX_1 1 | #define TH_CY_RX_1 1 | ||||
#define MAX_CY_RX_RINGS 2 | #define MAX_CY_RX_RINGS 2 | ||||
#define DOUBLE_INCR 2 | #define DOUBLE_INCR 2 | ||||
#define TH_SINGLE_RX 0 | #define TH_SINGLE_RX 0 | ||||
#define NUM_CRYPTO_SYM_RX_RINGS 1 | #define NUM_CRYPTO_SYM_RX_RINGS 1 | ||||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | SalCtrl_SymCreateTransHandle(icp_accel_dev_t *device, | ||||
LAC_CHECK_STATUS_SYM_INIT(status); | LAC_CHECK_STATUS_SYM_INIT(status); | ||||
msgSize = LAC_QAT_SYM_REQ_SZ_LW * LAC_LONG_WORD_IN_BYTES; | msgSize = LAC_QAT_SYM_REQ_SZ_LW * LAC_LONG_WORD_IN_BYTES; | ||||
status = | status = | ||||
icp_adf_transCreateHandle(device, | icp_adf_transCreateHandle(device, | ||||
ICP_TRANS_TYPE_ETR, | ICP_TRANS_TYPE_ETR, | ||||
section, | section, | ||||
pCryptoService->acceleratorNum, | pCryptoService->acceleratorNum, | ||||
pCryptoService->bankNum, | pCryptoService->bankNumSym, | ||||
temp_string, | temp_string, | ||||
lac_getRingType(SAL_RING_TYPE_A_SYM_HI), | lac_getRingType(SAL_RING_TYPE_A_SYM_HI), | ||||
NULL, | NULL, | ||||
ICP_RESP_TYPE_NONE, | ICP_RESP_TYPE_NONE, | ||||
numSymRequests, | numSymRequests, | ||||
msgSize, | msgSize, | ||||
(icp_comms_trans_handle *)&( | (icp_comms_trans_handle *)&( | ||||
pCryptoService->trans_handle_sym_tx)); | pCryptoService->trans_handle_sym_tx)); | ||||
LAC_CHECK_STATUS_SYM_INIT(status); | LAC_CHECK_STATUS_SYM_INIT(status); | ||||
status = | status = | ||||
Sal_StringParsing("Cy", | Sal_StringParsing("Cy", | ||||
pCryptoService->generic_service_info.instance, | pCryptoService->generic_service_info.instance, | ||||
"RingSymRx", | "RingSymRx", | ||||
temp_string); | temp_string); | ||||
LAC_CHECK_STATUS_SYM_INIT(status); | LAC_CHECK_STATUS_SYM_INIT(status); | ||||
msgSize = LAC_QAT_SYM_RESP_SZ_LW * LAC_LONG_WORD_IN_BYTES; | msgSize = LAC_QAT_SYM_RESP_SZ_LW * LAC_LONG_WORD_IN_BYTES; | ||||
status = icp_adf_transCreateHandle( | status = icp_adf_transCreateHandle( | ||||
device, | device, | ||||
ICP_TRANS_TYPE_ETR, | ICP_TRANS_TYPE_ETR, | ||||
section, | section, | ||||
pCryptoService->acceleratorNum, | pCryptoService->acceleratorNum, | ||||
pCryptoService->bankNum, | pCryptoService->bankNumSym, | ||||
temp_string, | temp_string, | ||||
lac_getRingType(SAL_RING_TYPE_NONE), | lac_getRingType(SAL_RING_TYPE_NONE), | ||||
(icp_trans_callback)LacSymQat_SymRespHandler, | (icp_trans_callback)LacSymQat_SymRespHandler, | ||||
rx_resp_type, | rx_resp_type, | ||||
numSymRequests, | numSymRequests, | ||||
msgSize, | msgSize, | ||||
(icp_comms_trans_handle *)&(pCryptoService->trans_handle_sym_rx)); | (icp_comms_trans_handle *)&(pCryptoService->trans_handle_sym_rx)); | ||||
LAC_CHECK_STATUS_SYM_INIT(status); | LAC_CHECK_STATUS_SYM_INIT(status); | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | SalCtrl_CryptoDebug(void *private_data, char *data, int size, int offset) | ||||
return ++offset; | return ++offset; | ||||
} | } | ||||
static CpaStatus | static CpaStatus | ||||
SalCtrl_SymInit(icp_accel_dev_t *device, sal_service_t *service) | SalCtrl_SymInit(icp_accel_dev_t *device, sal_service_t *service) | ||||
{ | { | ||||
CpaStatus status = CPA_STATUS_SUCCESS; | CpaStatus status = CPA_STATUS_SUCCESS; | ||||
Cpa32U qatHmacMode = 0; | |||||
Cpa32U numSymConcurrentReq = 0; | Cpa32U numSymConcurrentReq = 0; | ||||
char adfGetParam[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | char adfGetParam[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | ||||
char temp_string[SAL_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | char temp_string[SAL_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | ||||
sal_crypto_service_t *pCryptoService = (sal_crypto_service_t *)service; | sal_crypto_service_t *pCryptoService = (sal_crypto_service_t *)service; | ||||
char *section = DYN_SEC; | char *section = DYN_SEC; | ||||
/*Instance may not in the DYN section*/ | /*Instance may not in the DYN section*/ | ||||
if (CPA_FALSE == pCryptoService->generic_service_info.is_dyn) { | if (CPA_FALSE == pCryptoService->generic_service_info.is_dyn) { | ||||
section = icpGetProcessName(); | section = icpGetProcessName(); | ||||
} | } | ||||
/* Register callbacks for the symmetric services | /* Register callbacks for the symmetric services | ||||
* (Hash, Cipher, Algorithm-Chaining) (returns void)*/ | * (Hash, Cipher, Algorithm-Chaining) (returns void)*/ | ||||
LacSymCb_CallbacksRegister(); | LacSymCb_CallbacksRegister(); | ||||
qatHmacMode = (Cpa32U)Sal_Strtoul(adfGetParam, NULL, SAL_CFG_BASE_DEC); | |||||
switch (qatHmacMode) { | |||||
case HMAC_MODE_1: | |||||
pCryptoService->qatHmacMode = ICP_QAT_HW_AUTH_MODE1; | |||||
break; | |||||
case HMAC_MODE_2: | |||||
pCryptoService->qatHmacMode = ICP_QAT_HW_AUTH_MODE2; | |||||
break; | |||||
default: | |||||
pCryptoService->qatHmacMode = ICP_QAT_HW_AUTH_MODE1; | |||||
break; | |||||
} | |||||
/* Get num concurrent requests from config file */ | /* Get num concurrent requests from config file */ | ||||
status = | status = | ||||
Sal_StringParsing("Cy", | Sal_StringParsing("Cy", | ||||
pCryptoService->generic_service_info.instance, | pCryptoService->generic_service_info.instance, | ||||
"NumConcurrentSymRequests", | "NumConcurrentSymRequests", | ||||
temp_string); | temp_string); | ||||
LAC_CHECK_STATUS(status); | LAC_CHECK_STATUS(status); | ||||
status = | status = | ||||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Lines | if (CPA_TRUE == pStatsCollection->bStatsEnabled) { | ||||
} | } | ||||
} | } | ||||
pCryptoService->generic_service_info.stats = pStatsCollection; | pCryptoService->generic_service_info.stats = pStatsCollection; | ||||
return status; | return status; | ||||
} | } | ||||
static CpaStatus | static CpaStatus | ||||
SalCtrl_GetBankNum(icp_accel_dev_t *device, | |||||
Cpa32U inst, | |||||
char *section, | |||||
char *bank_name, | |||||
Cpa16U *bank) | |||||
{ | |||||
char adfParamValue[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | |||||
char adfParamName[SAL_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | |||||
CpaStatus status = CPA_STATUS_SUCCESS; | |||||
status = Sal_StringParsing("Cy", inst, bank_name, adfParamName); | |||||
LAC_CHECK_STATUS(status); | |||||
status = icp_adf_cfgGetParamValue(device, | |||||
section, | |||||
adfParamName, | |||||
adfParamValue); | |||||
if (CPA_STATUS_SUCCESS != status) { | |||||
QAT_UTILS_LOG("Failed to get %s from configuration file\n", | |||||
adfParamName); | |||||
return status; | |||||
} | |||||
*bank = (Cpa16U)Sal_Strtoul(adfParamValue, NULL, SAL_CFG_BASE_DEC); | |||||
return status; | |||||
} | |||||
static CpaStatus | |||||
SalCtr_InstInit(icp_accel_dev_t *device, sal_service_t *service) | SalCtr_InstInit(icp_accel_dev_t *device, sal_service_t *service) | ||||
{ | { | ||||
char adfGetParam[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | char adfGetParam[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | ||||
char temp_string[SAL_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | char temp_string[SAL_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | ||||
char temp_string2[SAL_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | char temp_string2[SAL_CFG_MAX_VAL_LEN_IN_BYTES] = { 0 }; | ||||
sal_crypto_service_t *pCryptoService = (sal_crypto_service_t *)service; | sal_crypto_service_t *pCryptoService = (sal_crypto_service_t *)service; | ||||
CpaStatus status = CPA_STATUS_SUCCESS; | CpaStatus status = CPA_STATUS_SUCCESS; | ||||
char *section = DYN_SEC; | char *section = DYN_SEC; | ||||
/*Instance may not in the DYN section*/ | /*Instance may not in the DYN section*/ | ||||
if (CPA_FALSE == pCryptoService->generic_service_info.is_dyn) { | if (CPA_FALSE == pCryptoService->generic_service_info.is_dyn) { | ||||
section = icpGetProcessName(); | section = icpGetProcessName(); | ||||
} | } | ||||
/* Get Config Info: Accel Num, bank Num, packageID, | /* Get Config Info: Accel Num, bank Num, packageID, | ||||
coreAffinity, nodeAffinity and response mode */ | coreAffinity, nodeAffinity and response mode */ | ||||
pCryptoService->acceleratorNum = 0; | pCryptoService->acceleratorNum = 0; | ||||
status = | /* Gen4, a bank only has 2 rings (1 ring pair), only one type of service | ||||
Sal_StringParsing("Cy", | can be assigned one time. asym and sym will be in different bank*/ | ||||
if (isCyGen4x(pCryptoService)) { | |||||
switch (service->type) { | |||||
case SAL_SERVICE_TYPE_CRYPTO_ASYM: | |||||
status = SalCtrl_GetBankNum( | |||||
device, | |||||
pCryptoService->generic_service_info.instance, | pCryptoService->generic_service_info.instance, | ||||
section, | |||||
"BankNumberAsym", | |||||
&pCryptoService->bankNumAsym); | |||||
if (CPA_STATUS_SUCCESS != status) | |||||
return status; | |||||
break; | |||||
case SAL_SERVICE_TYPE_CRYPTO_SYM: | |||||
status = SalCtrl_GetBankNum( | |||||
device, | |||||
pCryptoService->generic_service_info.instance, | |||||
section, | |||||
"BankNumberSym", | |||||
&pCryptoService->bankNumSym); | |||||
if (CPA_STATUS_SUCCESS != status) | |||||
return status; | |||||
break; | |||||
case SAL_SERVICE_TYPE_CRYPTO: | |||||
status = SalCtrl_GetBankNum( | |||||
device, | |||||
pCryptoService->generic_service_info.instance, | |||||
section, | |||||
"BankNumberAsym", | |||||
&pCryptoService->bankNumAsym); | |||||
if (CPA_STATUS_SUCCESS != status) | |||||
return status; | |||||
status = SalCtrl_GetBankNum( | |||||
device, | |||||
pCryptoService->generic_service_info.instance, | |||||
section, | |||||
"BankNumberSym", | |||||
&pCryptoService->bankNumSym); | |||||
if (CPA_STATUS_SUCCESS != status) | |||||
return status; | |||||
break; | |||||
default: | |||||
return CPA_STATUS_FAIL; | |||||
} | |||||
} else { | |||||
status = SalCtrl_GetBankNum( | |||||
device, | |||||
pCryptoService->generic_service_info.instance, | |||||
section, | |||||
"BankNumber", | "BankNumber", | ||||
temp_string); | &pCryptoService->bankNumSym); | ||||
LAC_CHECK_STATUS(status); | if (CPA_STATUS_SUCCESS != status) | ||||
status = | |||||
icp_adf_cfgGetParamValue(device, section, temp_string, adfGetParam); | |||||
if (CPA_STATUS_SUCCESS != status) { | |||||
QAT_UTILS_LOG("Failed to get %s from configuration file\n", | |||||
temp_string); | |||||
return status; | return status; | ||||
pCryptoService->bankNumAsym = pCryptoService->bankNumSym; | |||||
} | } | ||||
pCryptoService->bankNum = | |||||
(Cpa16U)Sal_Strtoul(adfGetParam, NULL, SAL_CFG_BASE_DEC); | |||||
status = | status = | ||||
Sal_StringParsing("Cy", | Sal_StringParsing("Cy", | ||||
pCryptoService->generic_service_info.instance, | pCryptoService->generic_service_info.instance, | ||||
"IsPolled", | "IsPolled", | ||||
temp_string); | temp_string); | ||||
LAC_CHECK_STATUS(status); | LAC_CHECK_STATUS(status); | ||||
status = | status = | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | SalCtr_InstInit(icp_accel_dev_t *device, sal_service_t *service) | ||||
if (SAL_RESP_POLL_CFG_FILE != pCryptoService->isPolled) { | if (SAL_RESP_POLL_CFG_FILE != pCryptoService->isPolled) { | ||||
/* Next need to read the [AcceleratorX] section of the config | /* Next need to read the [AcceleratorX] section of the config | ||||
* file */ | * file */ | ||||
status = Sal_StringParsing("Accelerator", | status = Sal_StringParsing("Accelerator", | ||||
pCryptoService->acceleratorNum, | pCryptoService->acceleratorNum, | ||||
"", | "", | ||||
temp_string2); | temp_string2); | ||||
LAC_CHECK_STATUS(status); | LAC_CHECK_STATUS(status); | ||||
if (service->type == SAL_SERVICE_TYPE_CRYPTO_ASYM) | |||||
status = Sal_StringParsing("Bank", | status = Sal_StringParsing("Bank", | ||||
pCryptoService->bankNum, | pCryptoService->bankNumAsym, | ||||
"CoreAffinity", | "CoreAffinity", | ||||
temp_string); | temp_string); | ||||
else | |||||
/* For cy service, asym bank and sym bank will set the | |||||
same core affinity. So Just read one*/ | |||||
status = Sal_StringParsing("Bank", | |||||
pCryptoService->bankNumSym, | |||||
"CoreAffinity", | |||||
temp_string); | |||||
LAC_CHECK_STATUS(status); | LAC_CHECK_STATUS(status); | ||||
} else { | } else { | ||||
strncpy(temp_string2, section, (strlen(section) + 1)); | strncpy(temp_string2, section, (strlen(section) + 1)); | ||||
status = Sal_StringParsing( | status = Sal_StringParsing( | ||||
"Cy", | "Cy", | ||||
pCryptoService->generic_service_info.instance, | pCryptoService->generic_service_info.instance, | ||||
"CoreAffinity", | "CoreAffinity", | ||||
temp_string); | temp_string); | ||||
▲ Show 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | case CPA_STATUS_RESOURCE: | ||||
LAC_COPY_STRING(pStatusText, CPA_STATUS_STR_RESOURCE); | LAC_COPY_STRING(pStatusText, CPA_STATUS_STR_RESOURCE); | ||||
break; | break; | ||||
case CPA_STATUS_INVALID_PARAM: | case CPA_STATUS_INVALID_PARAM: | ||||
LAC_COPY_STRING(pStatusText, CPA_STATUS_STR_INVALID_PARAM); | LAC_COPY_STRING(pStatusText, CPA_STATUS_STR_INVALID_PARAM); | ||||
break; | break; | ||||
case CPA_STATUS_FATAL: | case CPA_STATUS_FATAL: | ||||
LAC_COPY_STRING(pStatusText, CPA_STATUS_STR_FATAL); | LAC_COPY_STRING(pStatusText, CPA_STATUS_STR_FATAL); | ||||
break; | break; | ||||
case CPA_STATUS_UNSUPPORTED: | |||||
LAC_COPY_STRING(pStatusText, CPA_STATUS_STR_UNSUPPORTED); | |||||
break; | |||||
default: | default: | ||||
status = CPA_STATUS_INVALID_PARAM; | status = CPA_STATUS_INVALID_PARAM; | ||||
break; | break; | ||||
} | } | ||||
return status; | return status; | ||||
} | } | ||||
void | void | ||||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | if (CPA_INSTANCE_HANDLE_SINGLE == instanceHandle_in) { | ||||
if (!instanceHandle) { | if (!instanceHandle) { | ||||
instanceHandle = | instanceHandle = | ||||
Lac_GetFirstHandle(SAL_SERVICE_TYPE_CRYPTO_SYM); | Lac_GetFirstHandle(SAL_SERVICE_TYPE_CRYPTO_SYM); | ||||
} | } | ||||
} else { | } else { | ||||
instanceHandle = instanceHandle_in; | instanceHandle = instanceHandle_in; | ||||
} | } | ||||
LAC_CHECK_NULL_PARAM(instanceHandle); | LAC_CHECK_NULL_PARAM(instanceHandle); | ||||
SAL_CHECK_INSTANCE_TYPE(instanceHandle, | |||||
(SAL_SERVICE_TYPE_CRYPTO | | |||||
SAL_SERVICE_TYPE_CRYPTO_ASYM | | |||||
SAL_SERVICE_TYPE_CRYPTO_SYM)); | |||||
pService = (sal_crypto_service_t *)instanceHandle; | pService = (sal_crypto_service_t *)instanceHandle; | ||||
status = cpaCyInstanceGetInfo2(instanceHandle, &info); | status = cpaCyInstanceGetInfo2(instanceHandle, &info); | ||||
if (CPA_STATUS_SUCCESS != status) { | if (CPA_STATUS_SUCCESS != status) { | ||||
LAC_LOG_ERROR("Can not get instance info\n"); | LAC_LOG_ERROR("Can not get instance info\n"); | ||||
return status; | return status; | ||||
} | } | ||||
Show All 28 Lines | */ | ||||
if (CPA_INSTANCE_HANDLE_SINGLE == instanceHandle_in) { | if (CPA_INSTANCE_HANDLE_SINGLE == instanceHandle_in) { | ||||
instanceHandle = Lac_CryptoGetFirstHandle(); | instanceHandle = Lac_CryptoGetFirstHandle(); | ||||
} else { | } else { | ||||
instanceHandle = instanceHandle_in; | instanceHandle = instanceHandle_in; | ||||
} | } | ||||
LAC_CHECK_NULL_PARAM(instanceHandle); | LAC_CHECK_NULL_PARAM(instanceHandle); | ||||
SAL_CHECK_INSTANCE_TYPE(instanceHandle, | |||||
(SAL_SERVICE_TYPE_CRYPTO | | |||||
SAL_SERVICE_TYPE_CRYPTO_ASYM | | |||||
SAL_SERVICE_TYPE_CRYPTO_SYM)); | |||||
status = cpaCyInstanceGetInfo2(instanceHandle, &info); | status = cpaCyInstanceGetInfo2(instanceHandle, &info); | ||||
if (CPA_STATUS_SUCCESS != status) { | if (CPA_STATUS_SUCCESS != status) { | ||||
LAC_LOG_ERROR("Can not get instance info\n"); | LAC_LOG_ERROR("Can not get instance info\n"); | ||||
return status; | return status; | ||||
} | } | ||||
dev = icp_adf_getAccelDevByAccelId(info.physInstId.packageId); | dev = icp_adf_getAccelDevByAccelId(info.physInstId.packageId); | ||||
if (NULL == dev) { | if (NULL == dev) { | ||||
▲ Show 20 Lines • Show All 485 Lines • ▼ Show 20 Lines | cpaCySymQueryCapabilities(const CpaInstanceHandle instanceHandle_in, | ||||
memset(pCapInfo, '\0', sizeof(CpaCySymCapabilitiesInfo)); | memset(pCapInfo, '\0', sizeof(CpaCySymCapabilitiesInfo)); | ||||
/* An asym crypto instance does not support sym service */ | /* An asym crypto instance does not support sym service */ | ||||
if (SAL_SERVICE_TYPE_CRYPTO_ASYM == pGenericService->type) { | if (SAL_SERVICE_TYPE_CRYPTO_ASYM == pGenericService->type) { | ||||
return CPA_STATUS_SUCCESS; | return CPA_STATUS_SUCCESS; | ||||
} | } | ||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_NULL); | CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_NULL); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_ARC4); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_ECB); | CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_ECB); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_CBC); | CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_CBC); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_CTR); | CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_CTR); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_CCM); | CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_CCM); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_GCM); | CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_GCM); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_DES_ECB); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_DES_CBC); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_3DES_ECB); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_3DES_CBC); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_3DES_CTR); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_KASUMI_F8); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_SNOW3G_UEA2); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_F8); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_XTS); | CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_XTS); | ||||
if (isCyGen2x(pCryptoService)) { | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_ARC4); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | |||||
CPA_CY_SYM_CIPHER_DES_ECB); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | |||||
CPA_CY_SYM_CIPHER_DES_CBC); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | |||||
CPA_CY_SYM_CIPHER_3DES_ECB); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | |||||
CPA_CY_SYM_CIPHER_3DES_CBC); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | |||||
CPA_CY_SYM_CIPHER_3DES_CTR); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | |||||
CPA_CY_SYM_CIPHER_KASUMI_F8); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | |||||
CPA_CY_SYM_CIPHER_SNOW3G_UEA2); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, CPA_CY_SYM_CIPHER_AES_F8); | |||||
} | |||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_MD5); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA1); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA1); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA224); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA224); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA256); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA256); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA384); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA384); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA512); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SHA512); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_XCBC); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_XCBC); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_CCM); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_CCM); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_GCM); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_GCM); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_KASUMI_F9); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_SNOW3G_UIA2); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_CMAC); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_CMAC); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_GMAC); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_GMAC); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_CBC_MAC); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_AES_CBC_MAC); | ||||
if (isCyGen2x(pCryptoService)) { | |||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_MD5); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_KASUMI_F9); | |||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, | |||||
CPA_CY_SYM_HASH_SNOW3G_UIA2); | |||||
} | |||||
if (pGenericService->capabilitiesMask & | if (pGenericService->capabilitiesMask & | ||||
ICP_ACCEL_CAPABILITIES_CRYPTO_ZUC) { | ICP_ACCEL_CAPABILITIES_CRYPTO_ZUC) { | ||||
CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | CPA_BITMAP_BIT_SET(pCapInfo->ciphers, | ||||
CPA_CY_SYM_CIPHER_ZUC_EEA3); | CPA_CY_SYM_CIPHER_ZUC_EEA3); | ||||
CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_ZUC_EIA3); | CPA_BITMAP_BIT_SET(pCapInfo->hashes, CPA_CY_SYM_HASH_ZUC_EIA3); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | icp_sal_CyPollNRBGRing(CpaInstanceHandle instanceHandle_in, | ||||
return CPA_STATUS_UNSUPPORTED; | return CPA_STATUS_UNSUPPORTED; | ||||
} | } | ||||
/* Returns the handle to the first asym crypto instance */ | /* Returns the handle to the first asym crypto instance */ | ||||
static CpaInstanceHandle | static CpaInstanceHandle | ||||
Lac_GetFirstAsymHandle(icp_accel_dev_t *adfInsts[ADF_MAX_DEVICES], | Lac_GetFirstAsymHandle(icp_accel_dev_t *adfInsts[ADF_MAX_DEVICES], | ||||
Cpa16U num_dev) | Cpa16U num_dev) | ||||
{ | { | ||||
CpaStatus status = CPA_STATUS_SUCCESS; | |||||
icp_accel_dev_t *dev_addr = NULL; | icp_accel_dev_t *dev_addr = NULL; | ||||
sal_t *base_addr = NULL; | sal_t *base_addr = NULL; | ||||
sal_list_t *list_temp = NULL; | sal_list_t *list_temp = NULL; | ||||
CpaInstanceHandle cyInst = NULL; | CpaInstanceHandle cyInst = NULL; | ||||
CpaInstanceInfo2 info; | |||||
Cpa16U i = 0; | Cpa16U i = 0; | ||||
for (i = 0; i < num_dev; i++) { | for (i = 0; i < num_dev; i++) { | ||||
dev_addr = (icp_accel_dev_t *)adfInsts[i]; | dev_addr = (icp_accel_dev_t *)adfInsts[i]; | ||||
base_addr = dev_addr->pSalHandle; | base_addr = dev_addr->pSalHandle; | ||||
if ((NULL != base_addr) && (NULL != base_addr->asym_services)) { | if (NULL == base_addr) { | ||||
continue; | |||||
} | |||||
list_temp = base_addr->asym_services; | list_temp = base_addr->asym_services; | ||||
while (NULL != list_temp) { | |||||
cyInst = SalList_getObject(list_temp); | cyInst = SalList_getObject(list_temp); | ||||
status = cpaCyInstanceGetInfo2(cyInst, &info); | |||||
list_temp = SalList_next(list_temp); | |||||
if (CPA_STATUS_SUCCESS != status || | |||||
CPA_TRUE != info.isPolled) { | |||||
cyInst = NULL; | |||||
continue; | |||||
} | |||||
break; | break; | ||||
} | } | ||||
if (cyInst) { | |||||
break; | |||||
} | } | ||||
} | |||||
return cyInst; | return cyInst; | ||||
} | } | ||||
/* Returns the handle to the first sym crypto instance */ | /* Returns the handle to the first sym crypto instance */ | ||||
static CpaInstanceHandle | static CpaInstanceHandle | ||||
Lac_GetFirstSymHandle(icp_accel_dev_t *adfInsts[ADF_MAX_DEVICES], | Lac_GetFirstSymHandle(icp_accel_dev_t *adfInsts[ADF_MAX_DEVICES], | ||||
Cpa16U num_dev) | Cpa16U num_dev) | ||||
{ | { | ||||
CpaStatus status = CPA_STATUS_SUCCESS; | |||||
icp_accel_dev_t *dev_addr = NULL; | icp_accel_dev_t *dev_addr = NULL; | ||||
sal_t *base_addr = NULL; | sal_t *base_addr = NULL; | ||||
sal_list_t *list_temp = NULL; | sal_list_t *list_temp = NULL; | ||||
CpaInstanceHandle cyInst = NULL; | CpaInstanceHandle cyInst = NULL; | ||||
CpaInstanceInfo2 info; | |||||
Cpa16U i = 0; | Cpa16U i = 0; | ||||
for (i = 0; i < num_dev; i++) { | for (i = 0; i < num_dev; i++) { | ||||
dev_addr = (icp_accel_dev_t *)adfInsts[i]; | dev_addr = (icp_accel_dev_t *)adfInsts[i]; | ||||
base_addr = dev_addr->pSalHandle; | base_addr = dev_addr->pSalHandle; | ||||
if ((NULL != base_addr) && (NULL != base_addr->sym_services)) { | if (NULL == base_addr) { | ||||
continue; | |||||
} | |||||
list_temp = base_addr->sym_services; | list_temp = base_addr->sym_services; | ||||
while (NULL != list_temp) { | |||||
cyInst = SalList_getObject(list_temp); | cyInst = SalList_getObject(list_temp); | ||||
status = cpaCyInstanceGetInfo2(cyInst, &info); | |||||
list_temp = SalList_next(list_temp); | |||||
if (CPA_STATUS_SUCCESS != status || | |||||
CPA_TRUE != info.isPolled) { | |||||
cyInst = NULL; | |||||
continue; | |||||
} | |||||
break; | break; | ||||
} | } | ||||
if (cyInst) { | |||||
break; | |||||
} | } | ||||
} | |||||
return cyInst; | return cyInst; | ||||
} | } | ||||
/* Returns the handle to the first crypto instance | /* Returns the handle to the first crypto instance | ||||
* Note that the crypto instance in this case supports | * Note that the crypto instance in this case supports | ||||
* both asym and sym services */ | * both asym and sym services */ | ||||
static CpaInstanceHandle | static CpaInstanceHandle | ||||
Lac_GetFirstCyHandle(icp_accel_dev_t *adfInsts[ADF_MAX_DEVICES], Cpa16U num_dev) | Lac_GetFirstCyHandle(icp_accel_dev_t *adfInsts[ADF_MAX_DEVICES], Cpa16U num_dev) | ||||
{ | { | ||||
CpaStatus status = CPA_STATUS_SUCCESS; | |||||
icp_accel_dev_t *dev_addr = NULL; | icp_accel_dev_t *dev_addr = NULL; | ||||
sal_t *base_addr = NULL; | sal_t *base_addr = NULL; | ||||
sal_list_t *list_temp = NULL; | sal_list_t *list_temp = NULL; | ||||
CpaInstanceHandle cyInst = NULL; | CpaInstanceHandle cyInst = NULL; | ||||
CpaInstanceInfo2 info; | |||||
Cpa16U i = 0; | Cpa16U i = 0; | ||||
for (i = 0; i < num_dev; i++) { | for (i = 0; i < num_dev; i++) { | ||||
dev_addr = (icp_accel_dev_t *)adfInsts[i]; | dev_addr = (icp_accel_dev_t *)adfInsts[i]; | ||||
base_addr = dev_addr->pSalHandle; | base_addr = dev_addr->pSalHandle; | ||||
if ((NULL != base_addr) && | if (NULL == base_addr) { | ||||
(NULL != base_addr->crypto_services)) { | continue; | ||||
} | |||||
list_temp = base_addr->crypto_services; | list_temp = base_addr->crypto_services; | ||||
while (NULL != list_temp) { | |||||
cyInst = SalList_getObject(list_temp); | cyInst = SalList_getObject(list_temp); | ||||
status = cpaCyInstanceGetInfo2(cyInst, &info); | |||||
list_temp = SalList_next(list_temp); | |||||
if (CPA_STATUS_SUCCESS != status || | |||||
CPA_TRUE != info.isPolled) { | |||||
cyInst = NULL; | |||||
continue; | |||||
} | |||||
break; | break; | ||||
} | } | ||||
if (cyInst) { | |||||
break; | |||||
} | } | ||||
} | |||||
return cyInst; | return cyInst; | ||||
} | } | ||||
CpaInstanceHandle | CpaInstanceHandle | ||||
Lac_GetFirstHandle(sal_service_type_t svc_type) | Lac_GetFirstHandle(sal_service_type_t svc_type) | ||||
{ | { | ||||
CpaStatus status = CPA_STATUS_SUCCESS; | CpaStatus status = CPA_STATUS_SUCCESS; | ||||
static icp_accel_dev_t *adfInsts[ADF_MAX_DEVICES] = { 0 }; | static icp_accel_dev_t *adfInsts[ADF_MAX_DEVICES] = { 0 }; | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | icp_sal_dp_SymGetInflightRequests(CpaInstanceHandle instanceHandle, | ||||
crypto_handle = (sal_crypto_service_t *)instanceHandle; | crypto_handle = (sal_crypto_service_t *)instanceHandle; | ||||
return icp_adf_dp_getInflightRequests( | return icp_adf_dp_getInflightRequests( | ||||
crypto_handle->trans_handle_sym_tx, | crypto_handle->trans_handle_sym_tx, | ||||
maxInflightRequests, | maxInflightRequests, | ||||
numInflightRequests); | numInflightRequests); | ||||
} | } | ||||
CpaStatus | |||||
icp_sal_setForceAEADMACVerify(CpaInstanceHandle instanceHandle, | |||||
CpaBoolean forceAEADMacVerify) | |||||
{ | |||||
sal_crypto_service_t *crypto_handle = NULL; | |||||
crypto_handle = (sal_crypto_service_t *)instanceHandle; | |||||
LAC_CHECK_NULL_PARAM(crypto_handle); | |||||
crypto_handle->forceAEADMacVerify = forceAEADMacVerify; | |||||
return CPA_STATUS_SUCCESS; | |||||
} |