]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/OpensslLib/rand_pool.c
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Library / OpensslLib / rand_pool.c
index 6218ae0c1cd7f78faaeb0f188d2143b424dc5419..13e860a853d09772419b174dc82a9a6ce17630c4 100644 (file)
@@ -29,22 +29,21 @@ STATIC
 BOOLEAN\r
 EFIAPI\r
 RandGetBytes (\r
-  IN UINTN         Length,\r
-  OUT UINT8       *RandBuffer\r
+  IN UINTN   Length,\r
+  OUT UINT8  *RandBuffer\r
   )\r
 {\r
-  BOOLEAN     Ret;\r
-  UINT64      TempRand;\r
+  BOOLEAN  Ret;\r
+  UINT64   TempRand;\r
 \r
   Ret = FALSE;\r
 \r
   if (RandBuffer == NULL) {\r
-    DEBUG((DEBUG_ERROR, "[OPENSSL_RAND_POOL] NULL RandBuffer. No random numbers are generated and your system is not secure\n"));\r
+    DEBUG ((DEBUG_ERROR, "[OPENSSL_RAND_POOL] NULL RandBuffer. No random numbers are generated and your system is not secure\n"));\r
     ASSERT (RandBuffer != NULL); // Since we can't generate random numbers, we should assert. Otherwise we will just blow up later.\r
     return Ret;\r
   }\r
 \r
-\r
   while (Length > 0) {\r
     // Use RngLib to get random number\r
     Ret = GetRandomNumber64 (&TempRand);\r
@@ -52,12 +51,12 @@ RandGetBytes (
     if (!Ret) {\r
       return Ret;\r
     }\r
+\r
     if (Length >= sizeof (TempRand)) {\r
-      *((UINT64*) RandBuffer) = TempRand;\r
-      RandBuffer += sizeof (UINT64);\r
-      Length -= sizeof (TempRand);\r
-    }\r
-    else {\r
+      *((UINT64 *)RandBuffer) = TempRand;\r
+      RandBuffer             += sizeof (UINT64);\r
+      Length                 -= sizeof (TempRand);\r
+    } else {\r
       CopyMem (RandBuffer, &TempRand, Length);\r
       Length = 0;\r
     }\r
@@ -76,12 +75,12 @@ RandGetBytes (
  */\r
 size_t\r
 rand_pool_acquire_entropy (\r
-  RAND_POOL *pool\r
+  RAND_POOL  *pool\r
   )\r
 {\r
   BOOLEAN        Ret;\r
   size_t         Bytes_needed;\r
-  unsigned char *Buffer;\r
+  unsigned char  *Buffer;\r
 \r
   Bytes_needed = rand_pool_bytes_needed (pool, 1 /*entropy_factor*/);\r
   if (Bytes_needed > 0) {\r
@@ -91,8 +90,7 @@ rand_pool_acquire_entropy (
       Ret = RandGetBytes (Bytes_needed, Buffer);\r
       if (FALSE == Ret) {\r
         rand_pool_add_end (pool, 0, 0);\r
-      }\r
-      else {\r
+      } else {\r
         rand_pool_add_end (pool, Bytes_needed, 8 * Bytes_needed);\r
       }\r
     }\r
@@ -108,13 +106,14 @@ rand_pool_acquire_entropy (
  */\r
 int\r
 rand_pool_add_nonce_data (\r
-  RAND_POOL *pool\r
+  RAND_POOL  *pool\r
   )\r
 {\r
-  UINT8 data[16];\r
-  RandGetBytes (sizeof(data), data);\r
+  UINT8  data[16];\r
+\r
+  RandGetBytes (sizeof (data), data);\r
 \r
-  return rand_pool_add (pool, (unsigned char*)&data, sizeof(data), 0);\r
+  return rand_pool_add (pool, (unsigned char *)&data, sizeof (data), 0);\r
 }\r
 \r
 /*\r
@@ -124,13 +123,14 @@ rand_pool_add_nonce_data (
  */\r
 int\r
 rand_pool_add_additional_data (\r
-  RAND_POOL *pool\r
+  RAND_POOL  *pool\r
   )\r
 {\r
-  UINT8 data[16];\r
-  RandGetBytes (sizeof(data), data);\r
+  UINT8  data[16];\r
+\r
+  RandGetBytes (sizeof (data), data);\r
 \r
-  return rand_pool_add (pool, (unsigned char*)&data, sizeof(data), 0);\r
+  return rand_pool_add (pool, (unsigned char *)&data, sizeof (data), 0);\r
 }\r
 \r
 /*\r
@@ -152,7 +152,7 @@ rand_pool_init (
  * This is OpenSSL required interface.\r
  */\r
 VOID\r
-rand_pool_cleanup(\r
+rand_pool_cleanup (\r
   VOID\r
   )\r
 {\r
@@ -165,7 +165,7 @@ rand_pool_cleanup(
  */\r
 VOID\r
 rand_pool_keep_random_devices_open (\r
-  int keep\r
+  int  keep\r
   )\r
 {\r
 }\r