From patchwork Tue Dec 20 14:32:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 121091 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 C7EA4A0545; Tue, 20 Dec 2022 15:34:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE90142D69; Tue, 20 Dec 2022 15:33:27 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 9A2A042D10 for ; Tue, 20 Dec 2022 15:33:25 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BKEOQ0v018991 for ; Tue, 20 Dec 2022 06:33:25 -0800 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=8Lw8WQ2XJMBqwPqEp2AgDi4khP9BeF8K4dNibNQI9Rk=; b=N5fGYhW6aBoJbzgiyWrg2zq2bk69g7hqe9wZ4yEu2SPKT7dE5cT5gM3jiu97p9hzTKrw G8CLhvHB0PoteSe7QPvje0oYcfqZLR1RYDagAp4oXGDkX4WUzmAtuyz4kDAofG96sb+n 2SpytkJO2vqO9kPxj0i9/MVSoPLA6+nrfI9fmAnRm9TcVN7aTCN3Mw0Cj0/PtrKbINHT jYTIsbPpuVT9nxvmPixCj+sFqT/B5Mx0EOgfJAWKEqRzU1xNeT/77TVPSV4K7dgmL1Qn +TXDKC1kERnU0AxKTwUrUrBIuCpPm9ZSEUmfXjb7TGyfehZ4s6qHjWjbribo8d6y7CkQ Ow== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3mhe5rnb5x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 20 Dec 2022 06:33:24 -0800 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.42; Tue, 20 Dec 2022 06:33:22 -0800 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.42 via Frontend Transport; Tue, 20 Dec 2022 06:33:22 -0800 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 87C1C3F7070; Tue, 20 Dec 2022 06:33:20 -0800 (PST) From: Tejasree Kondoj To: Akhil Goyal CC: Anoob Joseph , Vidya Sagar Velumuri , Gowrishankar Muthukrishnan , Volodymyr Fialko , "Aakash Sasidharan" , Subject: [PATCH 17/17] common/cnxk: remove salt from session Date: Tue, 20 Dec 2022 20:02:32 +0530 Message-ID: <20221220143232.2519650-18-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221220143232.2519650-1-ktejasree@marvell.com> References: <20221220143232.2519650-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: nM0wSn8c5EVtB4bV9IbsjgdBK8cSgTpe X-Proofpoint-ORIG-GUID: nM0wSn8c5EVtB4bV9IbsjgdBK8cSgTpe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-20_05,2022-12-20_01,2022-06-22_01 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 From: Anoob Joseph Complete 16B IV can be passed in DPTR to microcode. Passing salt in CPTR cannot be supported as the salt need to be given in different formats when CTX is enabled. Signed-off-by: Anoob Joseph --- drivers/common/cnxk/roc_se.c | 17 +++-------------- drivers/common/cnxk/roc_se.h | 2 +- drivers/crypto/cnxk/cnxk_se.h | 6 +++--- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/common/cnxk/roc_se.c b/drivers/common/cnxk/roc_se.c index f335c2367f..6f0a81b22c 100644 --- a/drivers/common/cnxk/roc_se.c +++ b/drivers/common/cnxk/roc_se.c @@ -497,8 +497,9 @@ roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type type, } int -roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, - const uint8_t *key, uint16_t key_len, uint8_t *salt) +roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, const uint8_t *key, + uint16_t key_len) + { bool chained_op = se_ctx->ciph_then_auth || se_ctx->auth_then_ciph; struct roc_se_zuc_snow3g_ctx *zs_ctx = &se_ctx->se_ctx.zs_ctx; @@ -520,18 +521,6 @@ roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, zuc_const = zs_ctx->zuc.otk_ctx.zuc_const; } - /* For AES-GCM, salt is taken from ctx even if IV source - * is from DPTR - */ - if ((salt != NULL) && (type == ROC_SE_AES_GCM)) { - memcpy(fctx->enc.encr_iv, salt, 4); - /* Assuming it was just salt update - * and nothing else - */ - if (key == NULL) - return 0; - } - if (type == ROC_SE_AES_GCM) se_ctx->template_w4.s.opcode_minor = BIT(5); diff --git a/drivers/common/cnxk/roc_se.h b/drivers/common/cnxk/roc_se.h index d1ef71577c..e9415f21a5 100644 --- a/drivers/common/cnxk/roc_se.h +++ b/drivers/common/cnxk/roc_se.h @@ -370,7 +370,7 @@ int __roc_api roc_se_auth_key_set(struct roc_se_ctx *se_ctx, roc_se_auth_type ty const uint8_t *key, uint16_t key_len, uint16_t mac_len); int __roc_api roc_se_ciph_key_set(struct roc_se_ctx *se_ctx, roc_se_cipher_type type, - const uint8_t *key, uint16_t key_len, uint8_t *salt); + const uint8_t *key, uint16_t key_len); void __roc_api roc_se_ctx_swap(struct roc_se_ctx *se_ctx); void __roc_api roc_se_ctx_init(struct roc_se_ctx *se_ctx); diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 1827b0d7b3..0e5d2dde39 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -1708,7 +1708,7 @@ fill_sess_aead(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) } if (unlikely(roc_se_ciph_key_set(&sess->roc_se_ctx, enc_type, aead_form->key.data, - aead_form->key.length, NULL))) + aead_form->key.length))) return -1; if (unlikely(roc_se_auth_key_set(&sess->roc_se_ctx, auth_type, NULL, 0, @@ -1866,7 +1866,7 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) } if (unlikely(roc_se_ciph_key_set(&sess->roc_se_ctx, enc_type, c_form->key.data, - c_form->key.length, NULL))) + c_form->key.length))) return -1; if ((enc_type >= ROC_SE_ZUC_EEA3) && (enc_type <= ROC_SE_AES_CTR_EEA2)) @@ -2072,7 +2072,7 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) } if (unlikely(roc_se_ciph_key_set(&sess->roc_se_ctx, enc_type, a_form->key.data, - a_form->key.length, NULL))) + a_form->key.length))) return -1; if (unlikely(roc_se_auth_key_set(&sess->roc_se_ctx, auth_type, NULL, 0,