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 11749A00C5; Wed, 29 Jun 2022 10:25:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 98C78400D7; Wed, 29 Jun 2022 10:25:43 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 16F4A40042 for ; Wed, 29 Jun 2022 10:25:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656491141; x=1688027141; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=kB//IzF4LvV1Fj0t2B4Fal2Yw7N+y+a9WJQCqjxA+vc=; b=dWOYaBP8c1Cq3FcE18hzQpDr1/gXMB5BimPwlCysVN8/aJO9y/2VL7qm +Y9KORioeBiSvEhhO89tpQ2OiLDGMXpjYKY0hNPjTDx7C9QN3aNDvZOx6 UnQkhIaCt797Q+cbJPo52Y1FUWXz6CVoO03I+1lc/0ydfc6vXFQ3f8D64 zfAkuVMszrVPJczwuwfmT2upm2Ev6v5UR+p0wBKrgSWCI92cRSa40jhSc ZbQ/XfoOLxMSywOOdMOCSKf8MEzCaZ7evhf/Btw4yMxbExujLEHHFIlsl vnM3LDmQ5uWqfFs4NSd3VKhFSmBJn2VceUPUoChlJHjwkQSpmn7PFyIR3 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10392"; a="307461224" X-IronPort-AV: E=Sophos;i="5.92,231,1650956400"; d="scan'208";a="307461224" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2022 01:25:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,231,1650956400"; d="scan'208";a="590613496" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by orsmga002.jf.intel.com with ESMTP; 29 Jun 2022 01:25:38 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 29 Jun 2022 01:25:37 -0700 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 29 Jun 2022 01:25:37 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 29 Jun 2022 01:25:37 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.103) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 29 Jun 2022 01:25:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZTxE9ql1vFNXcucN3hedN4FouldvDcqZZrnv86J7E0QZbsrHrRl5uzhCy0cHhasIlCn7ijXGIAt/W968O4MZjCI3eLuOWI+XkJ4luLc9didwSp5YdagQD4eZTfZ/YhAJ5l3Ahz4FH+GwqZy2WxKzTKFkEs16GkswdOgu8lrktkcyJFqL646iTV18FDrWperpYOiRPI+7VnIDYRiKk3V7Rez+65Iuk7yTM6VlAcxlc0AksDa1OWVKryvSkUEZa9qyorou/kPKSjURQT68extJisUC/T13P9xt6wtThBmZPARM4zH4Bq+wtLoduhiG1o0XNstA4R7rWvoJg9HxIjf+dQ== 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=7zHGxVXAFDMhCZJfd9oo/XyIOw0cDXnbCn4h8EKMOGE=; b=M1cZiQE2mIVGtlpdPFntlDHBWvh2qk+JM4HQVy4JvGJFcdRSx7u3DiGAXHJQMnGi3xeZWGGUeKXsyD/IsRJChd9lAXkJAMSNtaPDOqFIXvxMUHCtUC4j1YndNat+ULLnWB2L0vIbEyXAsS3/Y7qxjUs3c8QLDkHLjME3N9Y8DuFjVZbXcN6o0lZ6HSyFWDKe3Gkg5/WamrQq0dVvZfdgMuaF9Z724ZZAKp37J3KmgQH/79Gc/DqwebCzz9ZiQaNB3WNs774hLONSvto3xMADAk2fG8YDgW7YbAmXdzCec1lFS8qTyulB7oiICgvVK1gqFwi1qxc1VfEQb6etnqpp/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW5PR11MB5809.namprd11.prod.outlook.com (2603:10b6:303:197::6) by DM4PR11MB5261.namprd11.prod.outlook.com (2603:10b6:5:388::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.17; Wed, 29 Jun 2022 08:25:29 +0000 Received: from MW5PR11MB5809.namprd11.prod.outlook.com ([fe80::6537:6de6:7337:1b87]) by MW5PR11MB5809.namprd11.prod.outlook.com ([fe80::6537:6de6:7337:1b87%6]) with mapi id 15.20.5353.016; Wed, 29 Jun 2022 08:25:29 +0000 From: "Zhang, Roy Fan" To: Gowrishankar Muthukrishnan , "dev@dpdk.org" CC: "Dooley, Brian" , Anoob Joseph , Archana Muniganti , Jerin Jacob Subject: RE: [PATCH v1] examples/fips_validation: add parsing for sha Thread-Topic: [PATCH v1] examples/fips_validation: add parsing for sha Thread-Index: AQHYivD/DzsDPqTjNU+46iysKaak6K1mC8xA Date: Wed, 29 Jun 2022 08:25:28 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-Hans-HK, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: da5283f6-5414-48e9-1866-08da59a8eced x-ms-traffictypediagnostic: DM4PR11MB5261:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7mDQRCMlvn/M7dQ6txcKdwobbp3UmXPAKAm2+Uf6rDN99tyLBCBbElxC1MJ5VqHmZL8ypo2fGMZC5oXEOgHplt/FpoCx+w16Rtf3P9otbmSXzuJ1c85i/LsFGQpmqlwLTlIuNJJbFJZ9kYIuJyoV9nbF1EddStxBVFhxt6yVlM/qH9VojeGjjCewEnVOIhxbSU2RqHyUc6cgAJB1Os3Bo6SZHBM+T30N7MgRkHSDUXDFMF+FtKlG33HUbj/iURv9gotW46bnTV42qf4ttM79MeMA52q1tN7k1EM3i9ggAi5nI8LLv3EHQAHV+CcAHXOkiSz0YPFQLj4rKNeKsXSiXZbg1omqUkURPOzudXvbgmMIeKYXlqIG+8M8vpF4q69tGFuW2QmeiOhPQ2D8a1Qj9UxeUmEHvDlhopjf5S8BUOwMTVKktXpPLCv2DcbcEetOY4zT4rwtus/WVwtCNqUZ0KByk775vAFT4s2Ypay6aUc+tQjRoG+sfbU4vvXBeiy40rMd1Ykr9vudelCVQMwt7Td59d0QWQ98DUoX+1mg7vDnyd/STPQ+XioQneYbaY9CBA7SyhFl7kKaFFANbDvRO89VXijsRZ5Bbxc+zZQ4kUvi2IDdpcQtmCqrPyqJ9jT8O4yDWU7A6GkvZujv3r6PLYQqBF+Hr8wHoVq1siNmssiXQZVk7cj2+UOkd2HBGoKnColNvy8oT/ryDMpxc0E+zAAuEZA3uoVEInZiMqo1Gg7O5rAPdL2HCb45A1Gwj+ELtS0xcLmt0W/vOajCpPvd5H9KWu3FC+HzAqYDkfk0wWg= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW5PR11MB5809.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(376002)(396003)(39860400002)(136003)(366004)(346002)(54906003)(7696005)(478600001)(110136005)(71200400001)(26005)(186003)(53546011)(6506007)(66446008)(86362001)(66556008)(66946007)(316002)(41300700001)(76116006)(9686003)(55016003)(83380400001)(33656002)(8676002)(82960400001)(52536014)(122000001)(4326008)(2906002)(8936002)(66476007)(64756008)(5660300002)(38100700002)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?cW/UzIIBiU3Aeswfi1TkGjc/OLmjor3HtYkFU0aJVio14BJ2KJtY5Wts?= =?Windows-1252?Q?luI2eYrKu4Kn5V8FXsVPdseItF7XTd/iIiafejT5FZIk6WTOEqlcWsh7?= =?Windows-1252?Q?bUpEUW59vS8F6CudtMme7c+MS4H0RPLy179bPq42mHKQIKnhDnRDbvnJ?= =?Windows-1252?Q?/ijdMrjbGus0C4xtJ6HwMEolN+Sxs+W/Psrb85w4EDUvyV/zLk73eBJq?= =?Windows-1252?Q?PlFEWr2LuvBnYpkoGiGr4jQAV0eoKHAp972QcEgM66BJCz7jNgGOweyr?= =?Windows-1252?Q?4PpwewO1oI+HuyEy0KiWft270Qsx8MPLJDrPP4dwlCHUUiJgIPpzp9AM?= =?Windows-1252?Q?SutXILkxJo/3ZS3OCzFNJ/GNtFatUfprMvog7R6gmwdqxNhMaMMa+Rt5?= =?Windows-1252?Q?6QWCJa+ExXWT3L4BjS/viIqZ6Scy1CL8dAFIhsSZkXRbPCirZ21/AJyD?= =?Windows-1252?Q?hQAXCzNawA6M+Rcu6y1xvYYsmOIJXzgn+/9Maoq+gBgMFVEhxxmkuo28?= =?Windows-1252?Q?6KV8e03LIRS9hAbPz8756A2Wz0arbqk+R2zBE7PEmErC6PIk3DiVJ2xT?= =?Windows-1252?Q?8ZkDqt1JX6AS2SMa+EirdA7Hf73FH81oUAxgtg+00fzIYH9Tn023++7z?= =?Windows-1252?Q?VCyQorLCIBqeIGuUH7Td/aUTaGlvmc9QA2enr2L4c5nUuZ7y3IQN3Ave?= =?Windows-1252?Q?gmdpw35/QUJZdM/x50QfPBngfX85MBsRMAJ9vP+nkXoxUGLBJRLO7bbu?= =?Windows-1252?Q?drVaxL4ahF9NzFWfozqMiDFwLUzAbOdeN6NKJ8XrWYVZzc53nBuKz2Wv?= =?Windows-1252?Q?IbwHJXQJVKY3z4+djUodEXtbgJelOQGJtDUicCbiW+fNDdgeHWW6HO7B?= =?Windows-1252?Q?Qau7vDWB0p2J6e7B1qC4u9gaWBEfiioMC/ONonW7zRyd6K0uDPfA7B5P?= =?Windows-1252?Q?DqBYjshf9Rnp1cwzzwJuBi4KuZuEUnDb7LI2N1wWOCGRn7JRyq8xk6/h?= =?Windows-1252?Q?lL87Uf+FY/FeV6xb5qCE2KuJnHNFRbeNErspCgNXfuDv/fYhiwiZfeef?= =?Windows-1252?Q?LPf0e0xarbTWsY0cFo2/+/w0WFDLaLlI/cgkJ4/PQk3Gej7mbvvl1aHY?= =?Windows-1252?Q?3UWXXy+KnooiBksDOAEz/gxN1IlMo3ddx5vAetwmiq882V/sOaUeJvBo?= =?Windows-1252?Q?Z0lpJbDFkKEIilIi/rbdrnm4nP89v1rKYpHrnsNlT/ASUfULf/PpBMSf?= =?Windows-1252?Q?CzdOI8z1AZLgTXzKkg80vGwiMKbo0qEZ2sLcTvnmoDkxIlQczpns5kvK?= =?Windows-1252?Q?rVDTR8fD7R+D3sIhUVLyV3qoUpa0Z9NY/UBdMFNJUMmwjXXYBFpmRVGO?= =?Windows-1252?Q?E33bx8pCNlrDsofjT3Xc/o9JllEJLoUo/Zt/I9CFvSbBsm+wMBSFmwll?= =?Windows-1252?Q?Sgci8Ct4m7zqI7jrqSFZ/c0QycXZwqdILy+Oxrh3FeBVMveZosyne9l2?= =?Windows-1252?Q?IJa9YUaRGLMwDd1tY6SkNyZoElco1hAkdWryt172gE8ubrom/nikEt8I?= =?Windows-1252?Q?NpzXU3pGUjM77fWtj8AtbovyJkC0N6CnjPGwRL8mDUGPQEk03FwOS/Ac?= =?Windows-1252?Q?MiYfHZBP/y6pbAB45+NF1CBHk3MfMmuux4A0HX/JGm8M7HFV1K015fDR?= =?Windows-1252?Q?duC3fHotjNg2Sb2LSgnu0lgDlihUd/LM?= Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW5PR11MB5809.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: da5283f6-5414-48e9-1866-08da59a8eced X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jun 2022 08:25:29.0060 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jEGil7FvE08cIfFna0cxuHRSRQ2HmokSnVkUkWQhLl21Y+ABjWn6hYzwwnTh+RwPTusCbpceKaqWGhsv+S4eag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5261 X-OriginatorOrg: intel.com 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, > -----Original Message----- > From: Gowrishankar Muthukrishnan > Sent: Tuesday, June 28, 2022 2:14 PM > To: dev@dpdk.org > Cc: Zhang, Roy Fan ; Dooley, Brian > ; Anoob Joseph ; Archana > Muniganti ; Jerin Jacob ; > Gowrishankar Muthukrishnan > Subject: [PATCH v1] examples/fips_validation: add parsing for sha >=20 > Added function to parse algorithm for SHA test. Verified with SHA 1 and 2= 56 > vectors. SHA 384 and 512 has some issues with the way jansson objects are > created, which could be addressed separately. >=20 > Signed-off-by: Gowrishankar Muthukrishnan > --- > +#endif /* USE_JANSSON */ > diff --git a/examples/fips_validation/main.c b/examples/fips_validation/m= ain.c > index 7ccb5f52f4..41347de199 100644 > --- 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; I see to get around with the callback function limitation you extend the fi= ps val to an array. Nice move! But if it is not too much trouble for you - please com= ment the purpose of the change - it will make the future maintenance much easier= ! > char temp[MAX_DIGEST_SIZE*2]; > int ret; > uint32_t i, j; >=20 > + 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); >=20 > rte_free(vec.pt.val); > vec.pt.val =3D rte_malloc(NULL, (MAX_DIGEST_SIZE*SHA_MD_BLOCK), 0); >=20 > - 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"); > + } >=20 > for (j =3D 0; j < SHA_EXTERN_ITER; j++) { >=20 > @@ -1719,6 +1724,9 @@ fips_mct_sha_test(void) > vec.cipher_auth.digest.len); > md[2].len =3D vec.cipher_auth.digest.len; >=20 > + 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++) { >=20 > memcpy(vec.pt.val, md[0].val, > @@ -1742,7 +1750,7 @@ fips_mct_sha_test(void) > return ret; > } >=20 > - ret =3D get_writeback_data(&val); > + ret =3D get_writeback_data(&val[0]); > if (ret < 0) > return ret; >=20 > @@ -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; >=20 > - 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; >=20 > - 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); > } >=20 > for (i =3D 0; i < (SHA_MD_BLOCK); i++) > @@ -1771,7 +1782,8 @@ fips_mct_sha_test(void) >=20 > rte_free(vec.pt.val); >=20 > - free(val.val); > + free(val[0].val); It took me a while to understand why you don't free val[1] ??. Nicely done anyway. > + free(msg.val); >=20 > 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 Other than that Acked-by: Fan Zhang