From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C1732A00E6 for ; Sun, 7 Jul 2019 07:41:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C5501325F; Sun, 7 Jul 2019 07:41:21 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 6CA641D7 for ; Sun, 7 Jul 2019 07:41:20 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x675fJmr017203; Sat, 6 Jul 2019 22:41:19 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=c5JeLL2tZPFPccxgxlcyHPJljY7jHanL7ctgw0UFrow=; b=V5C2vbVnLNPII/MFIu7ArPvX2YHojKj6uiK+04zPVySBjOg9UuY5cfHqnAPqy1Cq2mBm ugDdk4yvK+FuLM+daVKxT0HQ9Ms3WyyopwLusPwJSt2xJ04MbnzVH55+KQmDeblDeEuV lqaETLHmM3eMRDdUKS57fZJg3Xqbw2fsqaLJWu9txJfmLVtzHMVZJGpHgI7XKb6fShy+ XRKbMzL2WpLorNoKh1KZ38ig1PbwEWfa96yLVsW0DCyn/E2MTeLEtbv5DF8asUlIcHHa iXDCPJxepTDre4b1kIai77r4MYXYqfuGxMfLlpfZp2c3FDrxRPQYLou8xD9xd9EmoRaX Sg== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2tjs0nttas-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 06 Jul 2019 22:41:19 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sat, 6 Jul 2019 22:41:18 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (104.47.45.59) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Sat, 6 Jul 2019 22:41:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c5JeLL2tZPFPccxgxlcyHPJljY7jHanL7ctgw0UFrow=; b=WdKiy1EHdZi9Op6Xxu+hSnu5FQyEQoIoRiXXGHL7r15j+dkFVR8M+S2NoZvQxG/tUJFndOV+OTvqIDKrrPr7Shg3CEdw0NNkR45su50aTmj5e8LRKF4jp8Sp7h0MIvZ7RIjC/P7lBEvwlNFNG3xwhhv4I/qmMI1gFfJl4+Mitds= Received: from MN2PR18MB2398.namprd18.prod.outlook.com (20.179.81.144) by MN2PR18MB3309.namprd18.prod.outlook.com (10.255.237.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18; Sun, 7 Jul 2019 05:41:13 +0000 Received: from MN2PR18MB2398.namprd18.prod.outlook.com ([fe80::2451:7192:cae4:5980]) by MN2PR18MB2398.namprd18.prod.outlook.com ([fe80::2451:7192:cae4:5980%7]) with mapi id 15.20.2052.019; Sun, 7 Jul 2019 05:41:13 +0000 From: Liron Himi To: Akhil Goyal CC: Fan Zhang , "dev@dpdk.org" , "Liron Himi" Thread-Topic: [PATCH] crypto/mvsam: fix missed code change for mvsam Thread-Index: AQHVMzYB2i6hE/N/zkOpBVkJdZks96a+pg5w Date: Sun, 7 Jul 2019 05:41:13 +0000 Message-ID: References: <20190705132349.7245-1-roy.fan.zhang@intel.com> In-Reply-To: Accept-Language: he-IL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [217.132.250.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 31b49eee-8b7e-4c0d-2962-08d7029db959 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR18MB3309; x-ms-traffictypediagnostic: MN2PR18MB3309: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 0091C8F1EB x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39840400004)(366004)(396003)(136003)(346002)(376002)(199004)(189003)(13464003)(52536014)(68736007)(486006)(76116006)(66556008)(66446008)(6116002)(73956011)(305945005)(66946007)(7736002)(64756008)(66476007)(3846002)(25786009)(8676002)(446003)(476003)(229853002)(99286004)(66066001)(14454004)(86362001)(11346002)(186003)(2906002)(71200400001)(71190400001)(8936002)(6916009)(54906003)(81156014)(81166006)(9686003)(26005)(256004)(53546011)(55016002)(14444005)(6506007)(478600001)(4326008)(76176011)(33656002)(102836004)(5660300002)(7696005)(107886003)(316002)(6436002)(53936002)(6246003)(74316002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB3309; H:MN2PR18MB2398.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 2M4n7OgcOjS7a8aVERS2FAIFqYCBX48A2kaW+qF5EYU3Uf3bZNf6KbthGEdbo76tuRPG8hrYrw6W2eW9SwZcMoU4KZAWUTxj94CEs0k5NEIK2K82mngstojzuYpbLOdzj9t45GxWbGJ4R88oCmmAlCT/LS5DI9Q78R1UIc9KbL7ZhDxlRQ34Xhfa4tNcOMpRftmwXUKXyXUYkdmmGY6Y2b5W6gDz8SsDrwLDMgvjt3kw81umUbQASL/PG3irF5ny1yd2Ex2dZqHR9oI1biCg7MGh3jgh/oG59lg/gyGJodXlVuxz/bmVyS3bH4VRZ2r+E7wzNpT36uibAqMeV+8n+ssZlzBPjGOwgaBspis0hcwmgXRmhVcTCcmASZusVM4tnVgn8XkacVX7ibGZ0hR6sdGEFriTdi8X0Ey9v3Gpxqw= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 31b49eee-8b7e-4c0d-2962-08d7029db959 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jul 2019 05:41:13.7594 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lironh@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB3309 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-07_02:, , signatures=0 Subject: Re: [dpdk-dev] [PATCH] crypto/mvsam: fix missed code change for mvsam X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" -----Original Message----- From: Akhil Goyal =20 Sent: Friday, July 5, 2019 16:32 To: Fan Zhang ; dev@dpdk.org; Liron Himi Subject: [EXT] RE: [PATCH] crypto/mvsam: fix missed code change for mvsam External Email ---------------------------------------------------------------------- Hi Liron, Following patch need to be merged today as it is fixing a build issue for a= patch already merged. Could you please review this patch? Sorry for a very short notice. Thanks, Akhil > -----Original Message----- > From: Fan Zhang > Sent: Friday, July 5, 2019 6:54 PM > To: dev@dpdk.org > Cc: Akhil Goyal ; Fan Zhang=20 > > Subject: [PATCH] crypto/mvsam: fix missed code change for mvsam >=20 > This patch fixes the missed "uint8_t *" to "const uint8_t *" xform key=20 > data type change for mvsam driver. >=20 > Fixes: f3390532cf6a ("cryptodev: make xform key pointer constant") >=20 > Signed-off-by: Fan Zhang > --- > drivers/crypto/mvsam/rte_mrvl_pmd.c | 44 > ++++++++++++++++++++++++++++++--- > drivers/crypto/mvsam/rte_mrvl_pmd_ops.c | 9 +++++++ > 2 files changed, 49 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c > b/drivers/crypto/mvsam/rte_mrvl_pmd.c > index c2ae82a26..65e4769f2 100644 > --- a/drivers/crypto/mvsam/rte_mrvl_pmd.c > +++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c > @@ -222,6 +222,8 @@ static int > mrvl_crypto_set_cipher_session_parameters(struct mrvl_crypto_session *se= ss, > const struct rte_crypto_sym_xform *cipher_xform) { > + uint8_t *cipher_key; > + > /* Make sure we've got proper struct */ > if (cipher_xform->type !=3D RTE_CRYPTO_SYM_XFORM_CIPHER) { > MRVL_LOG(ERR, "Wrong xform struct provided!"); @@ -256,8 +258,17 @@=20 > mrvl_crypto_set_cipher_session_parameters(struct > mrvl_crypto_session *sess, > return -EINVAL; > } >=20 > + cipher_key =3D malloc(cipher_xform->cipher.key.length); > + if (cipher_key =3D=3D NULL) { > + MRVL_LOG(ERR, "Insufficient memory!"); > + return -ENOMEM; > + } > + > + memcpy(cipher_key, cipher_xform->cipher.key, > + cipher_xform->cipher.key.length); > + > sess->sam_sess_params.cipher_key_len =3D cipher_xform- > >cipher.key.length; > - sess->sam_sess_params.cipher_key =3D cipher_xform->cipher.key.data; > + sess->sam_sess_params.cipher_key =3D cipher_key; >=20 > return 0; > } > @@ -273,6 +284,8 @@ static int > mrvl_crypto_set_auth_session_parameters(struct mrvl_crypto_session *sess= , > const struct rte_crypto_sym_xform *auth_xform) { > + uint8_t *auth_key =3D NULL; > + > /* Make sure we've got proper struct */ > if (auth_xform->type !=3D RTE_CRYPTO_SYM_XFORM_AUTH) { > MRVL_LOG(ERR, "Wrong xform struct provided!"); @@ -293,9 +306,21 @@=20 > mrvl_crypto_set_auth_session_parameters(struct > mrvl_crypto_session *sess, > auth_map[auth_xform->auth.algo].auth_alg; > sess->sam_sess_params.u.basic.auth_icv_len =3D > auth_xform->auth.digest_length; > + > + if (auth_xform->auth.key.length > 0) { > + auth_key =3D malloc(auth_xform->auth.key.length); > + if (auth_key =3D=3D NULL) { > + MRVL_LOG(ERR, "Not enough memory!"); > + return -EINVAL; > + } > + > + memcpy(auth_key, auth_xform->auth.key.data, > + auth_xform->auth.key.length); > + } > + > + > /* auth_key must be NULL if auth algorithm does not use HMAC */ > - sess->sam_sess_params.auth_key =3D auth_xform->auth.key.length ? > - auth_xform->auth.key.data : NULL; > + sess->sam_sess_params.auth_key =3D auth_key; > sess->sam_sess_params.auth_key_len =3D auth_xform->auth.key.length; >=20 > return 0; > @@ -312,6 +337,8 @@ static int > mrvl_crypto_set_aead_session_parameters(struct mrvl_crypto_session *sess= , > const struct rte_crypto_sym_xform *aead_xform) { > + uint8_t *aead_key; > + > /* Make sure we've got proper struct */ > if (aead_xform->type !=3D RTE_CRYPTO_SYM_XFORM_AEAD) { > MRVL_LOG(ERR, "Wrong xform struct provided!"); @@ -344,7 +371,16 @@=20 > mrvl_crypto_set_aead_session_parameters(struct > mrvl_crypto_session *sess, > return -EINVAL; > } >=20 > - sess->sam_sess_params.cipher_key =3D aead_xform->aead.key.data; > + aead_key =3D malloc(aead_xform->aead.key.length); > + if (aead_key =3D=3D NULL) { > + MRVL_LOG(ERR, "Insufficient memory!"); > + return -ENOMEM; > + } > + > + memcpy(aead_key, aead_xform->aead.key.data, > + aead_xform->aead.key.length); > + > + sess->sam_sess_params.cipher_key =3D aead_key; > sess->sam_sess_params.cipher_key_len =3D aead_xform- > >aead.key.length; >=20 > if (sess->sam_sess_params.cipher_mode =3D=3D SAM_CIPHER_GCM) diff --git= =20 > a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c > b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c > index f6bf2cd4c..b334c7694 100644 > --- a/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c > +++ b/drivers/crypto/mvsam/rte_mrvl_pmd_ops.c > @@ -751,6 +751,8 @@ > mrvl_crypto_pmd_sym_session_configure(__rte_unused struct=20 > rte_cryptodev *dev, > return -ENOMEM; > } >=20 > + memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session)); > + > ret =3D mrvl_crypto_set_session_parameters(sess_private_data, xform); > if (ret !=3D 0) { > MRVL_LOG(ERR, "Failed to configure session parameters!"); @@ -769,6=20 > +771,13 @@ mrvl_crypto_pmd_sym_session_configure(__rte_unused struct=20 > rte_cryptodev *dev, > return -EIO; > } >=20 > + /* free the keys memory allocated for session creation */ > + if (mrvl_sess->sam_sess_params.cipher_key !=3D NULL) > + free(mrvl_sess->sam_sess_params.cipher_key); > + if (mrvl_sess->sam_sess_params.auth_key !=3D NULL) > + free(mrvl_sess->sam_sess_params.auth_key); > + > + > return 0; > } >=20 > -- > 2.14.5 Based on Fan's comments acked-by: Liron Himi