From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 70193A04C0
	for <public@inbox.dpdk.org>; Thu,  8 Oct 2020 10:50:37 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 4FE0C1BB40;
	Thu,  8 Oct 2020 10:50:36 +0200 (CEST)
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id EDAE61BA8E;
 Thu,  8 Oct 2020 10:50:31 +0200 (CEST)
IronPort-SDR: 00QGEoI8gq29G8MfPRN1tNdOG9gThO4px0Zxnl350HaPm3IU09v/o36bAobbp2Hm+8+m+KrR6f
 vOsm1oAKP6vQ==
X-IronPort-AV: E=McAfee;i="6000,8403,9767"; a="161843871"
X-IronPort-AV: E=Sophos;i="5.77,350,1596524400"; d="scan'208";a="161843871"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 08 Oct 2020 01:50:28 -0700
IronPort-SDR: UcVwLx48jIKEMq56gokJUQh2PV6kr4WJ35W3WX7AoajntfY7UrYy7uPEPrbdEp7jPAtwOK09MU
 xVV/6bBpb7aw==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.77,350,1596524400"; d="scan'208";a="349423619"
Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15])
 by fmsmga002.fm.intel.com with ESMTP; 08 Oct 2020 01:50:28 -0700
Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by
 ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.1713.5; Thu, 8 Oct 2020 01:50:28 -0700
Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by
 orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5
 via Frontend Transport; Thu, 8 Oct 2020 01:50:28 -0700
Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.53) by
 edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.1713.5; Thu, 8 Oct 2020 01:50:26 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=ZKp4LIoCDn8DshwDPqrEsBnOi9ED5pd847oz6rc8/WzWx9i6kSUZc7mtSncvdP5c9yf0xAj97SEaR40hqvvmwDHBQaCGAMCjX10dy+gZKjjnfOvea7XggVbz9m5aRLorMgIRrohbOY6e7leKdOKg8mfRicLA2RPHCy0/6GNtcIj8SJzgMFq9YIYQfkLs17GZJrKMGbFiZ3D5N+1wH+mmq/tpLSortHa9/eXW+Ad1hTcTeljaXnm+L5zUOKgTnJ4zekyQA+7h/kI57fLCn/GQAS66ZvXMuez5MK1NPjZ/v+8BNYmM7lpTfAaJW3xchqp9nN4G28bytZhcq0xBWx9o6g==
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-SenderADCheck;
 bh=5BKKsgPxpdRinb2bzgLjGD/2ra0b+mxeNNnkhXyNEfs=;
 b=G3niyIBDcmTuKU45u9H6OgJ8+0Emy1kpiJnHjM1MNPIJNSZKsn9GE9QNCGlkquaAse14SjOAFSZVVXRhY7QB8SfqgKoZfGUQILN2zfNiXP8K5pxrpd2cV1Dt6SJ1xmoynfMshkNOOPPzrsgxF9bqE1mm0csKjp0FlpWSrR3xUd5rABHo1VO9Etb0HoUvLYiG6VWay/j9dtIP3Cr1KmpUzWrvjO6+4UbGTmgEY5zFZx7wTtLqiK7csJWOr7kBjQ8RXoC528XNjyZG0giijPW0KegBwZoGoDTIcat82Oi9SndJOxyhn7lufl+uuir4AF47qbc4N1b1jL1aOSciWK8vog==
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
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; 
 s=selector2-intel-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=5BKKsgPxpdRinb2bzgLjGD/2ra0b+mxeNNnkhXyNEfs=;
 b=eD8T0vIem72Ur+fcdtgV7uPMKeEYucNmnFJ/U4qnmsc6cWNUEr8m6AJUbZFWuS2TefVchpCr0RyrS6RUmN2O9EEl6yT1N78jykCS8lqD6c6w+ydEkI4WqW3Etc9UwvPRMHYNZprsUomcm2Irky33WXzWFyFaEFoThriYxE460b0=
Received: from BL0PR11MB3043.namprd11.prod.outlook.com (2603:10b6:208:33::19)
 by BL0PR11MB3283.namprd11.prod.outlook.com (2603:10b6:208:69::11)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.24; Thu, 8 Oct
 2020 08:50:25 +0000
Received: from BL0PR11MB3043.namprd11.prod.outlook.com
 ([fe80::11fa:a7fe:329d:9239]) by BL0PR11MB3043.namprd11.prod.outlook.com
 ([fe80::11fa:a7fe:329d:9239%5]) with mapi id 15.20.3455.023; Thu, 8 Oct 2020
 08:50:25 +0000
From: "Zhang, Roy Fan" <roy.fan.zhang@intel.com>
To: Olivier Matz <olivier.matz@6wind.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, "Kovacevic, Marko"
 <marko.kovacevic@intel.com>, Akhil Goyal <akhil.goyal@nxp.com>, "Kusztal,
 ArkadiuszX" <arkadiuszx.kusztal@intel.com>, "stable@dpdk.org"
 <stable@dpdk.org>, Anoob Joseph <anoobj@marvell.com>
Thread-Topic: [PATCH 2/3] examples/fips_validation: ignore \r in input files
Thread-Index: AQHWm7Q4Kcw8UFQAJkyqV8ey/1yPmamKQQZwgAAY/oCAAwz2AA==
Date: Thu, 8 Oct 2020 08:50:25 +0000
Message-ID: <BL0PR11MB30438E6FF7D2FD5868BD5E48B80B0@BL0PR11MB3043.namprd11.prod.outlook.com>
References: <20201006074143.31691-1-olivier.matz@6wind.com>
 <20201006074143.31691-3-olivier.matz@6wind.com>
 <BL0PR11MB3043578A9E723EC69C927303B80D0@BL0PR11MB3043.namprd11.prod.outlook.com>
 <20201006100901.GJ21395@platinum>
In-Reply-To: <20201006100901.GJ21395@platinum>
Accept-Language: zh-Hans-HK, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-version: 11.5.1.3
dlp-reaction: no-action
dlp-product: dlpe-windows
authentication-results: 6wind.com; dkim=none (message not signed)
 header.d=none;6wind.com; dmarc=none action=none header.from=intel.com;
x-originating-ip: [95.44.220.85]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 4c3420b7-52d0-4271-0234-08d86b67330c
x-ms-traffictypediagnostic: BL0PR11MB3283:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <BL0PR11MB3283ACF9F007C5C31E6479AEB80B0@BL0PR11MB3283.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:2449;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: echp54T1K1wNWjorfd/rhwJ8gtckzviWgecoRm+OPrVfFP8b78+GYt1h0XXXRN2fqHCNEOtnh50vcDg8AArp9Gei0dQQKVkWftaY5/Wb0/fnJ9tW3rSdnsilkjMzNsyqYigZ64tOk8GlV0QG9a/iMv0//lmFwr5sjSVf73G1DA7PX9HIgDgLwfOvFUTWhnNF+Ah6Njh7LixKg4lFt+GPBc3Ndt3dukKkDGp6Wj3z5T073idb+HxWwBd+4lGTbBJZhrr4/SFlPteZKES9ILTAHAuVPHnbIXiOlpv39zjGRNN18OH+REfhZ1PVY9PmLT9hSe8y22R/Bb1sjcHU++rSiBZ9yAhtenzj5PesFjd3ilUNJ7go23J/bLHBZNfMEBdTybzDpWCnQpld5BvArG9Xkw==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:BL0PR11MB3043.namprd11.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(4636009)(366004)(376002)(396003)(136003)(346002)(39860400002)(5660300002)(66946007)(66476007)(76116006)(2906002)(6916009)(9686003)(316002)(54906003)(64756008)(66446008)(966005)(66556008)(52536014)(8936002)(478600001)(8676002)(33656002)(6506007)(53546011)(7696005)(71200400001)(86362001)(4326008)(186003)(26005)(83080400001)(83380400001)(55016002);
 DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata: 7IWzJPR8SKeH2FN9Zu7AZTWkyEiKW2Pwqay5KsGHdJxHJY0J3R7ZZG1EY5Lpq2DF6ZIpvBSliI/FnL1L53R2THLQngsQH8PczCFKMFkBSv/0NfJeFCQbS0i2MPRZ/miGy7nep5G20GBIYvOuMo6T7jydk7DRUNRrIpVHD8643ROMXvFLkLQbB1zVmo2ZXO37p5zJbVTP9mUKMMdZmb9s2913fIqfCE8BPtiJVm3yEbKfDatM/cpTBb+nJUHSG79NpmHPS3HM5ptNSb0AoczlNkr20ouCKsrBP8enhOQteHz+NJQjwQqroZhr7j5H1iBeapM5vLglQZBIdl3AU8zg0UhkyaBWg/ovGi5iOQCm/Wa/RXvkGWFGIDEg4ywZilM0PFtBYh8p4pNAJZnHVzNuUhqPo9FQbqspQNUmxz8WfBjqwcV0iPoqnuOuMjz84QAHsNRbPTmLyeJUJyj3w87K3cxpFAIQa/5sH/VD4ZD6NMfVk85IXr8+15M8rrsOnX0eGU7FzZm94jue7CgaUjdmcyb7cC4u7ibfYrvZjQGswkElUIH7ZSEiVACvQ4lnv6b7oQwiE0i5bYGrhDa+3vvUmHVV0vLeyXGLGT4+fH0TUrmFfE8aDzDt2eFIg28v4nE6kV4QAXMPrW2lPIo8ORb/tw==
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: BL0PR11MB3043.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 4c3420b7-52d0-4271-0234-08d86b67330c
X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2020 08:50:25.0796 (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: BeExxKwXEfCuDNjsVh8GBxpOrgwjcaE7ohLvgy8czFl4v4XxpEDIMkyWWwsQX6vSw9q3mDpo2Ko097qtAld1hA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3283
X-OriginatorOrg: intel.com
Subject: Re: [dpdk-stable] [PATCH 2/3] examples/fips_validation: ignore \r
	in input files
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Hi Olivier,

Anood and us had the similar discussion.

Can we change the sample application to parse version data instead,
and for the version specific code changes we will wrap them by a
branch to compare the parsed version and the expected version?=20
(we probably should have done that long time ago).

I drafted a code change to parse the version data, see if you think it
is ok?

diff --git a/examples/fips_validation/fips_validation.c b/examples/fips_val=
idation/fips_validation.c
index 9bdf257b8..9b6518c92 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -98,7 +98,7 @@ fips_test_parse_header(void)
 	uint32_t i;
 	char *tmp;
 	int ret;
-	int algo_parsed =3D 0;
+	int algo_parsed =3D 0, version_parsed =3D 0;
 	time_t t =3D time(NULL);
 	struct tm *tm_now =3D localtime(&t);
=20
@@ -107,6 +107,27 @@ fips_test_parse_header(void)
 		return ret;
=20
 	for (i =3D 0; i < info.nb_vec_lines; i++) {
+		/* parse the version info */
+		tmp =3D strstr(info.vec[i], "CAVS ");
+		if (tmp !=3D NULL) {
+			if (version_parsed !=3D 0) {
+				RTE_LOG(ERR, USER1,
+					"Multiple version data\n");
+				return -1;
+			}
+
+			tmp =3D tmp + sizeof("CAVS ");
+
+			if (strlen(tmp) >=3D MAX_VER_STRING_SIZE) {
+				RTE_LOG(ERR, USER1, "Version (%s) too long\n",
+						tmp);
+				return -1;
+			}
+
+			strlcpy(info.version, tmp, MAX_VER_STRING_SIZE);
+			version_parsed =3D 1;
+		}
+
 		if (!algo_parsed) {
 			if (strstr(info.vec[i], "AESVS")) {
 				algo_parsed =3D 1;
diff --git a/examples/fips_validation/fips_validation.h b/examples/fips_val=
idation/fips_validation.h
index 75fa555fa..b8c60c55f 100644
--- a/examples/fips_validation/fips_validation.h
+++ b/examples/fips_validation/fips_validation.h
@@ -15,6 +15,9 @@
 #define MAX_BUF_SIZE		2048
 #define MAX_STRING_SIZE		64
 #define MAX_DIGEST_SIZE		64
+#define MAX_VER_STRING_SIZE	8
+
+#define FIPS_DEF_VERSION	"21.0"
=20
 #define POSITIVE_TEST		0
 #define NEGATIVE_TEST		-1
@@ -155,6 +158,7 @@ struct sha_interim_data {
 };
=20
 struct fips_test_interim_info {
+	char version[MAX_VER_STRING_SIZE];
 	FILE *fp_rd;
 	FILE *fp_wr;
 	enum file_types file_type;


Regards,
Fan

> -----Original Message-----
> From: Olivier Matz <olivier.matz@6wind.com>
> Sent: Tuesday, October 6, 2020 11:09 AM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>
> Cc: dev@dpdk.org; Kovacevic, Marko <marko.kovacevic@intel.com>; Akhil
> Goyal <akhil.goyal@nxp.com>; Kusztal, ArkadiuszX
> <arkadiuszx.kusztal@intel.com>; stable@dpdk.org; Anoob Joseph
> <anoobj@marvell.com>
> Subject: Re: [PATCH 2/3] examples/fips_validation: ignore \r in input fil=
es
>=20
> Hi Fan,
>=20
> On Tue, Oct 06, 2020 at 08:47:10AM +0000, Zhang, Roy Fan wrote:
> > Hi Olivier,
> >
> > > -----Original Message-----
> > > From: Olivier Matz <olivier.matz@6wind.com>
> > > Sent: Tuesday, October 6, 2020 8:42 AM
> > > To: dev@dpdk.org
> > > Cc: Kovacevic, Marko <marko.kovacevic@intel.com>; Akhil Goyal
> > > <akhil.goyal@nxp.com>; Zhang, Roy Fan <roy.fan.zhang@intel.com>;
> Kusztal,
> > > ArkadiuszX <arkadiuszx.kusztal@intel.com>; stable@dpdk.org
> > > Subject: [PATCH 2/3] examples/fips_validation: ignore \r in input fil=
es
> > >
> > > Some test vectors contain '\r' before '\n' (see link). Ignore them.
> > >
> > > Link: https://www.openssl.org/docs/fips/testvectors-linux-2007-10-
> 10.tar.gz
> > > Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS
> application")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > > ---
> > >  examples/fips_validation/fips_validation.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > >
> > > diff --git a/examples/fips_validation/fips_validation.c
> > > b/examples/fips_validation/fips_validation.c
> > > index 13f763c9aa..858f581ba3 100644
> > > --- a/examples/fips_validation/fips_validation.c
> > > +++ b/examples/fips_validation/fips_validation.c
> > > @@ -33,6 +33,8 @@ get_file_line(void)
> > >
> > >  		if (loc >=3D MAX_LINE_CHAR - 1)
> > >  			return -ENOMEM;
> > > +		if (c =3D=3D '\r')
> > > +			continue;
> > >  		if (c =3D=3D '\n')
> > >  			break;
> > >  		line[loc++] =3D c;
> > > --
> >
> >
> > The patch looks ok but the test file link you provided in the patch is =
CAVS
> > 5.3.
> >
> > As mentioned in
> > https://doc.dpdk.org/guides/sample_app_ug/fips_validation.html, the
> supported
> > CAVS supported version is 21.0 (not latest one by newer than 5.3). In C=
AVS
> > 21.0 test files there is no '\r' before '\n' (I suppose this is for Win=
dows
> > right).
>=20
> Thank you for your feedback.
>=20
> I'm ok to drop this patch from the patchset if you feel it's useless, or
> I can update the commit log with the information you provide, to clarify
> that it should not happen with the supported version of CAVS.
>=20
> Please let me know what you prefer.
>=20
>=20
> Thanks,
> Olivier