]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptDh.c
index abe4601d111f3e8d54de153ef7d5443d74e824cb..27322888934d03ded82504a26bff2b8e0a4d389b 100644 (file)
@@ -26,7 +26,7 @@ DhNew (
   //\r
   // Allocates & Initializes DH Context by OpenSSL DH_new()\r
   //\r
-  return (VOID *) DH_new ();\r
+  return (VOID *)DH_new ();\r
 }\r
 \r
 /**\r
@@ -46,7 +46,7 @@ DhFree (
   //\r
   // Free OpenSSL DH Context\r
   //\r
-  DH_free ((DH *) DhContext);\r
+  DH_free ((DH *)DhContext);\r
 }\r
 \r
 /**\r
@@ -80,21 +80,21 @@ DhGenerateParameter (
   OUT     UINT8  *Prime\r
   )\r
 {\r
-  BOOLEAN RetVal;\r
-  BIGNUM  *BnP;\r
+  BOOLEAN  RetVal;\r
+  BIGNUM   *BnP;\r
 \r
   //\r
   // Check input parameters.\r
   //\r
-  if (DhContext == NULL || Prime == NULL || PrimeLength > INT_MAX) {\r
+  if ((DhContext == NULL) || (Prime == NULL) || (PrimeLength > INT_MAX)) {\r
     return FALSE;\r
   }\r
 \r
-  if (Generator != DH_GENERATOR_2 && Generator != DH_GENERATOR_5) {\r
+  if ((Generator != DH_GENERATOR_2) && (Generator != DH_GENERATOR_5)) {\r
     return FALSE;\r
   }\r
 \r
-  RetVal = (BOOLEAN) DH_generate_parameters_ex (DhContext, (UINT32) PrimeLength, (UINT32) Generator, NULL);\r
+  RetVal = (BOOLEAN)DH_generate_parameters_ex (DhContext, (UINT32)PrimeLength, (UINT32)Generator, NULL);\r
   if (!RetVal) {\r
     return FALSE;\r
   }\r
@@ -142,11 +142,11 @@ DhSetParameter (
   //\r
   // Check input parameters.\r
   //\r
-  if (DhContext == NULL || Prime == NULL || PrimeLength > INT_MAX) {\r
+  if ((DhContext == NULL) || (Prime == NULL) || (PrimeLength > INT_MAX)) {\r
     return FALSE;\r
   }\r
 \r
-  if (Generator != DH_GENERATOR_2 && Generator != DH_GENERATOR_5) {\r
+  if ((Generator != DH_GENERATOR_2) && (Generator != DH_GENERATOR_5)) {\r
     return FALSE;\r
   }\r
 \r
@@ -199,29 +199,29 @@ DhGenerateKey (
   IN OUT  UINTN  *PublicKeySize\r
   )\r
 {\r
-  BOOLEAN RetVal;\r
-  DH      *Dh;\r
-  BIGNUM  *DhPubKey;\r
-  INTN    Size;\r
+  BOOLEAN  RetVal;\r
+  DH       *Dh;\r
+  BIGNUM   *DhPubKey;\r
+  INTN     Size;\r
 \r
   //\r
   // Check input parameters.\r
   //\r
-  if (DhContext == NULL || PublicKeySize == NULL) {\r
+  if ((DhContext == NULL) || (PublicKeySize == NULL)) {\r
     return FALSE;\r
   }\r
 \r
-  if (PublicKey == NULL && *PublicKeySize != 0) {\r
+  if ((PublicKey == NULL) && (*PublicKeySize != 0)) {\r
     return FALSE;\r
   }\r
 \r
-  Dh = (DH *) DhContext;\r
+  Dh = (DH *)DhContext;\r
 \r
-  RetVal = (BOOLEAN) DH_generate_key (DhContext);\r
+  RetVal = (BOOLEAN)DH_generate_key (DhContext);\r
   if (RetVal) {\r
     DH_get0_key (Dh, (const BIGNUM **)&DhPubKey, NULL);\r
     Size = BN_num_bytes (DhPubKey);\r
-    if ((Size > 0) && (*PublicKeySize < (UINTN) Size)) {\r
+    if ((Size > 0) && (*PublicKeySize < (UINTN)Size)) {\r
       *PublicKeySize = Size;\r
       return FALSE;\r
     }\r
@@ -229,6 +229,7 @@ DhGenerateKey (
     if (PublicKey != NULL) {\r
       BN_bn2bin (DhPubKey, PublicKey);\r
     }\r
+\r
     *PublicKeySize = Size;\r
   }\r
 \r
@@ -275,7 +276,7 @@ DhComputeKey (
   //\r
   // Check input parameters.\r
   //\r
-  if (DhContext == NULL || PeerPublicKey == NULL || KeySize == NULL || Key == NULL) {\r
+  if ((DhContext == NULL) || (PeerPublicKey == NULL) || (KeySize == NULL) || (Key == NULL)) {\r
     return FALSE;\r
   }\r
 \r
@@ -283,7 +284,7 @@ DhComputeKey (
     return FALSE;\r
   }\r
 \r
-  Bn = BN_bin2bn (PeerPublicKey, (UINT32) PeerPublicKeySize, NULL);\r
+  Bn = BN_bin2bn (PeerPublicKey, (UINT32)PeerPublicKeySize, NULL);\r
   if (Bn == NULL) {\r
     return FALSE;\r
   }\r
@@ -294,7 +295,7 @@ DhComputeKey (
     return FALSE;\r
   }\r
 \r
-  if (*KeySize < (UINTN) Size) {\r
+  if (*KeySize < (UINTN)Size) {\r
     *KeySize = Size;\r
     BN_free (Bn);\r
     return FALSE;\r