From nobody Sat May 18 21:16:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+87399+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87399+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1646894747; cv=none; d=zohomail.com; s=zohoarc; b=W6AtbZZ+xJiR1Ro2CH41Hv6Jvr42MU6X2auh2UTGmJTmySrFqoise8guoXhtBuy3oZKE+LYjw26xlncAOwIHR6wMxj3NSiDUWBszDQP6A1hLJ9PYvLOLxPs+PSuPIKsPVRR8Bg3nGct1Yx1ALScy6LN0ZewMOdzYWJo0vvB6850= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646894747; h=Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=GjPnulViAFp4MdyGaFYSxNUYbv8VetQNfMq2R16nFq4=; b=lV8+553bRXv/21t9bDjQEj17vFPa4894p203ZYGHu3JKLM9IJiFvkcNnpnOWp04LfvEXUj2hltNEcWKYX2YXmvMWMqQsYF6xlglYcHhe3RBh8qlXoCQGZ9xUJ83kzIKENWk8KVO9MCL4icfqd3hoad8S3lB2a8JiKqmESXXh168= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+87399+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1646894747141374.4845623129381; Wed, 9 Mar 2022 22:45:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id VNYwYY1788612xHFLQxf1h34; Wed, 09 Mar 2022 22:45:46 -0800 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.6892.1646894745831549531 for ; Wed, 09 Mar 2022 22:45:46 -0800 X-Received: from pps.filterd (m0150242.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 229IOduR023826; Thu, 10 Mar 2022 06:45:42 GMT X-Received: from g4t3426.houston.hpe.com (g4t3426.houston.hpe.com [15.241.140.75]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3eq1g35gjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Mar 2022 06:45:42 +0000 X-Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3426.houston.hpe.com (Postfix) with ESMTP id 6B7495A; Thu, 10 Mar 2022 06:45:41 +0000 (UTC) X-Received: from abner-virtual-machine.asiapacific.hpqcorp.net (abner-virtual-machine.asiapacific.hpqcorp.net [15.119.211.133]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id 469FB48; Thu, 10 Mar 2022 06:45:40 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: Nickle Wang , Andrew Fish , Ray Ni Subject: [edk2-devel] [PATCH] EmulatorPkg/RedfishPlatformCredentialLib: Check EFI_SECURE_BOOT_MODE_NAME Date: Thu, 10 Mar 2022 13:42:25 +0800 Message-Id: <20220310054225.21135-1-abner.chang@hpe.com> X-Proofpoint-ORIG-GUID: 6iDPV-sIUYJHcHHvgS5e0GkeBmHOvGq8 X-Proofpoint-GUID: 6iDPV-sIUYJHcHHvgS5e0GkeBmHOvGq8 X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@hpe.com X-Gm-Message-State: X9dUPB2IBIW5wpmO486sqGiMx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1646894746; bh=/OqtQRa+oa3sgoGviYcVr9JFfvXwpDgre8xQQ/IyPNM=; h=Cc:Date:From:Reply-To:Subject:To; b=KKL/10yb2RoMbS7brew8Jo5XDrQTK78z2niVm21Gyx9U7LY26o7cqNLQIjXbiiW/Svt lbNzmRvBf6ZZNK+T4mDOwhYUXYylJRxdq2WyvfM9LAYSWzrBTe1zbyCvTlpXB1TeyXW0+ 3GDPy6H6oYEL6vyWmbpej3sypnjSBt6SLhc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1646894748302100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Check EFI_SECURE_BOOT_MODE_NAME before setting the flags to prohibit acquiring Redfish service credential and using Redfish service. Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Andrew Fish Cc: Ray Ni Reviewed-by: Nickle Wang --- .../RedfishPlatformCredentialLib.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatfo= rmCredentialLib.c b/EmulatorPkg/Library/RedfishPlatformCredentialLib/Redfis= hPlatformCredentialLib.c index eaf9c56450..a0233a984d 100644 --- a/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCrede= ntialLib.c +++ b/EmulatorPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCrede= ntialLib.c @@ -165,6 +165,9 @@ LibStopRedfishService ( IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType ) { + EFI_STATUS Status; + UINT8 *SecureBootVar; + if (ServiceStopType >=3D ServiceStopTypeMax) { return EFI_INVALID_PARAMETER; } @@ -177,8 +180,18 @@ LibStopRedfishService ( if (!PcdGetBool (PcdRedfishServieStopIfSecureBootDisabled)) { return EFI_UNSUPPORTED; } else { - mStopRedfishService =3D TRUE; - DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped due to SecureBoo= t is disabled!!\n")); + // + // Check Secure Boot status and lock Redfish service if Secure Boot = is disabled. + // + Status =3D GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVaria= bleGuid, (VOID **)&SecureBootVar, NULL); + if (EFI_ERROR (Status) || (*SecureBootVar !=3D SECURE_BOOT_MODE_ENAB= LE)) { + // + // Secure Boot is disabled + // + mSecureBootDisabled =3D TRUE; + mStopRedfishService =3D TRUE; + DEBUG ((DEBUG_INFO, "EFI Redfish service is stopped due to SecureB= oot is disabled!!\n")); + } } } else if (ServiceStopType =3D=3D ServiceStopTypeExitBootService) { // @@ -224,18 +237,5 @@ LibCredentialEndOfDxeNotify ( IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This ) { - EFI_STATUS Status; - UINT8 *SecureBootVar; - - // - // Check Secure Boot status and lock Redfish service if Secure Boot is d= isabled. - // - Status =3D GetVariable2 (EFI_SECURE_BOOT_MODE_NAME, &gEfiGlobalVariableG= uid, (VOID **)&SecureBootVar, NULL); - if (EFI_ERROR (Status) || (*SecureBootVar !=3D SECURE_BOOT_MODE_ENABLE))= { - // - // Secure Boot is disabled - // - mSecureBootDisabled =3D TRUE; - LibStopRedfishService (This, ServiceStopTypeSecureBootDisabled); - } + LibStopRedfishService (This, ServiceStopTypeSecureBootDisabled); } --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#87399): https://edk2.groups.io/g/devel/message/87399 Mute This Topic: https://groups.io/mt/89681463/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-