From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2DB8BA0A0F for ; Thu, 1 Jul 2021 08:58:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E125412A3; Thu, 1 Jul 2021 08:58:25 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A3B1C40040; Thu, 1 Jul 2021 08:58:22 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1616tZT0028861; Wed, 30 Jun 2021 23:58:20 -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-type; s=pfpt0220; bh=+ebM3RejiHoei07xuRAVU8nB3apcNphlmRXdiH7pCHU=; b=Vg0zQZuVaGbQNQ47C2vnZPs32ZIBvGaPKt/F5jpILXU487liD/lQr2rwW0lvNctwzUI/ nDnYzg+gUh2aHmt7MbJ7/Orf6vhshEhjdWwcydyzSn/SyFIM8hIcnH0nsFMBTDrMV+Vx o5NOiEVY1m0Q51NNOlp/HaF9ScmiU0Ked10iZgPA0d7s2R82zVIAOA1Niw1UKkBmdcCs i24Ag5wm43V3VU2sD2oGIQ5Nv+cKelfVJVKSh690Qw4PgFdLticlnpsX2VOJaVaUUQj3 8Tzkko7YigiQ8m4ggDwuJHtrsAWbxmbp9QFpOhabfXYHLntLUvPNIxwt70RcrXWFvXIn TA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 39h2h4hg3e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 30 Jun 2021 23:58:20 -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; Wed, 30 Jun 2021 23:58:19 -0700 Received: from jupiter077.il.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; Wed, 30 Jun 2021 23:58:17 -0700 From: To: CC: , , , , Date: Thu, 1 Jul 2021 09:58:12 +0300 Message-ID: <20210701065812.31008-1-danat@marvell.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: UMHk5saFbIcktOFxl52VO7xJER5riYbN X-Proofpoint-ORIG-GUID: UMHk5saFbIcktOFxl52VO7xJER5riYbN X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-01_01:2021-06-30, 2021-07-01 signatures=0 Subject: [dpdk-stable] [PATCH] crypto/mvsam: set session params for AES-GCM mode X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Dana Vardi For AEAD session and AES-GCM mode, IV offset will set to include the Nonce. In addition, the following operations order will define: first encryption and then authentication. Fixes: 8a61c83af2fa ("crypto/mrvl: add mrvl crypto driver") Cc: stable@dpdk.org Signed-off-by: Dana Vardi Reviewed-by: Liron Himi Tested-by: Liron Himi --- drivers/crypto/mvsam/rte_mrvl_pmd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c index 9054210ce..d8e07e9c1 100644 --- a/drivers/crypto/mvsam/rte_mrvl_pmd.c +++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c @@ -361,6 +361,14 @@ mrvl_crypto_set_aead_session_parameters(struct mrvl_crypto_session *sess, sess->sam_sess_params.cipher_mode = aead_map[aead_xform->aead.algo].cipher_mode; + if (sess->sam_sess_params.cipher_mode == SAM_CIPHER_GCM) { + /* IV must include nonce for all counter modes */ + sess->cipher_iv_offset = aead_xform->cipher.iv.offset; + + /* Set order of authentication then encryption to 0 in GCM */ + sess->sam_sess_params.u.basic.auth_then_encrypt = 0; + } + /* Assume IV will be passed together with data. */ sess->sam_sess_params.cipher_iv = NULL; -- 2.17.1