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 CDD89A04FD; Fri, 7 Oct 2022 19:53:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2DF0400D5; Fri, 7 Oct 2022 19:53:02 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1AEBA40042 for ; Fri, 7 Oct 2022 19:53:00 +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 297FLkJe007146; Fri, 7 Oct 2022 10:53:00 -0700 Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3k2pperju9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Oct 2022 10:53:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X4ZDsPE9LOfnJP2gLLBkuRAmTJ5ZxG3xUt/5qCe8eltL8rhOo/4N5xZwuXrZy9muL6CvRVXK4zgy2/XcPZyhVb/CzTVN2d/yZMP05Z7MMaU/opHaVmFAjMqTqw3cfc5oQ97wmqZRUwvYB9BaP4wieTK/D4ulpOq6UhAsaW6imABOWrL6kmvyIm5MZFZaoIrjr/VxsBpc7N6KGy1KE612gJDKfjANTx3jAgcIBc/MybujveT1LLAG+uUdIMRWTs41CX5zPl7Dw1NY83r4jhzKVW3+Nt5a8emlJg956vOwRC1g4O79J/DEiK/pAN8ion4XPIfd3LjL+xMK40CBIqYAjg== 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=oQxl7an7ABYfk+ckdj3WI4M5yi5jJSt0W6nu5PaRh3w=; b=L2hqv8JXvtrhnaiU6JzHlgu6VtCHPXnvo080cwH8tC6MJwcIOPBVQRiCamGa2kKPudljObhkmJKmyvqc3ZJuEAgYBEExojOcT/1vAyqGrasrOeStW2V45QWp/6tkmJRgYYiqjUvr64eKq6tTuRK4V0EqyooctKmrIFQ16oRNh3gtJABVmezzLKvJofNuB/D0Al9t+uy3vE73LmcTZTNeW6LdJU6AGxXI9gKDQL53nFUglmJJ2UqCKmai8wxPE/fGmF3IxQBQ/MCPiQpYLFO7hlcpaBq+olWtGfmd/fGUWJvEMpZgZKDK9fIV38kdL9+jUlHU/of9wuHsqut3RpsiwQ== 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=oQxl7an7ABYfk+ckdj3WI4M5yi5jJSt0W6nu5PaRh3w=; b=VTKHoBLqG756KoW2bF0AhGOfEaCarOqmOs/6JFfzYvOQswEEGdzyOPFgUS29hochUgsTj3c3CVeTpml6YegbuH4UyyNa9UDy/YA0oSvoKcNClMN17wqUjdaLAdz6Pls/G0KodpJVD0yKdM8xrAL0lN2eG934rnJoT47vjAGzZts= Received: from CO6PR18MB4484.namprd18.prod.outlook.com (2603:10b6:5:359::9) by PH0PR18MB4800.namprd18.prod.outlook.com (2603:10b6:510:cf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Fri, 7 Oct 2022 17:52:57 +0000 Received: from CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::ee27:3b96:a580:ba9e]) by CO6PR18MB4484.namprd18.prod.outlook.com ([fe80::ee27:3b96:a580:ba9e%9]) with mapi id 15.20.5676.033; Fri, 7 Oct 2022 17:52:57 +0000 From: Akhil Goyal To: Gowrishankar Muthukrishnan , "dev@dpdk.org" CC: Anoob Joseph , Fan Zhang , Brian Dooley , Jerin Jacob Kollanukkaran , Gowrishankar Muthukrishnan Subject: RE: [v2 3/7] examples/fips_validation: add function to calculate SHA hash size Thread-Topic: [v2 3/7] examples/fips_validation: add function to calculate SHA hash size Thread-Index: AQHY0kJ8Lghd18OAN0ywxZM1HP8wua4DRcrA Date: Fri, 7 Oct 2022 17:52:57 +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-traffictypediagnostic: CO6PR18MB4484:EE_|PH0PR18MB4800:EE_ x-ms-office365-filtering-correlation-id: b65fb4fa-50a6-4f1d-59a2-08daa88cc47d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lN02a0tq8omK/18qLgdJobKcc3vjobv8XoBQjnWWuQH2sZFuarzWv/brjO6bcU5Tvs1imVOgc6BDWL45pCZKXvCIMLV56Tu7ebLbSPSTV9d/Rj+du1CMy7nEsK2teclesPwACYubARynQNfEjIuJdGq2S7nFtjqZbmTYcu0lyg66TURHf3Mjx7lcH5rQJS897hi3FD0YSCXpB0W23G2yDH6gUXRZ0wffpiV71IQsSy0WkKiGP7OInza2PO7YoP0d4PXef9AOHMZNgnX/CqXY4tj32CKbKjXuOd2fEJoIWZK5fYXWKpw0D7pIH81OY2PUcw9FSQ9kO3pvIh7A+yLNDRNQJxOBGYuHxQZxr3GaIP3Gx0S3QLBKjBrt1c2Ua813tJPqA5As7xd3YGZrU7MmJrGdnUQ/Ewxa4du3tIf97eDcfpVouigaGTsxDhjRlJPa9QsCd2mp1TCu9c9nED7zhKi//ro/fpMu/gRAECsoK6ebAGa01k/xCxnao7PbK5gZ+LQm1IRlQZoKe12SvXqFtwV9A4sjSPSl1dPchgBRnvYOOcUaDjifrqawI8MuneS//oJXu1IkjPDTC8ogTqUW1OmoxV6SUZN/HNy03qOlmUJ6aa/0v42Y/apJ1Rjl17Z0BptbkhPhIQElIdPsFtM0XzeJ9Xke+0/3NA9J/DsMEy90VJNGyVfc6afHw+qGyY6QaLOYubTq+oguNUrt0iHAxTG23lhx/PpQpnjfZuj3mbTOOdoH/h4h6qdcaJ58BMlyWel8hiE/uhkS46T3rcrHzA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR18MB4484.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(376002)(396003)(136003)(39860400002)(346002)(451199015)(55016003)(86362001)(38100700002)(316002)(9686003)(186003)(5660300002)(2906002)(71200400001)(76116006)(26005)(4326008)(110136005)(54906003)(66556008)(66946007)(66446008)(66476007)(8936002)(38070700005)(33656002)(52536014)(83380400001)(107886003)(64756008)(8676002)(478600001)(122000001)(6506007)(7696005)(55236004)(41300700001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?wGvbjsI4wseqBCgxixqleoRKwYyIsHFJFMxzz/82U/fg1bFvJcKbtbERs5lK?= =?us-ascii?Q?LLhsvicn/xzAvVHDbHePzsyu1E9T86klRKk1IREIr8ASiI1BiZDF33CQKGgL?= =?us-ascii?Q?nkhzqyoTqWFj6bTW52yPXsnoFpCImgdZ+HqO06BGtjHbJ0zqsdS31mh2+/Re?= =?us-ascii?Q?9dBnGZ5gG3rTtMj7jOe2VKY8xghgogEtN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YTblNzRuu+zRLSI3arHe0O7+v1cui1Nvh5PDlUNwdbTBqOKOCaE+y?= =?us-ascii?Q?Cj+F3Kw8OYwgdeW8OQdIyTfVC5XqrWMPILL9j8aJQYFVmjGmrWGsRnaHirnx?= =?us-ascii?Q?n83HCJlNUFgzkFT9qwaxdyTE2jcRIZnvFVn5aC173lHTCGnccw6ImrYZI0fn?= =?us-ascii?Q?0FDNpVf/Ykh2lvyn4o4poL+izuUQcc6GYTAkdY63kVZh+ZaRTPZgasN9s5mr?= =?us-ascii?Q?XdhJbGLPN9JQZYl6NHBah2NyIzGkK0P51Y90UxXdVYsnXhDuod8bXAfhXNjO?= =?us-ascii?Q?3IzOBtRULSiONgILasjiUh4L+dZqeUK4Li0IkqNZS8Qeuoqop+QPdsSnZHdN?= =?us-ascii?Q?VXcsEYpoi/AAvbzkHIs4dBiYJlM6zwdxdi7Wet6AyMcKnBpGFXOi5L65+EKK?= =?us-ascii?Q?BlcUzGhAVZfeH26ncktSTJUR/wgYCNVjV4oXopoEEf90+gD0aSLdx0+sip03?= =?us-ascii?Q?PJ/FuA7h8LHycwCI5BupbIbNcD3pjVBtokrxJvru?= 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: CO6PR18MB4484.namprd18.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b65fb4fa-50a6-4f1d-59a2-08daa88cc47d X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2022 17:52:57.1471 (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: Jo1FBdHBDzt+bIG60q9sDIxmL56NdYsMsEMh3ys9UKyonviZW1OZXjaVsPobzZekyx6XLxFlLfN05q5Qi2jnkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR18MB4800 X-Proofpoint-GUID: RmrAq8xdKa5VyOzWHaz9JZhV447XX8ro X-Proofpoint-ORIG-GUID: RmrAq8xdKa5VyOzWHaz9JZhV447XX8ro X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-10-07_04,2022-10-07_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 > Subject: [v2 3/7] examples/fips_validation: add function to calculate SHA= hash > size >=20 > Add function to calculate hash size for a given SHA hash algorithm. >=20 > Fixes: d5c247145c2 ("examples/fips_validation: add parsing for SHA") >=20 > Signed-off-by: Gowrishankar Muthukrishnan > Acked-by: Brian Dooley >=20 > --- This patch caused a build failure for cross compile. [713/820] Compiling C object 'examples/c590b3c@@dpdk-fips_validation@exe/fi= ps_validation_fips_validation_sha.c.o'. ../examples/fips_validation/fips_validation_sha.c: In function 'parse_test_= sha_hash_size': ../examples/fips_validation/fips_validation_sha.c:44:10: error: implicit de= claration of function 'atoi' [-Wimplicit-function-declaration] 44 | ret =3D atoi(phsc[i].str); | ^~~~ ../examples/fips_validation/fips_validation_sha.c:44:10: error: nested exte= rn declaration of 'atoi' [-Wnested-externs] Added include file in fips_validation_sha.c #include > v2: > - fixed include file > --- > examples/fips_validation/fips_validation.h | 1 + > .../fips_validation/fips_validation_sha.c | 39 ++++++++++++------- > 2 files changed, 25 insertions(+), 15 deletions(-) >=20 > diff --git a/examples/fips_validation/fips_validation.h > b/examples/fips_validation/fips_validation.h > index a6288e17e5..6e5f2fce75 100644 > --- a/examples/fips_validation/fips_validation.h > +++ b/examples/fips_validation/fips_validation.h > @@ -374,4 +374,5 @@ int prepare_gcm_xform(struct rte_crypto_sym_xform > *xform); >=20 > int prepare_gmac_xform(struct rte_crypto_sym_xform *xform); >=20 > +int parse_test_sha_hash_size(enum rte_crypto_auth_algorithm algo); > #endif > diff --git a/examples/fips_validation/fips_validation_sha.c > b/examples/fips_validation/fips_validation_sha.c > index 75b073c15d..cac2a25e6c 100644 > --- a/examples/fips_validation/fips_validation_sha.c > +++ b/examples/fips_validation/fips_validation_sha.c > @@ -33,6 +33,22 @@ struct plain_hash_size_conversion { > {"64", RTE_CRYPTO_AUTH_SHA512}, > }; >=20 > +int > +parse_test_sha_hash_size(enum rte_crypto_auth_algorithm algo) > +{ > + int ret =3D -EINVAL; > + uint8_t i; > + > + for (i =3D 0; i < RTE_DIM(phsc); i++) { > + if (phsc[i].algo =3D=3D algo) { > + ret =3D atoi(phsc[i].str); > + break; > + } > + } > + > + return ret; > +} > + > static int > parse_interim_algo(__rte_unused const char *key, > char *text, > @@ -212,6 +228,7 @@ parse_test_sha_json_algorithm(void) > json_t *algorithm_object; > const char *algorithm_str; > uint32_t i; > + int sz; >=20 > algorithm_object =3D json_object_get(json_info.json_vector_set, > "algorithm"); > algorithm_str =3D json_string_value(algorithm_object); > @@ -226,23 +243,15 @@ parse_test_sha_json_algorithm(void) > if (i =3D=3D RTE_DIM(json_algorithms)) > return -1; >=20 > - for (i =3D 0; i < RTE_DIM(phsc); i++) { > - if (info.interim_info.sha_data.algo =3D=3D phsc[i].algo) { > - vec.cipher_auth.digest.len =3D atoi(phsc[i].str); > - free(vec.cipher_auth.digest.val); > - vec.cipher_auth.digest.val =3D calloc(1, > vec.cipher_auth.digest.len); > - if (vec.cipher_auth.digest.val =3D=3D NULL) > - return -1; > - > - break; > - } > - } > + sz =3D parse_test_sha_hash_size(info.interim_info.sha_data.algo); > + if (sz < 0) > + return -1; >=20 > - if (i =3D=3D RTE_DIM(phsc)) { > - free(vec.cipher_auth.digest.val); > - vec.cipher_auth.digest.val =3D NULL; > + free(vec.cipher_auth.digest.val); > + vec.cipher_auth.digest.len =3D sz; > + vec.cipher_auth.digest.val =3D calloc(1, sz); > + if (vec.cipher_auth.digest.val =3D=3D NULL) > return -1; > - } >=20 > return 0; > } > -- > 2.25.1