]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaPss.c
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptRsaPss.c
index 37075ea65a0dc7cf388b3453fd4337af2b8045a1..bdc9155e1f4090fa58d0ec43fe2035904fb6aa53 100644 (file)
@@ -16,7 +16,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <openssl/objects.h>\r
 #include <openssl/evp.h>\r
 \r
-\r
 /**\r
   Retrieve a pointer to EVP message digest object.\r
 \r
@@ -25,27 +24,26 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/\r
 STATIC\r
 const\r
-EVP_MD*\r
+EVP_MD *\r
 GetEvpMD (\r
-  IN UINT16 DigestLen\r
+  IN UINT16  DigestLen\r
   )\r
 {\r
-  switch (DigestLen){\r
+  switch (DigestLen) {\r
     case SHA256_DIGEST_SIZE:\r
-      return EVP_sha256();\r
+      return EVP_sha256 ();\r
       break;\r
     case SHA384_DIGEST_SIZE:\r
-      return EVP_sha384();\r
+      return EVP_sha384 ();\r
       break;\r
     case SHA512_DIGEST_SIZE:\r
-      return EVP_sha512();\r
+      return EVP_sha512 ();\r
       break;\r
     default:\r
       return NULL;\r
   }\r
 }\r
 \r
-\r
 /**\r
   Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017.\r
   Implementation determines salt length automatically from the signature encoding.\r
@@ -76,76 +74,84 @@ RsaPssVerify (
   IN  UINT16       SaltLen\r
   )\r
 {\r
-  BOOLEAN Result;\r
-  EVP_PKEY *EvpRsaKey;\r
-  EVP_MD_CTX *EvpVerifyCtx;\r
-  EVP_PKEY_CTX *KeyCtx;\r
+  BOOLEAN       Result;\r
+  EVP_PKEY      *EvpRsaKey;\r
+  EVP_MD_CTX    *EvpVerifyCtx;\r
+  EVP_PKEY_CTX  *KeyCtx;\r
   CONST EVP_MD  *HashAlg;\r
 \r
-  Result = FALSE;\r
-  EvpRsaKey = NULL;\r
+  Result       = FALSE;\r
+  EvpRsaKey    = NULL;\r
   EvpVerifyCtx = NULL;\r
-  KeyCtx = NULL;\r
-  HashAlg = NULL;\r
+  KeyCtx       = NULL;\r
+  HashAlg      = NULL;\r
 \r
   if (RsaContext == NULL) {\r
     return FALSE;\r
   }\r
-  if (Message == NULL || MsgSize == 0 || MsgSize > INT_MAX) {\r
+\r
+  if ((Message == NULL) || (MsgSize == 0) || (MsgSize > INT_MAX)) {\r
     return FALSE;\r
   }\r
-  if (Signature == NULL || SigSize == 0 || SigSize > INT_MAX) {\r
+\r
+  if ((Signature == NULL) || (SigSize == 0) || (SigSize > INT_MAX)) {\r
     return FALSE;\r
   }\r
+\r
   if (SaltLen != DigestLen) {\r
     return FALSE;\r
   }\r
 \r
-  HashAlg = GetEvpMD(DigestLen);\r
+  HashAlg = GetEvpMD (DigestLen);\r
 \r
   if (HashAlg == NULL) {\r
     return FALSE;\r
   }\r
 \r
-  EvpRsaKey = EVP_PKEY_new();\r
+  EvpRsaKey = EVP_PKEY_new ();\r
   if (EvpRsaKey == NULL) {\r
     goto _Exit;\r
   }\r
 \r
-  EVP_PKEY_set1_RSA(EvpRsaKey, RsaContext);\r
+  EVP_PKEY_set1_RSA (EvpRsaKey, RsaContext);\r
 \r
-  EvpVerifyCtx = EVP_MD_CTX_create();\r
+  EvpVerifyCtx = EVP_MD_CTX_create ();\r
   if (EvpVerifyCtx == NULL) {\r
     goto _Exit;\r
   }\r
 \r
-  Result = EVP_DigestVerifyInit(EvpVerifyCtx, &KeyCtx, HashAlg, NULL, EvpRsaKey) > 0;\r
+  Result = EVP_DigestVerifyInit (EvpVerifyCtx, &KeyCtx, HashAlg, NULL, EvpRsaKey) > 0;\r
   if (KeyCtx == NULL) {\r
     goto _Exit;\r
   }\r
 \r
   if (Result) {\r
-    Result = EVP_PKEY_CTX_set_rsa_padding(KeyCtx, RSA_PKCS1_PSS_PADDING) > 0;\r
+    Result = EVP_PKEY_CTX_set_rsa_padding (KeyCtx, RSA_PKCS1_PSS_PADDING) > 0;\r
   }\r
+\r
   if (Result) {\r
-    Result = EVP_PKEY_CTX_set_rsa_pss_saltlen(KeyCtx, SaltLen) > 0;\r
+    Result = EVP_PKEY_CTX_set_rsa_pss_saltlen (KeyCtx, SaltLen) > 0;\r
   }\r
+\r
   if (Result) {\r
-    Result = EVP_PKEY_CTX_set_rsa_mgf1_md(KeyCtx, HashAlg) > 0;\r
+    Result = EVP_PKEY_CTX_set_rsa_mgf1_md (KeyCtx, HashAlg) > 0;\r
   }\r
+\r
   if (Result) {\r
-    Result = EVP_DigestVerifyUpdate(EvpVerifyCtx, Message, (UINT32)MsgSize) > 0;\r
+    Result = EVP_DigestVerifyUpdate (EvpVerifyCtx, Message, (UINT32)MsgSize) > 0;\r
   }\r
+\r
   if (Result) {\r
-    Result = EVP_DigestVerifyFinal(EvpVerifyCtx, Signature, (UINT32)SigSize) > 0;\r
+    Result = EVP_DigestVerifyFinal (EvpVerifyCtx, Signature, (UINT32)SigSize) > 0;\r
   }\r
 \r
-_Exit :\r
+_Exit:\r
   if (EvpRsaKey != NULL) {\r
-    EVP_PKEY_free(EvpRsaKey);\r
+    EVP_PKEY_free (EvpRsaKey);\r
   }\r
+\r
   if (EvpVerifyCtx != NULL) {\r
-    EVP_MD_CTX_destroy(EvpVerifyCtx);\r
+    EVP_MD_CTX_destroy (EvpVerifyCtx);\r
   }\r
 \r
   return Result;\r