From nobody Sat May 18 22:31:24 2024 Delivered-To: importer@patchew.org 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+95413+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666234485597848.4250681529303; Wed, 19 Oct 2022 19:54:45 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3zvyYY1788612xKdeT3vNQHy; Wed, 19 Oct 2022 19:54:45 -0700 X-Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.107.243.71]) by mx.groups.io with SMTP id smtpd.web09.5523.1666234484207047548 for ; Wed, 19 Oct 2022 19:54:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ifrc0kJqoCDzBbHftbnPqUpW//sbpqypob/j8WrjzguXzruG4oRQZ5Z8rmiJH6JaayDnQaig1eAV0zYBTwznPV9Xk4A5ngKWGY5j89MgkuD+pN0UBd3ksGATkPDlHCHcGou1KUuZV6lG6hkC8zzfuWbHUA9p4jek7RZcBXQpwMEcJ1lyUkGRlKsCdwDPdYOjnxA5KSORSh31/XLtJ5Xy95cifkL8Y78dvQvuIVTpI0OwqOI+B2IUkbfyceL3rGOcObnsNtkHo7NMXT4/n6UUuT3aac8CKUM5o81ZcTZ5CebMHORhZIj+Zv4AMWQ07sJLZE3Prr5FWXq8j9I9j83lUg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EBWg5/fohR788tapeQnUvL+OJwERQdazVCg65/earkg=; b=UiibenQp8APdyTpfwpKt4z8TzcbAM72IWheSzdIPwNBWobbgOHKBo0FvpGZac2Uvl6aKp6UZ5EXY8ZGyUcby09l3eZJVxZXNPpowC67951WMUacMY0/Fgiag7iPiJ1Q90LfS6BMaLhjHL3Hq9e39sah+jA6akH7b5yfdaNaXSXJAYyMhEa+uE4+TwtIdkwpJJCBQ9LeotIIJcBdRpdd042H0QA6Wqc8IiXJNJQcPU3nJ7trft/THd01SFufvN7idmwrJFJ1niy8n2/s3QhZKjwmCaO+2uSzEAIuLYRhVIORctNIqblhktBSwXHsd79plSlT96MQpj3vBJHOL0tUxrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none (sender ip is 216.228.118.233) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=nvidia.com; dkim=none (message not signed); arc=none X-Received: from MW2PR16CA0071.namprd16.prod.outlook.com (2603:10b6:907:1::48) by MN0PR12MB5978.namprd12.prod.outlook.com (2603:10b6:208:37d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Thu, 20 Oct 2022 02:54:42 +0000 X-Received: from CO1NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::48) by MW2PR16CA0071.outlook.office365.com (2603:10b6:907:1::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Thu, 20 Oct 2022 02:54:41 +0000 X-MS-Exchange-Authentication-Results: spf=none (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=nvidia.com; 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+95413+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: None (protection.outlook.com: nvidia.com does not designate permitted sender hosts) X-Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT060.mail.protection.outlook.com (10.13.175.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Thu, 20 Oct 2022 02:54:41 +0000 X-Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Wed, 19 Oct 2022 19:54:35 -0700 X-Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Wed, 19 Oct 2022 19:54:34 -0700 X-Received: from nickle.nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Wed, 19 Oct 2022 19:54:34 -0700 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Nick Ramirez Subject: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformCredentialLib: IPMI implementation Date: Thu, 20 Oct 2022 10:54:34 +0800 Message-ID: <20221020025434.29969-1-nicklew@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT060:EE_|MN0PR12MB5978:EE_ X-MS-Office365-Filtering-Correlation-Id: 40ae53b6-828f-4d03-76b6-08dab2466f68 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: kkoeVoEHq2qpm3jBMC+WcD0pPPQ/ZOTbh910mDTIsmXN5kqjoxE4cbFrVu29fYQk/ztLTyW7QrQkEZr0tnnt24AahqlN5uA0YdnrBZb4L34VNPrdRELW2XdsfI7p+C+j8xA82sbXQtb85MI7L4G8kET3HdMDaiNpTn+LkOjnHHPYecJP6IsCNeAf/ILh/76MvYKdcr2NKzPFxdQqZrlWJSbErzXe/kgCB6Q5E60bfmRZSP/IS8a8uqmGgiLV0BTMFuTl456naEwnGI6rXdiUIsRQwufV5uoiabmkyASKsoAHsHN3czrp1w07OjUIIrhL2w+TLZnJKktXV6UibYHW4LneNdDHnh4LNecXQpBlEAu9fihyz/FaDsbCNtVK9MCW7yjNZ4ycNx3EHMVDxwNvsohd84qQ7bACIjMGm/SYwL8bILmx0j8VoCjkvDBwM/CY3UDzogo5J1zJpR01LejCmfY+DZNkHb1heE8Vdiu9JJ6N1PrLVPJhpFw9IiRDA6SHTb5N1qA7cu3GWCqiZO8BCPCvZ1A3SarvS/hiT4x9DH1IwbCdEqvO2jWkBWqAgfN7aS34+14+WqC2sc2BIHrZ3b+zdIrUOr/yeTV38+F6kU/ylNWO/1GDtiX1wyDAyKXuasoTHA9rj4A/PUODZK1Lbv6fAQd4wzH/6/vUz2I1OhS9fADb3iTVa+jahQYy/0CUwhvnyE8at1SZAOMvryJKVNUAwEWmskns/bxo1GauDT7NMHP2j+3HR5i8V+njcPAdULYkIZjUd03IJtNHtelzUw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2022 02:54:41.1980 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40ae53b6-828f-4d03-76b6-08dab2466f68 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5978 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,nicklew@nvidia.com X-Gm-Message-State: UY3Cd6DLfUfar9VMps1cpS7zx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666234485; bh=8GlhLbStDrSpmwrZeS/Ottd1LDJ89us/CMtaqqWv3p4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=GsC7PnIo4Lf3eBx1KMXFSSSzem/pi3u1bX+c2w11foZqz/0wLGUuCnae/+O6gYShAXQ S9/9qN1J6fU5GYNoml9Jk6vjKTJtq0K0exAuRibVytwduBSql1nYF+XFZgf2ux8RRslFP bOkTaGXQ+2wP+z8pPjM0Pzu+nKrWZ59Nnj4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666234485927100001 Content-Type: text/plain; charset="utf-8" This library follows Redfish Host Interface specification and use IPMI command to get bootstrap account credential(NetFn 2Ch, Command 02h) from BMC. RedfishHostInterfaceDxe will use this credential for the following communication between BIOS and BMC. Cc: Abner Chang Cc: Nick Ramirez Signed-off-by: Nickle Wang --- .../RedfishPlatformCredentialLib.c | 273 ++++++++++++++++++ .../RedfishPlatformCredentialLib.h | 75 +++++ .../RedfishPlatformCredentialLib.inf | 37 +++ 3 files changed, 385 insertions(+) create mode 100644 RedfishPkg/Library/RedfishPlatformCredentialLib/Redfish= PlatformCredentialLib.c create mode 100644 RedfishPkg/Library/RedfishPlatformCredentialLib/Redfish= PlatformCredentialLib.h create mode 100644 RedfishPkg/Library/RedfishPlatformCredentialLib/Redfish= PlatformCredentialLib.inf diff --git a/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatfor= mCredentialLib.c b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishP= latformCredentialLib.c new file mode 100644 index 0000000000..23a15ab1fa --- /dev/null +++ b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden= tialLib.c @@ -0,0 +1,273 @@ +/** @file +* +* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include "RedfishPlatformCredentialLib.h" + +// +// Global flag of controlling credential service +// +BOOLEAN mRedfishServiceStopped =3D FALSE; + +/** + Notify the Redfish service provide to stop provide configuration service= to this platform. + + This function should be called when the platfrom is about to leave the s= afe environment. + It will notify the Redfish service provider to abort all logined session= , and prohibit + further login with original auth info. GetAuthInfo() will return EFI_UNS= UPPORTED once this + function is returned. + + @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PRO= TOCOL instance. + @param[in] ServiceStopType Reason of stopping Redfish service. + + @retval EFI_SUCCESS Service has been stoped successfully. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +LibStopRedfishService ( + IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This, + IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType + ) +{ + EFI_STATUS Status; + + if ((ServiceStopType <=3D ServiceStopTypeNone) || (ServiceStopType >=3D = ServiceStopTypeMax)) { + return EFI_INVALID_PARAMETER; + } + + // + // Raise flag first + // + mRedfishServiceStopped =3D TRUE; + + // + // Notify BMC to disable credential bootstrapping support. + // + Status =3D GetBootstrapAccountCredentials (TRUE, NULL, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: fail to disable bootstrap credential: %r\n",= __FUNCTION__, Status)); + return Status; + } + + return EFI_SUCCESS; +} + +/** + Notification of Exit Boot Service. + + @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL. +**/ +VOID +EFIAPI +LibCredentialExitBootServicesNotify ( + IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This + ) +{ + // + // Stop the credential support when system is about to enter OS. + // + LibStopRedfishService (This, ServiceStopTypeExitBootService); +} + +/** + Notification of End of DXe. + + @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL. +**/ +VOID +EFIAPI +LibCredentialEndOfDxeNotify ( + IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This + ) +{ + // + // Do nothing now. + // We can stop credential support when system reach end-of-dxe for secur= ity reason. + // +} + +/** + Function to retrieve temporary use credentials for the UEFI redfish clie= nt + + @param[in] DisableBootstrapControl + TRUE - Tell the BMC to disable the b= ootstrap credential + service to ensure no one else= gains credentials + FALSE Allow the bootstrap credentia= l service to continue + @param[out] BootstrapUsername + A pointer to a UTF-8 encoded string = for the credential username + When DisableBootstrapControl is TRUE= , this pointer can be NULL + + @param[out] BootstrapPassword + A pointer to a UTF-8 encoded string = for the credential password + When DisableBootstrapControl is TRUE= , this pointer can be NULL + + @retval EFI_SUCCESS Credentials were successfully fetche= d and returned + @retval EFI_INVALID_PARAMETER BootstrapUsername or BootstrapPasswo= rd is NULL when DisableBootstrapControl + is set to FALSE + @retval EFI_DEVICE_ERROR An IPMI failure occurred +**/ +EFI_STATUS +GetBootstrapAccountCredentials ( + IN BOOLEAN DisableBootstrapControl, + IN OUT CHAR8 *BootstrapUsername, OPTIONAL + IN OUT CHAR8 *BootstrapPassword OPTIONAL + ) +{ + EFI_STATUS Status; + IPMI_BOOTSTRAP_CREDENTIALS_COMMAND_DATA CommandData; + IPMI_BOOTSTRAP_CREDENTIALS_RESULT_RESPONSE ResponseData; + UINT32 ResponseSize; + + if (!PcdGetBool (PcdIpmiFeatureEnable)) { + DEBUG ((DEBUG_ERROR, "%a: IPMI is not enabled! Unable to fetch Redfish= credentials\n", __FUNCTION__)); + return EFI_UNSUPPORTED; + } + + // + // NULL buffer check + // + if (!DisableBootstrapControl && ((BootstrapUsername =3D=3D NULL) || (Boo= tstrapPassword =3D=3D NULL))) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((DEBUG_VERBOSE, "%a: Disable bootstrap control: 0x%x\n", __FUNCTI= ON__, DisableBootstrapControl)); + + // + // IPMI callout to NetFn 2C, command 02 + // Request data: + // Byte 1: REDFISH_IPMI_GROUP_EXTENSION + // Byte 2: DisableBootstrapControl + // + CommandData.GroupExtensionId =3D REDFISH_IPMI_GROUP_EXTENSION; + CommandData.DisableBootstrapControl =3D (DisableBootstrapControl ? REDFI= SH_IPMI_BOOTSTRAP_CREDENTIAL_DISABLE : REDFISH_IPMI_BOOTSTRAP_CREDENTIAL_EN= ABLE); + + ResponseSize =3D sizeof (ResponseData); + + // + // Response data: + // Byte 1 : Completion code + // Byte 2 : REDFISH_IPMI_GROUP_EXTENSION + // Byte 3-18 : Username + // Byte 19-34: Password + // + Status =3D IpmiSubmitCommand ( + IPMI_NETFN_GROUP_EXT, + REDFISH_IPMI_GET_BOOTSTRAP_CREDENTIALS_CMD, + (UINT8 *)&CommandData, + sizeof (CommandData), + (UINT8 *)&ResponseData, + &ResponseSize + ); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: IPMI transaction failure. Returning\n", __FU= NCTION__)); + ASSERT_EFI_ERROR (Status); + return Status; + } else { + if (ResponseData.CompletionCode !=3D IPMI_COMP_CODE_NORMAL) { + if (ResponseData.CompletionCode =3D=3D REDFISH_IPMI_COMP_CODE_BOOTST= RAP_CREDENTIAL_DISABLED) { + DEBUG ((DEBUG_ERROR, "%a: bootstrap credential support was disable= d\n", __FUNCTION__)); + return EFI_ACCESS_DENIED; + } + + DEBUG ((DEBUG_ERROR, "%a: Completion code =3D 0x%x. Returning\n", __= FUNCTION__, ResponseData.CompletionCode)); + return EFI_PROTOCOL_ERROR; + } else if (ResponseData.GroupExtensionId !=3D REDFISH_IPMI_GROUP_EXTEN= SION) { + DEBUG ((DEBUG_ERROR, "%a: Group Extension Response =3D 0x%x. Returni= ng\n", __FUNCTION__, ResponseData.GroupExtensionId)); + return EFI_DEVICE_ERROR; + } else { + if (BootstrapUsername !=3D NULL) { + CopyMem (BootstrapUsername, ResponseData.Username, USERNAME_MAX_LE= NGTH); + // + // Manually append null-terminator in case 16 characters username = returned. + // + BootstrapUsername[USERNAME_MAX_LENGTH] =3D '\0'; + } + + if (BootstrapPassword !=3D NULL) { + CopyMem (BootstrapPassword, ResponseData.Password, PASSWORD_MAX_LE= NGTH); + // + // Manually append null-terminator in case 16 characters password = returned. + // + BootstrapPassword[PASSWORD_MAX_LENGTH] =3D '\0'; + } + } + } + + return Status; +} + +/** + Retrieve platform's Redfish authentication information. + + This functions returns the Redfish authentication method together with t= he user Id and + password. + - For AuthMethodNone, the UserId and Password could be used for HTTP hea= der authentication + as defined by RFC7235. + - For AuthMethodRedfishSession, the UserId and Password could be used fo= r Redfish + session login as defined by Redfish API specification (DSP0266). + + Callers are responsible for and freeing the returned string storage. + + @param[in] This Pointer to EDKII_REDFISH_CREDENTIAL_PRO= TOCOL instance. + @param[out] AuthMethod Type of Redfish authentication method. + @param[out] UserId The pointer to store the returned UserI= d string. + @param[out] Password The pointer to store the returned Passw= ord string. + + @retval EFI_SUCCESS Get the authentication information succ= essfully. + @retval EFI_ACCESS_DENIED SecureBoot is disabled after EndOfDxe. + @retval EFI_INVALID_PARAMETER This or AuthMethod or UserId or Passwor= d is NULL. + @retval EFI_OUT_OF_RESOURCES There are not enough memory resources. + @retval EFI_UNSUPPORTED Unsupported authentication method is fo= und. + +**/ +EFI_STATUS +EFIAPI +LibCredentialGetAuthInfo ( + IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This, + OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod, + OUT CHAR8 **UserId, + OUT CHAR8 **Password + ) +{ + EFI_STATUS Status; + + if ((AuthMethod =3D=3D NULL) || (UserId =3D=3D NULL) || (Password =3D=3D= NULL)) { + return EFI_INVALID_PARAMETER; + } + + *UserId =3D NULL; + *Password =3D NULL; + + if (mRedfishServiceStopped) { + DEBUG ((DEBUG_ERROR, "%a: credential service is stopped due to securit= y reason\n", __FUNCTION__)); + return EFI_ACCESS_DENIED; + } + + *AuthMethod =3D AuthMethodHttpBasic; + + *UserId =3D AllocateZeroPool (sizeof (CHAR8) * USERNAME_MAX_SIZE); + if (*UserId =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + *Password =3D AllocateZeroPool (sizeof (CHAR8) * PASSWORD_MAX_SIZE); + if (*Password =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Status =3D GetBootstrapAccountCredentials (FALSE, *UserId, *Password); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: fail to get bootstrap credential: %r\n", __F= UNCTION__, Status)); + return Status; + } + + return EFI_SUCCESS; +} diff --git a/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatfor= mCredentialLib.h b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishP= latformCredentialLib.h new file mode 100644 index 0000000000..5b448e01be --- /dev/null +++ b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden= tialLib.h @@ -0,0 +1,75 @@ +/** @file +* +* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define REDFISH_IPMI_GROUP_EXTENSION 0x52 +#define REDFISH_IPMI_GET_BOOTSTRAP_CREDENTIALS_CMD 0x02 +#define REDFISH_IPMI_BOOTSTRAP_CREDENTIAL_ENABLE 0xA5 +#define REDFISH_IPMI_BOOTSTRAP_CREDENTIAL_DISABLE 0x00 +#define REDFISH_IPMI_COMP_CODE_BOOTSTRAP_CREDENTIAL_DISABLED 0x80 + +// +// Per Redfish Host Interface Specification 1.3, The maximum lenght of +// username and password is 16 characters long. +// +#define USERNAME_MAX_LENGTH 16 +#define PASSWORD_MAX_LENGTH 16 +#define USERNAME_MAX_SIZE (USERNAME_MAX_LENGTH + 1) // NULL terminator +#define PASSWORD_MAX_SIZE (PASSWORD_MAX_LENGTH + 1) // NULL terminator + +#pragma pack(1) +/// +/// The definition of IPMI command to get bootstrap account credentials +/// +typedef struct { + UINT8 GroupExtensionId; + UINT8 DisableBootstrapControl; +} IPMI_BOOTSTRAP_CREDENTIALS_COMMAND_DATA; + +/// +/// The response data of getting bootstrap credential +/// +typedef struct { + UINT8 CompletionCode; + UINT8 GroupExtensionId; + CHAR8 Username[USERNAME_MAX_LENGTH]; + CHAR8 Password[PASSWORD_MAX_LENGTH]; +} IPMI_BOOTSTRAP_CREDENTIALS_RESULT_RESPONSE; + +#pragma pack() + +/** + Function to retrieve temporary use credentials for the UEFI redfish clie= nt + + @param[in] DisableBootstrapControl + TRUE - Tell the BMC to disable the b= ootstrap credential + service to ensure no one else= gains credentials + FALSE Allow the bootstrap credentia= l service to continue + @param[out] BootstrapUsername + A pointer to a UTF-8 encoded string = for the credential username + + @param[out] BootstrapPassword + A pointer to a UTF-8 encoded string = for the credential password + + @retval EFI_SUCCESS Credentials were successfully fetche= d and returned + @retval EFI_DEVICE_ERROR An IPMI failure occurred +**/ +EFI_STATUS +GetBootstrapAccountCredentials ( + IN BOOLEAN DisableBootstrapControl, + IN OUT CHAR8 *BootstrapUsername, + IN OUT CHAR8 *BootstrapPassword + ); diff --git a/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatfor= mCredentialLib.inf b/RedfishPkg/Library/RedfishPlatformCredentialLib/Redfis= hPlatformCredentialLib.inf new file mode 100644 index 0000000000..a990d28363 --- /dev/null +++ b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCreden= tialLib.inf @@ -0,0 +1,37 @@ +## @file +# +# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001000b + BASE_NAME =3D RedfishPlatformCredentialLib + FILE_GUID =3D 9C45D622-4C66-417F-814C-F76246D97233 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RedfishPlatformCredentialLib + +[Sources] + RedfishPlatformCredentialLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RedfishPkg/RedfishPkg.dec + IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + UefiLib + DebugLib + IpmiBaseLib + MemoryAllocationLib + BaseMemoryLib + +[Pcd] + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable + +[Depex] + TRUE --=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 (#95413): https://edk2.groups.io/g/devel/message/95413 Mute This Topic: https://groups.io/mt/94446537/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-