From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.13118.1596465203445506068 for ; Mon, 03 Aug 2020 07:33:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=lHpMXQns; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: jian.j.wang@intel.com) IronPort-SDR: iNujhDz3AueczHXU1H71wVAeeLFXVjXr2XGrdZxS86/frx+3lqqfsVRyTNHiiTv28ablrX98Bm +BiziRnN83lA== X-IronPort-AV: E=McAfee;i="6000,8403,9701"; a="149549613" X-IronPort-AV: E=Sophos;i="5.75,430,1589266800"; d="scan'208";a="149549613" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Aug 2020 07:33:22 -0700 IronPort-SDR: DySC3e0lJmeMcCh8PhUoCaOhnSvbLJB6o/O2JhwevGVHgL1D2Lalu89Tt9utDfFzg7MHM5yyd0 CDYMJlv9twzg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,430,1589266800"; d="scan'208";a="366358410" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga001.jf.intel.com with ESMTP; 03 Aug 2020 07:33:21 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 3 Aug 2020 07:33:21 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 3 Aug 2020 07:33:21 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.170) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 3 Aug 2020 07:33:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cJYMjcio7WCQ5f6yf/zFb1Kcqa7xDuWSv2KjK0Yvt5f1rDrfM6abCpZ7+Qssi5iLnSzYKs9uVwQzNvOF6qDGCp4Ef6uLTyHTolZCq51oYlsQb8zCBPsTA+n7N1/LZB0rW1zLvOs4kk/AAMf2ijGiRA1KYMVZscgjTJdrrs+97N/TUXFueCAUXttFp1HABeoSgg/U7VgPpSBpvOprwQiJRfq3xDCqJdSiY4GvVejq9YQKgOIHGKSLMO+PCyw1Qy8o+pwKfeA1fr6NQxWRvw4CDT4sBe+qWwWwUdaY7TVnQHqoCvr0GgpDKQEZPF8R70GgRZa5FH5qoJhLt+YeC+1+eA== 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=plq2X9kMDqYHy5la8mkjqg4oU5/72r3DpNhE6NhqPGg=; b=BV4HMKFtwzXxAEplJe0YA2jLiILaal+ur6aHP0jZxhOEIaZ9JDjBWAwBVVpagVyQSo4I0U50dFSXKYU//ASnm39YzAmRKR7D4fidR64jU4UXUJUgyRn7XoNs5BMaL7G0y/YoLJ5HkSjnJsS7g/F7peUQpoKQboywO1R4pUm/pUg6Sc6BPOO34Bwvzta/EFkZmzvq6nJDPPCEuxqF0WVBJaZzRo8XaAdjYV2Dg8GRLWBbTxi2Z3EjxNAjJXoDwNvIqR1+rmItn4OC3EB7uJv2npJbggC0ZMkcHAF3pBLm1jvbQn2CV1sUZCwC1R3h8lKgHR2A1RSm1wxq32I0A//A3w== 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=plq2X9kMDqYHy5la8mkjqg4oU5/72r3DpNhE6NhqPGg=; b=lHpMXQnsNUnSQQvUubJegAPl5WpVX1nlxZcbAJmwvahedpohcj6RMz6E/6Cca69/AxBJ/bBupyDe+ZqWHVnYX0WcUwBOQ3Z6c0NFvrEuQtLwVP7u2sqD0oPsAPVJtUm/b0mD2e8Waz4vHV7dENugfoAg1WI6251J1pd+1YmPUGw= Received: from SN6PR11MB3312.namprd11.prod.outlook.com (2603:10b6:805:c8::14) by SN6PR11MB3405.namprd11.prod.outlook.com (2603:10b6:805:c0::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.20; Mon, 3 Aug 2020 14:33:13 +0000 Received: from SN6PR11MB3312.namprd11.prod.outlook.com ([fe80::bc48:4db0:9666:124e]) by SN6PR11MB3312.namprd11.prod.outlook.com ([fe80::bc48:4db0:9666:124e%7]) with mapi id 15.20.3239.021; Mon, 3 Aug 2020 14:33:13 +0000 From: "Wang, Jian J" To: "devel@edk2.groups.io" , "Zhang, Qi1" CC: "Yao, Jiewen" , Chao Zhang , "Kumar, Rahul1" Subject: Re: [edk2-devel] [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function Thread-Topic: [edk2-devel] [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a new function Thread-Index: AQHWZLgFj4Y/bLGRSkmxt7rw3UBliakmfI1w Date: Mon, 3 Aug 2020 14:33:13 +0000 Message-ID: References: <20200728082040.13955-1-qi1.zhang@intel.com> <20200728082040.13955-2-qi1.zhang@intel.com> In-Reply-To: <20200728082040.13955-2-qi1.zhang@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjEzY2NkZjktNzM2Ni00ODNhLWIwNmUtNWM1OWViZTEzZTBmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiaE00SEREemVjMVwvQ0R6Y2M2eXNNTVZTV0FscTFYNVRtYVpjY1g2QlArcllcLzVFVTdvY3d6U1V3ZTdhaDBiRUppIn0= dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-ctpclassification: CTP_NT 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: [192.198.147.196] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bd4e475f-815b-43bd-86f1-08d837ba2715 x-ms-traffictypediagnostic: SN6PR11MB3405: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: E5zhMqv3mDb1LspQFjVyEhteeCPK8NntAQR/uDT5LVs2y0x79BjwP5/JeCDicOlyedz113L+bs92UxPMRLdWCJvDUYUibnfNTw+Ming+TBSDgGSIxr8Cor2WVma/iCsT3DuLdLdy70C3HXsXar+NkkfPOBcoxxr/2D2F7pBlmb97Jme2FWrE0ooKeNPEym4bMEaySfsBd8T1oYn/ReBF06q/KYgxFD2uOg9xL+uIUXIxTfFSP+r8roUvbF0ZqxwzQfXSdt8JfMJ8yW9zTSmEqgBCB8cgX7Q80rekIM3wttFO78q/CNtvfSl9AzTpPtEbsfUhiHI2nmRIIyiaTZHOBR5tgJ5VPjTggKD0gkKF1icOAyRATSQf2CveUQZHRikqiR10o5nAOurPlCVKL5/6Pw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR11MB3312.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(346002)(376002)(366004)(396003)(39860400002)(71200400001)(54906003)(26005)(66556008)(107886003)(186003)(110136005)(66476007)(66946007)(53546011)(66446008)(316002)(8676002)(6506007)(8936002)(64756008)(76116006)(7696005)(5660300002)(15650500001)(52536014)(9686003)(33656002)(6636002)(4326008)(478600001)(966005)(19627235002)(55016002)(83380400001)(86362001)(2906002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: Sjap+kod6XsPVLdhIt7+GWfjoc9GTNhWq+7zM4hQMmmyCIXtCV/PM4WhN+co6Jl3bc0VfrFeS9Z/5JbexVPV2UEgJFsqxJ8lMcV+AdBvb1It8FIGBTikyiTPhrSva6J9YpXMsXGLpeV4xGGZ+wUfN5wAkfz0B7EtTh1opcXTGMt2Kfv/J4oEhcVXsMaAl2GSK2e7J9ZNPbS221CuZOL/w33qRRNGr09P29FHBPm88x7WHFOz5dNIgiwqGrSInolYrJZC4RlJ047ytaqFtPpWZcecpz2aAiwjlKiF9104MXo/iIg1prJUHkT0yHpvuIE0x3SmfbuyZdeQaDbtcdM5A0GPZ4kiWD50Jh7Wjyv6NYpjKBOANTR2+nPVlh3WAL6k3ExTfODRUINNNX0lNvYOLe4bl9OR6Z4PTRD9Q7srsXLX3A2Eu7g9UTbQwIX6WU8besEHShAQXShO9WshzFENzCzaqpIrolkJ+qx2ZsXI5TjL36aYxJnzdY6WHq4ty+r8e8jabY0DJJKburJA3Ag5tNdwpH4Js/UM4augrp4kYBVfoia8HiENDB3DbyjcwZOZKaTitG6RQf1hZh7hat6g4j4VnXQ4zaGLY+pNc6ny1olTNIJqtRDsaE78oRTSDOGGy6kmpXOX4Ula2b+LBHbOlA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB3312.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd4e475f-815b-43bd-86f1-08d837ba2715 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Aug 2020 14:33:13.0573 (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: StLmFMsy6YytUBD+jvPqRXWyDTcfS96Xi5hO3cyLxUmmZjgxAh8OnRRUpTTkVuCB0OUNmZT7KEnPdFLGTzszwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3405 Return-Path: jian.j.wang@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jian J Wang Regards, Jian > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Qi Zhang > Sent: Tuesday, July 28, 2020 4:21 PM > To: devel@edk2.groups.io > Cc: Zhang, Qi1 ; Yao, Jiewen ; > Wang, Jian J ; Chao Zhang = ; > Kumar, Rahul1 > Subject: [edk2-devel] [PATCH v4 1/2] SecurityPkg/Tpm2CommandLib: add a ne= w > function >=20 > From: "Zhang, Qi" >=20 > Tpm2GetCapabilityIsCommandImplemented >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2793 >=20 > check if the commad is supported by comparing the command code with > command index. >=20 > Cc: Jiewen Yao > Cc: Jian J Wang > Cc: Chao Zhang > Cc: Rahul Kumar > Signed-off-by: Qi Zhang > --- > SecurityPkg/Include/Library/Tpm2CommandLib.h | 16 ++++++++ > .../Library/Tpm2CommandLib/Tpm2Capability.c | 40 +++++++++++++++++++ > 2 files changed, 56 insertions(+) >=20 > diff --git a/SecurityPkg/Include/Library/Tpm2CommandLib.h > b/SecurityPkg/Include/Library/Tpm2CommandLib.h > index ce381e786b..ee8eb62295 100644 > --- a/SecurityPkg/Include/Library/Tpm2CommandLib.h > +++ b/SecurityPkg/Include/Library/Tpm2CommandLib.h > @@ -790,6 +790,22 @@ Tpm2GetCapabilityAlgorithmSet ( > OUT UINT32 *AlgorithmSet >=20 > ); >=20 >=20 >=20 > +/** >=20 > + This function will query if the command is supported. >=20 > + >=20 > + @param[In] Command TPM_CC command starts from TPM_CC_FIRST. >=20 > + @param[out] IsCmdImpl The command is supported or not. >=20 > + >=20 > + @retval EFI_SUCCESS Operation completed successfully. >=20 > + @retval EFI_DEVICE_ERROR The command was unsuccessful. >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +Tpm2GetCapabilityIsCommandImplemented ( >=20 > + IN TPM_CC Command, >=20 > + OUT BOOLEAN *IsCmdImpl >=20 > + ); >=20 > + >=20 > /** >=20 > This command is used to check to see if specific combinations of algor= ithm > parameters are supported. >=20 >=20 >=20 > diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c > b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c > index 85b11c7715..17c0c3a151 100644 > --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c > +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c > @@ -39,6 +39,8 @@ typedef struct { >=20 >=20 > #pragma pack() >=20 >=20 >=20 > +#define TPMA_CC_COMMANDINDEX_MASK 0x2000FFFF >=20 > + >=20 > /** >=20 > This command returns various information regarding the TPM and its cur= rent > state. >=20 >=20 >=20 > @@ -628,6 +630,44 @@ Tpm2GetCapabilityAlgorithmSet ( > return EFI_SUCCESS; >=20 > } >=20 >=20 >=20 > +/** >=20 > + This function will query if the command is supported. >=20 > + >=20 > + @param[In] Command TPM_CC command starts from TPM_CC_FIRST. >=20 > + @param[out] IsCmdImpl The command is supported or not. >=20 > + >=20 > + @retval EFI_SUCCESS Operation completed successfully. >=20 > + @retval EFI_DEVICE_ERROR The command was unsuccessful. >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +Tpm2GetCapabilityIsCommandImplemented ( >=20 > + IN TPM_CC Command, >=20 > + OUT BOOLEAN *IsCmdImpl >=20 > + ) >=20 > +{ >=20 > + TPMS_CAPABILITY_DATA TpmCap; >=20 > + TPMI_YES_NO MoreData; >=20 > + EFI_STATUS Status; >=20 > + UINT32 Attribute; >=20 > + >=20 > + Status =3D Tpm2GetCapability ( >=20 > + TPM_CAP_COMMANDS, >=20 > + Command, >=20 > + 1, >=20 > + &MoreData, >=20 > + &TpmCap >=20 > + ); >=20 > + if (EFI_ERROR (Status)) { >=20 > + return Status; >=20 > + } >=20 > + >=20 > + CopyMem (&Attribute, &TpmCap.data.command.commandAttributes[0], > sizeof (UINT32)); >=20 > + *IsCmdImpl =3D (Command =3D=3D (SwapBytes32(Attribute) & > TPMA_CC_COMMANDINDEX_MASK)); >=20 > + >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > + >=20 > /** >=20 > This command is used to check to see if specific combinations of algor= ithm > parameters are supported. >=20 >=20 >=20 > -- > 2.26.2.windows.1 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. >=20 > View/Reply Online (#63392): https://edk2.groups.io/g/devel/message/63392 > Mute This Topic: https://groups.io/mt/75840053/1768734 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [jian.j.wang@intel.com= ] > -=3D-=3D-=3D-=3D-=3D-=3D