summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Library/OpensslLib/rand_pool.c
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:53:54 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit7c342378317039e632d9a1a5d4cf7c21aec8cb7a (patch)
tree6b34f630a779ee11db93c02cf54fa65c29716aed /CryptoPkg/Library/OpensslLib/rand_pool.c
parent2b16a4fb91b9b31c0d152588f5ac51080c6c0763 (diff)
downloadedk2-7c342378317039e632d9a1a5d4cf7c21aec8cb7a.tar.gz
edk2-7c342378317039e632d9a1a5d4cf7c21aec8cb7a.tar.bz2
edk2-7c342378317039e632d9a1a5d4cf7c21aec8cb7a.zip
CryptoPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the CryptoPkg 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: Jian J Wang <jian.j.wang@intel.com>
Diffstat (limited to 'CryptoPkg/Library/OpensslLib/rand_pool.c')
-rw-r--r--CryptoPkg/Library/OpensslLib/rand_pool.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/CryptoPkg/Library/OpensslLib/rand_pool.c b/CryptoPkg/Library/OpensslLib/rand_pool.c
index 6218ae0c1c..13e860a853 100644
--- a/CryptoPkg/Library/OpensslLib/rand_pool.c
+++ b/CryptoPkg/Library/OpensslLib/rand_pool.c
@@ -29,22 +29,21 @@ STATIC
BOOLEAN
EFIAPI
RandGetBytes (
- IN UINTN Length,
- OUT UINT8 *RandBuffer
+ IN UINTN Length,
+ OUT UINT8 *RandBuffer
)
{
- BOOLEAN Ret;
- UINT64 TempRand;
+ BOOLEAN Ret;
+ UINT64 TempRand;
Ret = FALSE;
if (RandBuffer == NULL) {
- DEBUG((DEBUG_ERROR, "[OPENSSL_RAND_POOL] NULL RandBuffer. No random numbers are generated and your system is not secure\n"));
+ DEBUG ((DEBUG_ERROR, "[OPENSSL_RAND_POOL] NULL RandBuffer. No random numbers are generated and your system is not secure\n"));
ASSERT (RandBuffer != NULL); // Since we can't generate random numbers, we should assert. Otherwise we will just blow up later.
return Ret;
}
-
while (Length > 0) {
// Use RngLib to get random number
Ret = GetRandomNumber64 (&TempRand);
@@ -52,12 +51,12 @@ RandGetBytes (
if (!Ret) {
return Ret;
}
+
if (Length >= sizeof (TempRand)) {
- *((UINT64*) RandBuffer) = TempRand;
- RandBuffer += sizeof (UINT64);
- Length -= sizeof (TempRand);
- }
- else {
+ *((UINT64 *)RandBuffer) = TempRand;
+ RandBuffer += sizeof (UINT64);
+ Length -= sizeof (TempRand);
+ } else {
CopyMem (RandBuffer, &TempRand, Length);
Length = 0;
}
@@ -76,12 +75,12 @@ RandGetBytes (
*/
size_t
rand_pool_acquire_entropy (
- RAND_POOL *pool
+ RAND_POOL *pool
)
{
BOOLEAN Ret;
size_t Bytes_needed;
- unsigned char *Buffer;
+ unsigned char *Buffer;
Bytes_needed = rand_pool_bytes_needed (pool, 1 /*entropy_factor*/);
if (Bytes_needed > 0) {
@@ -91,8 +90,7 @@ rand_pool_acquire_entropy (
Ret = RandGetBytes (Bytes_needed, Buffer);
if (FALSE == Ret) {
rand_pool_add_end (pool, 0, 0);
- }
- else {
+ } else {
rand_pool_add_end (pool, Bytes_needed, 8 * Bytes_needed);
}
}
@@ -108,13 +106,14 @@ rand_pool_acquire_entropy (
*/
int
rand_pool_add_nonce_data (
- RAND_POOL *pool
+ RAND_POOL *pool
)
{
- UINT8 data[16];
- RandGetBytes (sizeof(data), data);
+ UINT8 data[16];
+
+ RandGetBytes (sizeof (data), data);
- return rand_pool_add (pool, (unsigned char*)&data, sizeof(data), 0);
+ return rand_pool_add (pool, (unsigned char *)&data, sizeof (data), 0);
}
/*
@@ -124,13 +123,14 @@ rand_pool_add_nonce_data (
*/
int
rand_pool_add_additional_data (
- RAND_POOL *pool
+ RAND_POOL *pool
)
{
- UINT8 data[16];
- RandGetBytes (sizeof(data), data);
+ UINT8 data[16];
+
+ RandGetBytes (sizeof (data), data);
- return rand_pool_add (pool, (unsigned char*)&data, sizeof(data), 0);
+ return rand_pool_add (pool, (unsigned char *)&data, sizeof (data), 0);
}
/*
@@ -152,7 +152,7 @@ rand_pool_init (
* This is OpenSSL required interface.
*/
VOID
-rand_pool_cleanup(
+rand_pool_cleanup (
VOID
)
{
@@ -165,7 +165,7 @@ rand_pool_cleanup(
*/
VOID
rand_pool_keep_random_devices_open (
- int keep
+ int keep
)
{
}