MdePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
1436aea4d5
commit
2f88bd3a12
@@ -37,46 +37,47 @@ GenerateRandomNumberViaNist800Algorithm (
|
||||
RngProtocol = NULL;
|
||||
|
||||
if (Buffer == NULL) {
|
||||
DEBUG((DEBUG_ERROR, "%a: Buffer == NULL.\n", __FUNCTION__));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
DEBUG ((DEBUG_ERROR, "%a: Buffer == NULL.\n", __FUNCTION__));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (&gEfiRngProtocolGuid, NULL, (VOID **)&RngProtocol);
|
||||
if (EFI_ERROR (Status) || RngProtocol == NULL) {
|
||||
DEBUG((DEBUG_ERROR, "%a: Could not locate RNG prototocol, Status = %r\n", __FUNCTION__, Status));
|
||||
return Status;
|
||||
if (EFI_ERROR (Status) || (RngProtocol == NULL)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Could not locate RNG prototocol, Status = %r\n", __FUNCTION__, Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Ctr256Guid, BufferSize, Buffer);
|
||||
DEBUG((DEBUG_INFO, "%a: GetRNG algorithm CTR-256 - Status = %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm CTR-256 - Status = %r\n", __FUNCTION__, Status));
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Hmac256Guid, BufferSize, Buffer);
|
||||
DEBUG((DEBUG_INFO, "%a: GetRNG algorithm HMAC-256 - Status = %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm HMAC-256 - Status = %r\n", __FUNCTION__, Status));
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = RngProtocol->GetRNG (RngProtocol, &gEfiRngAlgorithmSp80090Hash256Guid, BufferSize, Buffer);
|
||||
DEBUG((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
// If all the other methods have failed, use the default method from the RngProtocol
|
||||
Status = RngProtocol->GetRNG (RngProtocol, NULL, BufferSize, Buffer);
|
||||
DEBUG((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_INFO, "%a: GetRNG algorithm Hash-256 - Status = %r\n", __FUNCTION__, Status));
|
||||
if (!EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
// If we get to this point, we have failed
|
||||
DEBUG((DEBUG_ERROR, "%a: GetRNG() failed, staus = %r\n", __FUNCTION__, Status));
|
||||
DEBUG ((DEBUG_ERROR, "%a: GetRNG() failed, staus = %r\n", __FUNCTION__, Status));
|
||||
|
||||
return Status;
|
||||
}// GenerateRandomNumberViaNist800Algorithm()
|
||||
|
||||
|
||||
/**
|
||||
Generates a 16-bit random number.
|
||||
|
||||
@@ -94,17 +95,17 @@ GetRandomNumber16 (
|
||||
OUT UINT16 *Rand
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Rand == NULL)
|
||||
{
|
||||
if (Rand == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, sizeof(UINT16));
|
||||
Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, sizeof (UINT16));
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -122,19 +123,20 @@ GetRandomNumber16 (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNumber32 (
|
||||
OUT UINT32 *Rand
|
||||
OUT UINT32 *Rand
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Rand == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = GenerateRandomNumberViaNist800Algorithm ((UINT8*)Rand, sizeof(UINT32));
|
||||
Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, sizeof (UINT32));
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -152,19 +154,20 @@ GetRandomNumber32 (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNumber64 (
|
||||
OUT UINT64 *Rand
|
||||
OUT UINT64 *Rand
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Rand == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = GenerateRandomNumberViaNist800Algorithm ((UINT8*)Rand, sizeof(UINT64));
|
||||
Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, sizeof (UINT64));
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -182,18 +185,19 @@ GetRandomNumber64 (
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GetRandomNumber128 (
|
||||
OUT UINT64 *Rand
|
||||
OUT UINT64 *Rand
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Rand == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = GenerateRandomNumberViaNist800Algorithm ((UINT8*)Rand, 2 * sizeof(UINT64));
|
||||
Status = GenerateRandomNumberViaNist800Algorithm ((UINT8 *)Rand, 2 * sizeof (UINT64));
|
||||
if (EFI_ERROR (Status)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user