From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.22424.1605857924966303239 for ; Thu, 19 Nov 2020 23:38:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=l5KUFyDA; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: jiewen.yao@intel.com) IronPort-SDR: 1QSX+V8DDt+s4iLdNMPqptrBrI0gVCJPxdiqrz+EOwv8n5jj+UEuF9jAGWeuYFPUsj+TV903jj aeP+gs/+w/1g== X-IronPort-AV: E=McAfee;i="6000,8403,9810"; a="233049682" X-IronPort-AV: E=Sophos;i="5.78,355,1599548400"; d="scan'208";a="233049682" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2020 23:38:43 -0800 IronPort-SDR: z/utKWfwzy0Nvo8Xap2hM5zHxl32jUNaA9eA2KHB9qdPFX8Z98T0iWmSE3OUY6ZTTTpOPjAlGE WgFTIHSvgD9A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,355,1599548400"; d="scan'208";a="311940702" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga007.fm.intel.com with ESMTP; 19 Nov 2020 23:38:43 -0800 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 19 Nov 2020 23:38:43 -0800 Received: from fmsmsx604.amr.corp.intel.com (10.18.126.84) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 19 Nov 2020 23:38:42 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx604.amr.corp.intel.com (10.18.126.84) 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, 19 Nov 2020 23:38:42 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Thu, 19 Nov 2020 23:38:38 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BNcQgW3R/SYgBVfA7vLMGFA1l2Oks7vvcEMSyNlGnS6qM8ihUbuTKrCK8vgM05qdHR7WBSTjZ0GeyvPWUIUl5VhsCrmBKXzi90apjr+z1HWaoqgp6hlwFUoC9+ovGB3SClEkHqKneiraQbzge9m1pylTdAx8I0Vu+bKUMJtapuQZVGXBFM1ZqQAl93+mCXjDfFxl03c8/xzY0rd78NeIJC3jEdqo2ggOnjriMDIqCMCAbgZrnCHpeump0XMm6Jx3PCI7YIhsLlWEXkDlwYIubtQ3g8s7/3wAr5thtbIJrnhXAJjW6SdOHnXczckaGYOBaVh/EXMEUMsH5nwI0iolEA== 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=pl7tNQfP/DB/oLv3Hme5q93H9cHVNgwSz8CXR9R8HCE=; b=k0saeRDez3kKj0799pzwmr93xGb4wdVPSDdEwN3s/4XXCYYrXStPrf1Tiyq/Y8GNoPuomxs1x9EB2Nq+knxg90SHpOUaoXH2N3k6tR8QC4Ch8b5Fsp18319QG4zoqDz2g3vsO1eVMKvfh5aXl88jmyHLBbsMtFK8rbMoWFPwQ+E9LPBHxLtRSUHD/5mShFCa8TWT+iujK1aKh5jQ+JXu3sAQ2Uwv055BlrpgccKIV9ygwjRBEPQ20pk+pxhZycWcRrUt6FA4bmoCJkjyfZUYE/mkSwbDopDGTE9dbfm4HGGGLszUOmys8t7GIaLmoE7LCyP4q3Aglgq7Sp5tm+6dwg== 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=pl7tNQfP/DB/oLv3Hme5q93H9cHVNgwSz8CXR9R8HCE=; b=l5KUFyDA1wTKeOundq2dvLSorpl9OGWaJihX+WPYMddN8GmQY6ZRa2/d7YhRWR7TWh0YHgEStwiydk1PgDlhWRfA8k3H3REH1j3Z4KeXes6J7jbBk14PsZ8tI5Lajq+lo/PO9CZYwimbFu+BMbimEzILdU84dEx9/OxW08XSyZw= Received: from CY4PR11MB1288.namprd11.prod.outlook.com (2603:10b6:903:23::8) by CY4PR11MB1478.namprd11.prod.outlook.com (2603:10b6:910:8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3589.25; Fri, 20 Nov 2020 07:38:37 +0000 Received: from CY4PR11MB1288.namprd11.prod.outlook.com ([fe80::a188:2994:6c14:aad7]) by CY4PR11MB1288.namprd11.prod.outlook.com ([fe80::a188:2994:6c14:aad7%12]) with mapi id 15.20.3589.022; Fri, 20 Nov 2020 07:38:37 +0000 From: "Yao, Jiewen" To: "devel@edk2.groups.io" , "Wang, Jian J" , "Mistry, Nishant C" Subject: Re: [edk2-devel] [PATCH] SecurityPkg: Add RPMC Index to the RpmcLib Thread-Topic: [edk2-devel] [PATCH] SecurityPkg: Add RPMC Index to the RpmcLib Thread-Index: AQHWuHzk+4fs4mqcokOTGbzRWrKAEanNRqUAgANljMA= Date: Fri, 20 Nov 2020 07:38:37 +0000 Message-ID: References: <661e44cf628ae7315fc738b64a52736f6b5b5285.1605047447.git.nishant.c.mistry@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [101.80.124.211] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b97666df-92d8-4f29-05fb-08d88d274adf x-ms-traffictypediagnostic: CY4PR11MB1478: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TaVf8YDABSbgL0bqDM/O4ffiZZKFP+mnG2pG8XKvKyDQ43FJHrJDiGKJbpS/soff6ydvkNTHZHr8pQAi3C86DapIZd1cno7jmXDUQlglamW0KztPVpGNKMFA0HEiAT8/Ps2qYoJanS34YllcQSe5Jg2vgi73Rs/aKXsjiEz+Mj3I7ZAYoocO0373f2v7p8dl7vcE0ts4OXWMIZXKMo1Rl6O5uxO+z/9ePGowMxMzNMKRM705Tm0izJ4FBxeR7egxA8M1oEOCBySW90ffbFJBYt//MCLpYUzllH1VQJd2USWmRHh2gNC8qjt4+/Mr0RxIgiyzbM/BHnKjEURvd15SUuxkZpZP2DqkiFqi9b2R7awea+6DHwHYQhwXWIuRzQbj87aFa5J3KTQkQdn+fGxYFA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR11MB1288.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(39860400002)(346002)(366004)(396003)(136003)(8676002)(5660300002)(186003)(52536014)(83380400001)(6636002)(33656002)(9686003)(71200400001)(55016002)(15650500001)(6506007)(8936002)(53546011)(26005)(966005)(2906002)(66946007)(110136005)(76116006)(7696005)(478600001)(66476007)(66556008)(64756008)(66446008)(316002)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: L8S+J9sDz2zv6isEzl5srQendvrpjQKzxVE6hK72OIJGGHQpkuzuIr2Jeeld/LAJb1iRjXjIONwedY6bbrJ+sWS033V8YQ0OaKZ5NnySOptdhAJvNtRFbnjkymnlF/Qo157GpADFTwMnhQU7DizRVzUwHM44h9lnCf9WwfoU7xOJckCDY2qlPFru+3Ak7Wx83dlQhvvA03uChcFyb2toLkFrV2eLKaO6UdJP5eiC+H1ji3OGobIFOflrtrg7EVGydZpXXvMNwEIXHEJ8+cVvfvl76uMaY4FwXxTxAkIKlZ2GNV8cEGxWOap3dYM6oQo4VflRPesP90QuG05Ic+NqUE8iF51A52DZ47GpF5o4MaCJxl12wQ0NpDGdLMS8RKil9gSOMfkPBnK+oRcTQ0/OqrinLqWbfl+r3Qbgbsps4xXm3VhyGKbblYXK37iqYS9wsuvpvGbG1Uw+ivXWbM8KQTsGKEb9H8P1j3QyQAv3UvPmTZFSOdTyttizrBIQ5ucgzK0YDhX9ME95KzBbewbdkJZyVwUQUiKOLpQYYJBu6+AeUxiXu+URENVZ5QVubFowZkUJVGFpMgu3KdMV6/xZEQSCrDbKYwr6ABdpUS4EbF5aV5KxgSSWx0WpSu0uSpA/Jh1bsn6JaSyEuQrWO/xmdA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB1288.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b97666df-92d8-4f29-05fb-08d88d274adf X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2020 07:38:37.0946 (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: 5XAlSPN0boV5GvRk5uuFnlCXTQWenKG8Y0ZOuZLSVm5rIt5WQw09cEoUscJLfy6TQObZV/9GFh+G4E4eqQWCDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1478 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hey The more I review the code, the more I think we should revisit the usage m= ode for multiple counters. Some thought: 1) In previous design, it is very clear that we only have one counter. We = read it and we increase it. But here, if we add Index, that means there could be multiple counters. Th= en the question is how many? There is no API to tell us how many counters w= e can use. For multiple counter case, I think we need at least one API - GetCounterNu= mber(). 2) The description for Index is not clear. Does that start from 0 or 1, to any ID to match hardware? If it is the last one, then we need a bit-mask, or a valid ID array to sho= w which counter number is valid to use. 3) Compatibility is another problem, if the old solution *just* need one c= ounter, then it has to use the new API to select which counter? Now, I am not sure if using *Index* is the best way to resolve the problem= . I recommend we check in a real solution to use the RpmcLib, then we can se= e what interface is really needed. Thank you Yao Jiewen > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Wang, > Jian J > Sent: Wednesday, November 18, 2020 11:35 AM > To: devel@edk2.groups.io; Mistry, Nishant C > Subject: Re: [edk2-devel] [PATCH] SecurityPkg: Add RPMC Index to the > RpmcLib >=20 >=20 > Reviewed-by: Jian J Wang >=20 > Regards, > Jian >=20 > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of > Nishant > > Mistry > > Sent: Thursday, November 12, 2020 2:49 AM > > To: devel@edk2.groups.io > > Subject: [edk2-devel] [PATCH] SecurityPkg: Add RPMC Index to the RpmcL= ib > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2594 > > > > The re-design requires multiple RPMC counter usages. > > The consumer will be capable of selecting amongst multiple counters. > > > > Signed-off-by: Nishant C Mistry > > --- > > SecurityPkg/Include/Library/RpmcLib.h | 6 +++++- > > SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c | 6 +++++- > > 2 files changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/SecurityPkg/Include/Library/RpmcLib.h > > b/SecurityPkg/Include/Library/RpmcLib.h > > index 5882bfae2f..3c15bce1ce 100644 > > --- a/SecurityPkg/Include/Library/RpmcLib.h > > +++ b/SecurityPkg/Include/Library/RpmcLib.h > > @@ -14,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > /** > > Requests the monotonic counter from the designated RPMC counter. > > > > + @param[in] CounterIndex The RPMC index > > @param[out] CounterValue A pointer to a buffer to stor= e the > RPMC > > value. > > > > @retval EFI_SUCCESS The operation completed succe= ssfully. > > @@ -23,12 +24,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > EFI_STATUS > > EFIAPI > > RequestMonotonicCounter ( > > + IN UINT8 CounterIndex, > > OUT UINT32 *CounterValue > > ); > > > > /** > > Increments the monotonic counter in the SPI flash device by 1. > > > > + @param[in] CounterIndex The RPMC index > > + > > @retval EFI_SUCCESS The operation completed succe= ssfully. > > @retval EFI_DEVICE_ERROR A device error occurred while > attempting > > to update the counter. > > @retval EFI_UNSUPPORTED The operation is un-supported= . > > @@ -36,7 +40,7 @@ RequestMonotonicCounter ( > > EFI_STATUS > > EFIAPI > > IncrementMonotonicCounter ( > > - VOID > > + IN UINT8 CounterIndex > > ); > > > > #endif > > diff --git a/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c > > b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c > > index e1dd09eb10..697e493a7c 100644 > > --- a/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c > > +++ b/SecurityPkg/Library/RpmcLibNull/RpmcLibNull.c > > @@ -12,6 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > /** > > Requests the monotonic counter from the designated RPMC counter. > > > > + @param[in] CounterIndex The RPMC index > > @param[out] CounterValue A pointer to a buffer to stor= e the > RPMC > > value. > > > > @retval EFI_SUCCESS The operation completed succe= ssfully. > > @@ -21,6 +22,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > EFI_STATUS > > EFIAPI > > RequestMonotonicCounter ( > > + IN UINT8 CounterIndex, > > OUT UINT32 *CounterValue > > ) > > { > > @@ -31,6 +33,8 @@ RequestMonotonicCounter ( > > /** > > Increments the monotonic counter in the SPI flash device by 1. > > > > + @param[in] CounterIndex The RPMC index > > + > > @retval EFI_SUCCESS The operation completed succe= ssfully. > > @retval EFI_DEVICE_ERROR A device error occurred while > attempting > > to update the counter. > > @retval EFI_UNSUPPORTED The operation is un-supported= . > > @@ -38,7 +42,7 @@ RequestMonotonicCounter ( > > EFI_STATUS > > EFIAPI > > IncrementMonotonicCounter ( > > - VOID > > + IN UINT8 CounterIndex > > ) > > { > > ASSERT (FALSE); > > -- > > 2.16.2.windows.1 > > > > > > > > > > >=20 >=20 >=20 >=20 >=20