TianoCore EDK2 master
Loading...
Searching...
No Matches
RedfishCredentialDxe.c File Reference

Go to the source code of this file.

Macros

#define REDFISH_VERSION_DEFAULT_STRING   L"v1"
 

Functions

VOID EFIAPI RedfishCredentialExitBootServicesEventNotify (IN EFI_EVENT Event, OUT VOID *Context)
 
VOID EFIAPI RedfishCredentialEndOfDxeEventNotify (IN EFI_EVENT Event, OUT VOID *Context)
 
EFI_STATUS ReleaseCredentialPrivate ()
 
EFI_STATUS IterateThroughBootstrapAccounts (IN REDFISH_SERVICE RedfishService)
 
EFI_STATUS EFIAPI RedfishCredentialGetAuthInfo (IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This, OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod, OUT CHAR8 **UserId, OUT CHAR8 **Password)
 
EFI_STATUS EFIAPI RedfishCredentialStopService (IN EDKII_REDFISH_CREDENTIAL_PROTOCOL *This, IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType)
 
EFI_STATUS EFIAPI RedfishCredential2GetAuthInfo (IN EDKII_REDFISH_CREDENTIAL2_PROTOCOL *This, OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod, OUT CHAR8 **UserId, OUT CHAR8 **Password)
 
EFI_STATUS EFIAPI RedfishCredential2StopService (IN EDKII_REDFISH_CREDENTIAL2_PROTOCOL *This, IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE ServiceStopType)
 
EFI_STATUS EFIAPI DeleteRedfishBootstrapAccount (IN REDFISH_SERVICE RedfishService, IN CHAR16 *TargetUri)
 
BOOLEAN ProcessRedfishBootstarpAccount (IN REDFISH_SERVICE RedfishService, IN EFI_STRING AccountUri)
 
EFI_STATUS RedfishGetServiceVersion (OUT CHAR16 **ServiceVersionStr)
 
EFI_STATUS RedfishGetAuthConfig (OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod, OUT CHAR8 **UserId)
 
EFI_STATUS ClearRedfishServiceList (VOID)
 
EFI_STATUS AddRedfishServiceToList (IN REDFISH_SERVICE RedfishService)
 
EFI_STATUS DeleteRedfishServiceFromList (IN REDFISH_SERVICE RedfishService)
 
EFI_STATUS EFIAPI RedfishCredential2RegisterService (IN EDKII_REDFISH_CREDENTIAL2_PROTOCOL *This, IN REDFISH_SERVICE RedfishService)
 
EFI_STATUS EFIAPI RedfishCredential2UnregisterService (IN EDKII_REDFISH_CREDENTIAL2_PROTOCOL *This, IN REDFISH_SERVICE RedfishService)
 
EFI_STATUS EFIAPI RedfishCredentialDxeDriverEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI RedfishCredentialDxeDriverUnload (IN EFI_HANDLE ImageHandle)
 

Variables

REDFISH_CREDENTIAL_PRIVATEmCredentialPrivate = NULL
 

Detailed Description

RedfishCrentialDxe produces the EdkIIRedfishCredentialProtocol for the consumer to get the Redfish credential Info and to restrict Redfish access from UEFI side.

(C) Copyright 2020 Hewlett Packard Enterprise Development LP
(C) Copyright 2024 American Megatrends International LLC

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file RedfishCredentialDxe.c.

Macro Definition Documentation

◆ REDFISH_VERSION_DEFAULT_STRING

#define REDFISH_VERSION_DEFAULT_STRING   L"v1"

Definition at line 14 of file RedfishCredentialDxe.c.

Function Documentation

◆ AddRedfishServiceToList()

EFI_STATUS AddRedfishServiceToList ( IN REDFISH_SERVICE  RedfishService)

The function adds a new Redfish service to internal list

Parameters
[in]RedfishServicePointer to REDFISH_SERVICE to be added to the list.
Return values
EFI_SUCCESSRedfish service is added to list successfully.
EFI_OUT_OF_RESOURCESOut of resources error.

Definition at line 613 of file RedfishCredentialDxe.c.

◆ ClearRedfishServiceList()

EFI_STATUS ClearRedfishServiceList ( VOID  )

This function clears Redfish service internal list.

Return values
EFI_SUCCESSRedfish service is deleted from list successfully.
OthersFail to remove the entry

Definition at line 569 of file RedfishCredentialDxe.c.

◆ DeleteRedfishBootstrapAccount()

EFI_STATUS EFIAPI DeleteRedfishBootstrapAccount ( IN REDFISH_SERVICE  RedfishService,
IN CHAR16 *  TargetUri 
)

Function sends DELETE request to BMC for the account defined by the target URI.

Parameters
[in]RedfishServicePointer to Redfish Service to be used for sending DELETE request to BMC.
[in]TargetUriURI of bootstrap account to send DELETE request to.

Definition at line 262 of file RedfishCredentialDxe.c.

◆ DeleteRedfishServiceFromList()

EFI_STATUS DeleteRedfishServiceFromList ( IN REDFISH_SERVICE  RedfishService)

This function deletes Redfish service from internal list.

Parameters
[in]RedfishServicePointer to REDFISH_SERVICE to be delete from the list.
Return values
EFI_SUCCESSRedfish service is deleted from list successfully.
OthersFail to remove the entry

Definition at line 670 of file RedfishCredentialDxe.c.

◆ IterateThroughBootstrapAccounts()

EFI_STATUS IterateThroughBootstrapAccounts ( IN REDFISH_SERVICE  RedfishService)

Iterates through all account in the account collection Get the information about specific Account. Checks the User Name and if name matches delete that account

Parameters
[in]RedfishServicePointer to Redfish Service to be used for sending DELETE request to BMC.

Definition at line 400 of file RedfishCredentialDxe.c.

◆ ProcessRedfishBootstarpAccount()

BOOLEAN ProcessRedfishBootstarpAccount ( IN REDFISH_SERVICE  RedfishService,
IN EFI_STRING  AccountUri 
)

Get the information about specific Account. Checks the User Name and if name matches delete that account

Parameters
[in]RedfishServicePointer to Redfish Service to be used for sending DELETE request to BMC.
[in]AccountUriURI of bootstrap account to verify.

Definition at line 318 of file RedfishCredentialDxe.c.

◆ RedfishCredential2GetAuthInfo()

EFI_STATUS EFIAPI RedfishCredential2GetAuthInfo ( IN EDKII_REDFISH_CREDENTIAL2_PROTOCOL This,
OUT EDKII_REDFISH_AUTH_METHOD AuthMethod,
OUT CHAR8 **  UserId,
OUT CHAR8 **  Password 
)

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.

Parameters
[in]ThisPointer to EDKII_REDFISH_CREDENTIAL2_PROTOCOL instance.
[out]AuthMethodType of Redfish authentication method.
[out]UserIdThe pointer to store the returned UserId string.
[out]PasswordThe pointer to store the returned Password string.
Return values
EFI_SUCCESSGet the authentication information successfully.
EFI_ACCESS_DENIEDSecureBoot is disabled after EndOfDxe.
EFI_INVALID_PARAMETERThis or AuthMethod or UserId or Password is NULL.
EFI_OUT_OF_RESOURCESThere are not enough memory resources.
EFI_UNSUPPORTEDUnsupported authentication method is found.

Definition at line 161 of file RedfishCredentialDxe.c.

◆ RedfishCredential2RegisterService()

EFI_STATUS EFIAPI RedfishCredential2RegisterService ( IN EDKII_REDFISH_CREDENTIAL2_PROTOCOL This,
IN REDFISH_SERVICE  RedfishService 
)

Register Redfish service instance so protocol knows that some module uses bootstrap account.

Parameters
[in]ThisPointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
[in]RedfishServiceRedfish service instance to register.
Return values
EFI_SUCCESSThis Redfish service instance has been registered successfully.
OthersFail to register Redfish Service

Definition at line 713 of file RedfishCredentialDxe.c.

◆ RedfishCredential2StopService()

EFI_STATUS EFIAPI RedfishCredential2StopService ( IN EDKII_REDFISH_CREDENTIAL2_PROTOCOL This,
IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE  ServiceStopType 
)

Notifies the Redfish service provider to stop providing configuration service to this platform. Deletes the bootstrap account on BMC side, so it will not be used by any other driver.

This function should be called when the platfrom is about to leave the safe environment. It will delete the bootstrap account sending DELETE request to BMC. 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 returned.

Parameters
[in]ThisPointer to EDKII_REDFISH_CREDENTIAL2_PROTOCOL instance.
[in]ServiceStopTypeReason of stopping Redfish service.
Return values
EFI_SUCCESSService has been stoped successfully.
EFI_INVALID_PARAMETERThis is NULL or given the worng ServiceStopType.
EFI_UNSUPPORTEDNot support to stop Redfish service.
OthersSome error happened.

Definition at line 213 of file RedfishCredentialDxe.c.

◆ RedfishCredential2UnregisterService()

EFI_STATUS EFIAPI RedfishCredential2UnregisterService ( IN EDKII_REDFISH_CREDENTIAL2_PROTOCOL This,
IN REDFISH_SERVICE  RedfishService 
)

Unregister Redfish service instance and delete the bootstrap account when all registered services unregistered.

Parameters
[in]ThisPointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
[in]RedfishServiceRedfish service instance to unregister.
Return values
EFI_SUCCESSThis Redfish service instance has been unregistered successfully.
OthersFail to unregister Redfish Service

Definition at line 759 of file RedfishCredentialDxe.c.

◆ RedfishCredentialDxeDriverEntryPoint()

EFI_STATUS EFIAPI RedfishCredentialDxeDriverEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Main entry for this driver.

Parameters
ImageHandleImage handle this driver.
SystemTablePointer to SystemTable.
Return values
EFI_SUCCESSThis function always complete successfully.

Definition at line 809 of file RedfishCredentialDxe.c.

◆ RedfishCredentialDxeDriverUnload()

EFI_STATUS EFIAPI RedfishCredentialDxeDriverUnload ( IN EFI_HANDLE  ImageHandle)

This is the unload handle for Redfish Credentials module.

Uninstall all the protocols installed in the driver entry point. Clear all allocated resources.

Parameters
[in]ImageHandleThe drivers' driver image.
Return values
EFI_SUCCESSThe image is unloaded.
OthersFailed to unload the image.

Definition at line 941 of file RedfishCredentialDxe.c.

◆ RedfishCredentialEndOfDxeEventNotify()

VOID EFIAPI RedfishCredentialEndOfDxeEventNotify ( IN EFI_EVENT  Event,
OUT VOID *  Context 
)

Callback function executed when the EndOfDxe event group is signaled.

Parameters
[in]EventEvent whose notification function is being invoked.
[out]ContextPointer to the buffer pass in.

Definition at line 42 of file RedfishCredentialDxe.c.

◆ RedfishCredentialExitBootServicesEventNotify()

VOID EFIAPI RedfishCredentialExitBootServicesEventNotify ( IN EFI_EVENT  Event,
OUT VOID *  Context 
)

Callback function executed when the ExitBootServices event group is signaled.

Parameters
[in]EventEvent whose notification function is being invoked.
[out]ContextPointer to the buffer pass in.

Definition at line 26 of file RedfishCredentialDxe.c.

◆ RedfishCredentialGetAuthInfo()

EFI_STATUS EFIAPI RedfishCredentialGetAuthInfo ( IN EDKII_REDFISH_CREDENTIAL_PROTOCOL This,
OUT EDKII_REDFISH_AUTH_METHOD AuthMethod,
OUT CHAR8 **  UserId,
OUT CHAR8 **  Password 
)

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.

Parameters
[in]ThisPointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
[out]AuthMethodType of Redfish authentication method.
[out]UserIdThe pointer to store the returned UserId string.
[out]PasswordThe pointer to store the returned Password string.
Return values
EFI_SUCCESSGet the authentication information successfully.
EFI_ACCESS_DENIEDSecureBoot is disabled after EndOfDxe.
EFI_INVALID_PARAMETERThis or AuthMethod or UserId or Password is NULL.
EFI_OUT_OF_RESOURCESThere are not enough memory resources.
EFI_UNSUPPORTEDUnsupported authentication method is found.

Definition at line 90 of file RedfishCredentialDxe.c.

◆ RedfishCredentialStopService()

EFI_STATUS EFIAPI RedfishCredentialStopService ( IN EDKII_REDFISH_CREDENTIAL_PROTOCOL This,
IN EDKII_REDFISH_CREDENTIAL_STOP_SERVICE_TYPE  ServiceStopType 
)

Notify the Redfish service provider 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 returned.

Parameters
[in]ThisPointer to EDKII_REDFISH_CREDENTIAL_PROTOCOL instance.
[in]ServiceStopTypeReason of stopping Redfish service.
Return values
EFI_SUCCESSService has been stoped successfully.
EFI_INVALID_PARAMETERThis is NULL or given the worng ServiceStopType.
EFI_UNSUPPORTEDNot support to stop Redfish service.
OthersSome error happened.

Definition at line 123 of file RedfishCredentialDxe.c.

◆ RedfishGetAuthConfig()

EFI_STATUS RedfishGetAuthConfig ( OUT EDKII_REDFISH_AUTH_METHOD AuthMethod,
OUT CHAR8 **  UserId 
)

Retrieve platform's Redfish authentication information.

This functions returns the Redfish authentication method together with the user Id. For AuthMethodNone, UserId will point to NULL which means authentication is not required to access the Redfish service. Callers are responsible for freeing the returned string storage pointed by UserId.

Parameters
[out]AuthMethodType of Redfish authentication method.
[out]UserIdThe pointer to store the returned UserId string.
Return values
EFI_SUCCESSGet the authentication information successfully.
EFI_INVALID_PARAMETERAuthMethod or UserId or Password is NULL.
EFI_UNSUPPORTEDUnsupported authentication method is found.

Definition at line 523 of file RedfishCredentialDxe.c.

◆ RedfishGetServiceVersion()

EFI_STATUS RedfishGetServiceVersion ( OUT CHAR16 **  ServiceVersionStr)

This function returns the string of Redfish service version.

Parameters
[out]ServiceVersionStrRedfish service string.
Returns
EFI_STATUS

Definition at line 377 of file RedfishCredentialDxe.c.

◆ ReleaseCredentialPrivate()

EFI_STATUS ReleaseCredentialPrivate ( )

Releases all resources allocated by the module. Uninstall all the protocols installed in the driver entry point.

Return values
EFI_SUCCESSThe resources are released.
OthersFailed to release the resources.

Definition at line 911 of file RedfishCredentialDxe.c.

Variable Documentation

◆ mCredentialPrivate

REDFISH_CREDENTIAL_PRIVATE* mCredentialPrivate = NULL

Definition at line 16 of file RedfishCredentialDxe.c.