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.11078.1600430307304555752 for ; Fri, 18 Sep 2020 04:58:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=BzdrCcAw; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: divneil.r.wadhawan@intel.com) IronPort-SDR: CDBfmAuV6v7wMPJKnN3x9OjPOILt43ddo8PVukaz/YkMtxRyHnSqq9BkFfxTTU3n7Ub57tfImo NV1EZSUDN86w== X-IronPort-AV: E=McAfee;i="6000,8403,9747"; a="157303572" X-IronPort-AV: E=Sophos;i="5.77,274,1596524400"; d="scan'208,217";a="157303572" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2020 04:58:24 -0700 IronPort-SDR: bCMeM/hcW7mBViNqCDQT0/cQ+K4ackmdWNT+nasRFFpq8wWaMKoDX+v6M7IdblvOFTumIP8WX7 voergmk8VEFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,274,1596524400"; d="scan'208,217";a="336781374" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 18 Sep 2020 04:58:24 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) 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; Fri, 18 Sep 2020 04:58:23 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 18 Sep 2020 04:58:23 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) 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 via Frontend Transport; Fri, 18 Sep 2020 04:58:23 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.174) 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; Fri, 18 Sep 2020 04:58:23 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M1ncWUEqapbVd7Y4B3TJ3TW1gDdQqLeZNmImi+msJWQzoNY31AL5k+qMU9ctmrnYF2V9ogaFHkG4Mebfk3vNYTi4PqFkUzTCTEf4Jpy7EbkQDDJWu24ITVCoyUKzYm0oegSPXjjunm6ic7dwTQoutkNK2Mo5ooc2fHUt9wggQXVHiKVNzVMQrLutOgJTyZceofKK2f5LdQ69VaYeyIQvo4WobtwJm/PQmH6kFlsR3yW5rPRfyGM4H8qsOcMofeyx84Ydlhcx+PVfIVFSav/NqBoCQfpfX4F3A5uwzbz6JXe6NadXU1F6QrLnsevCPHaGfWyZCtmMij49bncCjfYWzw== 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=yfdmNwo+uhkU9h5UyGMDLyBz1iMgARlVZM+AjMQF+Ww=; b=ImVjuuM3gF9wdupmwr8qSNuG0caDBQcsHS4zQ/wRsEjQM2FOb/Q+2gVYQcnup6WYrv1v6C9uIMR/TIasOEZzDnmelM8hWG9pGnSo50tzg+rqfneo+0lVGLnoFBjnphRj5AwOKHrsEiPb+vpJSvlsIvZZThuNUYRyMaH4aaotZc7Qs9jIw+Y4/Z/7AKH4z+vgTF7SKt7RzuJpftSrQl0WVV/dtDayoDgAY9gucTcQhlL9LxLb/tZ1Vr8GQgzkXIVVcbQFEbsXgqeq+vIEx4/Lvmqzs3G4dNtK+8ZozMEnmTxKGHCom6f+ulUAGz2cBqADZwRHm8LIK0YmyMj2WGj6AQ== 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=yfdmNwo+uhkU9h5UyGMDLyBz1iMgARlVZM+AjMQF+Ww=; b=BzdrCcAwtOLCr5gvYilIJ8rGybrWE1uoGi4X2y2HGiUP1kfdz7J7K6H9DlrNDjKCQ0YyVSRoMmb2RrHiMk3vpT6rLKlGlLhscbWjN+mBBg0pjNVp3Wf+fw63y0q5QEUEwT7UmmM5keIWe3uVhBjsCPMuD+pv7Mch71Qj4AHWnbk= Received: from DM6PR11MB4315.namprd11.prod.outlook.com (2603:10b6:5:201::28) by DM6PR11MB4316.namprd11.prod.outlook.com (2603:10b6:5:205::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3370.16; Fri, 18 Sep 2020 11:58:19 +0000 Received: from DM6PR11MB4315.namprd11.prod.outlook.com ([fe80::4c5c:c6d0:dfd3:1e45]) by DM6PR11MB4315.namprd11.prod.outlook.com ([fe80::4c5c:c6d0:dfd3:1e45%4]) with mapi id 15.20.3370.019; Fri, 18 Sep 2020 11:58:19 +0000 From: "Wadhawan, Divneil R" To: "Ni, Ray" , "devel@edk2.groups.io" CC: gaoliming , 'Andrew Fish' , "Justen, Jordan L" , "Kinney, Michael D" , "Wadhawan, Divneil R" Subject: Re: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for Secure Boot Thread-Topic: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for Secure Boot Thread-Index: AdaMQS9sqEhJ/RVOQYWR22UtRyYHlAAgXCCgAABlWnAAAbCaMAA5kd/AAABiu/A= Date: Fri, 18 Sep 2020 11:58:19 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [106.200.250.114] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d2c0f177-7f87-4eca-4984-08d85bca22d8 x-ms-traffictypediagnostic: DM6PR11MB4316: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6Ke5uDb+HHRCK+rXmxJB2VkFUUoDUyrjAdx5mGu6T8GjzYXslKrVjcpY/nMNSp5diT3ijdwqQo2dIxoE0sSNpWB0dolFGSH1iWZbMt3sWR8ZcxI1ccDNhttShJcodFWi898PaL3sqWUuGpm7Y5rgDnLmaYl4QcXuKtlR5E1ob4o/K4LDYTBgIHpUbaUjxIXZCdIOE3UJnN61qgjk4+3MghloQZChirBUFDjYlJNabDTS/UbNLjdaG8ZG0J4rjnoL5PAFzcsajJev+zdgRdx6X4tkpI3nPMU0e66h9Gg9kCkLNkSVly/DKOEr18SID9yzGU/HchkFtHSUP2tLTaGj1+/HYrDrz/AzhWjZRp3z8TfbA8QAvwMNF16oaHgLrWSk05zQl709TA8dh4ubrShjYMU22lmZylX41tiv8mj2HW++9aex+P/489W95ucfAuf4 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4315.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(376002)(396003)(39860400002)(136003)(366004)(316002)(186003)(26005)(8936002)(8676002)(9326002)(2906002)(966005)(7696005)(6506007)(53546011)(478600001)(55016002)(9686003)(107886003)(66446008)(64756008)(66556008)(66476007)(76116006)(110136005)(4326008)(54906003)(86362001)(66946007)(71200400001)(52536014)(166002)(83380400001)(33656002)(5660300002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: +8GojTYcW3tpgRIt0xP4lsqJtDL7DcxpPN/7zdmHV8lyYZcBu2qEyhmKN9IAyi/rM2oUmmtHbd7pyCF+xCRiBI5hV5mxYUz3bPBkYI7YWJUWLqcJorvnPvGktPxeavG/o4RTIjblPaRNgtof4dSupA8RMkuOpIg64/w/vrepAIkDlQbeDQeMEL1IPSROvumplBAa+ZUl5zXYcxfJhR8GfMZtAdFqRge+1fAOxqC8j5Bb5jOcIJEDupvCAMINpFk7nTSwavlrXAul2rut/ZJiIOJM74fypExIWIyFmsdmPdzgDtaW4tcY/kBKm6qLydTtmaFqDQdJ9453PB7FxaaJO0Z9plD2iCvdcbtfmjl7neoQDPXCmMlF23U1FXqlEuK5ilqJlQIM9Tqx/F9ox9ml9+XMpYRraHfExO4dKPhgCQgp1J9EhYh5BX9yOQQjuwpN1GuBw5roPixbsYTI1Br6PZ4Ax7QTRK8AsVlnyRprO1qs2EfdqMFboOfFKZRlNRFJXLlgoTXzbbUhoAKcQdz2hcRcJNMn88KtQl01vNLm0zIOqL/6l2X5TaMS+HGyoDVRYrS7wGC/mt5UJmaOpWyO8DKkYdI5sJM3iz2wBIzfXSYvJIrmewaupusaYkQ/psPykYVxMtJMLASSdi2gy9eWgw== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4315.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2c0f177-7f87-4eca-4984-08d85bca22d8 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Sep 2020 11:58:19.7967 (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: nVQPn5CEbuCCcf2fxk255TyP+dNw/YebzvtL4LUs0SLVuRwHK9DzGlyOc1t0P+twsIflysntSXHSaSWWsjSXCei0a58OCyC+DhoHRM91R9Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4316 Return-Path: divneil.r.wadhawan@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_DM6PR11MB43156EF6DB722179335D5FA6CB3F0DM6PR11MB4315namp_" --_000_DM6PR11MB43156EF6DB722179335D5FA6CB3F0DM6PR11MB4315namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ray, Thanks for your help. I see the patch is merged now. :) Regards, Divneil From: Ni, Ray Sent: Friday, September 18, 2020 5:17 PM To: Wadhawan, Divneil R ; devel@edk2.groups.i= o Cc: gaoliming ; 'Andrew Fish' ; = Justen, Jordan L ; Kinney, Michael D Subject: RE: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for Secure= Boot Divneil, pull request is created: https://github.com/tianocore/edk2/pull/941 If it succeeds, the patch will be merged automatically. If it fails, please check the specific failure message and provide updated = patch. Thanks, Ray From: Ni, Ray Sent: Thursday, September 17, 2020 4:19 PM To: Wadhawan, Divneil R >; devel@edk2.groups.io Cc: gaoliming >; = 'Andrew Fish' >; Justen, Jordan L <= jordan.l.justen@intel.com>; Kinney, Micha= el D > Subject: RE: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for Secure= Boot Reviewed-by: Ray Ni > From: Wadhawan, Divneil R > Sent: Thursday, September 17, 2020 3:43 PM To: Ni, Ray >; devel@edk2.groups.= io Cc: gaoliming >; = 'Andrew Fish' >; Justen, Jordan L <= jordan.l.justen@intel.com>; Kinney, Micha= el D >; Wadha= wan, Divneil R > Subject: RE: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for Secure= Boot Hi Ray, Yes, I have tested the following: 1. SECURE_BOOT_ENABLE=3Dtrue * Key Enrollment (PK, KEK, db) via custom mode * Execution of unit test shell application (signed one works okay, unsi= gned gives an Access denied) 1. SECURE_BOOT_ENABLE=3Dfalse (default case) * Secure Boot Configuration menu is not visible (Same as existing defau= lt case) * Execution of Unit Test Application (Signed/Unsigned both works okay) I am planning to post the script in BZ: https://bugzilla.tianocore.org/show= _bug.cgi?id=3D2949 in a day or too. The script generates the full key hierarchy that makes it easy to test this= patch. The patch in BZ requires modifications as per Mike's comment, so, you can s= kip the patches in BZ for now. Regards, Divneil From: Ni, Ray > Sent: Thursday, September 17, 2020 12:49 PM To: Wadhawan, Divneil R >; devel@edk2.groups.io Cc: gaoliming >; = 'Andrew Fish' >; Justen, Jordan L <= jordan.l.justen@intel.com>; Kinney, Micha= el D > Subject: RE: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for Secure= Boot Divneil, Just want to double confirm: did you test the secure boot and non-secure bo= ot? Thanks, Ray From: Wadhawan, Divneil R > Sent: Wednesday, September 16, 2020 11:53 PM To: devel@edk2.groups.io Cc: Ni, Ray >; gaoliming >; 'Andrew Fish' >; Justen, Jordan L >; Kinney, Michael D >; Wadhawan, Divneil R > Subject: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for Secure Boo= t SECURE_BOOT_ENABLE feature flag is introduced to enable Secure Boot. The following gets enabled with this patch: o Secure Boot Menu in "Device Manager" for enrolling keys o Storage space for Authenticated Variables o Authenticated execution of 3rd party images Signed-off-by: Divneil Rai Wadhawan > --- EmulatorPkg/EmulatorPkg.dsc | 37 +++++++++++++++++++++++++++++++++++-- EmulatorPkg/EmulatorPkg.fdf | 14 ++++++++++++++ 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc index 86a6271735..c6e25c745e 100644 --- a/EmulatorPkg/EmulatorPkg.dsc +++ b/EmulatorPkg/EmulatorPkg.dsc @@ -32,6 +32,7 @@ DEFINE NETWORK_TLS_ENABLE =3D FALSE DEFINE NETWORK_HTTP_BOOT_ENABLE =3D FALSE DEFINE NETWORK_ISCSI_ENABLE =3D FALSE + DEFINE SECURE_BOOT_ENABLE =3D FALSE [SkuIds] 0|DEFAULT @@ -106,12 +107,20 @@ LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf CpuExceptionHandlerLib|MdeModulePkg/Library/CpuExceptionHandlerLibNull/C= puExceptionHandlerLibNull.inf TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf - AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf + PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecu= reLibNull.inf + AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf +!else + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf +!endif + [LibraryClasses.common.SEC] PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.i= nf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf @@ -162,6 +171,16 @@ TimerLib|EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.inf EmuThunkLib|EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf +[LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_DRIVER, Libr= aryClasses.common.UEFI_APPLICATION] +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf +!endif + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf +!endif + [LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVE= R, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_APPLICATION= ] HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf @@ -190,6 +209,10 @@ gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize|0x002a0000 gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareBlockSize|0x10000 gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareVolume|L"../FV/FV_RECOVERY.fd" +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE +!endif gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize|L"64!64" @@ -306,7 +329,14 @@ EmulatorPkg/ResetRuntimeDxe/Reset.inf MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf - MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf { + +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificatio= nLib.inf +!endif + } + MdeModulePkg/Universal/EbcDxe/EbcDxe.inf MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.in= f EmulatorPkg/EmuThunkDxe/EmuThunk.inf @@ -315,6 +345,9 @@ EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.inf EmulatorPkg/TimerDxe/Timer.inf +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDx= e.inf +!endif MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf index 295f6f1db8..b256aa9397 100644 --- a/EmulatorPkg/EmulatorPkg.fdf +++ b/EmulatorPkg/EmulatorPkg.fdf @@ -46,10 +46,17 @@ DATA =3D { # Blockmap[1]: End 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ## This is the VARIABLE_STORE_HEADER +!if $(SECURE_BOOT_ENABLE) =3D=3D FALSE #Signature: gEfiVariableGuid =3D # { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0= xfe, 0x7d }} 0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41, 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d, +!else + # Signature: gEfiAuthenticatedVariableGuid =3D + # { 0xaaf32c78, 0x947b, 0x439a, { 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0= x77, 0x92 }} + 0x78, 0x2c, 0xf3, 0xaa, 0x7b, 0x94, 0x9a, 0x43, + 0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92, +!endif #Size: 0xc000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableS= ize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) =3D 0xBFB8 # This can speed up the Variable Dispatch a bit. 0xB8, 0xBF, 0x00, 0x00, @@ -186,6 +193,13 @@ INF RuleOverride =3D UI MdeModulePkg/Application/UiAp= p/UiApp.inf INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf +# +# Secure Boot Key Enroll +# +!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE +INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfig= Dxe.inf +!endif + # # Network stack drivers # -- 2.24.1.windows.2 --_000_DM6PR11MB43156EF6DB722179335D5FA6CB3F0DM6PR11MB4315namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Ray,

 

Thanks for your help.

I see the patch is merged now. :)

 

Regards,

Divneil

 

From: Ni, Ray <ray.ni@intel.com>
Sent: Friday, September 18, 2020 5:17 PM
To: Wadhawan, Divneil R <divneil.r.wadhawan@intel.com>; devel@= edk2.groups.io
Cc: gaoliming <gaoliming@byosoft.com.cn>; 'Andrew Fish' <af= ish@apple.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Kinn= ey, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for= Secure Boot

 

Divneil,

pull request is created: https://github.com/tianocore/edk2/pull/941

 

If it succeeds, the patch will be merged automatical= ly.

If it fails, please check the specific failure messa= ge and provide updated patch.

 

Thanks,

Ray

 

From: Ni, Ray
Sent: Thursday, September 17, 2020 4:19 PM
To: Wadhawan, Divneil R <divneil.r.wadhawan@intel.com>; devel@edk2.groups.io
Cc: gaoliming <gaolim= ing@byosoft.com.cn>; 'Andrew Fish' <afish@apple.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Kinney, Michael D <michae= l.d.kinney@intel.com>
Subject: RE: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for= Secure Boot

 

Reviewed-by: Ray Ni <ray.ni@intel.com>

 

From: Wadhawan, Divneil R <divneil.r.wadhawan@intel.com>
Sent: Thursday, September 17, 2020 3:43 PM
To: Ni, Ray <ray.ni@intel.com= >; devel@edk2.groups.io
Cc: gaoliming <gaolim= ing@byosoft.com.cn>; 'Andrew Fish' <afish@apple.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Kinney, Michael D <michae= l.d.kinney@intel.com>; Wadhawan, Divneil R <divneil.r.wadhawan@intel.com>
Subject: RE: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for= Secure Boot

 

Hi Ray,

 

Yes, I have tested the following:

 

  1. SECURE_BOOT_ENABLE=3Dtrue
  • Key Enrollment (PK, KEK, db) via custom mode
  • Exe= cution of unit test shell application (signed one works okay, unsigned give= s an Access denied)

 

  1. SECURE_BOOT_ENABLE=3Dfalse (default case)
  • Secure Boot Configuration menu is not visible (Same as existing defau= lt case)
  • Execution of Unit Test Application (Signed/Un= signed both works okay)

 

I am planning to post the script in BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2949 in a day or too.<= o:p>

The script generates the full key hierarchy that mak= es it easy to test this patch.

The patch in BZ requires modifications as per Mike&#= 8217;s comment, so, you can skip the patches in BZ for now.

 

Regards,

Divneil

 

From: Ni, Ray <ray.ni@intel.com>
Sent: Thursday, September 17, 2020 12:49 PM
To: Wadhawan, Divneil R <divneil.r.wadhawan@intel.com>; devel@edk2.groups.io
Cc: gaoliming <gaolim= ing@byosoft.com.cn>; 'Andrew Fish' <afish@apple.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Kinney, Michael D <michae= l.d.kinney@intel.com>
Subject: RE: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for= Secure Boot

 

Divneil,

Just want to double confirm: did you test the secure= boot and non-secure boot?

 

Thanks,

Ray

 

From: Wadhawan, Divneil R <divneil.r.wadhawan@intel.com>
Sent: Wednesday, September 16, 2020 11:53 PM
To: devel@edk2.groups.io=
Cc: Ni, Ray <ray.ni@intel.com= >; gaoliming <gaolimi= ng@byosoft.com.cn>; 'Andrew Fish' <afish@apple.com>; Justen, Jordan L <jordan.l.justen@intel.com>; Kinney, Michael D <michae= l.d.kinney@intel.com>; Wadhawan, Divneil R <divneil.r.wadhawan@intel.com>
Subject: [edk2-devel] [PATCH v2] EmulatorPkg: Enable support for Sec= ure Boot

 

SECURE_BOOT_ENABLE feature flag is introduced to ena= ble Secure Boot.

The following gets enabled with this patch:

o Secure Boot Menu in "Device Manager" for= enrolling keys

o Storage space for Authenticated Variables

o Authenticated execution of 3rd party images

 

Signed-off-by: Divneil Rai Wadhawan <divneil.r.wadhawan@intel.com>

---

EmulatorPkg/EmulatorPkg.dsc | 37 +++++++++++++++++++= ++++++++++++++++--

EmulatorPkg/EmulatorPkg.fdf | 14 ++++++++++++++=

2 files changed, 49 insertions(+), 2 deletions(-)

 

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorP= kg/EmulatorPkg.dsc

index 86a6271735..c6e25c745e 100644

--- a/EmulatorPkg/EmulatorPkg.dsc

+++ b/EmulatorPkg/EmulatorPkg.dsc

@@ -32,6 +32,7 @@

   DEFINE NETWORK_TLS_ENABLE  &n= bsp;    =3D FALSE

   DEFINE NETWORK_HTTP_BOOT_ENABLE =3D FAL= SE

   DEFINE NETWORK_ISCSI_ENABLE  =    =3D FALSE

+  DEFINE SECURE_BOOT_ENABLE   &= nbsp;   =3D FALSE

 

 [SkuIds]

   0|DEFAULT

@@ -106,12 +107,20 @@

   LockBoxLib|MdeModulePkg/Library/LockBox= NullLib/LockBoxNullLib.inf

   CpuExceptionHandlerLib|MdeModulePkg/Lib= rary/CpuExceptionHandlerLibNull/CpuExceptionHandlerLibNull.inf

   TpmMeasurementLib|MdeModulePkg/Library/= TpmMeasurementLibNull/TpmMeasurementLibNull.inf

-  AuthVariableLib|MdeModulePkg/Library/AuthVar= iableLibNull/AuthVariableLibNull.inf

   VarCheckLib|MdeModulePkg/Library/VarChe= ckLib/VarCheckLib.inf

   SortLib|MdeModulePkg/Library/BaseSortLi= b/BaseSortLib.inf

   ShellLib|ShellPkg/Library/UefiShellLib/= UefiShellLib.inf

   FileHandleLib|MdePkg/Library/UefiFileHa= ndleLib/UefiFileHandleLib.inf

 

+!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE

+  IntrinsicLib|CryptoPkg/Library/IntrinsicLib/= IntrinsicLib.inf

+  OpensslLib|CryptoPkg/Library/OpensslLib/Open= sslLibCrypto.inf

+  PlatformSecureLib|SecurityPkg/Library/Platfo= rmSecureLibNull/PlatformSecureLibNull.inf

+  AuthVariableLib|SecurityPkg/Library/AuthVari= ableLib/AuthVariableLib.inf

+!else

+  AuthVariableLib|MdeModulePkg/Library/AuthVar= iableLibNull/AuthVariableLibNull.inf

+!endif

+

[LibraryClasses.common.SEC]

   PeiServicesLib|EmulatorPkg/Library/SecP= eiServicesLib/SecPeiServicesLib.inf

   PcdLib|MdePkg/Library/BasePcdLibNull/Ba= sePcdLibNull.inf

@@ -162,6 +171,16 @@

   TimerLib|EmulatorPkg/Library/DxeCoreTim= erLib/DxeCoreTimerLib.inf

  EmuThunkLib|EmulatorPkg/Library/DxeEmuLi= b/DxeEmuLib.inf

 

+[LibraryClasses.common.DXE_DRIVER, LibraryClasses.c= ommon.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION]

+!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE

+  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/= BaseCryptLib.inf

+!endif

+

+[LibraryClasses.common.DXE_RUNTIME_DRIVER]

+!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE

+  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/= RuntimeCryptLib.inf

+!endif

+

[LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryCl= asses.common.UEFI_DRIVER, LibraryClasses.common.DXE_DRIVER, LibraryClasses.= common.UEFI_APPLICATION]

   HobLib|MdePkg/Library/DxeHobLib/DxeHobL= ib.inf

   PcdLib|MdePkg/Library/DxePcdLib/DxePcdL= ib.inf

@@ -190,6 +209,10 @@

   gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwa= reFdSize|0x002a0000

   gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwa= reBlockSize|0x10000

   gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwa= reVolume|L"../FV/FV_RECOVERY.fd"

+!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE

+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVar= iableSize|0x2800

+  gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysica= lPresence|TRUE

+!endif

 

   gEmulatorPkgTokenSpaceGuid.PcdEmuM= emorySize|L"64!64"

 

@@ -306,7 +329,14 @@

   EmulatorPkg/ResetRuntimeDxe/Reset.inf

   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe= .inf

   EmulatorPkg/FvbServicesRuntimeDxe/FvbSe= rvicesRuntimeDxe.inf

-  MdeModulePkg/Universal/SecurityStubDxe/Secur= ityStubDxe.inf

+

+  MdeModulePkg/Universal/SecurityStubDxe/Secur= ityStubDxe.inf {

+    <LibraryClasses>

+!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE

+      NULL|SecurityPkg/Lib= rary/DxeImageVerificationLib/DxeImageVerificationLib.inf

+!endif

+  }

+

   MdeModulePkg/Universal/EbcDxe/EbcDxe.in= f

   MdeModulePkg/Universal/MemoryTest/NullM= emoryTestDxe/NullMemoryTestDxe.inf

   EmulatorPkg/EmuThunkDxe/EmuThunk.inf

@@ -315,6 +345,9 @@

   EmulatorPkg/PlatformSmbiosDxe/PlatformS= mbiosDxe.inf

   EmulatorPkg/TimerDxe/Timer.inf

 

+!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE

+  SecurityPkg/VariableAuthenticated/SecureBoot= ConfigDxe/SecureBootConfigDxe.inf

+!endif

 

   MdeModulePkg/Universal/Variable/Ru= ntimeDxe/VariableRuntimeDxe.inf {

     <LibraryClasses>=

diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorP= kg/EmulatorPkg.fdf

index 295f6f1db8..b256aa9397 100644

--- a/EmulatorPkg/EmulatorPkg.fdf

+++ b/EmulatorPkg/EmulatorPkg.fdf

@@ -46,10 +46,17 @@ DATA =3D {

   # Blockmap[1]: End

   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0= 0, 0x00,

   ## This is the VARIABLE_STORE_HEADER

+!if $(SECURE_BOOT_ENABLE) =3D=3D FALSE

   #Signature: gEfiVariableGuid =3D

   #  { 0xddcf3616, 0x3275, 0x4164, {= 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}

   0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x6= 4, 0x41,

   0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xf= e, 0x7d,

+!else

+  # Signature: gEfiAuthenticatedVariableGuid = =3D

+  #  { 0xaaf32c78, 0x947b, 0x439a, { 0xa1= , 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x92 }}

+  0x78, 0x2c, 0xf3, 0xaa, 0x7b, 0x94, 0x9a, 0x= 43,

+  0xa1, 0x80, 0x2e, 0x14, 0x4e, 0xc3, 0x77, 0x= 92,

+!endif

   #Size: 0xc000 (gEfiMdeModulePkgTokenSpa= ceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_H= EADER) =3D 0xBFB8

   # This can speed up the Variable Dispat= ch a bit.

   0xB8, 0xBF, 0x00, 0x00,

@@ -186,6 +193,13 @@ INF  RuleOverride =3D UI M= deModulePkg/Application/UiApp/UiApp.inf

INF  MdeModulePkg/Application/BootManagerMenuAp= p/BootManagerMenuApp.inf

INF  MdeModulePkg/Universal/DriverSampleDxe/Dri= verSampleDxe.inf

 

+#

+# Secure Boot Key Enroll

+#

+!if $(SECURE_BOOT_ENABLE) =3D=3D TRUE

+INF SecurityPkg/VariableAuthenticated/SecureBootCon= figDxe/SecureBootConfigDxe.inf

+!endif

+

#

# Network stack drivers

#

--

2.24.1.windows.2

--_000_DM6PR11MB43156EF6DB722179335D5FA6CB3F0DM6PR11MB4315namp_--