public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "yi1 li" <yi1.li@intel.com>
To: devel@edk2.groups.io
Cc: Yi Li <yi1.li@intel.com>, Jiewen Yao <jiewen.yao@intel.com>,
	Jian J Wang <jian.j.wang@intel.com>,
	Xiaoyu Lu <xiaoyux.lu@intel.com>,
	Guomin Jiang <guomin.jiang@intel.com>
Subject: [PATCH 7/7] CryptoPkg: Run uncrustify tools on EC and BN change
Date: Wed,  7 Sep 2022 16:29:24 +0800	[thread overview]
Message-ID: <6a2d188dd969ac2ca134779147867ca715269470.1662539080.git.yi1.li@intel.com> (raw)
In-Reply-To: <cover.1662539079.git.yi1.li@intel.com>

Run uncrustify tools on EC and BN change to meet UEFI code style.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>

Signed-off-by: Yi Li <yi1.li@intel.com>
---
 CryptoPkg/Driver/Crypto.c                     |   2 +-
 CryptoPkg/Include/Library/BaseCryptLib.h      |   8 +-
 CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c   |  54 +--
 CryptoPkg/Library/BaseCryptLib/Pk/CryptEc.c   | 156 ++++----
 CryptoPkg/Private/Protocol/Crypto.h           | 368 +++++++++---------
 .../UnitTest/Library/BaseCryptLib/BnTests.c   | 109 +++---
 .../UnitTest/Library/BaseCryptLib/EcTests.c   |  93 ++---
 7 files changed, 405 insertions(+), 385 deletions(-)

diff --git a/CryptoPkg/Driver/Crypto.c b/CryptoPkg/Driver/Crypto.c
index f7b9287218..9682a46778 100644
--- a/CryptoPkg/Driver/Crypto.c
+++ b/CryptoPkg/Driver/Crypto.c
@@ -5546,7 +5546,7 @@ CryptoServiceEcDhComputeKey (
   IN OUT  UINTN        *KeySize
   )
 {
-  return CALL_BASECRYPTLIB (Ec.Services.DhComputeKey, EcDhComputeKey, (EcContext, PeerPublic, PeerPublicSize, CompressFlag ,Key, KeySize), FALSE);
+  return CALL_BASECRYPTLIB (Ec.Services.DhComputeKey, EcDhComputeKey, (EcContext, PeerPublic, PeerPublicSize, CompressFlag, Key, KeySize), FALSE);
 }
 
 const EDKII_CRYPTO_PROTOCOL  mEdkiiCrypto = {
diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h
index ea3ed5270f..d74fc21c1e 100644
--- a/CryptoPkg/Include/Library/BaseCryptLib.h
+++ b/CryptoPkg/Include/Library/BaseCryptLib.h
@@ -14,12 +14,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include <Uefi/UefiBaseType.h>
 
-#define CRYPTO_NID_NULL        0x0000
+#define CRYPTO_NID_NULL  0x0000
 
 // Key Exchange
-#define CRYPTO_NID_SECP256R1           0x0204
-#define CRYPTO_NID_SECP384R1           0x0205
-#define CRYPTO_NID_SECP521R1           0x0206
+#define CRYPTO_NID_SECP256R1  0x0204
+#define CRYPTO_NID_SECP384R1  0x0205
+#define CRYPTO_NID_SECP521R1  0x0206
 
 ///
 /// MD5 digest size in bytes
diff --git a/CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c b/CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c
index 7a3043b1de..282926ddcc 100644
--- a/CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c
+++ b/CryptoPkg/Library/BaseCryptLib/Bn/CryptBn.c
@@ -99,7 +99,7 @@ BigNumAdd (
   OUT VOID       *BnRes
   )
 {
-  return (BOOLEAN) BN_add (BnRes, BnA, BnB);
+  return (BOOLEAN)BN_add (BnRes, BnA, BnB);
 }
 
 /**
@@ -122,7 +122,7 @@ BigNumSub (
   OUT VOID       *BnRes
   )
 {
-  return (BOOLEAN) BN_sub (BnRes, BnA, BnB);
+  return (BOOLEAN)BN_sub (BnRes, BnA, BnB);
 }
 
 /**
@@ -145,15 +145,15 @@ BigNumMod (
   OUT VOID       *BnRes
   )
 {
-  BOOLEAN RetVal;
-  BN_CTX  *Ctx;
+  BOOLEAN  RetVal;
+  BN_CTX   *Ctx;
 
   Ctx = BN_CTX_new ();
   if (Ctx == NULL) {
     return FALSE;
   }
 
-  RetVal = (BOOLEAN) BN_mod (BnRes, BnA, BnB, Ctx);
+  RetVal = (BOOLEAN)BN_mod (BnRes, BnA, BnB, Ctx);
   BN_CTX_free (Ctx);
 
   return RetVal;
@@ -181,15 +181,15 @@ BigNumExpMod (
   OUT VOID       *BnRes
   )
 {
-  BOOLEAN RetVal;
-  BN_CTX  *Ctx;
+  BOOLEAN  RetVal;
+  BN_CTX   *Ctx;
 
   Ctx = BN_CTX_new ();
   if (Ctx == NULL) {
     return FALSE;
   }
 
-  RetVal = (BOOLEAN) BN_mod_exp (BnRes, BnA, BnP, BnM, Ctx);
+  RetVal = (BOOLEAN)BN_mod_exp (BnRes, BnA, BnP, BnM, Ctx);
 
   BN_CTX_free (Ctx);
   return RetVal;
@@ -215,8 +215,8 @@ BigNumInverseMod (
   OUT VOID       *BnRes
   )
 {
-  BOOLEAN RetVal;
-  BN_CTX  *Ctx;
+  BOOLEAN  RetVal;
+  BN_CTX   *Ctx;
 
   Ctx = BN_CTX_new ();
   if (Ctx == NULL) {
@@ -226,7 +226,7 @@ BigNumInverseMod (
   RetVal = FALSE;
   if (BN_mod_inverse (BnRes, BnA, BnM, Ctx) != NULL) {
     RetVal = TRUE;
-  };
+  }
 
   BN_CTX_free (Ctx);
   return RetVal;
@@ -252,15 +252,15 @@ BigNumDiv (
   OUT VOID       *BnRes
   )
 {
-  BOOLEAN RetVal;
-  BN_CTX  *Ctx;
+  BOOLEAN  RetVal;
+  BN_CTX   *Ctx;
 
   Ctx = BN_CTX_new ();
   if (Ctx == NULL) {
     return FALSE;
   }
 
-  RetVal = (BOOLEAN) BN_div (BnRes, NULL, BnA, BnB, Ctx);
+  RetVal = (BOOLEAN)BN_div (BnRes, NULL, BnA, BnB, Ctx);
   BN_CTX_free (Ctx);
 
   return RetVal;
@@ -288,15 +288,15 @@ BigNumMulMod (
   OUT VOID       *BnRes
   )
 {
-  BOOLEAN RetVal;
-  BN_CTX  *Ctx;
+  BOOLEAN  RetVal;
+  BN_CTX   *Ctx;
 
   Ctx = BN_CTX_new ();
   if (Ctx == NULL) {
     return FALSE;
   }
 
-  RetVal = (BOOLEAN) BN_mod_mul (BnRes, BnA, BnB, BnM, Ctx);
+  RetVal = (BOOLEAN)BN_mod_mul (BnRes, BnA, BnB, BnM, Ctx);
   BN_CTX_free (Ctx);
 
   return RetVal;
@@ -370,7 +370,7 @@ BigNumIsWord (
   IN UINTN       Num
   )
 {
-  return (BOOLEAN) BN_is_word (Bn, Num);
+  return (BOOLEAN)BN_is_word (Bn, Num);
 }
 
 /**
@@ -387,7 +387,7 @@ BigNumIsOdd (
   IN CONST VOID  *Bn
   )
 {
-  return (BOOLEAN) BN_is_odd (Bn);
+  return (BOOLEAN)BN_is_odd (Bn);
 }
 
 /**
@@ -444,7 +444,7 @@ BigNumRShift (
   OUT VOID       *BnRes
   )
 {
-  return (BOOLEAN) BN_rshift (BnRes, Bn, (INT32) N);
+  return (BOOLEAN)BN_rshift (BnRes, Bn, (INT32)N);
 }
 
 /**
@@ -483,15 +483,15 @@ BigNumSqrMod (
   OUT VOID       *BnRes
   )
 {
-  BOOLEAN RetVal;
-  BN_CTX  *Ctx;
+  BOOLEAN  RetVal;
+  BN_CTX   *Ctx;
 
   Ctx = BN_CTX_new ();
   if (Ctx == NULL) {
     return FALSE;
   }
 
-  RetVal = (BOOLEAN) BN_mod_sqr (BnRes, BnA, BnM, Ctx);
+  RetVal = (BOOLEAN)BN_mod_sqr (BnRes, BnA, BnM, Ctx);
   BN_CTX_free (Ctx);
 
   return RetVal;
@@ -543,7 +543,7 @@ BigNumSetUint (
   IN UINTN  Val
   )
 {
-  return (BOOLEAN) BN_set_word (Bn, Val);
+  return (BOOLEAN)BN_set_word (Bn, Val);
 }
 
 /**
@@ -566,15 +566,15 @@ BigNumAddMod (
   OUT VOID       *BnRes
   )
 {
-  BOOLEAN RetVal;
-  BN_CTX  *Ctx;
+  BOOLEAN  RetVal;
+  BN_CTX   *Ctx;
 
   Ctx = BN_CTX_new ();
   if (Ctx == NULL) {
     return FALSE;
   }
 
-  RetVal = (BOOLEAN) BN_mod_add (BnRes, BnA, BnB, BnM, Ctx);
+  RetVal = (BOOLEAN)BN_mod_add (BnRes, BnA, BnB, BnM, Ctx);
   BN_CTX_free (Ctx);
 
   return RetVal;
diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptEc.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptEc.c
index e9b0391a56..396c819834 100644
--- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptEc.c
+++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptEc.c
@@ -27,8 +27,8 @@
 STATIC
 INT32
 CryptoNidToOpensslNid (
-  IN UINTN CryptoNid
-)
+  IN UINTN  CryptoNid
+  )
 {
   INT32  Nid;
 
@@ -102,7 +102,7 @@ EcGroupGetCurve (
   IN VOID        *BnCtx
   )
 {
-  return (BOOLEAN) EC_GROUP_get_curve (EcGroup, BnPrime, BnA, BnB, BnCtx);
+  return (BOOLEAN)EC_GROUP_get_curve (EcGroup, BnPrime, BnA, BnB, BnCtx);
 }
 
 /**
@@ -124,7 +124,7 @@ EcGroupGetOrder (
   OUT VOID  *BnOrder
   )
 {
-  return (BOOLEAN) EC_GROUP_get_order (EcGroup, BnOrder, NULL);
+  return (BOOLEAN)EC_GROUP_get_order (EcGroup, BnOrder, NULL);
 }
 
 /**
@@ -204,7 +204,7 @@ EcPointGetAffineCoordinates (
   IN VOID        *BnCtx
   )
 {
-  return (BOOLEAN) EC_POINT_get_affine_coordinates (EcGroup, EcPoint, BnX, BnY, BnCtx);
+  return (BOOLEAN)EC_POINT_get_affine_coordinates (EcGroup, EcPoint, BnX, BnY, BnCtx);
 }
 
 /**
@@ -229,7 +229,7 @@ EcPointSetAffineCoordinates (
   IN VOID        *BnCtx
   )
 {
-  return (BOOLEAN) EC_POINT_set_affine_coordinates (EcGroup, EcPoint, BnX, BnY, BnCtx);
+  return (BOOLEAN)EC_POINT_set_affine_coordinates (EcGroup, EcPoint, BnX, BnY, BnCtx);
 }
 
 /**
@@ -255,7 +255,7 @@ EcPointAdd (
   IN VOID        *BnCtx
   )
 {
-  return (BOOLEAN) EC_POINT_add (EcGroup, EcPointResult, EcPointA, EcPointB, BnCtx);
+  return (BOOLEAN)EC_POINT_add (EcGroup, EcPointResult, EcPointA, EcPointB, BnCtx);
 }
 
 /**
@@ -281,7 +281,7 @@ EcPointMul (
   IN VOID        *BnCtx
   )
 {
-  return (BOOLEAN) EC_POINT_mul (EcGroup, EcPointResult, NULL, EcPoint, BnPScalar, BnCtx);
+  return (BOOLEAN)EC_POINT_mul (EcGroup, EcPointResult, NULL, EcPoint, BnPScalar, BnCtx);
 }
 
 /**
@@ -302,7 +302,7 @@ EcPointInvert (
   IN VOID        *BnCtx
   )
 {
-  return (BOOLEAN) EC_POINT_invert (EcGroup, EcPoint, BnCtx);
+  return (BOOLEAN)EC_POINT_invert (EcGroup, EcPoint, BnCtx);
 }
 
 /**
@@ -395,7 +395,7 @@ EcPointSetCompressedCoordinates (
   IN VOID        *BnCtx
   )
 {
-  return (BOOLEAN) EC_POINT_set_compressed_coordinates (EcGroup, EcPoint, BnX, YBit, BnCtx);
+  return (BOOLEAN)EC_POINT_set_compressed_coordinates (EcGroup, EcPoint, BnX, YBit, BnCtx);
 }
 
 // =====================================================================================
@@ -417,7 +417,7 @@ EcNewByNid (
   IN UINTN  Nid
   )
 {
-  INT32 OpenSslNid;
+  INT32  OpenSslNid;
 
   OpenSslNid = CryptoNidToOpensslNid (Nid);
   if (OpenSslNid < 0) {
@@ -438,7 +438,7 @@ EcFree (
   IN  VOID  *EcContext
   )
 {
-  EC_KEY_free ((EC_KEY *) EcContext);
+  EC_KEY_free ((EC_KEY *)EcContext);
 }
 
 /**
@@ -475,26 +475,26 @@ EcGenerateKey (
   IN OUT  UINTN  *PublicKeySize
   )
 {
-  EC_KEY         *EcKey;
-  CONST EC_GROUP *Group;
-  CONST EC_POINT *EcPoint;
-  BOOLEAN        RetVal;
-  BIGNUM         *BnX;
-  BIGNUM         *BnY;
-  UINTN          HalfSize;
-  INTN           XSize;
-  INTN           YSize;
-
-  if (EcContext == NULL || PublicKeySize == NULL) {
+  EC_KEY          *EcKey;
+  CONST EC_GROUP  *Group;
+  CONST EC_POINT  *EcPoint;
+  BOOLEAN         RetVal;
+  BIGNUM          *BnX;
+  BIGNUM          *BnY;
+  UINTN           HalfSize;
+  INTN            XSize;
+  INTN            YSize;
+
+  if ((EcContext == NULL) || (PublicKeySize == NULL)) {
     return FALSE;
   }
 
-  if (PublicKey == NULL && *PublicKeySize != 0) {
+  if ((PublicKey == NULL) && (*PublicKeySize != 0)) {
     return FALSE;
   }
 
-  EcKey = (EC_KEY *)EcContext;
-  Group = EC_KEY_get0_group (EcKey);
+  EcKey    = (EC_KEY *)EcContext;
+  Group    = EC_KEY_get0_group (EcKey);
   HalfSize = (EC_GROUP_get_degree (Group) + 7) / 8;
 
   // Assume RAND_seed was called
@@ -506,6 +506,7 @@ EcGenerateKey (
     *PublicKeySize = HalfSize * 2;
     return FALSE;
   }
+
   *PublicKeySize = HalfSize * 2;
 
   EcPoint = EC_KEY_get0_public_key (EcKey);
@@ -514,9 +515,9 @@ EcGenerateKey (
   }
 
   RetVal = FALSE;
-  BnX = BN_new();
-  BnY = BN_new();
-  if (BnX == NULL || BnY == NULL) {
+  BnX    = BN_new ();
+  BnY    = BN_new ();
+  if ((BnX == NULL) || (BnY == NULL)) {
     goto fail;
   }
 
@@ -526,9 +527,10 @@ EcGenerateKey (
 
   XSize = BN_num_bytes (BnX);
   YSize = BN_num_bytes (BnY);
-  if (XSize <= 0 || YSize <= 0) {
+  if ((XSize <= 0) || (YSize <= 0)) {
     goto fail;
   }
+
   ASSERT ((UINTN)XSize <= HalfSize && (UINTN)YSize <= HalfSize);
 
   ZeroMem (PublicKey, *PublicKeySize);
@@ -565,31 +567,32 @@ EcGetPubKey (
   IN OUT  UINTN  *PublicKeySize
   )
 {
-  EC_KEY         *EcKey;
-  CONST EC_GROUP *Group;
-  CONST EC_POINT *EcPoint;
-  BIGNUM         *BnX;
-  BIGNUM         *BnY;
-  UINTN          HalfSize;
-  INTN           XSize;
-  INTN           YSize;
-  BOOLEAN        RetVal;
-
-  if (EcContext == NULL || PublicKeySize == NULL) {
+  EC_KEY          *EcKey;
+  CONST EC_GROUP  *Group;
+  CONST EC_POINT  *EcPoint;
+  BIGNUM          *BnX;
+  BIGNUM          *BnY;
+  UINTN           HalfSize;
+  INTN            XSize;
+  INTN            YSize;
+  BOOLEAN         RetVal;
+
+  if ((EcContext == NULL) || (PublicKeySize == NULL)) {
     return FALSE;
   }
 
-  if (PublicKey == NULL && *PublicKeySize != 0) {
+  if ((PublicKey == NULL) && (*PublicKeySize != 0)) {
     return FALSE;
   }
 
-  EcKey = (EC_KEY *)EcContext;
-  Group = EC_KEY_get0_group (EcKey);
+  EcKey    = (EC_KEY *)EcContext;
+  Group    = EC_KEY_get0_group (EcKey);
   HalfSize = (EC_GROUP_get_degree (Group) + 7) / 8;
   if (*PublicKeySize < HalfSize * 2) {
     *PublicKeySize = HalfSize * 2;
     return FALSE;
   }
+
   *PublicKeySize = HalfSize * 2;
 
   EcPoint = EC_KEY_get0_public_key (EcKey);
@@ -598,9 +601,9 @@ EcGetPubKey (
   }
 
   RetVal = FALSE;
-  BnX = BN_new();
-  BnY = BN_new();
-  if (BnX == NULL || BnY == NULL) {
+  BnX    = BN_new ();
+  BnY    = BN_new ();
+  if ((BnX == NULL) || (BnY == NULL)) {
     goto fail;
   }
 
@@ -610,9 +613,10 @@ EcGetPubKey (
 
   XSize = BN_num_bytes (BnX);
   YSize = BN_num_bytes (BnY);
-  if (XSize <= 0 || YSize <= 0) {
+  if ((XSize <= 0) || (YSize <= 0)) {
     goto fail;
   }
+
   ASSERT ((UINTN)XSize <= HalfSize && (UINTN)YSize <= HalfSize);
 
   if (PublicKey != NULL) {
@@ -666,21 +670,21 @@ EcDhComputeKey (
   IN OUT  UINTN        *KeySize
   )
 {
-  EC_KEY         *EcKey;
-  EC_KEY         *PeerEcKey;
-  CONST EC_GROUP *Group;
-  BOOLEAN        RetVal;
-  BIGNUM         *BnX;
-  BIGNUM         *BnY;
-  EC_POINT       *Point;
-  INT32          OpenSslNid;
-  UINTN          HalfSize;
-
-  if (EcContext == NULL || PeerPublic == NULL || KeySize == NULL) {
+  EC_KEY          *EcKey;
+  EC_KEY          *PeerEcKey;
+  CONST EC_GROUP  *Group;
+  BOOLEAN         RetVal;
+  BIGNUM          *BnX;
+  BIGNUM          *BnY;
+  EC_POINT        *Point;
+  INT32           OpenSslNid;
+  UINTN           HalfSize;
+
+  if ((EcContext == NULL) || (PeerPublic == NULL) || (KeySize == NULL)) {
     return FALSE;
   }
 
-  if (Key == NULL && *KeySize != 0) {
+  if ((Key == NULL) && (*KeySize != 0)) {
     return FALSE;
   }
 
@@ -688,36 +692,40 @@ EcDhComputeKey (
     return FALSE;
   }
 
-  EcKey = (EC_KEY *) EcContext;
-  Group = EC_KEY_get0_group (EcKey);
+  EcKey    = (EC_KEY *)EcContext;
+  Group    = EC_KEY_get0_group (EcKey);
   HalfSize = (EC_GROUP_get_degree (Group) + 7) / 8;
-  if (CompressFlag == NULL && PeerPublicSize != HalfSize * 2) {
+  if ((CompressFlag == NULL) && (PeerPublicSize != HalfSize * 2)) {
     return FALSE;
   }
-  if (CompressFlag != NULL && PeerPublicSize != HalfSize) {
+
+  if ((CompressFlag != NULL) && (PeerPublicSize != HalfSize)) {
     return FALSE;
   }
+
   if (*KeySize < HalfSize) {
     *KeySize = HalfSize;
     return FALSE;
   }
+
   *KeySize = HalfSize;
 
-  RetVal = FALSE;
-  Point = NULL;
-  BnX = BN_bin2bn (PeerPublic, (INT32) HalfSize, NULL);
-  BnY = NULL;
-  Point = EC_POINT_new (Group);
+  RetVal    = FALSE;
+  Point     = NULL;
+  BnX       = BN_bin2bn (PeerPublic, (INT32)HalfSize, NULL);
+  BnY       = NULL;
+  Point     = EC_POINT_new (Group);
   PeerEcKey = NULL;
-  if (BnX == NULL || Point == NULL) {
+  if ((BnX == NULL) || (Point == NULL)) {
     goto fail;
   }
 
   if (CompressFlag == NULL) {
-    BnY = BN_bin2bn (PeerPublic + HalfSize, (INT32) HalfSize, NULL);
+    BnY = BN_bin2bn (PeerPublic + HalfSize, (INT32)HalfSize, NULL);
     if (BnY == NULL) {
       goto fail;
     }
+
     if (EC_POINT_set_affine_coordinates (Group, Point, BnX, BnY, NULL) != 1) {
       goto fail;
     }
@@ -729,13 +737,15 @@ EcDhComputeKey (
 
   // Validate NIST ECDH public key
   OpenSslNid = EC_GROUP_get_curve_name (Group);
-  PeerEcKey = EC_KEY_new_by_curve_name (OpenSslNid);
+  PeerEcKey  = EC_KEY_new_by_curve_name (OpenSslNid);
   if (PeerEcKey == NULL) {
     goto fail;
   }
+
   if (EC_KEY_set_public_key (PeerEcKey, Point) != 1) {
     goto fail;
   }
+
   if (EC_KEY_check_key (PeerEcKey) != 1) {
     goto fail;
   }
@@ -749,7 +759,7 @@ EcDhComputeKey (
 fail:
   BN_free (BnX);
   BN_free (BnY);
-  EC_POINT_free(Point);
+  EC_POINT_free (Point);
   EC_KEY_free (PeerEcKey);
   return RetVal;
 }
diff --git a/CryptoPkg/Private/Protocol/Crypto.h b/CryptoPkg/Private/Protocol/Crypto.h
index 84d9fbba32..a91f97b0c0 100644
--- a/CryptoPkg/Private/Protocol/Crypto.h
+++ b/CryptoPkg/Private/Protocol/Crypto.h
@@ -4302,216 +4302,216 @@ BOOLEAN
 ///
 struct _EDKII_CRYPTO_PROTOCOL {
   /// Version
-  EDKII_CRYPTO_GET_VERSION                           GetVersion;
+  EDKII_CRYPTO_GET_VERSION                            GetVersion;
   /// HMAC MD5 - deprecated and unsupported
-  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_NEW               DeprecatedHmacMd5New;
-  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FREE              DeprecatedHmacMd5Free;
-  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_SET_KEY           DeprecatedHmacMd5SetKey;
-  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_DUPLICATE         DeprecatedHmacMd5Duplicate;
-  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_UPDATE            DeprecatedHmacMd5Update;
-  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FINAL             DeprecatedHmacMd5Final;
+  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_NEW                DeprecatedHmacMd5New;
+  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FREE               DeprecatedHmacMd5Free;
+  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_SET_KEY            DeprecatedHmacMd5SetKey;
+  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_DUPLICATE          DeprecatedHmacMd5Duplicate;
+  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_UPDATE             DeprecatedHmacMd5Update;
+  DEPRECATED_EDKII_CRYPTO_HMAC_MD5_FINAL              DeprecatedHmacMd5Final;
   /// HMAC SHA1 - deprecated and unsupported
-  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_NEW              DeprecatedHmacSha1New;
-  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FREE             DeprecatedHmacSha1Free;
-  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_SET_KEY          DeprecatedHmacSha1SetKey;
-  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_DUPLICATE        DeprecatedHmacSha1Duplicate;
-  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_UPDATE           DeprecatedHmacSha1Update;
-  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FINAL            DeprecatedHmacSha1Final;
+  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_NEW               DeprecatedHmacSha1New;
+  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FREE              DeprecatedHmacSha1Free;
+  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_SET_KEY           DeprecatedHmacSha1SetKey;
+  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_DUPLICATE         DeprecatedHmacSha1Duplicate;
+  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_UPDATE            DeprecatedHmacSha1Update;
+  DEPRECATED_EDKII_CRYPTO_HMAC_SHA1_FINAL             DeprecatedHmacSha1Final;
   /// HMAC SHA256
-  EDKII_CRYPTO_HMAC_SHA256_NEW                       HmacSha256New;
-  EDKII_CRYPTO_HMAC_SHA256_FREE                      HmacSha256Free;
-  EDKII_CRYPTO_HMAC_SHA256_SET_KEY                   HmacSha256SetKey;
-  EDKII_CRYPTO_HMAC_SHA256_DUPLICATE                 HmacSha256Duplicate;
-  EDKII_CRYPTO_HMAC_SHA256_UPDATE                    HmacSha256Update;
-  EDKII_CRYPTO_HMAC_SHA256_FINAL                     HmacSha256Final;
+  EDKII_CRYPTO_HMAC_SHA256_NEW                        HmacSha256New;
+  EDKII_CRYPTO_HMAC_SHA256_FREE                       HmacSha256Free;
+  EDKII_CRYPTO_HMAC_SHA256_SET_KEY                    HmacSha256SetKey;
+  EDKII_CRYPTO_HMAC_SHA256_DUPLICATE                  HmacSha256Duplicate;
+  EDKII_CRYPTO_HMAC_SHA256_UPDATE                     HmacSha256Update;
+  EDKII_CRYPTO_HMAC_SHA256_FINAL                      HmacSha256Final;
   /// Md4 - deprecated and unsupported
-  DEPRECATED_EDKII_CRYPTO_MD4_GET_CONTEXT_SIZE       DeprecatedMd4GetContextSize;
-  DEPRECATED_EDKII_CRYPTO_MD4_INIT                   DeprecatedMd4Init;
-  DEPRECATED_EDKII_CRYPTO_MD4_DUPLICATE              DeprecatedMd4Duplicate;
-  DEPRECATED_EDKII_CRYPTO_MD4_UPDATE                 DeprecatedMd4Update;
-  DEPRECATED_EDKII_CRYPTO_MD4_FINAL                  DeprecatedMd4Final;
-  DEPRECATED_EDKII_CRYPTO_MD4_HASH_ALL               DeprecatedMd4HashAll;
+  DEPRECATED_EDKII_CRYPTO_MD4_GET_CONTEXT_SIZE        DeprecatedMd4GetContextSize;
+  DEPRECATED_EDKII_CRYPTO_MD4_INIT                    DeprecatedMd4Init;
+  DEPRECATED_EDKII_CRYPTO_MD4_DUPLICATE               DeprecatedMd4Duplicate;
+  DEPRECATED_EDKII_CRYPTO_MD4_UPDATE                  DeprecatedMd4Update;
+  DEPRECATED_EDKII_CRYPTO_MD4_FINAL                   DeprecatedMd4Final;
+  DEPRECATED_EDKII_CRYPTO_MD4_HASH_ALL                DeprecatedMd4HashAll;
   /// Md5
-  EDKII_CRYPTO_MD5_GET_CONTEXT_SIZE                  Md5GetContextSize;
-  EDKII_CRYPTO_MD5_INIT                              Md5Init;
-  EDKII_CRYPTO_MD5_DUPLICATE                         Md5Duplicate;
-  EDKII_CRYPTO_MD5_UPDATE                            Md5Update;
-  EDKII_CRYPTO_MD5_FINAL                             Md5Final;
-  EDKII_CRYPTO_MD5_HASH_ALL                          Md5HashAll;
+  EDKII_CRYPTO_MD5_GET_CONTEXT_SIZE                   Md5GetContextSize;
+  EDKII_CRYPTO_MD5_INIT                               Md5Init;
+  EDKII_CRYPTO_MD5_DUPLICATE                          Md5Duplicate;
+  EDKII_CRYPTO_MD5_UPDATE                             Md5Update;
+  EDKII_CRYPTO_MD5_FINAL                              Md5Final;
+  EDKII_CRYPTO_MD5_HASH_ALL                           Md5HashAll;
   /// Pkcs
-  EDKII_CRYPTO_PKCS1_ENCRYPT_V2                      Pkcs1v2Encrypt;
-  EDKII_CRYPTO_PKCS5_PW_HASH                         Pkcs5HashPassword;
-  EDKII_CRYPTO_PKCS7_VERIFY                          Pkcs7Verify;
-  EDKII_CRYPTO_PKCS7_VERIFY_EKU                      VerifyEKUsInPkcs7Signature;
-  EDKII_CRYPTO_PKCS7_GET_SIGNERS                     Pkcs7GetSigners;
-  EDKII_CRYPTO_PKCS7_FREE_SIGNERS                    Pkcs7FreeSigners;
-  EDKII_CRYPTO_PKCS7_SIGN                            Pkcs7Sign;
-  EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT            Pkcs7GetAttachedContent;
-  EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LIST           Pkcs7GetCertificatesList;
-  EDKII_CRYPTO_AUTHENTICODE_VERIFY                   AuthenticodeVerify;
-  EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY                ImageTimestampVerify;
+  EDKII_CRYPTO_PKCS1_ENCRYPT_V2                       Pkcs1v2Encrypt;
+  EDKII_CRYPTO_PKCS5_PW_HASH                          Pkcs5HashPassword;
+  EDKII_CRYPTO_PKCS7_VERIFY                           Pkcs7Verify;
+  EDKII_CRYPTO_PKCS7_VERIFY_EKU                       VerifyEKUsInPkcs7Signature;
+  EDKII_CRYPTO_PKCS7_GET_SIGNERS                      Pkcs7GetSigners;
+  EDKII_CRYPTO_PKCS7_FREE_SIGNERS                     Pkcs7FreeSigners;
+  EDKII_CRYPTO_PKCS7_SIGN                             Pkcs7Sign;
+  EDKII_CRYPTO_PKCS7_GET_ATTACHED_CONTENT             Pkcs7GetAttachedContent;
+  EDKII_CRYPTO_PKCS7_GET_CERTIFICATES_LIST            Pkcs7GetCertificatesList;
+  EDKII_CRYPTO_AUTHENTICODE_VERIFY                    AuthenticodeVerify;
+  EDKII_CRYPTO_IMAGE_TIMESTAMP_VERIFY                 ImageTimestampVerify;
   /// DH
-  EDKII_CRYPTO_DH_NEW                                DhNew;
-  EDKII_CRYPTO_DH_FREE                               DhFree;
-  EDKII_CRYPTO_DH_GENERATE_PARAMETER                 DhGenerateParameter;
-  EDKII_CRYPTO_DH_SET_PARAMETER                      DhSetParameter;
-  EDKII_CRYPTO_DH_GENERATE_KEY                       DhGenerateKey;
-  EDKII_CRYPTO_DH_COMPUTE_KEY                        DhComputeKey;
+  EDKII_CRYPTO_DH_NEW                                 DhNew;
+  EDKII_CRYPTO_DH_FREE                                DhFree;
+  EDKII_CRYPTO_DH_GENERATE_PARAMETER                  DhGenerateParameter;
+  EDKII_CRYPTO_DH_SET_PARAMETER                       DhSetParameter;
+  EDKII_CRYPTO_DH_GENERATE_KEY                        DhGenerateKey;
+  EDKII_CRYPTO_DH_COMPUTE_KEY                         DhComputeKey;
   /// Random
-  EDKII_CRYPTO_RANDOM_SEED                           RandomSeed;
-  EDKII_CRYPTO_RANDOM_BYTES                          RandomBytes;
+  EDKII_CRYPTO_RANDOM_SEED                            RandomSeed;
+  EDKII_CRYPTO_RANDOM_BYTES                           RandomBytes;
   /// RSA
-  EDKII_CRYPTO_RSA_VERIFY_PKCS1                      RsaVerifyPkcs1;
-  EDKII_CRYPTO_RSA_NEW                               RsaNew;
-  EDKII_CRYPTO_RSA_FREE                              RsaFree;
-  EDKII_CRYPTO_RSA_SET_KEY                           RsaSetKey;
-  EDKII_CRYPTO_RSA_GET_KEY                           RsaGetKey;
-  EDKII_CRYPTO_RSA_GENERATE_KEY                      RsaGenerateKey;
-  EDKII_CRYPTO_RSA_CHECK_KEY                         RsaCheckKey;
-  EDKII_CRYPTO_RSA_PKCS1_SIGN                        RsaPkcs1Sign;
-  EDKII_CRYPTO_RSA_PKCS1_VERIFY                      RsaPkcs1Verify;
-  EDKII_CRYPTO_RSA_GET_PRIVATE_KEY_FROM_PEM          RsaGetPrivateKeyFromPem;
-  EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509          RsaGetPublicKeyFromX509;
+  EDKII_CRYPTO_RSA_VERIFY_PKCS1                       RsaVerifyPkcs1;
+  EDKII_CRYPTO_RSA_NEW                                RsaNew;
+  EDKII_CRYPTO_RSA_FREE                               RsaFree;
+  EDKII_CRYPTO_RSA_SET_KEY                            RsaSetKey;
+  EDKII_CRYPTO_RSA_GET_KEY                            RsaGetKey;
+  EDKII_CRYPTO_RSA_GENERATE_KEY                       RsaGenerateKey;
+  EDKII_CRYPTO_RSA_CHECK_KEY                          RsaCheckKey;
+  EDKII_CRYPTO_RSA_PKCS1_SIGN                         RsaPkcs1Sign;
+  EDKII_CRYPTO_RSA_PKCS1_VERIFY                       RsaPkcs1Verify;
+  EDKII_CRYPTO_RSA_GET_PRIVATE_KEY_FROM_PEM           RsaGetPrivateKeyFromPem;
+  EDKII_CRYPTO_RSA_GET_PUBLIC_KEY_FROM_X509           RsaGetPublicKeyFromX509;
   /// Sha1
-  EDKII_CRYPTO_SHA1_GET_CONTEXT_SIZE                 Sha1GetContextSize;
-  EDKII_CRYPTO_SHA1_INIT                             Sha1Init;
-  EDKII_CRYPTO_SHA1_DUPLICATE                        Sha1Duplicate;
-  EDKII_CRYPTO_SHA1_UPDATE                           Sha1Update;
-  EDKII_CRYPTO_SHA1_FINAL                            Sha1Final;
-  EDKII_CRYPTO_SHA1_HASH_ALL                         Sha1HashAll;
+  EDKII_CRYPTO_SHA1_GET_CONTEXT_SIZE                  Sha1GetContextSize;
+  EDKII_CRYPTO_SHA1_INIT                              Sha1Init;
+  EDKII_CRYPTO_SHA1_DUPLICATE                         Sha1Duplicate;
+  EDKII_CRYPTO_SHA1_UPDATE                            Sha1Update;
+  EDKII_CRYPTO_SHA1_FINAL                             Sha1Final;
+  EDKII_CRYPTO_SHA1_HASH_ALL                          Sha1HashAll;
   /// Sha256
-  EDKII_CRYPTO_SHA256_GET_CONTEXT_SIZE               Sha256GetContextSize;
-  EDKII_CRYPTO_SHA256_INIT                           Sha256Init;
-  EDKII_CRYPTO_SHA256_DUPLICATE                      Sha256Duplicate;
-  EDKII_CRYPTO_SHA256_UPDATE                         Sha256Update;
-  EDKII_CRYPTO_SHA256_FINAL                          Sha256Final;
-  EDKII_CRYPTO_SHA256_HASH_ALL                       Sha256HashAll;
+  EDKII_CRYPTO_SHA256_GET_CONTEXT_SIZE                Sha256GetContextSize;
+  EDKII_CRYPTO_SHA256_INIT                            Sha256Init;
+  EDKII_CRYPTO_SHA256_DUPLICATE                       Sha256Duplicate;
+  EDKII_CRYPTO_SHA256_UPDATE                          Sha256Update;
+  EDKII_CRYPTO_SHA256_FINAL                           Sha256Final;
+  EDKII_CRYPTO_SHA256_HASH_ALL                        Sha256HashAll;
   /// Sha384
-  EDKII_CRYPTO_SHA384_GET_CONTEXT_SIZE               Sha384GetContextSize;
-  EDKII_CRYPTO_SHA384_INIT                           Sha384Init;
-  EDKII_CRYPTO_SHA384_DUPLICATE                      Sha384Duplicate;
-  EDKII_CRYPTO_SHA384_UPDATE                         Sha384Update;
-  EDKII_CRYPTO_SHA384_FINAL                          Sha384Final;
-  EDKII_CRYPTO_SHA384_HASH_ALL                       Sha384HashAll;
+  EDKII_CRYPTO_SHA384_GET_CONTEXT_SIZE                Sha384GetContextSize;
+  EDKII_CRYPTO_SHA384_INIT                            Sha384Init;
+  EDKII_CRYPTO_SHA384_DUPLICATE                       Sha384Duplicate;
+  EDKII_CRYPTO_SHA384_UPDATE                          Sha384Update;
+  EDKII_CRYPTO_SHA384_FINAL                           Sha384Final;
+  EDKII_CRYPTO_SHA384_HASH_ALL                        Sha384HashAll;
   /// Sha512
-  EDKII_CRYPTO_SHA512_GET_CONTEXT_SIZE               Sha512GetContextSize;
-  EDKII_CRYPTO_SHA512_INIT                           Sha512Init;
-  EDKII_CRYPTO_SHA512_DUPLICATE                      Sha512Duplicate;
-  EDKII_CRYPTO_SHA512_UPDATE                         Sha512Update;
-  EDKII_CRYPTO_SHA512_FINAL                          Sha512Final;
-  EDKII_CRYPTO_SHA512_HASH_ALL                       Sha512HashAll;
+  EDKII_CRYPTO_SHA512_GET_CONTEXT_SIZE                Sha512GetContextSize;
+  EDKII_CRYPTO_SHA512_INIT                            Sha512Init;
+  EDKII_CRYPTO_SHA512_DUPLICATE                       Sha512Duplicate;
+  EDKII_CRYPTO_SHA512_UPDATE                          Sha512Update;
+  EDKII_CRYPTO_SHA512_FINAL                           Sha512Final;
+  EDKII_CRYPTO_SHA512_HASH_ALL                        Sha512HashAll;
   /// X509
-  EDKII_CRYPTO_X509_GET_SUBJECT_NAME                 X509GetSubjectName;
-  EDKII_CRYPTO_X509_GET_COMMON_NAME                  X509GetCommonName;
-  EDKII_CRYPTO_X509_GET_ORGANIZATION_NAME            X509GetOrganizationName;
-  EDKII_CRYPTO_X509_VERIFY_CERT                      X509VerifyCert;
-  EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE            X509ConstructCertificate;
-  EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK      X509ConstructCertificateStack;
-  EDKII_CRYPTO_X509_FREE                             X509Free;
-  EDKII_CRYPTO_X509_STACK_FREE                       X509StackFree;
-  EDKII_CRYPTO_X509_GET_TBS_CERT                     X509GetTBSCert;
+  EDKII_CRYPTO_X509_GET_SUBJECT_NAME                  X509GetSubjectName;
+  EDKII_CRYPTO_X509_GET_COMMON_NAME                   X509GetCommonName;
+  EDKII_CRYPTO_X509_GET_ORGANIZATION_NAME             X509GetOrganizationName;
+  EDKII_CRYPTO_X509_VERIFY_CERT                       X509VerifyCert;
+  EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE             X509ConstructCertificate;
+  EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK       X509ConstructCertificateStack;
+  EDKII_CRYPTO_X509_FREE                              X509Free;
+  EDKII_CRYPTO_X509_STACK_FREE                        X509StackFree;
+  EDKII_CRYPTO_X509_GET_TBS_CERT                      X509GetTBSCert;
   /// TDES - deprecated and unsupported
-  DEPRECATED_EDKII_CRYPTO_TDES_GET_CONTEXT_SIZE      DeprecatedTdesGetContextSize;
-  DEPRECATED_EDKII_CRYPTO_TDES_INIT                  DeprecatedTdesInit;
-  DEPRECATED_EDKII_CRYPTO_TDES_ECB_ENCRYPT           DeprecatedTdesEcbEncrypt;
-  DEPRECATED_EDKII_CRYPTO_TDES_ECB_DECRYPT           DeprecatedTdesEcbDecrypt;
-  DEPRECATED_EDKII_CRYPTO_TDES_CBC_ENCRYPT           DeprecatedTdesCbcEncrypt;
-  DEPRECATED_EDKII_CRYPTO_TDES_CBC_DECRYPT           DeprecatedTdesCbcDecrypt;
+  DEPRECATED_EDKII_CRYPTO_TDES_GET_CONTEXT_SIZE       DeprecatedTdesGetContextSize;
+  DEPRECATED_EDKII_CRYPTO_TDES_INIT                   DeprecatedTdesInit;
+  DEPRECATED_EDKII_CRYPTO_TDES_ECB_ENCRYPT            DeprecatedTdesEcbEncrypt;
+  DEPRECATED_EDKII_CRYPTO_TDES_ECB_DECRYPT            DeprecatedTdesEcbDecrypt;
+  DEPRECATED_EDKII_CRYPTO_TDES_CBC_ENCRYPT            DeprecatedTdesCbcEncrypt;
+  DEPRECATED_EDKII_CRYPTO_TDES_CBC_DECRYPT            DeprecatedTdesCbcDecrypt;
   /// AES - ECB Mode is deprecated and unsupported
-  EDKII_CRYPTO_AES_GET_CONTEXT_SIZE                  AesGetContextSize;
-  EDKII_CRYPTO_AES_INIT                              AesInit;
-  DEPRECATED_EDKII_CRYPTO_AES_ECB_ENCRYPT            DeprecatedAesEcbEncrypt;
-  DEPRECATED_EDKII_CRYPTO_AES_ECB_DECRYPT            DeprecatedAesEcbDecrypt;
-  EDKII_CRYPTO_AES_CBC_ENCRYPT                       AesCbcEncrypt;
-  EDKII_CRYPTO_AES_CBC_DECRYPT                       AesCbcDecrypt;
+  EDKII_CRYPTO_AES_GET_CONTEXT_SIZE                   AesGetContextSize;
+  EDKII_CRYPTO_AES_INIT                               AesInit;
+  DEPRECATED_EDKII_CRYPTO_AES_ECB_ENCRYPT             DeprecatedAesEcbEncrypt;
+  DEPRECATED_EDKII_CRYPTO_AES_ECB_DECRYPT             DeprecatedAesEcbDecrypt;
+  EDKII_CRYPTO_AES_CBC_ENCRYPT                        AesCbcEncrypt;
+  EDKII_CRYPTO_AES_CBC_DECRYPT                        AesCbcDecrypt;
   /// Arc4 - deprecated and unsupported
-  DEPRECATED_EDKII_CRYPTO_ARC4_GET_CONTEXT_SIZE      DeprecatedArc4GetContextSize;
-  DEPRECATED_EDKII_CRYPTO_ARC4_INIT                  DeprecatedArc4Init;
-  DEPRECATED_EDKII_CRYPTO_ARC4_ENCRYPT               DeprecatedArc4Encrypt;
-  DEPRECATED_EDKII_CRYPTO_ARC4_DECRYPT               DeprecatedArc4Decrypt;
-  DEPRECATED_EDKII_CRYPTO_ARC4_RESET                 DeprecatedArc4Reset;
+  DEPRECATED_EDKII_CRYPTO_ARC4_GET_CONTEXT_SIZE       DeprecatedArc4GetContextSize;
+  DEPRECATED_EDKII_CRYPTO_ARC4_INIT                   DeprecatedArc4Init;
+  DEPRECATED_EDKII_CRYPTO_ARC4_ENCRYPT                DeprecatedArc4Encrypt;
+  DEPRECATED_EDKII_CRYPTO_ARC4_DECRYPT                DeprecatedArc4Decrypt;
+  DEPRECATED_EDKII_CRYPTO_ARC4_RESET                  DeprecatedArc4Reset;
   /// SM3
-  EDKII_CRYPTO_SM3_GET_CONTEXT_SIZE                  Sm3GetContextSize;
-  EDKII_CRYPTO_SM3_INIT                              Sm3Init;
-  EDKII_CRYPTO_SM3_DUPLICATE                         Sm3Duplicate;
-  EDKII_CRYPTO_SM3_UPDATE                            Sm3Update;
-  EDKII_CRYPTO_SM3_FINAL                             Sm3Final;
-  EDKII_CRYPTO_SM3_HASH_ALL                          Sm3HashAll;
+  EDKII_CRYPTO_SM3_GET_CONTEXT_SIZE                   Sm3GetContextSize;
+  EDKII_CRYPTO_SM3_INIT                               Sm3Init;
+  EDKII_CRYPTO_SM3_DUPLICATE                          Sm3Duplicate;
+  EDKII_CRYPTO_SM3_UPDATE                             Sm3Update;
+  EDKII_CRYPTO_SM3_FINAL                              Sm3Final;
+  EDKII_CRYPTO_SM3_HASH_ALL                           Sm3HashAll;
   /// HKDF
-  EDKII_CRYPTO_HKDF_SHA_256_EXTRACT_AND_EXPAND       HkdfSha256ExtractAndExpand;
+  EDKII_CRYPTO_HKDF_SHA_256_EXTRACT_AND_EXPAND        HkdfSha256ExtractAndExpand;
   /// X509 (Continued)
-  EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK_V    X509ConstructCertificateStackV;
+  EDKII_CRYPTO_X509_CONSTRUCT_CERTIFICATE_STACK_V     X509ConstructCertificateStackV;
   /// TLS
-  EDKII_CRYPTO_TLS_INITIALIZE                        TlsInitialize;
-  EDKII_CRYPTO_TLS_CTX_FREE                          TlsCtxFree;
-  EDKII_CRYPTO_TLS_CTX_NEW                           TlsCtxNew;
-  EDKII_CRYPTO_TLS_FREE                              TlsFree;
-  EDKII_CRYPTO_TLS_NEW                               TlsNew;
-  EDKII_CRYPTO_TLS_IN_HANDSHAKE                      TlsInHandshake;
-  EDKII_CRYPTO_TLS_DO_HANDSHAKE                      TlsDoHandshake;
-  EDKII_CRYPTO_TLS_HANDLE_ALERT                      TlsHandleAlert;
-  EDKII_CRYPTO_TLS_CLOSE_NOTIFY                      TlsCloseNotify;
-  EDKII_CRYPTO_TLS_CTRL_TRAFFIC_OUT                  TlsCtrlTrafficOut;
-  EDKII_CRYPTO_TLS_CTRL_TRAFFIC_IN                   TlsCtrlTrafficIn;
-  EDKII_CRYPTO_TLS_READ                              TlsRead;
-  EDKII_CRYPTO_TLS_WRITE                             TlsWrite;
+  EDKII_CRYPTO_TLS_INITIALIZE                         TlsInitialize;
+  EDKII_CRYPTO_TLS_CTX_FREE                           TlsCtxFree;
+  EDKII_CRYPTO_TLS_CTX_NEW                            TlsCtxNew;
+  EDKII_CRYPTO_TLS_FREE                               TlsFree;
+  EDKII_CRYPTO_TLS_NEW                                TlsNew;
+  EDKII_CRYPTO_TLS_IN_HANDSHAKE                       TlsInHandshake;
+  EDKII_CRYPTO_TLS_DO_HANDSHAKE                       TlsDoHandshake;
+  EDKII_CRYPTO_TLS_HANDLE_ALERT                       TlsHandleAlert;
+  EDKII_CRYPTO_TLS_CLOSE_NOTIFY                       TlsCloseNotify;
+  EDKII_CRYPTO_TLS_CTRL_TRAFFIC_OUT                   TlsCtrlTrafficOut;
+  EDKII_CRYPTO_TLS_CTRL_TRAFFIC_IN                    TlsCtrlTrafficIn;
+  EDKII_CRYPTO_TLS_READ                               TlsRead;
+  EDKII_CRYPTO_TLS_WRITE                              TlsWrite;
   /// TLS Set
-  EDKII_CRYPTO_TLS_SET_VERSION                       TlsSetVersion;
-  EDKII_CRYPTO_TLS_SET_CONNECTION_END                TlsSetConnectionEnd;
-  EDKII_CRYPTO_TLS_SET_CIPHER_LIST                   TlsSetCipherList;
-  EDKII_CRYPTO_TLS_SET_COMPRESSION_METHOD            TlsSetCompressionMethod;
-  EDKII_CRYPTO_TLS_SET_VERIFY                        TlsSetVerify;
-  EDKII_CRYPTO_TLS_SET_VERIFY_HOST                   TlsSetVerifyHost;
-  EDKII_CRYPTO_TLS_SET_SESSIONID                     TlsSetSessionId;
-  EDKII_CRYPTO_TLS_SET_CA_CERTIFICATE                TlsSetCaCertificate;
-  EDKII_CRYPTO_TLS_SET_HOST_PUBLIC_CERT              TlsSetHostPublicCert;
-  EDKII_CRYPTO_TLS_SET_HOST_PRIVATE_KEY              TlsSetHostPrivateKey;
-  EDKII_CRYPTO_TLS_SET_CERT_REVOCATION_LIST          TlsSetCertRevocationList;
+  EDKII_CRYPTO_TLS_SET_VERSION                        TlsSetVersion;
+  EDKII_CRYPTO_TLS_SET_CONNECTION_END                 TlsSetConnectionEnd;
+  EDKII_CRYPTO_TLS_SET_CIPHER_LIST                    TlsSetCipherList;
+  EDKII_CRYPTO_TLS_SET_COMPRESSION_METHOD             TlsSetCompressionMethod;
+  EDKII_CRYPTO_TLS_SET_VERIFY                         TlsSetVerify;
+  EDKII_CRYPTO_TLS_SET_VERIFY_HOST                    TlsSetVerifyHost;
+  EDKII_CRYPTO_TLS_SET_SESSIONID                      TlsSetSessionId;
+  EDKII_CRYPTO_TLS_SET_CA_CERTIFICATE                 TlsSetCaCertificate;
+  EDKII_CRYPTO_TLS_SET_HOST_PUBLIC_CERT               TlsSetHostPublicCert;
+  EDKII_CRYPTO_TLS_SET_HOST_PRIVATE_KEY               TlsSetHostPrivateKey;
+  EDKII_CRYPTO_TLS_SET_CERT_REVOCATION_LIST           TlsSetCertRevocationList;
   /// TLS Get
-  EDKII_CRYPTO_TLS_GET_VERSION                       TlsGetVersion;
-  EDKII_CRYPTO_TLS_GET_CONNECTION_END                TlsGetConnectionEnd;
-  EDKII_CRYPTO_TLS_GET_CURRENT_CIPHER                TlsGetCurrentCipher;
-  EDKII_CRYPTO_TLS_GET_CURRENT_COMPRESSION_ID        TlsGetCurrentCompressionId;
-  EDKII_CRYPTO_TLS_GET_VERIFY                        TlsGetVerify;
-  EDKII_CRYPTO_TLS_GET_SESSION_ID                    TlsGetSessionId;
-  EDKII_CRYPTO_TLS_GET_CLIENT_RANDOM                 TlsGetClientRandom;
-  EDKII_CRYPTO_TLS_GET_SERVER_RANDOM                 TlsGetServerRandom;
-  EDKII_CRYPTO_TLS_GET_KEY_MATERIAL                  TlsGetKeyMaterial;
-  EDKII_CRYPTO_TLS_GET_CA_CERTIFICATE                TlsGetCaCertificate;
-  EDKII_CRYPTO_TLS_GET_HOST_PUBLIC_CERT              TlsGetHostPublicCert;
-  EDKII_CRYPTO_TLS_GET_HOST_PRIVATE_KEY              TlsGetHostPrivateKey;
-  EDKII_CRYPTO_TLS_GET_CERT_REVOCATION_LIST          TlsGetCertRevocationList;
+  EDKII_CRYPTO_TLS_GET_VERSION                        TlsGetVersion;
+  EDKII_CRYPTO_TLS_GET_CONNECTION_END                 TlsGetConnectionEnd;
+  EDKII_CRYPTO_TLS_GET_CURRENT_CIPHER                 TlsGetCurrentCipher;
+  EDKII_CRYPTO_TLS_GET_CURRENT_COMPRESSION_ID         TlsGetCurrentCompressionId;
+  EDKII_CRYPTO_TLS_GET_VERIFY                         TlsGetVerify;
+  EDKII_CRYPTO_TLS_GET_SESSION_ID                     TlsGetSessionId;
+  EDKII_CRYPTO_TLS_GET_CLIENT_RANDOM                  TlsGetClientRandom;
+  EDKII_CRYPTO_TLS_GET_SERVER_RANDOM                  TlsGetServerRandom;
+  EDKII_CRYPTO_TLS_GET_KEY_MATERIAL                   TlsGetKeyMaterial;
+  EDKII_CRYPTO_TLS_GET_CA_CERTIFICATE                 TlsGetCaCertificate;
+  EDKII_CRYPTO_TLS_GET_HOST_PUBLIC_CERT               TlsGetHostPublicCert;
+  EDKII_CRYPTO_TLS_GET_HOST_PRIVATE_KEY               TlsGetHostPrivateKey;
+  EDKII_CRYPTO_TLS_GET_CERT_REVOCATION_LIST           TlsGetCertRevocationList;
   /// RSA PSS
-  EDKII_CRYPTO_RSA_PSS_SIGN                          RsaPssSign;
-  EDKII_CRYPTO_RSA_PSS_VERIFY                        RsaPssVerify;
+  EDKII_CRYPTO_RSA_PSS_SIGN                           RsaPssSign;
+  EDKII_CRYPTO_RSA_PSS_VERIFY                         RsaPssVerify;
   /// Parallel hash
-  EDKII_CRYPTO_PARALLEL_HASH_ALL                     ParallelHash256HashAll;
+  EDKII_CRYPTO_PARALLEL_HASH_ALL                      ParallelHash256HashAll;
   /// Big Number
-  EDKII_CRYPTO_BIGNUM_INIT                           BigNumInit;
-  EDKII_CRYPTO_BIGNUM_FROM_BIN                       BigNumFromBin;
-  EDKII_CRYPTO_BIGNUM_TO_BIN                         BigNumToBin;
-  EDKII_CRYPTO_BIGNUM_FREE                           BigNumFree;
-  EDKII_CRYPTO_BIGNUM_ADD                            BigNumAdd;
-  EDKII_CRYPTO_BIGNUM_SUB                            BigNumSub;
-  EDKII_CRYPTO_BIGNUM_MOD                            BigNumMod;
-  EDKII_CRYPTO_BIGNUM_EXP_MOD                        BigNumExpMod;
-  EDKII_CRYPTO_BIGNUM_INVERSE_MOD                    BigNumInverseMod;
-  EDKII_CRYPTO_BIGNUM_DIV                            BigNumDiv;
-  EDKII_CRYPTO_BIGNUM_MUL_MOD                        BigNumMulMod;
-  EDKII_CRYPTO_BIGNUM_CMP                            BigNumCmp;
-  EDKII_CRYPTO_BIGNUM_BITS                           BigNumBits;
-  EDKII_CRYPTO_BIGNUM_BYTES                          BigNumBytes;
-  EDKII_CRYPTO_BIGNUM_IS_WORD                        BigNumIsWord;
-  EDKII_CRYPTO_BIGNUM_IS_ODD                         BigNumIsOdd;
-  EDKII_CRYPTO_BIGNUM_COPY                           BigNumCopy;
-  EDKII_CRYPTO_BIGNUM_VALUE_ONE                      BigNumValueOne;
-  EDKII_CRYPTO_BIGNUM_R_SHIFT                        BigNumRShift;
-  EDKII_CRYPTO_BIGNUM_CONST_TIME                     BigNumConstTime;
-  EDKII_CRYPTO_BIGNUM_SQR_MOD                        BigNumSqrMod;
-  EDKII_CRYPTO_BIGNUM_NEW_CONTEXT                    BigNumNewContext;
-  EDKII_CRYPTO_BIGNUM_CONTEXT_FREE                   BigNumContextFree;
-  EDKII_CRYPTO_BIGNUM_SET_UINT                       BigNumSetUint;
-  EDKII_CRYPTO_BIGNUM_ADD_MOD                        BigNumAddMod;
+  EDKII_CRYPTO_BIGNUM_INIT                            BigNumInit;
+  EDKII_CRYPTO_BIGNUM_FROM_BIN                        BigNumFromBin;
+  EDKII_CRYPTO_BIGNUM_TO_BIN                          BigNumToBin;
+  EDKII_CRYPTO_BIGNUM_FREE                            BigNumFree;
+  EDKII_CRYPTO_BIGNUM_ADD                             BigNumAdd;
+  EDKII_CRYPTO_BIGNUM_SUB                             BigNumSub;
+  EDKII_CRYPTO_BIGNUM_MOD                             BigNumMod;
+  EDKII_CRYPTO_BIGNUM_EXP_MOD                         BigNumExpMod;
+  EDKII_CRYPTO_BIGNUM_INVERSE_MOD                     BigNumInverseMod;
+  EDKII_CRYPTO_BIGNUM_DIV                             BigNumDiv;
+  EDKII_CRYPTO_BIGNUM_MUL_MOD                         BigNumMulMod;
+  EDKII_CRYPTO_BIGNUM_CMP                             BigNumCmp;
+  EDKII_CRYPTO_BIGNUM_BITS                            BigNumBits;
+  EDKII_CRYPTO_BIGNUM_BYTES                           BigNumBytes;
+  EDKII_CRYPTO_BIGNUM_IS_WORD                         BigNumIsWord;
+  EDKII_CRYPTO_BIGNUM_IS_ODD                          BigNumIsOdd;
+  EDKII_CRYPTO_BIGNUM_COPY                            BigNumCopy;
+  EDKII_CRYPTO_BIGNUM_VALUE_ONE                       BigNumValueOne;
+  EDKII_CRYPTO_BIGNUM_R_SHIFT                         BigNumRShift;
+  EDKII_CRYPTO_BIGNUM_CONST_TIME                      BigNumConstTime;
+  EDKII_CRYPTO_BIGNUM_SQR_MOD                         BigNumSqrMod;
+  EDKII_CRYPTO_BIGNUM_NEW_CONTEXT                     BigNumNewContext;
+  EDKII_CRYPTO_BIGNUM_CONTEXT_FREE                    BigNumContextFree;
+  EDKII_CRYPTO_BIGNUM_SET_UINT                        BigNumSetUint;
+  EDKII_CRYPTO_BIGNUM_ADD_MOD                         BigNumAddMod;
   /// EC
   EDKII_CRYPTO_EC_GROUP_INIT                          EcGroupInit;
   EDKII_CRYPTO_EC_GROUP_GET_CURVE                     EcGroupGetCurve;
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BnTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BnTests.c
index df91752c9c..2636bb6318 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BnTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/BnTests.c
@@ -11,9 +11,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 // Debug data
 //
-#define MAX_TEST_DATA_SIZE  512
+#define MAX_TEST_DATA_SIZE    512
 #define BYTES_OF_OPERATION_A  60
-#define BITS_OF_OPERATION_A  480 //(8 * 60)
+#define BITS_OF_OPERATION_A   480// (8 * 60)
 
 GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8  BnOperationA[] = {
   0x00, 0x00, 0x00, 0x00, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
@@ -88,23 +88,23 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8  BnResultExpMod[] =  {
 
 // BnOperationA >> 128
 GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8  BnResultRShift[] =  {
-                          0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
-  0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
-  0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd
+  0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
+  0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6,0x4b,  0x55, 0xd3, 0x9a,
+  0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23,0xa3,  0xfe, 0xeb, 0xbd
 };
 
 // 0x12345678
-GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8  BnResultUIntSet[] =  {0x12, 0x34, 0x56, 0x78};
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8  BnResultUIntSet[] =  { 0x12, 0x34, 0x56, 0x78 };
 
 typedef struct {
-  VOID *BnA;
-  VOID *BnB;
-  VOID *BnC;
-  VOID *BnD;
-  VOID *BnCTX;
+  VOID    *BnA;
+  VOID    *BnB;
+  VOID    *BnC;
+  VOID    *BnD;
+  VOID    *BnCTX;
 } BN_TEST_CONTEXT;
 
-GLOBAL_REMOVE_IF_UNREFERENCED STATIC BN_TEST_CONTEXT mBnContext = {NULL, NULL, NULL, NULL, NULL};
+GLOBAL_REMOVE_IF_UNREFERENCED STATIC BN_TEST_CONTEXT  mBnContext = { NULL, NULL, NULL, NULL, NULL };
 
 //
 // Debug function
@@ -112,18 +112,23 @@ GLOBAL_REMOVE_IF_UNREFERENCED STATIC BN_TEST_CONTEXT mBnContext = {NULL, NULL, N
 STATIC
 BOOLEAN
 EqualBn2Bn (
-  CONST VOID *Expected, CONST VOID *Actual
+  CONST VOID  *Expected,
+  CONST VOID  *Actual
   )
 {
-    if (BigNumCmp(Expected, Actual) == 0)
-        return TRUE;
-    return FALSE;
+  if (BigNumCmp (Expected, Actual) == 0) {
+    return TRUE;
+  }
+
+  return FALSE;
 }
 
 STATIC
 BOOLEAN
 EqualBn2Bin (
-  CONST VOID *Bn, CONST UINT8 *Buffer, CONST UINTN BufferSize
+  CONST VOID   *Bn,
+  CONST UINT8  *Buffer,
+  CONST UINTN  BufferSize
   )
 {
   UINTN  BnTestBufferSize;
@@ -135,6 +140,7 @@ EqualBn2Bin (
       return TRUE;
     }
   }
+
   return FALSE;
 }
 
@@ -144,22 +150,24 @@ TestVerifyBnPreReq (
   UNIT_TEST_CONTEXT  Context
   )
 {
-  BN_TEST_CONTEXT *BnContext;
-
-  BnContext = Context;
-  BnContext->BnCTX = BigNumNewContext();
-  BnContext->BnA = BigNumInit();
-  BnContext->BnB = BigNumInit();
-  BnContext->BnC = BigNumInit();
-  BnContext->BnD = BigNumInit();
-  if (BnContext->BnCTX == NULL
-        || BnContext->BnA == NULL
-        || BnContext->BnB == NULL
-        || BnContext->BnC == NULL
-        || BnContext->BnD == NULL
-        ) {
+  BN_TEST_CONTEXT  *BnContext;
+
+  BnContext        = Context;
+  BnContext->BnCTX = BigNumNewContext ();
+  BnContext->BnA   = BigNumInit ();
+  BnContext->BnB   = BigNumInit ();
+  BnContext->BnC   = BigNumInit ();
+  BnContext->BnD   = BigNumInit ();
+  if (  (BnContext->BnCTX == NULL)
+     || (BnContext->BnA == NULL)
+     || (BnContext->BnB == NULL)
+     || (BnContext->BnC == NULL)
+     || (BnContext->BnD == NULL)
+        )
+  {
     return UNIT_TEST_ERROR_TEST_FAILED;
   }
+
   return UNIT_TEST_PASSED;
 }
 
@@ -169,7 +177,7 @@ TestVerifyBnCleanUp (
   UNIT_TEST_CONTEXT  Context
   )
 {
-  BN_TEST_CONTEXT *BnContext;
+  BN_TEST_CONTEXT  *BnContext;
 
   BnContext = Context;
   BigNumContextFree (BnContext->BnCTX);
@@ -185,63 +193,64 @@ TestVerifyBn (
   IN UNIT_TEST_CONTEXT  Context
   )
 {
-  BN_TEST_CONTEXT *BnContext;
-  UINTN Num;
-  CONST VOID *BnOne;
+  BN_TEST_CONTEXT  *BnContext;
+  UINTN            Num;
+  CONST VOID       *BnOne;
 
   BnContext = Context;
 
   // Calculation tests
   BnContext->BnA = BigNumFromBin (BnOperationA, sizeof (BnOperationA));
   BnContext->BnB = BigNumFromBin (BnOperationB, sizeof (BnOperationB));
-  //C=A+B
+  // C=A+B
   BigNumAdd (BnContext->BnA, BnContext->BnB, BnContext->BnC);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultSum, sizeof (BnResultSum)));
-  //D=C-A=B
+  // D=C-A=B
   BigNumSub (BnContext->BnC, BnContext->BnA, BnContext->BnD);
   UT_ASSERT_TRUE (EqualBn2Bn (BnContext->BnB, BnContext->BnD));
-  //C=(A+B)%D
+  // C=(A+B)%D
   BnContext->BnD = BigNumFromBin (BnOperationMod, sizeof (BnOperationMod));
   BigNumAddMod (BnContext->BnA, BnContext->BnB, BnContext->BnD, BnContext->BnC);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultSumMod, sizeof (BnResultSumMod)));
-  //C=(A*B)%D
+  // C=(A*B)%D
   BigNumMulMod (BnContext->BnA, BnContext->BnB, BnContext->BnD, BnContext->BnC);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultMulMod, sizeof (BnResultMulMod)));
-  //C=A/D
+  // C=A/D
   BigNumDiv (BnContext->BnA, BnContext->BnD, BnContext->BnC);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultDiv, sizeof (BnResultDiv)));
-  //C=A%D
+  // C=A%D
   BigNumMod (BnContext->BnA, BnContext->BnD, BnContext->BnC);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultMod, sizeof (BnResultMod)));
-  //1=(A*C)%D
+  // 1=(A*C)%D
   BigNumInverseMod (BnContext->BnA, BnContext->BnD, BnContext->BnC);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultInverseMod, sizeof (BnResultInverseMod)));
-  //C=(A^B)%D
+  // C=(A^B)%D
   BnContext->BnB = BigNumFromBin (BnOperationExp, sizeof (BnOperationExp));
   BigNumExpMod (BnContext->BnA, BnContext->BnB, BnContext->BnD, BnContext->BnC);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultExpMod, sizeof (BnResultExpMod)));
-  //C=A>>128
+  // C=A>>128
   BigNumRShift (BnContext->BnA, 128, BnContext->BnC);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultRShift, sizeof (BnResultRShift)));
-  //C=0x12345678
+  // C=0x12345678
   BigNumSetUint (BnContext->BnC, 0x12345678);
   UT_ASSERT_TRUE (EqualBn2Bin (BnContext->BnC, BnResultUIntSet, sizeof (BnResultUIntSet)));
-  //Bn compare
+  // Bn compare
   UT_ASSERT_TRUE (BigNumIsWord (BnContext->BnC, 0x12345678));
   UT_ASSERT_FALSE (BigNumIsWord (BnContext->BnC, 0x12345600));
   UT_ASSERT_FALSE (BigNumIsOdd (BnContext->BnC));
   UT_ASSERT_TRUE (BigNumIsOdd (BnContext->BnA));
 
-  //Other tests
+  // Other tests
   BigNumConstTime (BnContext->BnA);
   Num = BigNumBytes (BnContext->BnA);
   UT_ASSERT_EQUAL (Num, BYTES_OF_OPERATION_A);
   Num = BigNumBits (BnContext->BnA);
   UT_ASSERT_EQUAL (Num, BITS_OF_OPERATION_A);
-  BnOne = BigNumValueOne();
+  BnOne = BigNumValueOne ();
   if (BnOne == NULL) {
     return UNIT_TEST_ERROR_TEST_FAILED;
   }
+
   UT_ASSERT_TRUE (BigNumIsWord (BnOne, 0x1));
 
   return UNIT_TEST_PASSED;
@@ -251,7 +260,7 @@ TEST_DESC  mBnTest[] = {
   //
   // -----Description----------------Class---------------------Function-----------Pre----------------Post---------Context
   //
-  { "TestVerifyBn()",   "CryptoPkg.BaseCryptLib.BigNumber", TestVerifyBn, TestVerifyBnPreReq, TestVerifyBnCleanUp, &mBnContext   },
+  { "TestVerifyBn()", "CryptoPkg.BaseCryptLib.BigNumber", TestVerifyBn, TestVerifyBnPreReq, TestVerifyBnCleanUp, &mBnContext },
 };
 
-UINTN  mBnTestNum = ARRAY_SIZE(mBnTest);
+UINTN  mBnTestNum = ARRAY_SIZE (mBnTest);
diff --git a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/EcTests.c b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/EcTests.c
index 8008b1dc78..54ce0b22df 100644
--- a/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/EcTests.c
+++ b/CryptoPkg/Test/UnitTest/Library/BaseCryptLib/EcTests.c
@@ -8,19 +8,19 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 #include "TestBaseCryptLib.h"
 
-#define EC_CURVE_NUM_SUPPORTED 3
-UINTN  EcCurveList[EC_CURVE_NUM_SUPPORTED] = {CRYPTO_NID_SECP256R1, CRYPTO_NID_SECP384R1, CRYPTO_NID_SECP521R1};
-UINTN  EcKeyHalfSize[EC_CURVE_NUM_SUPPORTED] = {32, 48, 66};
+#define EC_CURVE_NUM_SUPPORTED  3
+UINTN  EcCurveList[EC_CURVE_NUM_SUPPORTED]   = { CRYPTO_NID_SECP256R1, CRYPTO_NID_SECP384R1, CRYPTO_NID_SECP521R1 };
+UINTN  EcKeyHalfSize[EC_CURVE_NUM_SUPPORTED] = { 32, 48, 66 };
 
-struct Generator
-{
-  UINT8 X[66];
-  UINT8 Y[66];
+struct Generator {
+  UINT8    X[66];
+  UINT8    Y[66];
 };
+
 // Generator points of all ec curve
-struct Generator EcCurveGenerator[EC_CURVE_NUM_SUPPORTED] =
+struct Generator  EcCurveGenerator[EC_CURVE_NUM_SUPPORTED] =
 {
-  //CRYPTO_NID_SECP256R1
+  // CRYPTO_NID_SECP256R1
   {
     { 0x6B, 0x17, 0xD1, 0xF2, 0xE1, 0x2C, 0x42, 0x47, 0xF8, 0xBC, 0xE6, 0xE5,
       0x63, 0xA4, 0x40, 0xF2, 0x77, 0x03, 0x7D, 0x81, 0x2D, 0xEB, 0x33, 0xA0,
@@ -30,7 +30,7 @@ struct Generator EcCurveGenerator[EC_CURVE_NUM_SUPPORTED] =
       0x7c, 0x0f, 0x9e, 0x16, 0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, 0xce,
       0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, 0x51, 0xf5 }
   },
-  //CRYPTO_NID_SECP384R1
+  // CRYPTO_NID_SECP384R1
   {
     { 0xAA, 0x87, 0xCA, 0x22, 0xBE, 0x8B, 0x05, 0x37, 0x8E, 0xB1, 0xC7, 0x1E,
       0xF3, 0x20, 0xAD, 0x74, 0x6E, 0x1D, 0x3B, 0x62, 0x8B, 0xA7, 0x9B, 0x98,
@@ -42,7 +42,7 @@ struct Generator EcCurveGenerator[EC_CURVE_NUM_SUPPORTED] =
       0xe9, 0xda, 0x31, 0x13, 0xb5, 0xf0, 0xb8, 0xc0, 0x0a, 0x60, 0xb1, 0xce,
       0x1d, 0x7e, 0x81, 0x9d, 0x7a, 0x43, 0x1d, 0x7c, 0x90, 0xea, 0x0e, 0x5f }
   },
-  //CRYPTO_NID_SECP521R1
+  // CRYPTO_NID_SECP521R1
   {
     { 0x00, 0xC6, 0x85, 0x8E, 0x06, 0xB7, 0x04, 0x04, 0xE9, 0xCD, 0x9E, 0x3E,
       0xCB, 0x66, 0x23, 0x95, 0xB4, 0x42, 0x9C, 0x64, 0x81, 0x39, 0x05, 0x3F,
@@ -60,16 +60,16 @@ struct Generator EcCurveGenerator[EC_CURVE_NUM_SUPPORTED] =
   }
 };
 
-VOID   *Ec1     ;
-VOID   *Ec2     ;
-VOID   *Group   ;
-VOID   *Point1  ;
-VOID   *Point2  ;
-VOID   *PointRes;
-VOID   *BnX     ;
-VOID   *BnY     ;
-VOID   *BnP     ;
-VOID   *BnOrder ;
+VOID  *Ec1;
+VOID  *Ec2;
+VOID  *Group;
+VOID  *Point1;
+VOID  *Point2;
+VOID  *PointRes;
+VOID  *BnX;
+VOID  *BnY;
+VOID  *BnP;
+VOID  *BnOrder;
 
 UNIT_TEST_STATUS
 EFIAPI
@@ -87,9 +87,10 @@ TestVerifyEcPreReq (
   BnY      = NULL;
   BnP      = BigNumInit ();
   BnOrder  = BigNumInit ();
-  if (BnP == NULL || BnOrder == NULL) {
+  if ((BnP == NULL) || (BnOrder == NULL)) {
     return UNIT_TEST_ERROR_TEST_FAILED;
   }
+
   return UNIT_TEST_PASSED;
 }
 
@@ -117,8 +118,8 @@ TestVerifyEcBasic (
   UNIT_TEST_CONTEXT  Context
   )
 {
-  UINTN   CurveCount;
-  BOOLEAN Status;
+  UINTN    CurveCount;
+  BOOLEAN  Status;
 
   //
   // Initialize BigNumbers
@@ -132,12 +133,12 @@ TestVerifyEcBasic (
       return UNIT_TEST_ERROR_TEST_FAILED;
     }
 
-    Point1 = EcPointInit (Group);
-    Point2 = EcPointInit (Group);
+    Point1   = EcPointInit (Group);
+    Point2   = EcPointInit (Group);
     PointRes = EcPointInit (Group);
-    BnX = BigNumFromBin (EcCurveGenerator[CurveCount].X, EcKeyHalfSize[CurveCount]);
-    BnY = BigNumFromBin (EcCurveGenerator[CurveCount].Y, EcKeyHalfSize[CurveCount]);
-    if (Point1 == NULL || Point2 == NULL || PointRes == NULL || BnX == NULL || BnY == NULL) {
+    BnX      = BigNumFromBin (EcCurveGenerator[CurveCount].X, EcKeyHalfSize[CurveCount]);
+    BnY      = BigNumFromBin (EcCurveGenerator[CurveCount].Y, EcKeyHalfSize[CurveCount]);
+    if ((Point1 == NULL) || (Point2 == NULL) || (PointRes == NULL) || (BnX == NULL) || (BnY == NULL)) {
       return UNIT_TEST_ERROR_TEST_FAILED;
     }
 
@@ -147,7 +148,7 @@ TestVerifyEcBasic (
     Status = EcGroupGetOrder (Group, BnOrder);
     UT_ASSERT_TRUE (Status);
 
-    //Point G should on curve
+    // Point G should on curve
     Status = EcPointSetAffineCoordinates (Group, Point1, BnX, BnY, NULL);
     UT_ASSERT_TRUE (Status);
 
@@ -163,21 +164,21 @@ TestVerifyEcBasic (
     Status = EcPointIsAtInfinity (Group, Point1);
     UT_ASSERT_FALSE (Status);
 
-    //Point 2G should on curve
+    // Point 2G should on curve
     Status = EcPointAdd (Group, PointRes, Point1, Point1, NULL);
     UT_ASSERT_TRUE (Status);
 
     Status = EcPointIsOnCurve (Group, PointRes, NULL);
     UT_ASSERT_TRUE (Status);
 
-    //Point Order * G should at infinity
+    // Point Order * G should at infinity
     Status = EcPointMul (Group, PointRes, Point1, BnOrder, NULL);
     UT_ASSERT_TRUE (Status);
 
     Status = EcPointIsAtInfinity (Group, PointRes);
     UT_ASSERT_TRUE (Status);
 
-    //-(-G) == G
+    // -(-G) == G
     Status = EcPointInvert (Group, Point2, NULL);
     UT_ASSERT_TRUE (Status);
 
@@ -190,7 +191,7 @@ TestVerifyEcBasic (
     Status = EcPointEqual (Group, Point2, Point1, NULL);
     UT_ASSERT_TRUE (Status);
 
-    //Compress point test
+    // Compress point test
     Status = EcPointSetCompressedCoordinates (Group, Point1, BnX, 0, NULL);
     UT_ASSERT_TRUE (Status);
 
@@ -216,16 +217,16 @@ TestVerifyEcDh (
   UNIT_TEST_CONTEXT  Context
   )
 {
-  UINT8   Public1[66 * 2];
-  UINTN   Public1Length;
-  UINT8   Public2[66 * 2];
-  UINTN   Public2Length;
-  UINT8   Key1[66];
-  UINTN   Key1Length;
-  UINT8   Key2[66];
-  UINTN   Key2Length;
-  UINTN   CurveCount;
-  BOOLEAN Status;
+  UINT8    Public1[66 * 2];
+  UINTN    Public1Length;
+  UINT8    Public2[66 * 2];
+  UINTN    Public2Length;
+  UINT8    Key1[66];
+  UINTN    Key1Length;
+  UINT8    Key2[66];
+  UINTN    Key2Length;
+  UINTN    CurveCount;
+  BOOLEAN  Status;
 
   for (CurveCount = 0; CurveCount < EC_CURVE_NUM_SUPPORTED; CurveCount++) {
     //
@@ -233,8 +234,8 @@ TestVerifyEcDh (
     //
     Public1Length = sizeof (Public1);
     Public2Length = sizeof (Public2);
-    Key1Length = sizeof (Key1);
-    Key2Length = sizeof (Key2);
+    Key1Length    = sizeof (Key1);
+    Key2Length    = sizeof (Key2);
     //
     // ECDH functions unit test
     //
-- 
2.31.1.windows.1


  parent reply	other threads:[~2022-09-07  8:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07  8:29 [PATCH 0/7] CryptoPkg: Add BigNum and EC support to BaseCryptLib yi1 li
2022-09-07  8:29 ` [PATCH 1/7] CryptoPkg: Add BigNum support yi1 li
2022-09-07  8:29 ` [PATCH 2/7] CryptoPkg: Add BigNum API to DXE and protocol yi1 li
2022-09-07  8:29 ` [PATCH 3/7] CryptoPkg: Add EC support yi1 li
2022-09-07  8:29 ` [PATCH 4/7] CryptoPkg: Add EC APIs to DXE and protocol yi1 li
2022-09-07  8:29 ` [PATCH 5/7] CryptoPkg/Test: Add unit test for CryptoBn yi1 li
2022-09-07  8:29 ` [PATCH 6/7] CryptoPkg/Test: Add unit test for CryptoEc yi1 li
2022-09-07  8:29 ` yi1 li [this message]
2022-09-20 16:01 ` [PATCH 0/7] CryptoPkg: Add BigNum and EC support to BaseCryptLib Yao, Jiewen
2022-09-21  4:56   ` yi1 li
2022-09-21 10:46     ` Yao, Jiewen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a2d188dd969ac2ca134779147867ca715269470.1662539080.git.yi1.li@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox