From patchwork Wed Sep 15 06:11:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar Velumuri X-Patchwork-Id: 98883 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33467A0C43; Wed, 15 Sep 2021 08:11:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9A924003F; Wed, 15 Sep 2021 08:11:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7B5F84003C for ; Wed, 15 Sep 2021 08:11:22 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18EIsXIQ015712; Tue, 14 Sep 2021 23:11:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=p2EPTeBsOeFhRWy7hOSP6V5eF4Rec4g4Ctly0Z8k1+E=; b=U10dmNpuacd+O11bw8mMMIzqUn2GCrHS7QrHgRb6Jqmkp4sRFcfmt8/Xr5pg612Btqwj 1AR7ThL50kyeQ5zIv49DEklMa6gGickBZa70dqA/cS+UghfYSyA+QG2jNCx8MXS2J6nQ EekrmvLHwVl6/6t/O3i9VpTCexW2cD1QH0ANlZ24mi/xerapoOOW65czPWv4oxy8hl7g XUgV+4C0RBLIE6oyfosHQEFJ7TbE6p8EwzfD7muq5dA1YhLO19SlDnBQMDj1GdksZSWO np96L7OCzO3BO/5LC2IyA8kM2VWRPQJTf2JMbxzPLP/Zf41hUicEihZSOCWkY27GaUku IQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3b31e81wmv-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 14 Sep 2021 23:11:21 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 14 Sep 2021 23:11:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 14 Sep 2021 23:11:19 -0700 Received: from vvelumuri_asim.marvell.com (unknown [10.29.53.48]) by maili.marvell.com (Postfix) with ESMTP id E1DDA3F7061; Tue, 14 Sep 2021 23:11:16 -0700 (PDT) From: Vidya Sagar Velumuri To: , , , , , , , , CC: Date: Wed, 15 Sep 2021 06:11:01 +0000 Message-ID: <20210915061103.28375-1-vvelumuri@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-GUID: Vye4hKk6-KvAHvpBRtEFKcTmM4_pYJG2 X-Proofpoint-ORIG-GUID: Vye4hKk6-KvAHvpBRtEFKcTmM4_pYJG2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-15_01,2021-09-14_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v1 1/3] common/cnxk: set key length setting for PDCP algos X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Set proper bits in the context based on key length for PDCP Signed-off-by: Vidya Sagar Velumuri Acked-by: Akhil Goyal diff --git a/drivers/common/cnxk/roc_se.c b/drivers/common/cnxk/roc_se.c index 03fbc5f2f7..4edbc8e547 100644 --- a/drivers/common/cnxk/roc_se.c +++ b/drivers/common/cnxk/roc_se.c @@ -160,6 +160,13 @@ cpt_pdcp_mac_len_set(struct roc_se_zuc_snow3g_ctx *zs_ctx, uint16_t mac_len) { roc_se_pdcp_mac_len_type mac_type = 0; + if (roc_model_is_cn9k()) { + if (mac_len != 4) { + plt_err("Only mac len 4 is supported on cn9k"); + return -ENOTSUP; + } + } + switch (mac_len) { case 4: mac_type = ROC_SE_PDCP_MAC_LEN_32_BIT; @@ -230,6 +237,9 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type, case ROC_SE_ZUC_EIA3: zs_ctx->zuc.otk_ctx.w0.s.alg_type = ROC_SE_PDCP_ALG_TYPE_ZUC; + ret = cpt_pdcp_key_type_set(zs_ctx, key_len); + if (ret) + return ret; ret = cpt_pdcp_mac_len_set(zs_ctx, mac_len); if (ret) return ret; From patchwork Wed Sep 15 06:11:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar Velumuri X-Patchwork-Id: 98884 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08597A0C43; Wed, 15 Sep 2021 08:11:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09ED1410E5; Wed, 15 Sep 2021 08:11:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 20BDC410E0 for ; Wed, 15 Sep 2021 08:11:27 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18EJRFXS024750; Tue, 14 Sep 2021 23:11:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=IpeFzG5TUbWGEVvPx2Zx6av5aGE+m98uHBrNTb2Ye9U=; b=b8dLKbZw0t/mEbTp6XDYU5CH4pMS1vLJwwkRkc/VjG7CcOVejrv1t1CdV0TbRaLqKY9+ Yi0c5FNdjocb+1o+lueTPbwrt5zyzrJbEq+bPILvjZ53qH5DU228cTlTegxyVmPpv2pv FH+hXhIU3vqHv7gmVEkAgvEYYoVsME+XlkGliQtZXRLu7ITQyqgl2/l077Pz36OIBlNn iS7b19ua0l8ZVrVoABSusO9PKmfe7pH0qQfJhQsfOdh3pSPSbsmAus2QiHErQRIse7Ik i46t+TrHZmT9focnKI3lRxeeE3IgMOwZoY+XistW2wYa71JrXjg+PR/syQveHokks6aY Ag== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 3b2t41m0b5-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 14 Sep 2021 23:11:25 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 14 Sep 2021 23:11:23 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 14 Sep 2021 23:11:23 -0700 Received: from vvelumuri_asim.marvell.com (unknown [10.29.53.48]) by maili.marvell.com (Postfix) with ESMTP id 4EE363F705B; Tue, 14 Sep 2021 23:11:20 -0700 (PDT) From: Vidya Sagar Velumuri To: , , , , , , , , CC: Date: Wed, 15 Sep 2021 06:11:02 +0000 Message-ID: <20210915061103.28375-2-vvelumuri@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915061103.28375-1-vvelumuri@marvell.com> References: <20210915061103.28375-1-vvelumuri@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: puufudEQxRAtutKfEFkhusEPAzI0w1GN X-Proofpoint-ORIG-GUID: puufudEQxRAtutKfEFkhusEPAzI0w1GN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-14_10,2021-09-14_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v1 2/3] crypto/cnxk: support for 256 bit key length in ZUC X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add support for 256 bit key length for ZUC in crpto_cn10k PMD. Add support for digest length of 8 and 16 bytes for ZUC with 256 bit key length. Signed-off-by: Vidya Sagar Velumuri diff --git a/doc/guides/rel_notes/release_21_11.rst b/doc/guides/rel_notes/release_21_11.rst index 3fa8018695..7422bff10a 100644 --- a/doc/guides/rel_notes/release_21_11.rst +++ b/doc/guides/rel_notes/release_21_11.rst @@ -68,6 +68,7 @@ New Features * Added Transport mode support in lookaside protocol (IPsec) for CN10K. * Added UDP encapsulation support in lookaside protocol (IPsec) for CN10K. * Added support for lookaside protocol (IPsec) offload for CN9K. + * Added support for ZUC algorithm with 256 bit key length for CN10K. * **Added support for event crypto adapter on Marvell CN10K and CN9K.** diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c index c4f7824332..31893e1d20 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_capabilities.c @@ -860,6 +860,38 @@ cpt_caps_add(struct rte_cryptodev_capabilities cnxk_caps[], int *cur_pos, *cur_pos += nb_caps; } +static void +cn10k_crypto_caps_update(struct rte_cryptodev_capabilities cnxk_caps[]) +{ + + struct rte_cryptodev_capabilities *caps; + int i = 0; + + while ((caps = &cnxk_caps[i++])->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) { + if ((caps->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC) && + (caps->sym.xform_type == RTE_CRYPTO_SYM_XFORM_CIPHER) && + (caps->sym.cipher.algo == RTE_CRYPTO_CIPHER_ZUC_EEA3)) { + + caps->sym.cipher.key_size.max = 32; + caps->sym.cipher.key_size.increment = 16; + caps->sym.cipher.iv_size.max = 24; + caps->sym.cipher.iv_size.increment = 8; + } + + if ((caps->op == RTE_CRYPTO_OP_TYPE_SYMMETRIC) && + (caps->sym.xform_type == RTE_CRYPTO_SYM_XFORM_AUTH) && + (caps->sym.auth.algo == RTE_CRYPTO_AUTH_ZUC_EIA3)) { + + caps->sym.auth.key_size.max = 32; + caps->sym.auth.key_size.increment = 16; + caps->sym.auth.digest_size.max = 16; + caps->sym.auth.digest_size.increment = 4; + caps->sym.auth.iv_size.max = 24; + caps->sym.auth.iv_size.increment = 8; + } + } +} + static void crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[], union cpt_eng_caps *hw_caps) @@ -876,6 +908,9 @@ crypto_caps_populate(struct rte_cryptodev_capabilities cnxk_caps[], cpt_caps_add(cnxk_caps, &cur_pos, caps_null, RTE_DIM(caps_null)); cpt_caps_add(cnxk_caps, &cur_pos, caps_end, RTE_DIM(caps_end)); + + if (roc_model_is_cn10k()) + cn10k_crypto_caps_update(cnxk_caps); } const struct rte_cryptodev_capabilities * diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index aedc4bc0d8..7959c4c7af 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -980,7 +980,7 @@ cpt_zuc_snow3g_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, uint8_t pdcp_alg_type; uint32_t encr_offset, auth_offset; uint32_t encr_data_len, auth_data_len; - int flags, iv_len = 16; + int flags, iv_len; uint64_t offset_ctrl; uint64_t *offset_vaddr; uint8_t *iv_s; @@ -996,6 +996,9 @@ cpt_zuc_snow3g_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, cpt_inst_w4.s.opcode_minor = se_ctx->template_w4.s.opcode_minor; if (flags == 0x1) { + iv_s = params->auth_iv_buf; + iv_len = params->auth_iv_len; + /* * Microcode expects offsets in bytes * TODO: Rounding off @@ -1016,9 +1019,10 @@ cpt_zuc_snow3g_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, encr_data_len = 0; encr_offset = 0; - - iv_s = params->auth_iv_buf; } else { + iv_s = params->iv_buf; + iv_len = params->cipher_iv_len; + /* EEA3 or UEA2 */ /* * Microcode expects offsets in bytes @@ -1039,8 +1043,6 @@ cpt_zuc_snow3g_prep(uint32_t req_flags, uint64_t d_offs, uint64_t d_lens, auth_data_len = 0; auth_offset = 0; - - iv_s = params->iv_buf; } if (unlikely((encr_offset >> 16) || (auth_offset >> 8))) { @@ -1719,7 +1721,7 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) break; case RTE_CRYPTO_CIPHER_ZUC_EEA3: enc_type = ROC_SE_ZUC_EEA3; - cipher_key_len = 16; + cipher_key_len = c_form->key.length; zsk_flag = ROC_SE_ZS_EA; break; case RTE_CRYPTO_CIPHER_AES_XTS: @@ -2069,6 +2071,9 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, uint32_t iv_buf[4]; int ret; + fc_params.cipher_iv_len = sess->iv_length; + fc_params.auth_iv_len = sess->auth_iv_length; + if (likely(sess->iv_length)) { flags |= ROC_SE_VALID_IV_BUF; fc_params.iv_buf = rte_crypto_op_ctod_offset(cop, uint8_t *, @@ -2379,6 +2384,7 @@ fill_digest_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess, */ d_offs = auth_range_off; auth_range_off = 0; + params.auth_iv_len = sess->auth_iv_length; params.auth_iv_buf = rte_crypto_op_ctod_offset( cop, uint8_t *, sess->auth_iv_offset); if (sess->zsk_flag == ROC_SE_K_F9) { From patchwork Wed Sep 15 06:11:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar Velumuri X-Patchwork-Id: 98885 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28647A0C43; Wed, 15 Sep 2021 08:11:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2ABAD410EB; Wed, 15 Sep 2021 08:11:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id A77CC410EB for ; Wed, 15 Sep 2021 08:11:29 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18EKD2cW026666; Tue, 14 Sep 2021 23:11:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=3dA+nS/V/eUxvhH4VC0oVqvxvkARLMAkxFiIL0TyvHo=; b=j2Q6M3Wo/JsHp7az6OlnZ0tRUiPUZ5ZGIYkAXot6NqbncirQXSR0R9iWaUQ6+Bf7vTFa S4YvFIw0bECSwYJT58bxGsm/oMCDt8PLAxbs2W4/MHtAFzLkWmnXYY7f0XkZvOpXRmUN oMx3dn2bnzCguBqREuTJH0J7OVu5p12gfX0yWcz6bg99nbRNw0qIbfgYAYZmDBXnpxXt p9B65y+wzEizpXmy7f0nXTIS8hWruslUudnghyoYlkuaAUWE2wTzf+snnCHsXCaB8uCf lfHOKQ5KCRjHoKsWyiIasbPKk3JeC3VEEQKHVaellGZM5OOfkOPZjUjEDMmpLoqA7bDh Bg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3b2t41m0bg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 14 Sep 2021 23:11:29 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 14 Sep 2021 23:11:26 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 14 Sep 2021 23:11:26 -0700 Received: from vvelumuri_asim.marvell.com (unknown [10.29.53.48]) by maili.marvell.com (Postfix) with ESMTP id AA57C3F7055; Tue, 14 Sep 2021 23:11:23 -0700 (PDT) From: Vidya Sagar Velumuri To: , , , , , , , , CC: Date: Wed, 15 Sep 2021 06:11:03 +0000 Message-ID: <20210915061103.28375-3-vvelumuri@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210915061103.28375-1-vvelumuri@marvell.com> References: <20210915061103.28375-1-vvelumuri@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: OGrVBz9UCIQOsNslyLp28quChoqw1qqV X-Proofpoint-ORIG-GUID: OGrVBz9UCIQOsNslyLp28quChoqw1qqV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-14_10,2021-09-14_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v1 3/3] test/crypto: add ZUC test cases for 256 bit key X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add test cases for zuc 256 bit key. Add test case for zuc 8 and 16 byte digest with 256 bit key mode Signed-off-by: Vidya Sagar Velumuri diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 16d770a17f..27dd3355b2 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -2352,6 +2352,9 @@ create_wireless_algo_hash_session(uint8_t dev_id, status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess, &ut_params->auth_xform, ts_params->session_priv_mpool); + if (status == -ENOTSUP) + return TEST_SKIPPED; + TEST_ASSERT_EQUAL(status, 0, "session init failed"); TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); return 0; @@ -2391,6 +2394,9 @@ create_wireless_algo_cipher_session(uint8_t dev_id, status = rte_cryptodev_sym_session_init(dev_id, ut_params->sess, &ut_params->cipher_xform, ts_params->session_priv_mpool); + if (status == -ENOTSUP) + return TEST_SKIPPED; + TEST_ASSERT_EQUAL(status, 0, "session init failed"); TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); return 0; @@ -5808,7 +5814,7 @@ test_zuc_encryption(const struct wireless_test_data *tdata) RTE_CRYPTO_CIPHER_ZUC_EEA3, tdata->key.data, tdata->key.len, tdata->cipher_iv.len); - if (retval < 0) + if (retval != 0) return retval; ut_params->ibuf = rte_pktmbuf_alloc(ts_params->mbuf_pool); @@ -6010,7 +6016,7 @@ test_zuc_authentication(const struct wireless_test_data *tdata) tdata->auth_iv.len, tdata->digest.len, RTE_CRYPTO_AUTH_OP_GENERATE, RTE_CRYPTO_AUTH_ZUC_EIA3); - if (retval < 0) + if (retval != 0) return retval; /* alloc mbuf and set payload */ @@ -6956,6 +6962,12 @@ test_zuc_encryption_test_case_6_sgl(void) return test_zuc_encryption_sgl(&zuc_test_case_cipher_193b); } +static int +test_zuc_encryption_test_case_7(void) +{ + return test_zuc_encryption(&zuc_test_case_cipher_800b_key_256b); +} + static int test_zuc_hash_generate_test_case_1(void) { @@ -7004,6 +7016,18 @@ test_zuc_hash_generate_test_case_8(void) return test_zuc_authentication(&zuc_test_case_auth_584b); } +static int +test_zuc_hash_generate_test_case_9(void) +{ + return test_zuc_authentication(&zuc_test_case_auth_584b_mac_64b); +} + +static int +test_zuc_hash_generate_test_case_10(void) +{ + return test_zuc_authentication(&zuc_test_case_auth_2080b_mac_128b); +} + static int test_zuc_cipher_auth_test_case_1(void) { @@ -14200,6 +14224,8 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_encryption_test_case_5), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_encryption_test_case_6_sgl), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_encryption_test_case_7), /** ZUC authenticate (EIA3) */ TEST_CASE_ST(ut_setup, ut_teardown, @@ -14218,6 +14244,11 @@ static struct unit_test_suite cryptodev_zuc_testsuite = { test_zuc_hash_generate_test_case_7), TEST_CASE_ST(ut_setup, ut_teardown, test_zuc_hash_generate_test_case_8), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_hash_generate_test_case_9), + TEST_CASE_ST(ut_setup, ut_teardown, + test_zuc_hash_generate_test_case_10), + /** ZUC alg-chain (EEA3/EIA3) */ TEST_CASE_ST(ut_setup, ut_teardown, diff --git a/app/test/test_cryptodev_zuc_test_vectors.h b/app/test/test_cryptodev_zuc_test_vectors.h index cc2338e107..2e330bc8d3 100644 --- a/app/test/test_cryptodev_zuc_test_vectors.h +++ b/app/test/test_cryptodev_zuc_test_vectors.h @@ -517,6 +517,68 @@ static struct wireless_test_data zuc_test_case_cipher_4019b = { } }; +static struct wireless_test_data zuc_test_case_cipher_800b_key_256b = { + .key = { + .data = { + 0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8, + 0x66, 0xC6, 0xAC, 0x58, 0xBD, 0x54, 0x30, 0x2A, + 0xE5, 0xBD, 0x3E, 0xA0, 0xEB, 0x55, 0xAD, 0xE8, + 0x66, 0xC6, 0xAC, 0x58, 0xBD, 0x54, 0x30, 0x2A + }, + .len = 32 + }, + .cipher_iv = { + .data = { + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x68, 0x23, 0xC4, 0x00, 0x00, 0x00 + }, + .len = 24 + }, + .plaintext = { + .data = { + 0x14, 0xA8, 0xEF, 0x69, 0x3D, 0x67, 0x85, 0x07, + 0xBB, 0xE7, 0x27, 0x0A, 0x7F, 0x67, 0xFF, 0x50, + 0x06, 0xC3, 0x52, 0x5B, 0x98, 0x07, 0xE4, 0x67, + 0xC4, 0xE5, 0x60, 0x00, 0xBA, 0x33, 0x8F, 0x5D, + 0x42, 0x95, 0x59, 0x03, 0x67, 0x51, 0x82, 0x22, + 0x46, 0xC8, 0x0D, 0x3B, 0x38, 0xF0, 0x7F, 0x4B, + 0xE2, 0xD8, 0xFF, 0x58, 0x05, 0xF5, 0x13, 0x22, + 0x29, 0xBD, 0xE9, 0x3B, 0xBB, 0xDC, 0xAF, 0x38, + 0x2B, 0xF1, 0xEE, 0x97, 0x2F, 0xBF, 0x99, 0x77, + 0xBA, 0xDA, 0x89, 0x45, 0x84, 0x7A, 0x2A, 0x6C, + 0x9A, 0xD3, 0x4A, 0x66, 0x75, 0x54, 0xE0, 0x4D, + 0x1F, 0x7F, 0xA2, 0xC3, 0x32, 0x41, 0xBD, 0x8F, + 0x01, 0xBA, 0x22, 0x0D + }, + .len = 800 + }, + .ciphertext = { + .data = { + 0xd0, 0xb4, 0x09, 0x5a, 0x83, 0xf3, 0x8d, 0x2a, + 0x8a, 0xc1, 0x75, 0x5a, 0xed, 0x53, 0xd3, 0xc6, + 0x15, 0x9d, 0x8c, 0x12, 0x98, 0x89, 0x66, 0x28, + 0x05, 0xc8, 0xd1, 0xc4, 0xbf, 0xf7, 0x72, 0x79, + 0xc7, 0x42, 0xde, 0xc8, 0xdc, 0xe9, 0xb4, 0x4a, + 0x92, 0x85, 0x31, 0xb7, 0xc6, 0x51, 0x83, 0x0b, + 0x96, 0x29, 0xdd, 0xe0, 0x3b, 0x7e, 0xbe, 0x7b, + 0x34, 0x23, 0x1b, 0xe1, 0x8d, 0x8a, 0xe7, 0x0f, + 0x12, 0x68, 0x41, 0x4e, 0xaa, 0xf0, 0xeb, 0x9d, + 0xbf, 0xed, 0x00, 0xd9, 0x3c, 0x4d, 0x9a, 0xfb, + 0x9c, 0xfe, 0xc7, 0xca, 0x3f, 0xd6, 0xbf, 0x03, + 0x73, 0x67, 0xcc, 0xc2, 0x38, 0xa3, 0xe0, 0x6e, + 0xe6, 0x4b, 0x63, 0x61 + }, + .len = 800 + }, + .validDataLenInBits = { + .len = 800 + }, + .validCipherLenInBits = { + .len = 800 + } +}; + static struct wireless_test_data zuc_test_case_cipher_200b_auth_200b = { .key = { .data = { @@ -1046,6 +1108,114 @@ static struct wireless_test_data zuc_test_case_auth_584b = { } }; +static struct wireless_test_data zuc_test_case_auth_2080b_mac_128b = { + .key = { + .data = { + 0xC8, 0xA4, 0x82, 0x62, 0xD0, 0xC2, 0xE2, 0xBA, + 0xC4, 0xB9, 0x6E, 0xF7, 0x7E, 0x80, 0xCA, 0x59, + 0xC8, 0xA4, 0x82, 0x62, 0xD0, 0xC2, 0xE2, 0xBA, + 0xC4, 0xB9, 0x6E, 0xF7, 0x7E, 0x80, 0xCA, 0x59 + }, + .len = 32 + }, + .auth_iv = { + .data = { + 0x05, 0x09, 0x78, 0x50, 0x80, 0x00, 0x00, 0x00, + 0x85, 0x09, 0x78, 0x50, 0x80, 0x00, 0x80, 0x00, + 0x85, 0x09, 0x78, 0x50, 0x80, 0x00, 0x80, 0x00 + }, + .len = 24 + }, + .plaintext = { + .data = { + 0xB5, 0x46, 0x43, 0x0B, 0xF8, 0x7B, 0x4F, 0x1E, + 0xE8, 0x34, 0x70, 0x4C, 0xD6, 0x95, 0x1C, 0x36, + 0xE2, 0x6F, 0x10, 0x8C, 0xF7, 0x31, 0x78, 0x8F, + 0x48, 0xDC, 0x34, 0xF1, 0x67, 0x8C, 0x05, 0x22, + 0x1C, 0x8F, 0xA7, 0xFF, 0x2F, 0x39, 0xF4, 0x77, + 0xE7, 0xE4, 0x9E, 0xF6, 0x0A, 0x4E, 0xC2, 0xC3, + 0xDE, 0x24, 0x31, 0x2A, 0x96, 0xAA, 0x26, 0xE1, + 0xCF, 0xBA, 0x57, 0x56, 0x38, 0x38, 0xB2, 0x97, + 0xF4, 0x7E, 0x85, 0x10, 0xC7, 0x79, 0xFD, 0x66, + 0x54, 0xB1, 0x43, 0x38, 0x6F, 0xA6, 0x39, 0xD3, + 0x1E, 0xDB, 0xD6, 0xC0, 0x6E, 0x47, 0xD1, 0x59, + 0xD9, 0x43, 0x62, 0xF2, 0x6A, 0xEE, 0xED, 0xEE, + 0x0E, 0x4F, 0x49, 0xD9, 0xBF, 0x84, 0x12, 0x99, + 0x54, 0x15, 0xBF, 0xAD, 0x56, 0xEE, 0x82, 0xD1, + 0xCA, 0x74, 0x63, 0xAB, 0xF0, 0x85, 0xB0, 0x82, + 0xB0, 0x99, 0x04, 0xD6, 0xD9, 0x90, 0xD4, 0x3C, + 0xF2, 0xE0, 0x62, 0xF4, 0x08, 0x39, 0xD9, 0x32, + 0x48, 0xB1, 0xEB, 0x92, 0xCD, 0xFE, 0xD5, 0x30, + 0x0B, 0xC1, 0x48, 0x28, 0x04, 0x30, 0xB6, 0xD0, + 0xCA, 0xA0, 0x94, 0xB6, 0xEC, 0x89, 0x11, 0xAB, + 0x7D, 0xC3, 0x68, 0x24, 0xB8, 0x24, 0xDC, 0x0A, + 0xF6, 0x68, 0x2B, 0x09, 0x35, 0xFD, 0xE7, 0xB4, + 0x92, 0xA1, 0x4D, 0xC2, 0xF4, 0x36, 0x48, 0x03, + 0x8D, 0xA2, 0xCF, 0x79, 0x17, 0x0D, 0x2D, 0x50, + 0x13, 0x3F, 0xD4, 0x94, 0x16, 0xCB, 0x6E, 0x33, + 0xBE, 0xA9, 0x0B, 0x8B, 0xF4, 0x55, 0x9B, 0x03, + 0x73, 0x2A, 0x01, 0xEA, 0x29, 0x0E, 0x6D, 0x07, + 0x4F, 0x79, 0xBB, 0x83, 0xC1, 0x0E, 0x58, 0x00, + 0x15, 0xCC, 0x1A, 0x85, 0xB3, 0x6B, 0x55, 0x01, + 0x04, 0x6E, 0x9C, 0x4B, 0xDC, 0xAE, 0x51, 0x35, + 0x69, 0x0B, 0x86, 0x66, 0xBD, 0x54, 0xB7, 0xA7, + 0x03, 0xEA, 0x7B, 0x6F, 0x22, 0x0A, 0x54, 0x69, + 0xA5, 0x68, 0x02, 0x7E + }, + .len = 2080 + }, + .validAuthLenInBits = { + .len = 2080 + }, + .digest = { + .data = {0x05, 0x9f, 0xd8, 0x21, 0x90, 0xfb, 0x13, 0x26, + 0x94, 0x37, 0x6d, 0xc0, 0xcc, 0x52, 0xb9, 0xcc}, + .len = 16 + } +}; + +static struct wireless_test_data zuc_test_case_auth_584b_mac_64b = { + .key = { + .data = { + 0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb, + 0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a, + 0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb, + 0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a + }, + .len = 32 + }, + .auth_iv = { + .data = { + 0xa9, 0x40, 0x59, 0xda, 0x50, 0x0, 0x0, 0x0, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x0, 0x80, 0x0, + 0x29, 0x40, 0x59, 0xda, 0x50, 0x0, 0x80, 0x0 + }, + .len = 24 + }, + .plaintext = { + .data = { + 0x98, 0x3b, 0x41, 0xd4, 0x7d, 0x78, 0x0c, 0x9e, + 0x1a, 0xd1, 0x1d, 0x7e, 0xb7, 0x03, 0x91, 0xb1, + 0xde, 0x0b, 0x35, 0xda, 0x2d, 0xc6, 0x2f, 0x83, + 0xe7, 0xb7, 0x8d, 0x63, 0x06, 0xca, 0x0e, 0xa0, + 0x7e, 0x94, 0x1b, 0x7b, 0xe9, 0x13, 0x48, 0xf9, + 0xfc, 0xb1, 0x70, 0xe2, 0x21, 0x7f, 0xec, 0xd9, + 0x7f, 0x9f, 0x68, 0xad, 0xb1, 0x6e, 0x5d, 0x7d, + 0x21, 0xe5, 0x69, 0xd2, 0x80, 0xed, 0x77, 0x5c, + 0xeb, 0xde, 0x3f, 0x40, 0x93, 0xc5, 0x38, 0x81, + 0x00, 0x00, 0x00, 0x00 + }, + .len = 584 + }, + .validAuthLenInBits = { + .len = 584 + }, + .digest = { + .data = {0xf5, 0x45, 0x4a, 0x75, 0x22, 0x39, 0x4b, 0xf2}, + .len = 8 + } +}; + struct wireless_test_data zuc_auth_cipher_test_case_1 = { .key = { .data = {