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 36599A034C; Wed, 29 Jun 2022 11:38:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CABEE400D7; Wed, 29 Jun 2022 11:38:15 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id B74FC40042 for ; Wed, 29 Jun 2022 11:38:13 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25T3sQkN031367; Wed, 29 Jun 2022 02:38:12 -0700 Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2176.outbound.protection.outlook.com [104.47.55.176]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3h0f85989w-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jun 2022 02:38:12 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fjCDyP34OcEQ2cFXkHoWfm/8JHn0b57Lxrc4aTNHDhasBHUnhu0/vElwDhcT6M+slCarvUUSKrCHcs3ufl+ovsk9dARzp58hFXX/zGp2r48rUX5mPmExrCnu4IoG915iSglCwrPBNxK17k3WYK/+gjcghzIt/5xSKq0T/+68RTRHt+ozaiPGHd3enLqVfcd0/A7LWIdlC9VW+m1HncHuYs/C6Zno9GNu/Jm6QHkWVBn3VC2OwvF/qnua/4g24hWP2j6b8oh1jrKEfQWZMCQyCiRw0MFvRT2QKt+oBoWKiCkZkWIVcDlRZoDjz4Ags7aGR3RdZR5T2lKnGrtFkVsM5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9wOaHw60FCw7daC6+OwluVvQ5mnDDm0a/P7nm5etzug=; b=DbA7mjxguAEZSxzJl0WgT+Xyl3vg1Z3iaFBdsd2hgNCtl5NCzrvTb7wsArROAiVtNRS4MbPNzc28nl7CcHx6f9yXvYE7GGJL/ddk2f4MgR1NKuaP3naD8gO8gJEzTyxyoZMzZoVv70Z0y4LjIYrSdufTl6gT5Jt3jSngvZQDlttE9+p5B3+AUPSPdNiiMikxEA3uOycHoqHVBRZcu+U+6yP5YDrzJZo+ugg9YUuGv1aHPcsWaPIluq/Pcj5nYQDkE56nRLwLG/bbjlHrluFIj/pjo9gszbiI6/NrYCVDetW+6OexpiHP4O3oGpQR2PsPJhj66xTm7Oy5jXw4GfB5fA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9wOaHw60FCw7daC6+OwluVvQ5mnDDm0a/P7nm5etzug=; b=YHsvJqgOdeYv0sv0znI26yKZBTm+CpyIxUivPLtCVFSSWktv0JazDkgwF6yuzeFXzS20QcP+KMJVVsOyVkGDqe1GUmUvGtzSoNlvQZbKCxCvi6/+L60xjWfV8WDzpylWW+bnSIAnOTJePTea3mXHGcZbSEhsI3LF6xZy8ntA5OA= Received: from CO1PR18MB4714.namprd18.prod.outlook.com (2603:10b6:303:e9::18) by BY3PR18MB4772.namprd18.prod.outlook.com (2603:10b6:a03:3cf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14; Wed, 29 Jun 2022 09:38:08 +0000 Received: from CO1PR18MB4714.namprd18.prod.outlook.com ([fe80::293d:7dd7:635d:62a3]) by CO1PR18MB4714.namprd18.prod.outlook.com ([fe80::293d:7dd7:635d:62a3%5]) with mapi id 15.20.5395.014; Wed, 29 Jun 2022 09:38:08 +0000 From: Gowrishankar Muthukrishnan To: "Zhang, Roy Fan" , "dev@dpdk.org" CC: "Dooley, Brian" , Anoob Joseph , Archana Muniganti , Jerin Jacob Kollanukkaran Subject: RE: [PATCH v1] examples/fips_validation: add parsing for sha Thread-Topic: [PATCH v1] examples/fips_validation: add parsing for sha Thread-Index: AQHYivD7+9XMqaPjLk28jPH2G18j+q1mDbEAgAAT6GA= Date: Wed, 29 Jun 2022 09:38:08 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f4f6ad6b-533a-4e74-5dc9-08da59b31357 x-ms-traffictypediagnostic: BY3PR18MB4772:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: aNN0xiTQ6PuLYgFpf6wlETR6evBWRqX+Q6vq2+aQxMSTvWEsB1ctKUQB7GmGyVAeVuAo9plXAjh+KM1E8uMbcp0PbcM1R89wpQNtwWKMv0+ugF0EnmCpm5YFZ+iPSXGDeu/xo2vOa8m6pcgHsjZc/E5JNLWt6s6WnQdz9D6MI3TusynzkmK7Y0cmD5iG+B1IpIqlipaqoVaxb+C8mlzwNLA4iCj70dgM2AjSB2tvTXtcN7fZu8kB6cRjo+bsym5AgmedOAvg3lNLSQ5d5oqwcskekWlJsV9vS8/vFDlwp4s1cT23PId2Uzu2o9YK7KLgrbbrtdidgZ8fK3ZH8zoFub+v2fxJCIuZ/iFkysQcKygg6ZP53g8t6KxMKUvILhugUMPVD3FS/wQOklKro9tueBsaqn9x0WWrf6sVgKsU0LHjn1Q6Hd5BUPBY4/71VPeddbYHStu/Gc+TWFm/BtRVh3dIUQgNicPYqt2NkP0KECoELc62gIIJBTsjBEWCZgZv7+EEPR0l4KpCJY52v3qQZFxPbKE/NjLJrWzuy82zHZgMSAZ/R4ioSJNPQKFvGTrYY5f8u5BjxJbQir9WdaWhngROm3ZoYsD0yd4qW+orDKfLwUsBCxJN5gveRGZCFsJ8j7p9p24uYLb9rCCQWvwRC3qbCjJSofYIyojthihj8sSEIcay9pblL4srz10Uk1necmOJCd5+700ntN26i0c6XK/fwAxoAZbaGPE4sDUdZbLnH3LJs505k5EPSnC+DAZ/bLV6/I62YxLAQ5cIMt4aDaKkqnNEwBua36lOf54nmMM= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR18MB4714.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(376002)(346002)(39860400002)(136003)(396003)(366004)(122000001)(66946007)(8676002)(64756008)(66446008)(76116006)(66476007)(66556008)(478600001)(110136005)(316002)(6506007)(186003)(107886003)(54906003)(26005)(4326008)(7696005)(9686003)(33656002)(83380400001)(52536014)(5660300002)(38070700005)(2906002)(41300700001)(86362001)(8936002)(38100700002)(71200400001)(55016003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?x6A6zVCF/vl3NYv8NUjL+u59CQWQbDfe9s5ik63veR2yMx0EbrIHikXNQ8KK?= =?us-ascii?Q?3Xozs4oViiHR/12KDzJuNLF5yXnhdZ8Lv26ahFNWiF/IcYWf8dg+sLl00P0D?= =?us-ascii?Q?6Le9Qm6vuRgPhgZtD/7XwTZdooZucy8zaZQtsHnb+ekNLnczUkrS3xiGEEMX?= =?us-ascii?Q?aBpfO92cPqaxsP0SppuTIR6YmQ0KNtv1JH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y1XZSeKJZPw/Bxak3QVIFHxf0BtvlKC2i9Pcmiax5CBZ05qrZK5u1Cq?= =?us-ascii?Q?0abvEYolfaHIr9sOLhftMcJVh1mXF8gVpoMg4xceqUeBY2kfIm6dDOpefSlP?= =?us-ascii?Q?eDrUYU7y3ULaWgXpFV91YKnGrTFV/bgdZx0o2PxjnteWUK9eOIal3IRT7F+m?= =?us-ascii?Q?8XysztjQz9GWgNiOsYhjb0XcA+Ngo9yp0++LsjKXEiQvArch70QlZ3B6EuWy?= =?us-ascii?Q?CFw3J5pthbgeFLeYTLsCL4zpwnzj23doLClUG0MzoUS6twpYTobvTtATViVB?= =?us-ascii?Q?3T5dw9XyIm74v44mhp6xR8TfhPMVeCmlDzZ7WQeyJdoWZtzAmCMFTdB3ZAAF?= =?us-ascii?Q?d0JztBiR3mtaX98WZYaE5TCIjh0S/TrSoqrpGxUeRSEd99hksoZLiZMPhY69?= =?us-ascii?Q?ZF1RA5qc6Yc4Jx7WSLT+/Xwiitk9kj3lRK1vuLk6ZI/XNI+dhouTW+ayvx2G?= =?us-ascii?Q?70vpfpktBZ87NchIUZPP9B7iSpW/tdF+3yw5oeJw3dNWwi/iNUz+oIABIM1x?= =?us-ascii?Q?bQ=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: marvell.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR18MB4714.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4f6ad6b-533a-4e74-5dc9-08da59b31357 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jun 2022 09:38:08.4232 (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: X3+hp9KvNtl1dbU+XhpTwQTpcKLHr9DcptXRJaMa+2mmd2DWYPJRO7T/W1Y9+9PJb/QlfOTTKFaEY3UZoFhfMC3u3++zBCXnQuExB50L+0E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR18MB4772 X-Proofpoint-GUID: V-0NXfzqD7YkbSOcptio0QJMPhmreocE X-Proofpoint-ORIG-GUID: V-0NXfzqD7YkbSOcptio0QJMPhmreocE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-28_11,2022-06-28_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 Hi Fan, > > --- a/examples/fips_validation/main.c > > +++ b/examples/fips_validation/main.c > > @@ -1693,19 +1693,24 @@ fips_mct_sha_test(void) > > #define SHA_EXTERN_ITER 100 > > #define SHA_INTERN_ITER 1000 > > #define SHA_MD_BLOCK 3 > > - struct fips_val val =3D {NULL, 0}, md[SHA_MD_BLOCK]; > > + struct fips_val val[2] =3D {{NULL, 0},}, md[SHA_MD_BLOCK], msg; >=20 > I see to get around with the callback function limitation you extend the = fips val > to an array. Nice move! But if it is not too much trouble for you - pleas= e > comment the purpose of the change - it will make the future maintenance m= uch > easier! Yes, I have added a comment on why val is an array in V3 patch. >=20 > > char temp[MAX_DIGEST_SIZE*2]; > > int ret; > > uint32_t i, j; > > > > + msg.len =3D SHA_MD_BLOCK * vec.cipher_auth.digest.len; > > + msg.val =3D calloc(1, msg.len); > > + memcpy(vec.cipher_auth.digest.val, vec.pt.val, > > vec.cipher_auth.digest.len); > > for (i =3D 0; i < SHA_MD_BLOCK; i++) > > md[i].val =3D rte_malloc(NULL, (MAX_DIGEST_SIZE*2), 0); > > > > rte_free(vec.pt.val); > > vec.pt.val =3D rte_malloc(NULL, (MAX_DIGEST_SIZE*SHA_MD_BLOCK), 0); > > > > - fips_test_write_one_case(); > > - fprintf(info.fp_wr, "\n"); > > + if (info.file_type !=3D FIPS_TYPE_JSON) { > > + fips_test_write_one_case(); > > + fprintf(info.fp_wr, "\n"); > > + } > > > > for (j =3D 0; j < SHA_EXTERN_ITER; j++) { > > > > @@ -1719,6 +1724,9 @@ fips_mct_sha_test(void) > > vec.cipher_auth.digest.len); > > md[2].len =3D vec.cipher_auth.digest.len; > > > > + for (i =3D 0; i < SHA_MD_BLOCK; i++) > > + memcpy(&msg.val[i * md[i].len], md[i].val, md[i].len); > > + > > for (i =3D 0; i < (SHA_INTERN_ITER); i++) { > > > > memcpy(vec.pt.val, md[0].val, > > @@ -1742,7 +1750,7 @@ fips_mct_sha_test(void) > > return ret; > > } > > > > - ret =3D get_writeback_data(&val); > > + ret =3D get_writeback_data(&val[0]); > > if (ret < 0) > > return ret; > > > > @@ -1751,7 +1759,7 @@ fips_mct_sha_test(void) > > memcpy(md[1].val, md[2].val, md[2].len); > > md[1].len =3D md[2].len; > > > > - memcpy(md[2].val, (val.val + vec.pt.len), > > + memcpy(md[2].val, (val[0].val + vec.pt.len), > > vec.cipher_auth.digest.len); > > md[2].len =3D vec.cipher_auth.digest.len; > > } > > @@ -1759,11 +1767,14 @@ fips_mct_sha_test(void) > > memcpy(vec.cipher_auth.digest.val, md[2].val, md[2].len); > > vec.cipher_auth.digest.len =3D md[2].len; > > > > - fprintf(info.fp_wr, "COUNT =3D %u\n", j); > > - > > - writeback_hex_str("", temp, &vec.cipher_auth.digest); > > - > > - fprintf(info.fp_wr, "MD =3D %s\n\n", temp); > > + if (info.file_type !=3D FIPS_TYPE_JSON) { > > + fprintf(info.fp_wr, "COUNT =3D %u\n", j); > > + writeback_hex_str("", temp, &vec.cipher_auth.digest); > > + fprintf(info.fp_wr, "MD =3D %s\n\n", temp); > > + } > > + val[1].val =3D msg.val; > > + val[1].len =3D msg.len; > > + info.parse_writeback(val); > > } > > > > for (i =3D 0; i < (SHA_MD_BLOCK); i++) @@ -1771,7 +1782,8 @@ > > fips_mct_sha_test(void) > > > > rte_free(vec.pt.val); > > > > - free(val.val); > > + free(val[0].val); >=20 > It took me a while to understand why you don't free val[1] ??. > Nicely done anyway. >=20 > > + free(msg.val); > > > > return 0; > > } > > @@ -1996,6 +2008,9 @@ fips_test_one_test_group(void) > > case FIPS_TEST_ALGO_AES: > > ret =3D parse_test_aes_json_init(); > > break; > > + case FIPS_TEST_ALGO_SHA: > > + ret =3D parse_test_sha_json_init(); > > + break; > > default: > > return -EINVAL; > > } > > -- > > 2.25.1 >=20 > Other than that > Acked-by: Fan Zhang Thanks.