From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.49]) by mx.groups.io with SMTP id smtpd.web12.8787.1666797980341080414 for ; Wed, 26 Oct 2022 08:26:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ami.com header.s=selector1 header.b=FhletHx8; spf=pass (domain: ami.com, ip: 40.107.94.49, mailfrom: igork@ami.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LH2DX7cLU8FdqMbjPpa3lcG36RLsPUuxM/4RKGkFKU1x2gOA/2LGyJu+4B8P+rvjttNEnDWU6+3z4/tW/fWY44uOQ5HJyT4C9MhuGc3tmCsMMhhnaeAdVTdkC4pRsbR97UTQMb6mZEHjrgaczBWboBph5i/UIKjhNsU33PTECtqjfIuZ1uHydzGtWkneoFya+YjMJiE6kdiLIBq3qWUv/744i/opElqqV/HpNhCccb5d2QMigWIrBYffTwLvVgoEHcdPz1dN8os+drwYUl2mCfREzbaMjdrThTEdSjHEaEkNRBapjTM7by9MmRr7olypprbUMVKxGnzxTaduf9zY4g== 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=b8GG0zaP2T4YXC+gHv8NuWX/ssXIXZ0wptzqYTzQ5Qo=; b=atS9NfD21dBpMqg3vpf+JhdOp5QPmsyVvP7gRAPQXOL3zYNjg/3xqI3GjlHEXuJP+ZHz7MLA4PpIsDddvsamcjXIIVVlEaBu/V3WwRCKSPxcfZZtl72uycnj0ejJG+MnQuzWjHLyzrqa2xk5YVe4/vCVCMl/YouoDOZ2DmZZzukIKsXclG19k0a9bajz84Hpu1yb+Xu6mNGNwbl063RLzn/SKi2uaxU3kI7ueWZki0Jkwc02qHTB9KSP/XVbxudrIWs7SXXDXoOrpzNBZT9uTIOAradD6TYM38keLwdiffWC2jFPtjpLH4V3I+tLsPTFfrGhD7ZQYrv/WEtR6FShlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ami.com; dmarc=pass action=none header.from=ami.com; dkim=pass header.d=ami.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ami.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=b8GG0zaP2T4YXC+gHv8NuWX/ssXIXZ0wptzqYTzQ5Qo=; b=FhletHx8DKR9TKr3y8RbUAp+4wB5AxtFmSE0KfC26/B2lapvndvdvcD3Gey+grbbEqHk1hs5AuJoiKzNOEu9G2LQqGGq48MjYbMr51oIGfqztdFWBcAYfioBofOZnT1S2jZlQ3tbE8LTzTT9XhjjFq4DyRVL8gpW01Gwy5+H/2c= Received: from BLAPR10MB5185.namprd10.prod.outlook.com (2603:10b6:208:328::16) by CH2PR10MB4214.namprd10.prod.outlook.com (2603:10b6:610:a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Wed, 26 Oct 2022 15:26:16 +0000 Received: from BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::473b:192f:7fa7:8bbf]) by BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::473b:192f:7fa7:8bbf%5]) with mapi id 15.20.5746.026; Wed, 26 Oct 2022 15:26:16 +0000 From: "Igor Kulchytskyy" To: Nickle Wang , "devel@edk2.groups.io" , "abner.chang@amd.com" CC: Nick Ramirez Subject: Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformCredentialLib: IPMI implementation Thread-Topic: [EXTERNAL] RE: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformCredentialLib: IPMI implementation Thread-Index: AQHY6EsYXS94wpev0kC4g3CHzmE5HK4gwjhA Date: Wed, 26 Oct 2022 15:26:16 +0000 Message-ID: References: <20221020025434.29969-1-nicklew@nvidia.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-10-22T06:54:31Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=f317d2a2-540a-4f78-af60-076270a05f0a; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ami.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BLAPR10MB5185:EE_|CH2PR10MB4214:EE_ x-ms-office365-filtering-correlation-id: 1b822a2d-c183-4a56-8d05-08dab7666c82 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6GjAZzq/LIwo6i3HzpniBs30asdkxlbUhm7Xtrtm2dm2hyXITw3QeWnlZLZjmfqsB95GVKP0Ku0bl4qGKowYxU5No7xbEOsCev1UW1xspjVBxDUKVM9KV7qDzeQW9Izyc93KDY9k+kK+vi8D/0eWzs7O0drQEYeG3M1RMWR6P2PIQ8FlaYCEVyYbXQ6Uo5Up1k6RgGG2I87dTDisqMLTGaOBuAgTGFNG5wcWdZn/yJb9lsxuSU4+wSxTAQPTfkuCU2kNE2UEWXqE0dhF2NKTkyvt+AcRyz+k1V5TF9VA4pnIt8JixoBut49z0CZ4OUwAjtPp/APAbiHCU56Jb2mg9SckuR9PaWHSZ1eWaWc5ZAAWRVrhob+FKIQJIvQoveLyUCmcJyIueOnMM+DenFKiaWA3rCjVZ+4Pj8TxVRorLuJqcV5U8/w8JMaj6CbWU0JI5ju5RaK0Rqyv7N2qBDAOl7oef1grNi2bJQor/MxcLwD8z8QVMK3hTmXjXUBuiJqJOdl1J8BW6j+a5lzEXe30GZOw6c4qaTXMvChlaJg/+VQD72g8wgODRmOsZmyu3U0M5+tM4dhdMk3cQlNjuieLy1fgms1aE4x/NGdBVI6p9nQH0BHD17nvns7sMFYtzUx9wr62d8Cf195B2tD1tnc2CquqDvja1em5OCFVIoa/8cJIZv6Vhmb8lHtwagu9HhtoLXxtcSY8JoaCSBWI/8OiV3YAmicQqejhxZ1xsBFLjRVETn8b58O92vTeS4NndTxgDW6ED8GqVsl40p46Q+pes71qBxZwQ3etO8W4PXoNIpM= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BLAPR10MB5185.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39850400004)(366004)(346002)(136003)(376002)(451199015)(30864003)(2906002)(6506007)(66899015)(76116006)(45080400002)(66946007)(66476007)(52536014)(8676002)(66446008)(64756008)(8936002)(41300700001)(66556008)(478600001)(966005)(316002)(19627235002)(110136005)(40140700001)(71200400001)(5660300002)(4326008)(33656002)(83380400001)(7696005)(53546011)(9686003)(55016003)(186003)(122000001)(86362001)(26005)(38070700005)(38100700002)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?aF/n2MSqaJGS5a3gTaLxJ2tXb0++8gvP6SnBV3raaXF7upVHHAeVKeU2GMQA?= =?us-ascii?Q?NAFl3Yr76DK1EcnQjF4UvXDCCumvwU5uYm2JPgQws1UX5OnauZ6i2NvHWbOb?= =?us-ascii?Q?KSb+Ua1iv9TUPB+3/YxgRZsRcPGlZLZ/QYDT2yRTc2TeqshUOhor0qduXzmB?= =?us-ascii?Q?Hbc8YYfOp7MtH/tFnLlmavXNxcwdItscQvApLkY5+lPBVVo7PiQM5OWBRN00?= =?us-ascii?Q?wV3mmqBQ1s7tlyB0HoztlABtEmKRX2v67S0dDe8nN8nLi32tQNAKcY57DGug?= =?us-ascii?Q?V5eQOgZLZHn0frVT2X5Hh+dyDNQF0LsKGnYubTOj2W8zRNV4RM5+nMdEpydb?= =?us-ascii?Q?efSPhlXzU/9oDquob9AR6VTp2bWekR6eabj+6X7Tyzpc9PVelBrYAE+bCAcx?= =?us-ascii?Q?ho/pnC7YB2yNCaIFLCnLKry/5gV1VQS+5nUUfSDpT63qD3Di33z2O96VlQpd?= =?us-ascii?Q?fTRm+OMWDUXyDtESkNEZXqRnmayEjesKM4o805hmvnH3bh/we2oYx24N3kF9?= =?us-ascii?Q?TBvDXByqAhl1Uwm6rGziMsFvAaJsha5VgXHmDWorvRSZm7cDNUsWDeHlM28z?= =?us-ascii?Q?6JEVTmqkqMCj8snp+4CVtxqj4F04mcJuS/kLTx2BPg3Fc13nYmyRhynuQJkC?= =?us-ascii?Q?XD/5vIGS4syrG6/GMfqk7Lo3xOTwydChtB9KT8ge2ydECL4faz0uBVJbtuCn?= =?us-ascii?Q?WmrteYm1U586ociG7MyFqmhsozkcZfAXyrDK4OWK9nlAAo9fJxLHUukx/HS0?= =?us-ascii?Q?0ma/k7LHXVj5S7khAV4VKga4lsJFV+Rvrl6pIakFZjYhTC0GHhW8tMolVRTw?= =?us-ascii?Q?zx2v27ZnKfIpTpwJZxltCXavDMg1aUq7jrIOiy8scqAhr8An61xKW/JmqGaX?= =?us-ascii?Q?HHswllYY/v6IxmaUFyVtWuWTU7nC7yFyllAg4OApB/0GYv0mIArTxC4Y43Ap?= =?us-ascii?Q?y/sOUODV0oWcB7W/IDE2ZpnkZ4N+p50YergTvKV2i/b8NgB4EOa/huQ+29UG?= =?us-ascii?Q?et+jvpdocPE6Zu8VWPXdN2QYvpunCR37oDDC1PWzJrfx/FNrZaJSHM0iCiG4?= =?us-ascii?Q?mkOKSWcNYSQkdYQPHl5m0Xa9alvKmFAY1h6xXkgelEet9IktiRjtqaJ0Ho6U?= =?us-ascii?Q?vDYzIOv1xM/QcKBTL/1MSDm2N518DtlwrrAXCBTRJzSK8W42CdVy5K4cYpwK?= =?us-ascii?Q?UOSNwEasiVdtiATRws9UNY/tzKCquRk6M5Men1dg++l6CWYeAIThrPgh4+QH?= =?us-ascii?Q?lr2BwNJBmKK27MV8HO39il2GHkElNrNYRxlYrsFmfxK9D3O+6h1ywIRh7DN5?= =?us-ascii?Q?VCPheQlLTHwtMZO3wNFHpNtgWNcmD6YaRKYXdKDLfBz0nXxmzbvxUGmJ0JQ1?= =?us-ascii?Q?qJmk4f1QR1eH1SG4RBwZP17N7+j5CFo6AgaYePQhsFLMdJNGZL4u58HyZfbr?= =?us-ascii?Q?HVMf8AvOsxQYng+ii3hw6/VOtYgFGDQywJQl1L8h6rCRIYb1wrZnqCtfYL86?= =?us-ascii?Q?MZgq/VAtJFn73qMqNQY/jgeJ+PG/ym+2HFD1kNDqRM3XnL2cNYD/s/De6yEk?= =?us-ascii?Q?feIAmq85VhOyUFNizFY=3D?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5185.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b822a2d-c183-4a56-8d05-08dab7666c82 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Oct 2022 15:26:16.0763 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Bt51njRYniAY4+7Z0APPKGCWR7oDPYs3vGZbOt5q8gNreAMnVcE7jUNFMxB8oqbI X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4214 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Nickle, I would like to discuss that DisableBootstrapControl flag and how it is use= d in our implementation. According to Redfish HI specification we can use this flag to disable crede= ntial bootstrapping control. It can be disabled permanently or till next reboot of the host or service. = That depend on the EnableAfterReset setting on BMC side: CredentialBootstrapping (v1.3+) { object The credential bootstrapping settings for this interface. EnableAfterReset (v1.3+) Boolean read-write (null) An indication of= whether credential bootstrapping is enabled after a reset for this interfa= ce. Enabled (v1.3+) Boolean read-write (null) An indication of whether = credential bootstrapping is enabled for this interface. RoleId (v1.3+) string read-write The role used for the bootstrap ac= count created for this interface. } So, if EnableAfterReset set to false, that means BMC will response with 0x8= 0 error and will not return any credentials after reboot. And BIOS BMC comm= unication will fail. Another concern with disabling credential bootstrapping control is that we= do it on Exit Boot event before passing a control to OS. But OS may also need to communicate to BMC through Redfish Host Interface t= o post some information. And it will be blocked by our IPMI call. We create that SMBIOS Type 42 table with Redfish Host Interface settings wh= ich can be used by OS to communicate with BMC. But without the credentials = it will not be possible. Another question is AuthMethod parameter you initialize in this library: *AuthMethod =3D AuthMethodHttpBasic; According to Redfish HI specification 3 methods may be used - No Auth, Basi= c Auth and Session Auth. Basic Auth and Session Auth methods are required the credentials to be used= by BIOS. And both of them should be supported by BMC. And your high level function RedfishCreateLibredfishService also supports o= f creation Basic or Session Auth service. I'm not sure why low level library which is created to get credentials from= BMC should decide what Authentication method should be used? Should it be configured with some PCD? Maybe user may select in Setup what = method should be used? Or it could be build time configuration? Thank you, Igor -----Original Message----- From: Nickle Wang Sent: Tuesday, October 25, 2022 4:24 AM To: devel@edk2.groups.io; abner.chang@amd.com Cc: Nick Ramirez ; Igor Kulchytskyy Subject: [EXTERNAL] RE: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformCred= entialLib: IPMI implementation **CAUTION: The e-mail below is from an external source. Please exercise cau= tion before opening attachments, clicking links, or following guidance.** Thanks for your review comments, Abner! I will update new version patch lat= er. The CI build error will be handled together. > please add Igor as reviewer too Sure! > + *UserId =3D AllocateZeroPool (sizeof (CHAR8) * USERNAME_MAX_SIZE); if [Chang, Abner] Allocation memory with the size (USERNAME_MAX_LENGTH + 1) for both BootUse= rname and BootstrapPassword? Because the maximum number of characters def= ined in the spec is USERNAME_MAX_LENGTH for the user/password. Yes, the additional one byte is for NULL terminator. USERNAME_MAX_LENGTH is= defined as 16 and follow host interface specification. Regards, Nickle -----Original Message----- From: devel@edk2.groups.io On Behalf Of Chang, Abner= via groups.io Sent: Saturday, October 22, 2022 3:01 PM To: Nickle Wang ; devel@edk2.groups.io Cc: Nick Ramirez ; Igor Kulchytskyy Subject: Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformCredentialLib: = IPMI implementation External email: Use caution opening links or attachments [AMD Official Use Only - General] Hi Nickle, please add Igor as reviewer too. My comments is in below, > -----Original Message----- > From: Nickle Wang > Sent: Thursday, October 20, 2022 10:55 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Nick Ramirez > > Subject: [PATCH] RedfishPkg/RedfishPlatformCredentialLib: IPMI > implementation > > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. > > > 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 +++ [Chang, Abner] Could we name this library RedfishPlatformCredentialIpmi so the naming styl= e is consistent with RedfishPlatformCredentialNull? > 3 files changed, 385 insertions(+) > create mode 100644 > RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredential= Lib. > c > create mode 100644 > RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredential= Lib. > h > create mode 100644 > RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCredent > ialLib.i > nf > > diff --git > a/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCrede > ntialLi > b.c > b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCrede > ntialLi > b.c > new file mode 100644 > index 0000000000..23a15ab1fa > --- /dev/null > +++ b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformC > +++ re > +++ dentialLib.c > @@ -0,0 +1,273 @@ > +/** @file > +* > +* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. > +* > +* SPDX-License-Identifier: BSD-2-Clause-Patent [Chang, Abner] We can have "@par Revision Reference:" in the file header to point out the= spec. https://nam12.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fwww.dmt= f.org%2Fsites%2Fdefault%2Ffiles%2Fstandards%2Fdocuments%2FDSP0270_1.3.0.pdf= &data=3D05%7C01%7Cigork%40ami.com%7Cebc4dc0526a34fad9c1108dab662388d%7C= 27e97857e15f486cb58e86c2b3040f93%7C1%7C1%7C638022830242966537%7CUnknown%7CT= WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%= 3D%7C3000%7C%7C%7C&sdata=3DywFQL6E7TjNtBuos89mYh4TtlUCa4QWd3uEByRsRU8c%= 3D&reserved=3D0 > +* > +**/ > + > +#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 safe > 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_UNSUPPORTED once this function is return= ed. > + > + @param[in] This Pointer to > EDKII_REDFISH_CREDENTIAL_PROTOCOL 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 > +security > reason. > + // > +} > + > +/** > + Function to retrieve temporary use credentials for the UEFI redfish > +client [Chang, Abner] We miss the functionality to disable bootstrap credential service in the fu= nction description. > + > + @param[in] DisableBootstrapControl > + TRUE - Tell the BMC to disable the= bootstrap credential > + service to ensure no one el= se gains credentials > + FALSE Allow the bootstrap > + credential 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 fetc= hed and > returned > + @retval EFI_INVALID_PARAMETER BootstrapUsername or > BootstrapPassword is NULL when DisableBootstrapControl > + is set to FALSE > + @retval EFI_DEVICE_ERROR An IPMI failure occurred [Chang, Abner] The return status should also include the status of disabling bootstrap cre= dential. > +**/ > +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) || > (BootstrapPassword =3D=3D NULL))) { > + return EFI_INVALID_PARAMETER; > + } > + > + DEBUG ((DEBUG_VERBOSE, "%a: Disable bootstrap control: 0x%x\n", > + __FUNCTION__, 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 ? > + REDFISH_IPMI_BOOTSTRAP_CREDENTIAL_DISABLE : > + REDFISH_IPMI_BOOTSTRAP_CREDENTIAL_ENABLE); > + > + 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", > __FUNCTION__)); > + ASSERT_EFI_ERROR (Status); > + return Status; > + } else { > + if (ResponseData.CompletionCode !=3D IPMI_COMP_CODE_NORMAL) { > + if (ResponseData.CompletionCode =3D=3D > REDFISH_IPMI_COMP_CODE_BOOTSTRAP_CREDENTIAL_DISABLED) { > + DEBUG ((DEBUG_ERROR, "%a: bootstrap credential support was > disabled\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_EXTENSION) { > + DEBUG ((DEBUG_ERROR, "%a: Group Extension Response =3D 0x%x. > Returning\n", __FUNCTION__, ResponseData.GroupExtensionId)); > + return EFI_DEVICE_ERROR; > + } else { > + if (BootstrapUsername !=3D NULL) { > + CopyMem (BootstrapUsername, ResponseData.Username, > USERNAME_MAX_LENGTH); > + // > + // 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_LENGTH); > + // > + // 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 the user Id and password. > + - For AuthMethodNone, the UserId and Password could be used for > + HTTP > header authentication > + as defined by RFC7235. > + - For AuthMethodRedfishSession, the UserId and Password could be > + used for > 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_PROTOCOL instance. > + @param[out] AuthMethod Type of Redfish authentication method= . > + @param[out] UserId The pointer to store the returned Use= rId string. > + @param[out] Password The pointer to store the returned Pas= sword > string. > + > + @retval EFI_SUCCESS Get the authentication information su= ccessfully. > + @retval EFI_ACCESS_DENIED SecureBoot is disabled after EndOfDxe= . > + @retval EFI_INVALID_PARAMETER This or AuthMethod or UserId or > Password is NULL. > + @retval EFI_OUT_OF_RESOURCES There are not enough memory resources= . > + @retval EFI_UNSUPPORTED Unsupported authentication method is > found. > + > +**/ > +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 > + security > reason\n", __FUNCTION__)); > + return EFI_ACCESS_DENIED; > + } > + > + *AuthMethod =3D AuthMethodHttpBasic; > + > + *UserId =3D AllocateZeroPool (sizeof (CHAR8) * USERNAME_MAX_SIZE); if [Chang, Abner] Allocation memory with the size (USERNAME_MAX_LENGTH + 1) for both BootUse= rname and BootstrapPassword? Because the maximum number of characters def= ined in the spec is USERNAME_MAX_LENGTH for the user/password. > + (*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", > __FUNCTION__, Status)); > + return Status; > + } > + > + return EFI_SUCCESS; > +} > diff --git > a/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCrede > ntialLi > b.h > b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCrede > ntialLi > b.h > new file mode 100644 > index 0000000000..5b448e01be > --- /dev/null > +++ b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformC > +++ re > +++ dentialLib.h > @@ -0,0 +1,75 @@ > +/** @file > +* > +* Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. > +* > +* 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 > +client [Chang, Abner] We miss the functionality to disable bootstrap credential service in the fu= nction description. > + > + @param[in] DisableBootstrapControl > + TRUE - Tell the BMC to disable the= bootstrap credential > + service to ensure no one el= se gains credentials > + FALSE Allow the bootstrap > + credential 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 fetc= hed and > returned [Chang, Abner] Or the bootstrap credential service is disabled successfully, right? > + @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/RedfishPlatformCrede > ntialLi > b.inf > b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformCrede > ntialLi > b.inf > new file mode 100644 > index 0000000000..a990d28363 > --- /dev/null > +++ b/RedfishPkg/Library/RedfishPlatformCredentialLib/RedfishPlatformC > +++ re > +++ dentialLib.inf > @@ -0,0 +1,37 @@ > +## @file > +# > +# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. > +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent # ## > + > +[Defines] > + INF_VERSION =3D 0x0001000b > + BASE_NAME =3D RedfishPlatformCredentialLib > + FILE_GUID =3D 9C45D622-4C66-417F-814C-F76246D9723= 3 > + 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 [Chang, Abner] Could you please add a comment to the reference of IpmiFeaturePkg? We have= to give customers a notice that the dependence of "edk2-platforms/Features= /Intel/OutOfBandManagement/". They have to add the path to PACKAGES_PATH. Y= ou also have to skip this dependence in the RedfishPkg.yaml to avoid the CI= error. Another thing is I propose to move out IpmiFeaturePkg from edk2-platforms/F= eatures/Intel/OutOfBandManagement to edk2-platforms/Features/ManageabilityP= kg that also provides the implementation of PLDM/MCTP/IPMI/KCS. I had an = initial talk with IpmiFeaturePkg owner and get the positive response on thi= s proposal. I will kick off the discussion on the dev mailing list. That is= to say this module may need a little bit change later, however that is goo= d to me having this implementation now. Thanks Abner > + > +[LibraryClasses] > + UefiLib > + DebugLib > + IpmiBaseLib > + MemoryAllocationLib > + BaseMemoryLib > + > +[Pcd] > + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable > + > +[Depex] > + TRUE > -- > 2.17.1 -The information contained in this message may be confidential and propriet= ary to American Megatrends (AMI). This communication is intended to be read= only by the individual or entity to whom it is addressed or by their desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. Please promptly notify the sender by reply e-mail or by telephone= at 770-246-8600, and then delete or destroy all copies of the transmission= .