summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/DxeRngLib
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:05 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit2f88bd3a1296c522317f1c21377876de63de5be7 (patch)
treeba47875489cc5698061275a495983e9dea3be098 /MdePkg/Library/DxeRngLib
parent1436aea4d5707e672672a11bda72be2c63c936c3 (diff)
downloadedk2-2f88bd3a1296c522317f1c21377876de63de5be7.tar.gz
edk2-2f88bd3a1296c522317f1c21377876de63de5be7.tar.bz2
edk2-2f88bd3a1296c522317f1c21377876de63de5be7.zip
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>
Diffstat (limited to 'MdePkg/Library/DxeRngLib')
-rw-r--r--MdePkg/Library/DxeRngLib/DxeRngLib.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/MdePkg/Library/DxeRngLib/DxeRngLib.c b/MdePkg/Library/DxeRngLib/DxeRngLib.c
index 9c3d67b5a6..82129aa445 100644
--- a/MdePkg/Library/DxeRngLib/DxeRngLib.c
+++ b/MdePkg/Library/DxeRngLib/DxeRngLib.c
@@ -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;
}