test/crypto: enable raw crypto tests for crypto_cn10k
PATCH 6/8 test/crypto: enable raw crypto tests for crypto_cn10k
From: Anoob Joseph <[email protected]>
Enable raw crypto tests with crypto_cn10k.
Signed-off-by Anoob Joseph <[email protected]>
--- app/test/test_cryptodev.c | 8 ++++++++ 1 file changed, 8 insertions(+)
app/test/test_cryptodev.c +8 -0
@@ -17519,6 +17519,12 @@ test_cryptodev_cn10k(void)return run_cryptodev_testsuite (RTE_STR (CRYPTODEV_NAME_CN10K_PMD )); } +static int +test_cryptodev_cn10k_raw_api (void ) +{ +return run_cryptodev_raw_testsuite (RTE_STR (CRYPTODEV_NAME_CN10K_PMD )); +} +static int test_cryptodev_dpaa2_sec_raw_api (void ) {
@@ -17531,6 +17537,8 @@ test_cryptodev_dpaa_sec_raw_api(void)return run_cryptodev_raw_testsuite (RTE_STR (CRYPTODEV_NAME_DPAA_SEC_PMD )); } +REGISTER_TEST_COMMAND (cryptodev_cn10k_raw_api_autotest, + test_cryptodev_cn10k_raw_api);REGISTER_TEST_COMMAND (cryptodev_dpaa2_sec_raw_api_autotest, test_cryptodev_dpaa2_sec_raw_api); REGISTER_TEST_COMMAND(cryptodev_dpaa_sec_raw_api_autotest,
Signature · 1 line
2.25.1
PATCH 7/8 crypto/cnxk: add support for sm4
From: Vidya Sagar Velumuri <[email protected]>
Add support for SM4 cipher
Support for modes: SM4_CBC, SM4_ECB, SM4_CTR, SM4_OFB, SM4_CFB
Signed-off-by Vidya Sagar Velumuri <[email protected]>
--- doc/guides/cryptodevs/cnxk.rst | 1 + doc/guides/cryptodevs/features/cn10k.ini | 1 + drivers/common/cnxk/hw/cpt.h | 5 +- drivers/common/cnxk/roc_se.c | 3 + drivers/common/cnxk/roc_se.h | 20 ++ drivers/crypto/cnxk/cnxk_cryptodev.h | 2 +- .../crypto/cnxk/cnxk_cryptodev_capabilities.c | 113 ++++++- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 5 +- drivers/crypto/cnxk/cnxk_se.h | 278 +++++++++++++++++- 9 files changed, 421 insertions(+), 7 deletions(-)
doc/guides/cryptodevs/cnxk.rst +1 -0
@@ -41,6 +41,7 @@ Cipher algorithms: * ``RTE_CRYPTO_CIPHER_KASUMI_F8`` * ``RTE_CRYPTO_CIPHER_SNOW3G_UEA2`` * ``RTE_CRYPTO_CIPHER_ZUC_EEA3`` +* ``RTE_CRYPTO_CIPHER_SM4`` Hash algorithms:
doc/guides/cryptodevs/features/cn10k.ini +1 -0
@@ -38,6 +38,7 @@ DES CBC = Y KASUMI F8 = Y SNOW3G UEA2 = Y ZUC EEA3 = Y +SM4 = Y ; ; Supported authentication algorithms of 'cn10k' crypto driver.
drivers/common/cnxk/hw/cpt.h +4 -1
@@ -73,7 +73,10 @@ union cpt_eng_caps { uint64_t __io des : 1; uint64_t __io crc : 1; uint64_t __io mmul : 1; - uint64_t __io reserved_15_33 : 19; + uint64_t __io reserved_15_20 : 6; + uint64_t __io sm3 : 1; + uint64_t __io sm4 : 1; + uint64_t __io reserved_23_33 : 11; uint64_t __io pdcp_chain : 1; uint64_t __io sg_ver2 : 1; uint64_t __io reserved_36_63 : 28;
drivers/common/cnxk/roc_se.c +3 -0
@@ -757,6 +757,9 @@ roc_se_ctx_init(struct roc_se_ctx *roc_se_ctx)case ROC_SE_PDCP_CHAIN : ctx_len =sizeof (struct roc_se_zuc_snow3g_chain_ctx );break ; +case ROC_SE_SM : + ctx_len =sizeof (struct roc_se_sm_context ); +break ;default : ctx_len =0 ; }
drivers/common/cnxk/roc_se.h +20 -0
@@ -17,6 +17,7 @@#define ROC_SE_MAJOR_OP_PDCP 0x37#define ROC_SE_MAJOR_OP_KASUMI 0x38#define ROC_SE_MAJOR_OP_PDCP_CHAIN 0x3C +#define ROC_SE_MAJOR_OP_SM 0x3D#define ROC_SE_MAJOR_OP_MISC 0x01ULL#define ROC_SE_MISC_MINOR_OP_PASSTHROUGH 0x03ULL
@@ -28,6 +29,8 @@#define ROC_SE_OFF_CTRL_LEN 8 +#define ROC_SE_SM4_KEY_LEN 16 +#define ROC_SE_ZS_EA 0x1#define ROC_SE_ZS_IA 0x2#define ROC_SE_K_F8 0x4
@@ -38,6 +41,7 @@#define ROC_SE_KASUMI 0x3#define ROC_SE_HASH_HMAC 0x4#define ROC_SE_PDCP_CHAIN 0x5 +#define ROC_SE_SM 0x6#define ROC_SE_OP_CIPHER_ENCRYPT 0x1#define ROC_SE_OP_CIPHER_DECRYPT 0x2
@@ -125,6 +129,14 @@ typedef enum {ROC_SE_DES_DOCSISBPI =0x96 , } roc_se_cipher_type; +typedef enum { +ROC_SM4_ECB =0x0 , +ROC_SM4_CBC =0x1 , +ROC_SM4_CTR =0x2 , +ROC_SM4_CFB =0x3 , +ROC_SM4_OFB =0x4 , +}roc_sm_cipher_type ; + typedef enum { /* Microcode errors */ ROC_SE_NO_ERR = 0x00,
@@ -192,6 +204,13 @@ struct roc_se_context {struct roc_se_hmac_context hmac; }; +struct roc_se_sm_context { +uint64_t rsvd_56_60 :5 ; +uint64_t enc_cipher :3 ; +uint64_t rsvd_0_55 :56 ; +uint8_t encr_key[16 ]; +}; + struct roc_se_otk_zuc_ctx { union { uint64_t u64;
@@ -325,6 +344,7 @@ struct roc_se_ctx {struct roc_se_zuc_snow3g_ctx zs_ctx;struct roc_se_zuc_snow3g_chain_ctx zs_ch_ctx;struct roc_se_kasumi_ctx k_ctx; +struct roc_se_sm_context sm_ctx; }; }se_ctx __plt_aligned (ROC_ALIGN );uint8_t *auth_key;
drivers/crypto/cnxk/cnxk_cryptodev.h +1 -1
@@ -10,7 +10,7 @@#include "roc_cpt.h" -#define CNXK_CPT_MAX_CAPS 49 +#define CNXK_CPT_MAX_CAPS 54#define CNXK_SEC_CRYPTO_MAX_CAPS 16#define CNXK_SEC_MAX_CAPS 9#define CNXK_AE_EC_ID_MAX 8
drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +110 -3
132 lines not on this page · raw message
drivers/crypto/cnxk/cnxk_cryptodev_ops.c +4 -1
@@ -660,7 +660,7 @@ cnxk_cpt_inst_w7_get(struct cnxk_se_sess *sess, struct roc_cpt *roc_cpt)/* Set the engine group */ if (sess->zsk_flag || sess->aes_ctr_eea2 || sess->is_sha3 || sess->is_sm3 || - sess->passthrough) + sess->passthrough || sess->is_sm4) inst_w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_SE ];else inst_w7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_IE ];
@@ -704,6 +704,9 @@ sym_session_configure(struct roc_cpt *roc_cpt, struct rte_crypto_sym_xform *xforcase ROC_SE_PDCP_CHAIN : thr_type =CPT_DP_THREAD_TYPE_PDCP_CHAIN ;break ; +case ROC_SE_SM : + thr_type =CPT_DP_THREAD_TYPE_SM ; +break ;default :plt_err ("Invalid op type" ); ret = -ENOTSUP ;
drivers/crypto/cnxk/cnxk_se.h +277 -1
320 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 8/8 crypto/cnxk: fix order of ECFPM parameters
In reply to Tejasree KondojFrom: Gowrishankar Muthukrishnan <[email protected]>
Fix order of ECFPM parameters.
Fixes 76618fc4bef ("crypto/cnxk: fix order of ECFPM parameters")
Signed-off-by Gowrishankar Muthukrishnan <[email protected]>
--- drivers/crypto/cnxk/cnxk_ae.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/cnxk/cnxk_ae.h +2 -1
@@ -723,7 +723,8 @@ cnxk_ae_ecfpm_prep(struct rte_crypto_ecpm_op_param *ecpm,* optionally ROUNDUP8(input point(x and y coordinates)). * Please note point length is equivalent to prime of the curve */ -if (cpt_ver ==ROC_CPT_REVISION_ID_96XX_C0 ) { +if (cpt_ver ==ROC_CPT_REVISION_ID_96XX_B0 || cpt_ver ==ROC_CPT_REVISION_ID_96XX_C0 || + cpt_ver ==ROC_CPT_REVISION_ID_98XX ) { dlen =sizeof (fpm_table_iova) +3 * p_align + scalar_align;memset (dptr,0 , dlen); *(uint64_t *)dptr = fpm_table_iova;
Signature · 1 line
2.25.1