//\r
// Allocates & Initializes DH Context by OpenSSL DH_new()\r
//\r
- return (VOID *) DH_new ();\r
+ return (VOID *)DH_new ();\r
}\r
\r
/**\r
//\r
// Free OpenSSL DH Context\r
//\r
- DH_free ((DH *) DhContext);\r
+ DH_free ((DH *)DhContext);\r
}\r
\r
/**\r
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
//\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
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
if (PublicKey != NULL) {\r
BN_bn2bin (DhPubKey, PublicKey);\r
}\r
+\r
*PublicKeySize = Size;\r
}\r
\r
//\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
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
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