From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.58]) by mx.groups.io with SMTP id smtpd.web10.8605.1625821955038058042 for ; Fri, 09 Jul 2021 02:12:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=BE536WuZ; spf=pass (domain: arm.com, ip: 40.107.3.58, mailfrom: sunny.wang@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=51nCdxxHZUSt6QGsld75Yb4drY94Z/DKOArPt46hiHk=; b=BE536WuZS0jVfScVrKzKtB+bjjmH2mKSDxEIoOvgZ/SgXMWto9cq0dUcg+UVfdQsGRPmijZeAWImbepP2YehqlUmEE+kebiHWjdVjHlzpAAiUtfnce82iR56B2Za7LvEmu/5A3VeHXyTPPalupptxD4jxJYtEMVQrz2lsN4SaJU= Received: from DB6PR07CA0086.eurprd07.prod.outlook.com (2603:10a6:6:2b::24) by DB9PR08MB7051.eurprd08.prod.outlook.com (2603:10a6:10:2be::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.21; Fri, 9 Jul 2021 09:12:30 +0000 Received: from DB5EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2b:cafe::a8) by DB6PR07CA0086.outlook.office365.com (2603:10a6:6:2b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.10 via Frontend Transport; Fri, 9 Jul 2021 09:12:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT042.mail.protection.outlook.com (10.152.21.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4308.20 via Frontend Transport; Fri, 9 Jul 2021 09:12:30 +0000 Received: ("Tessian outbound 4c0db4752fcb:v98"); Fri, 09 Jul 2021 09:12:29 +0000 X-CR-MTA-TID: 64aa7808 Received: from f9b61ac0e9bb.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 963CD950-D9CF-44D4-8E11-D93AFAAD258A.1; Fri, 09 Jul 2021 09:12:19 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f9b61ac0e9bb.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 09 Jul 2021 09:12:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JPdN1wNIILIFI5gVopqheBiqjU4/39x2uuojh9Qbv9ZL6SEeA5kkeRuQsDdZWFvio50KSqcWWoIU7heWNGVtFi1gWq0YpfqTVKscbvvHcEQmoDDIOmu+rxxmd/ZooNqDoSPHJSQ4JdWVfaVuWEDaFjFXRxJT3SmxBn50kxpnVyz4Vx0SBTP4FH1k3SXR9YlJvEp8iJeHoldboDSt34rMRZmJRxDe36NKPl/62gGHubUDm58ahuThJyEZVS/BwBLjgcIuImjufUIxZiGMz1z8DZduyRGe1xXkdBGzAYR0+el0xA2nbqeXr4s3SMX+zfDlR3TEyEIiJg+cqgoDeMmgJA== 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=51nCdxxHZUSt6QGsld75Yb4drY94Z/DKOArPt46hiHk=; b=OgxP3H2m7cDEwtHv//HLsmhuWB0YESXX1zUwJJJgpviLxezTrspF1IyAqXLT4DNOXf5WseEXyYlVJpDl9S9vD92BEMD68wDMV2HTaVXdakXwb4BMmTkfzVYDnbJDgTKqrY0ITzCb28P4v9GKa6bKH7D5BSkjBaZXjPZHtujxZ47QAnPXEOWW6wiuuRWl0mdiSInApCq9sbXN84BZ+qyYdnXkFKwpkvRvJjoFFDUaoRmwlGfEawZFWImLcTklyP0xnPbACo25UeUK7lyZK/siAzu9pBzssylaX3j/O7qoHFxdPcl0IK4hWmZoJAhJVfKIeMiKh5ti+K7IP0yuvGHUlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=51nCdxxHZUSt6QGsld75Yb4drY94Z/DKOArPt46hiHk=; b=BE536WuZS0jVfScVrKzKtB+bjjmH2mKSDxEIoOvgZ/SgXMWto9cq0dUcg+UVfdQsGRPmijZeAWImbepP2YehqlUmEE+kebiHWjdVjHlzpAAiUtfnce82iR56B2Za7LvEmu/5A3VeHXyTPPalupptxD4jxJYtEMVQrz2lsN4SaJU= Received: from DB8PR08MB3993.eurprd08.prod.outlook.com (2603:10a6:10:ad::26) by DBBPR08MB6203.eurprd08.prod.outlook.com (2603:10a6:10:201::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Fri, 9 Jul 2021 09:12:17 +0000 Received: from DB8PR08MB3993.eurprd08.prod.outlook.com ([fe80::14b0:85d6:deeb:9ee0]) by DB8PR08MB3993.eurprd08.prod.outlook.com ([fe80::14b0:85d6:deeb:9ee0%7]) with mapi id 15.20.4308.023; Fri, 9 Jul 2021 09:12:17 +0000 From: "Sunny Wang" To: Grzegorz Bernacki , "devel@edk2.groups.io" CC: "leif@nuviainc.com" , "ardb+tianocore@kernel.org" , Samer El-Haj-Mahmoud , "mw@semihalf.com" , "upstream@semihalf.com" , "jiewen.yao@intel.com" , "jian.j.wang@intel.com" , "min.m.xu@intel.com" , "lersek@redhat.com" , Sami Mujawar , "afish@apple.com" , "ray.ni@intel.com" , "jordan.l.justen@intel.com" , "rebecca@bsdio.com" , "grehan@freebsd.org" , Thomas Abraham , "chasel.chiu@intel.com" , "nathaniel.l.desimone@intel.com" , "gaoliming@byosoft.com.cn" , "eric.dong@intel.com" , "michael.d.kinney@intel.com" , "zailiang.sun@intel.com" , "yi.qian@intel.com" , "graeme@nuviainc.com" , "rad@semihalf.com" , "pete@akeo.ie" , Sunny Wang Subject: Re: [PATCH v5 05/10] SecurityPkg: Remove duplicated functions from SecureBootConfigDxe. Thread-Topic: [PATCH v5 05/10] SecurityPkg: Remove duplicated functions from SecureBootConfigDxe. Thread-Index: AQHXblouDe8DcvLe6EihGuLWnL4Ag6s6aAFA Date: Fri, 9 Jul 2021 09:12:17 +0000 Message-ID: References: <20210701091758.1057485-1-gjb@semihalf.com> <20210701091758.1057485-6-gjb@semihalf.com> In-Reply-To: <20210701091758.1057485-6-gjb@semihalf.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 55646B866A6CA14686A7395903E739E7.0 x-checkrecipientchecked: true Authentication-Results-Original: semihalf.com; dkim=none (message not signed) header.d=none;semihalf.com; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 354f0127-1dc7-4d25-2ba4-08d942b9adb4 x-ms-traffictypediagnostic: DBBPR08MB6203:|DB9PR08MB7051: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:40;OLM:480; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: F19/3tSRaqXN1SbDUUq2uteDLdsPd8R8k2h/opWvvEtlWr5cCITScUq6xdnVdgoW2+/voaElsBUs0awSWDnCinrigA5fs/ckG89+V0uxsScSWK5OWzWZttinov4Wz74t+ULutZ70jvS/K41Qd9kyD5uca4hdIHo92nWmlc6FJeRtUc7nM7oV1IeSUNgmCwbmeVhtZ8Jah2wTrhkNpqoD0IpvVBuNIdEshhESZT9JeiuGecAIs7375Sloc14A9aaQH2EwMgOPJDKybaDnmjKPQt45Zv0SlEsMmH/KbF+S1HishtB/v4fP1r28RoiXCZy0MoCqEOxX9xe/BzB6Qm5uni3NZ+j0VHETidRimYYKGvRYJp2vaLU3F4IQkiHnYPC4CInDL8fjvH8PgQqDh8T1ksNDBiX9vwi2X+DZht+42iikmbt2p6HSqQrE4nlYVkdAbb231yXCkJ1w8bho8FwZE5Nv+VROz7pHmH6hU/YUNxvTvYXRFPi+J9IbVHJGTHbcOqBCk726abNIpNaNRa+3mvuSxL02yi1tmH71+46BmyRa6L3dRBtMPCH5SzRb2ouYYQcSaRGQs9rPqOKGzYXTKsXeOJFKmRenha2nK/UZseUIzQXKn8cVtPauuXm1IHxTW8qnE4eqYKVgRo0KXkq5JQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB8PR08MB3993.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(136003)(39850400004)(366004)(346002)(376002)(478600001)(66946007)(86362001)(15650500001)(5660300002)(33656002)(38100700002)(71200400001)(53546011)(6506007)(66556008)(76116006)(8676002)(122000001)(66476007)(64756008)(66446008)(8936002)(316002)(83380400001)(110136005)(52536014)(54906003)(2906002)(26005)(186003)(4326008)(7696005)(7416002)(55016002)(9686003);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?M8QFWuUxUgfbKWs8ISEbkhNGTgAlnMZPCFj7E9WB5KkPawi4UEuiDtlJPF3F?= =?us-ascii?Q?R/LVLdQxHn4q0MJ4jJIbCRmX4IiN8Nqs1jjuI2/L7ZajhB2R7LKKsNB0Vur2?= =?us-ascii?Q?wQZVVYWnNtGIompenFMQPQVJW6HJtJqP5HqHLZkrapO+4iQwRoFeXQuUQq0/?= =?us-ascii?Q?v/5DGKr814MXJGahhmpGReQBbOylymSHunEJB/DscF4bxqX33zA+u+rtCmdo?= =?us-ascii?Q?dO/griiWMm1GB6Fs5sAkO4SAujlc9G2+rTJUgQaXojJfHUiiYLwV5YAd9lj4?= =?us-ascii?Q?MMvyXUMY4x3bZ07hT2rD0lIx09iX6M+IVJIxIBv88maDnK8ictrjwT4rIavM?= =?us-ascii?Q?CqJHHpy6RmNtRGRQE0PyKow4GXkX7+VoXOVwtx8G65XRcGNEPBlo+a7NkLc7?= =?us-ascii?Q?/sRubvjxtXpxzMzrl0X1jr4ta0PhM17iXO9vmP2ikhyLkasJrmTfXumyMhV/?= =?us-ascii?Q?LieGWUgWBQ0+8A6mPKZAEDb6q/8gDP9c4NOaOOumFs3MJIm/OH1JSyaOvR8E?= =?us-ascii?Q?QQBquU+udkamMPT/Owd5/sqDDL71MdvTnWdeFSMGHWjjhEH5vpdDsGUMrmE3?= =?us-ascii?Q?5whfiL1F84YQmoEiMJ7CSdwaGAkvbT5FVtmzKqac9wMMesXcZx+aBHRZjwC5?= =?us-ascii?Q?rybH6b8r9JJ1AD3eP0XwC0dTpPK3mfyEtzljIvF14EuPKBo2xzWMWz160m0L?= =?us-ascii?Q?99yOckcWlH4f+RvI775rEej+5Az519sMLMAo8N2zAGnXB+IDfcgjia8IcoYY?= =?us-ascii?Q?0gMQlIdt6V6hAeqqFRmJi0xV28/BieDctNGpcngb3OuE1Fdtk6aG/7m6gPrs?= =?us-ascii?Q?txSByiIOhr6UQ8BFvXnSuD+GOcRxInUfBumVFJ6E+PzIXqznk4Lo2OVkoo9T?= =?us-ascii?Q?A9r3jKCQHntUKr30LAkTMNIlkycdK7CywxHO9zwljZ/GSF5AhYXj68u8GrHq?= =?us-ascii?Q?gRilCbXwYgD1h84N6NwR78GFs2zNMvKXm1i+jQFIYHq4lb/KtEvD8z2aJCx0?= =?us-ascii?Q?UDYvt8p8e+YUhiQjlP0iBtFh4K4O2naAsjkza9YWWunN4HuSjUAlieia3t5V?= =?us-ascii?Q?ORbm/tI/7q25+qg7S4ry6tgIIpdrWERYhiF4wpCOH2zANEO6SrId3V2s82Pg?= =?us-ascii?Q?HiRJpGkl2QVQ/BGfSF+FlM/H/rQ3cSRZg71264s3FLnpVE0fqCXBmF5RDV4W?= =?us-ascii?Q?Y5QDU+gtyxU0LWrGcjaOFpcWU/23P5KSh36n/T59csVLOUrmTVughNqQuf+X?= =?us-ascii?Q?FhnfMh6m8YWv62zH3wEaSKxIGCe5jf6CkgAUVeIMJwlWfdI+JhLYMWASByX4?= =?us-ascii?Q?E0vwIe8vHuFBGiXK0JsNiihG?= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6203 Original-Authentication-Results: semihalf.com; dkim=none (message not signed) header.d=none;semihalf.com; dmarc=none action=none header.from=arm.com; Return-Path: Sunny.Wang@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 45e8a8e6-2e2e-4aa0-a153-08d942b9a637 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vaA+3uduXqoHGrCL2DFgf+h0HCQYXVaEGBH1Wp8FnG8jb2GPxTo39s3Ctxd6IaASKI4YRmGuxaGbDlHAi7GIQldisXRL9UI8S+gDSc0NaEvGOMBFXtBOfQNL7J83Ism/+2hTjEFIjE/FTbJVgISfx+dKKOmcxw92kYOgZbu51qaMyBnD3lFwdnf8cuzuSAFG60n3sRSS1+wO1NElmdxTdSHcQIrF0QQd9/4N4vW5QMaSHZ4KeCVOmrF1PodqZ+S9NAoCzNDiuv4+4Pm/lAM7bjW/QQ5goEabcAaO9M5qFggCmOPv69OT5ligTieve01he0eCGQlFVRUtylY9twN4y134j610GjLXcBFHIK3fKf23QvAMoOMAnTIUg/EsepxPG6UBL2MPXiSBOe9qpxkh/l5bAi/HjAfDRBeSr211t+RNTeMzzYafygeckQCEJ3YSMhiLRWSi8yIFUtfK7VCJIGrvuxBdCHEcooOfNajuuWeQ8Emqy/WQYyAHklzjYCC4iwsqfnlZfcamCDQdV5doyvuY7RcX37HJwome8KJMK6tlHGuxD4UY9AKt+J/ptAgMT10W4c0nRAkIe1pHzTUzUaYGuwgmxFjoEXJjHd88b8+F1A3661rOpbEB+ksp3teh9HxHrOPx5dm48iWSxGYUY5xk8IVabGXarKordwvtbNlQjZQy/94atbhCn9zXs4h0rwBcf9l4/tmiHCSQzHm5Zg== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(396003)(136003)(376002)(346002)(39850400004)(36840700001)(46966006)(316002)(33656002)(110136005)(52536014)(6506007)(53546011)(7696005)(82740400003)(47076005)(83380400001)(356005)(81166007)(5660300002)(70586007)(70206006)(15650500001)(8936002)(82310400003)(36860700001)(26005)(336012)(186003)(55016002)(9686003)(8676002)(86362001)(4326008)(2906002)(54906003)(478600001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2021 09:12:30.0204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 354f0127-1dc7-4d25-2ba4-08d942b9adb4 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7051 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Looks good to me. Reviewed-by: Sunny Wang -----Original Message----- From: Grzegorz Bernacki Sent: Thursday, July 1, 2021 5:18 PM To: devel@edk2.groups.io Cc: leif@nuviainc.com; ardb+tianocore@kernel.org; Samer El-Haj-Mahmoud ; Sunny Wang ; mw@semihalf.co= m; upstream@semihalf.com; jiewen.yao@intel.com; jian.j.wang@intel.com; min.= m.xu@intel.com; lersek@redhat.com; Sami Mujawar ; afi= sh@apple.com; ray.ni@intel.com; jordan.l.justen@intel.com; rebecca@bsdio.co= m; grehan@freebsd.org; Thomas Abraham ; chasel.chiu= @intel.com; nathaniel.l.desimone@intel.com; gaoliming@byosoft.com.cn; eric.= dong@intel.com; michael.d.kinney@intel.com; zailiang.sun@intel.com; yi.qian= @intel.com; graeme@nuviainc.com; rad@semihalf.com; pete@akeo.ie; Grzegorz B= ernacki Subject: [PATCH v5 05/10] SecurityPkg: Remove duplicated functions from Sec= ureBootConfigDxe. This commit removes functions which were added to SecureBootVariableLib. It also adds dependecy on that library. Signed-off-by: Grzegorz Bernacki --- SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.= inf | 1 + SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl= .c | 189 +------------------- 2 files changed, 2 insertions(+), 188 deletions(-) diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBo= otConfigDxe.inf b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/Sec= ureBootConfigDxe.inf index 573efa6379..30d9cd8025 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi= gDxe.inf +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi= gDxe.inf @@ -54,6 +54,7 @@ DevicePathLib FileExplorerLib PeCoffLib + SecureBootVariableLib [Guids] ## SOMETIMES_CONSUMES ## Variable:L"CustomMode" diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBo= otConfigImpl.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/Secu= reBootConfigImpl.c index e82bfe7757..67e5e594ed 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi= gImpl.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfi= gImpl.c @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "SecureBootConfigImpl.h" #include +#include CHAR16 mSecureBootStorageName[] =3D L"SECUREBOOT_CONFIGURATIO= N"; @@ -237,168 +238,6 @@ SaveSecureBootVariable ( return Status; } -/** - Create a time based data payload by concatenating the EFI_VARIABLE_AUTHE= NTICATION_2 - descriptor with the input data. NO authentication is required in this fu= nction. - - @param[in, out] DataSize On input, the size of Data buffer in by= tes. - On output, the size of data returned in= Data - buffer in bytes. - @param[in, out] Data On input, Pointer to data buffer to be = wrapped or - pointer to NULL to wrap an empty payloa= d. - On output, Pointer to the new payload d= ate buffer allocated from pool, - it's caller's responsibility to free th= e memory when finish using it. - - @retval EFI_SUCCESS Create time based payload successfully. - @retval EFI_OUT_OF_RESOURCES There are not enough memory resources t= o create time based payload. - @retval EFI_INVALID_PARAMETER The parameter is invalid. - @retval Others Unexpected error happens. - -**/ -EFI_STATUS -CreateTimeBasedPayload ( - IN OUT UINTN *DataSize, - IN OUT UINT8 **Data - ) -{ - EFI_STATUS Status; - UINT8 *NewData; - UINT8 *Payload; - UINTN PayloadSize; - EFI_VARIABLE_AUTHENTICATION_2 *DescriptorData; - UINTN DescriptorSize; - EFI_TIME Time; - - if (Data =3D=3D NULL || DataSize =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // In Setup mode or Custom mode, the variable does not need to be signed= but the - // parameters to the SetVariable() call still need to be prepared as aut= henticated - // variable. So we create EFI_VARIABLE_AUTHENTICATED_2 descriptor withou= t certificate - // data in it. - // - Payload =3D *Data; - PayloadSize =3D *DataSize; - - DescriptorSize =3D OFFSET_OF (EFI_VARIABLE_AUTHENTICATION_2, AuthInfo= ) + OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData); - NewData =3D (UINT8*) AllocateZeroPool (DescriptorSize + PayloadSize); - if (NewData =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - if ((Payload !=3D NULL) && (PayloadSize !=3D 0)) { - CopyMem (NewData + DescriptorSize, Payload, PayloadSize); - } - - DescriptorData =3D (EFI_VARIABLE_AUTHENTICATION_2 *) (NewData); - - ZeroMem (&Time, sizeof (EFI_TIME)); - Status =3D gRT->GetTime (&Time, NULL); - if (EFI_ERROR (Status)) { - FreePool(NewData); - return Status; - } - Time.Pad1 =3D 0; - Time.Nanosecond =3D 0; - Time.TimeZone =3D 0; - Time.Daylight =3D 0; - Time.Pad2 =3D 0; - CopyMem (&DescriptorData->TimeStamp, &Time, sizeof (EFI_TIME)); - - DescriptorData->AuthInfo.Hdr.dwLength =3D OFFSET_OF (WIN_CERTIFI= CATE_UEFI_GUID, CertData); - DescriptorData->AuthInfo.Hdr.wRevision =3D 0x0200; - DescriptorData->AuthInfo.Hdr.wCertificateType =3D WIN_CERT_TYPE_EFI_GUID= ; - CopyGuid (&DescriptorData->AuthInfo.CertType, &gEfiCertPkcs7Guid); - - if (Payload !=3D NULL) { - FreePool(Payload); - } - - *DataSize =3D DescriptorSize + PayloadSize; - *Data =3D NewData; - return EFI_SUCCESS; -} - -/** - Internal helper function to delete a Variable given its name and GUID, N= O authentication - required. - - @param[in] VariableName Name of the Variable. - @param[in] VendorGuid GUID of the Variable. - - @retval EFI_SUCCESS Variable deleted successfully. - @retval Others The driver failed to start the device. - -**/ -EFI_STATUS -DeleteVariable ( - IN CHAR16 *VariableName, - IN EFI_GUID *VendorGuid - ) -{ - EFI_STATUS Status; - VOID* Variable; - UINT8 *Data; - UINTN DataSize; - UINT32 Attr; - - GetVariable2 (VariableName, VendorGuid, &Variable, NULL); - if (Variable =3D=3D NULL) { - return EFI_SUCCESS; - } - FreePool (Variable); - - Data =3D NULL; - DataSize =3D 0; - Attr =3D EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | E= FI_VARIABLE_BOOTSERVICE_ACCESS - | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; - - Status =3D CreateTimeBasedPayload (&DataSize, &Data); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "Fail to create time-based data payload: %r", Sta= tus)); - return Status; - } - - Status =3D gRT->SetVariable ( - VariableName, - VendorGuid, - Attr, - DataSize, - Data - ); - if (Data !=3D NULL) { - FreePool (Data); - } - return Status; -} - -/** - - Set the platform secure boot mode into "Custom" or "Standard" mode. - - @param[in] SecureBootMode New secure boot mode: STANDARD_SECURE= _BOOT_MODE or - CUSTOM_SECURE_BOOT_MODE. - - @return EFI_SUCCESS The platform has switched to the spec= ial mode successfully. - @return other Fail to operate the secure boot mode. - -**/ -EFI_STATUS -SetSecureBootMode ( - IN UINT8 SecureBootMode - ) -{ - return gRT->SetVariable ( - EFI_CUSTOM_MODE_NAME, - &gEfiCustomModeEnableGuid, - EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCES= S, - sizeof (UINT8), - &SecureBootMode - ); -} - /** This code checks if the encode type and key strength of X.509 certificate is qualified. @@ -646,32 +485,6 @@ ON_EXIT: return Status; } -/** - Remove the PK variable. - - @retval EFI_SUCCESS Delete PK successfully. - @retval Others Could not allow to delete PK. - -**/ -EFI_STATUS -DeletePlatformKey ( - VOID -) -{ - EFI_STATUS Status; - - Status =3D SetSecureBootMode(CUSTOM_SECURE_BOOT_MODE); - if (EFI_ERROR (Status)) { - return Status; - } - - Status =3D DeleteVariable ( - EFI_PLATFORM_KEY_NAME, - &gEfiGlobalVariableGuid - ); - return Status; -} - /** Enroll a new KEK item from public key storing file (*.pbk). -- 2.25.1 IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.