From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0704.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe40::704]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9DC1A1A1E9E for ; Tue, 11 Oct 2016 01:56:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=29nygjPKk/rEtPQ/zt8xNQ9X4Cz/S73Yr/W+ZMNa+fE=; b=RRaUV7BSx1o/vumHB4C7jwVbvOVC6GFu+0T/WwAS5GZs7Xw6HwAl0bg80+H/Kt8phFRj0nNVIWyWj8TL42bEOG0mFT3VqmAoDN1EzXC7wF/m1kgGhpbZsUJ+6W2B+PzDPzaLfSmN2pIWxS6vAKpSjX6s/ggeljYvuYJhSArjRs0= Received: from BY1PR03MB1355.namprd03.prod.outlook.com (10.162.109.25) by BY1PR03MB1355.namprd03.prod.outlook.com (10.162.109.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.11; Tue, 11 Oct 2016 08:56:09 +0000 Received: from BY1PR03MB1355.namprd03.prod.outlook.com ([10.162.109.25]) by BY1PR03MB1355.namprd03.prod.outlook.com ([10.162.109.25]) with mapi id 15.01.0659.018; Tue, 11 Oct 2016 08:56:09 +0000 From: Sean Brogan To: Jiewen Yao , "edk2-devel@lists.01.org" CC: Michael D Kinney , Feng Tian , Chao Zhang , Liming Gao , Star Zeng Thread-Topic: [edk2] [PATCH V2 02/50] MdeModulePkg/Include: Add EdkiiSystemCapsuleLib definition. Thread-Index: AQHSGxVTVvPjFuYZ4kGibveDhIXEhaCjBBjA Date: Tue, 11 Oct 2016 08:56:09 +0000 Message-ID: References: <1475238128-22448-1-git-send-email-jiewen.yao@intel.com> <1475238128-22448-3-git-send-email-jiewen.yao@intel.com> In-Reply-To: <1475238128-22448-3-git-send-email-jiewen.yao@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sean.brogan@microsoft.com; x-originating-ip: [50.46.222.147] x-ms-office365-filtering-correlation-id: 36ed9f7d-993e-4d07-c955-08d3f1b471b3 x-microsoft-exchange-diagnostics: 1; BY1PR03MB1355; 7:YAB4gzOEA0YV/cwGefUtVSFRxSjFnjdAWNaLPqh8SiM/Xdp3V5cXyahTV0qxJm85WsCNYpxiKttDu5lNAmFRD6gi96F8E+Afjy8zmUIkq7g9p+YGNVXyqU8kjZNoqJv8e/RBA4hNXTb6EVlzEkslOnIUjSqrCx2siGF38xT8VbYb3aI2BcmcZsw9phtfvoAYocD17rUa48uTfvLZNd0/laODP1DvbZqovUpUryS24aueI4PqACQvtnZbYJCucoyD6hUUu1m0/l16Jcn7+COwFoCDvxkCDcG9YkPRYRzDnzs80aQwdgUrJc3eA8Zr8FrN2ULL7zM/JpDKHZTcPihTwkAfeovVlbvdo8nSk4HBZjEg68vYv/+1W2rErIimxOh4 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR03MB1355; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(61425038)(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(61426038)(61427038); SRVR:BY1PR03MB1355; BCL:0; PCL:0; RULEID:; SRVR:BY1PR03MB1355; x-forefront-prvs: 00922518D8 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(199003)(13464003)(377454003)(189002)(3660700001)(54356999)(50986999)(106356001)(8990500004)(68736007)(9686002)(15395725005)(8936002)(33656002)(2906002)(189998001)(4326007)(86362001)(11100500001)(66066001)(575784001)(19580395003)(3280700002)(5005710100001)(106116001)(6116002)(3846002)(102836003)(19580405001)(105586002)(10090500001)(81166006)(16799955002)(99286002)(76176999)(81156014)(10290500002)(10400500002)(101416001)(8676002)(15188155005)(86612001)(586003)(92566002)(122556002)(2900100001)(15975445007)(77096005)(5002640100001)(2501003)(76576001)(2950100002)(97736004)(5001770100001)(7846002)(87936001)(74316002)(7696004)(305945005)(7736002)(5660300001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR03MB1355; H:BY1PR03MB1355.namprd03.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2016 08:56:09.1084 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR03MB1355 Subject: Re: [PATCH V2 02/50] MdeModulePkg/Include: Add EdkiiSystemCapsuleLib definition. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 08:56:12 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I would suggest moving this to the "new" package. =20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Jiewen Yao > Sent: Friday, September 30, 2016 5:21 AM > To: edk2-devel@lists.01.org > Cc: Michael D Kinney ; Feng Tian > ; Chao Zhang ; Liming Gao > ; Star Zeng > Subject: [edk2] [PATCH V2 02/50] MdeModulePkg/Include: Add > EdkiiSystemCapsuleLib definition. >=20 > This library is used to abstract the action for EDKII system FMP capsule,= such as > extracting a component from capsule, or authenticate the capsule. >=20 > Cc: Feng Tian > Cc: Star Zeng > Cc: Michael D Kinney > Cc: Liming Gao > Cc: Chao Zhang > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jiewen Yao > Reviewed-by: Liming Gao > --- > MdeModulePkg/Include/Library/EdkiiSystemCapsuleLib.h | 154 > ++++++++++++++++++++ > 1 file changed, 154 insertions(+) >=20 > diff --git a/MdeModulePkg/Include/Library/EdkiiSystemCapsuleLib.h > b/MdeModulePkg/Include/Library/EdkiiSystemCapsuleLib.h > new file mode 100644 > index 0000000..db0ce79 > --- /dev/null > +++ b/MdeModulePkg/Include/Library/EdkiiSystemCapsuleLib.h > @@ -0,0 +1,154 @@ > +/** @file > + EDKII System Capsule library. > + > +Copyright (c) 2016, Intel Corporation. All rights reserved.
This > +program and the accompanying materials are licensed and made available > +under the terms and conditions of the BSD License which accompanies > +this distribution. The full text of the license may be found at > +http://opensource.org/licenses/bsd-license.php > + > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS > OR IMPLIED. > + > +**/ > + > + > +#ifndef __EDKII_SYSTEM_CAPSULE_LIB_H__ > +#define __EDKII_SYSTEM_CAPSULE_LIB_H__ > + > +#include > + > +/** > + Extract ImageFmpInfo from system firmware. > + > + @param[in] SystemFirmwareImage The System Firmware image. > + @param[in] SystemFirmwareImageSize The size of the System Firmware > image in bytes. > + @param[out] ImageFmpInfo The ImageFmpInfo. > + @param[out] ImageFmpInfoSize The size of the ImageFmpInfo in by= tes. > + > + @retval TRUE The ImageFmpInfo is extracted. > + @retval FALSE The ImageFmpInfo is not extracted. > +**/ > +BOOLEAN > +EFIAPI > +ExtractSystemFirmwareImageFmpInfo( > + IN VOID *SystemFirmwareImage, > + IN UINTN SystemFirmwareImageSize, > + OUT EDKII_SYSTEM_FIRMWARE_IMAGE_DESCRIPTOR **ImageFmpInfo, > + OUT UINTN *ImageFmpInfoSize > + ); > + > +/** > + Extract the driver FV from an authenticated image. > + > + @param[in] AuthenticatedImage The authenticated capsule image. > + @param[in] AuthenticatedImageSize The size of the authenticated caps= ule > image in bytes. > + @param[out] DriverFvImage The driver FV image. > + @param[out] DriverFvImageSize The size of the driver FV image in= bytes. > + > + @retval TRUE The driver Fv is extracted. > + @retval FALSE The driver Fv is not extracted. > +**/ > +BOOLEAN > +EFIAPI > +ExtractDriverFvImage( > + IN VOID *AuthenticatedImage, > + IN UINTN AuthenticatedImageSize, > + OUT VOID **DriverFvImage, > + OUT UINTN *DriverFvImageSize > + ); > + > +/** > + Extract the config image from an authenticated image. > + > + @param[in] AuthenticatedImage The authenticated capsule image. > + @param[in] AuthenticatedImageSize The size of the authenticated caps= ule > image in bytes. > + @param[out] ConfigImage The config image. > + @param[out] ConfigImageSize The size of the config image in by= tes. > + > + @retval TRUE The config image is extracted. > + @retval FALSE The config image is not extracted. > +**/ > +BOOLEAN > +EFIAPI > +ExtractConfigImage( > + IN VOID *AuthenticatedImage, > + IN UINTN AuthenticatedImageSize, > + OUT VOID **ConfigImage, > + OUT UINTN *ConfigImageSize > + ); > + > +/** > + Extract the System Firmware image from an authenticated image. > + > + @param[in] AuthenticatedImage The authenticated capsule image. > + @param[in] AuthenticatedImageSize The size of the authenticated caps= ule > image in bytes. > + @param[out] SystemFirmwareImage The System Firmware image. > + @param[out] SystemFirmwareImageSize The size of the System Firmware > image in bytes. > + > + @retval TRUE The System Firmware image is extracted. > + @retval FALSE The System Firmware image is not extracted. > +**/ > +BOOLEAN > +EFIAPI > +ExtractSystemFirmwareImage( > + IN VOID *AuthenticatedImage, > + IN UINTN AuthenticatedImageSize, > + OUT VOID **SystemFirmwareImage, > + OUT UINTN *SystemFirmwareImageSize > + ); > + > +/** > + Extract the authenticated image from an FMP capsule image. > + > + @param[in] Image The FMP capsule image, including > EFI_FIRMWARE_IMAGE_AUTHENTICATION. > + @param[in] ImageSize The size of FMP capsule image in b= ytes. > + @param[out] LastAttemptStatus The last attempt status, which wil= l be > recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. > + @param[out] AuthenticatedImage The authenticated capsule image, > excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION. > + @param[out] AuthenticatedImageSize The size of the authenticated caps= ule > image in bytes. > + > + @retval TRUE The authenticated image is extracted. > + @retval FALSE The authenticated image is not extracted. > +**/ > +BOOLEAN > +EFIAPI > +ExtractAuthenticatedImage( > + IN VOID *Image, > + IN UINTN ImageSize, > + OUT UINT32 *LastAttemptStatus, > + OUT VOID **AuthenticatedImage, > + OUT UINTN *AuthenticatedImageSize > + ); > + > +/** > + Authenticated system firmware FMP capsule image. > + > + Caution: This function may receive untrusted input. > + > + @param[in] Image The FMP capsule image, including > EFI_FIRMWARE_IMAGE_AUTHENTICATION. > + @param[in] ImageSize The size of FMP capsule image in b= ytes. > + @param[in] ForceVersionMatch TRUE: The version of capsule must = be as > same as the version of current image. > + FALSE: The version of capsule must= be as same as > greater than the lowest > + supported version of curren= t image. > + @param[out] LastAttemptVersion The last attempt version, which wi= ll be > recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. > + @param[out] LastAttemptStatus The last attempt status, which wil= l be > recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR. > + @param[out] AuthenticatedImage The authenticated capsule image, > excluding EFI_FIRMWARE_IMAGE_AUTHENTICATION. > + @param[out] AuthenticatedImageSize The size of the authenticated caps= ule > image in bytes. > + > + @retval TRUE Authentication passes and the authenticated image is > extracted. > + @retval FALSE Authentication fails and the authenticated image is not > extracted. > +**/ > +EFI_STATUS > +EFIAPI > +CapsuleAuthenticateSystemFirmware( > + IN VOID *Image, > + IN UINTN ImageSize, > + IN BOOLEAN ForceVersionMatch, > + OUT UINT32 *LastAttemptVersion, > + OUT UINT32 *LastAttemptStatus, > + OUT VOID **AuthenticatedImage, > + OUT UINTN *AuthenticatedImageSize > + ); > + > +#endif > + > -- > 2.7.4.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel