]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg Updates to support RFC3161 timestamp signature verification.
authorQin Long <qin.long@intel.com>
Wed, 12 Nov 2014 08:51:45 +0000 (08:51 +0000)
committerqlong <qlong@Edk2>
Wed, 12 Nov 2014 08:51:45 +0000 (08:51 +0000)
The main changes includes:
1. Enabling SHA384 and SHA512 digest algorithm; (Sha512.c)
2. RFC 3161 timestamp signature verification support; (CryptTs.c)
3. Fixed one ASN.1 length encoding issue in Authenticode verification routine. (CryptAuthenticode.c)
4. Add the corresponding test cases in Cryptest utility (SHA384 & SHA512 & Timestamp verification)

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16339 6f19259b-4bc3-4df7-8a09-765794883524

33 files changed:
CryptoPkg/Application/Cryptest/Cryptest.c
CryptoPkg/Application/Cryptest/Cryptest.h
CryptoPkg/Application/Cryptest/Cryptest.inf
CryptoPkg/Application/Cryptest/DhVerify.c
CryptoPkg/Application/Cryptest/HashVerify.c
CryptoPkg/Application/Cryptest/TSVerify.c [new file with mode: 0644]
CryptoPkg/Include/Library/BaseCryptLib.h
CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c [new file with mode: 0644]
CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512Null.c [new file with mode: 0644]
CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c
CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c
CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c [new file with mode: 0644]
CryptoPkg/Library/BaseCryptLib/Pk/CryptTsNull.c [new file with mode: 0644]
CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.S [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.c [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathLShiftS64.S [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathLShiftS64.c [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathMultS64x64.S [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathMultS64x64.c [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.S [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.c [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathReminderU64x64.S [deleted file]
CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathReminderU64x64.c [deleted file]
CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S [new file with mode: 0644]
CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c [new file with mode: 0644]
CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S [new file with mode: 0644]
CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c [new file with mode: 0644]
CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
CryptoPkg/Library/OpensslLib/OpensslLib.inf

index 44aaabadea6a177e6112c8b39f935ba43980566e..79c1850e68e0d7005d11581471b0461c565ced47 100644 (file)
@@ -1,7 +1,7 @@
-/** @file  \r
+/** @file\r
   Application for Cryptographic Primitives Validation.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -73,6 +73,11 @@ CryptestMain (
     return Status;\r
   }\r
 \r
+  Status = ValidateTSCounterSignature ();\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
   Status = ValidateCryptDh ();\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -84,4 +89,4 @@ CryptestMain (
   }\r
 \r
   return EFI_SUCCESS;\r
-}\r
+}
\ No newline at end of file
index 216d0a29dfe4905eb5131d2e6982a8763397d82b..17b4224b65ba3a33b7b7f99fba8437d76d7d8675 100644 (file)
@@ -1,7 +1,7 @@
-/** @file  \r
+/** @file\r
   Application for Cryptographic Primitives Validation.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -108,6 +108,18 @@ ValidateAuthenticode (
   VOID\r
   );\r
 \r
+/**\r
+  Validate UEFI-OpenSSL RFC3161 Timestamp CounterSignature Verification Interfaces.\r
+\r
+  @retval  EFI_SUCCESS  Validation succeeded.\r
+  @retval  EFI_ABORTED  Validation failed.\r
+\r
+**/\r
+EFI_STATUS\r
+ValidateTSCounterSignature (\r
+  VOID\r
+  );\r
+\r
 /**\r
   Validate UEFI-OpenSSL DH Interfaces.\r
 \r
@@ -132,4 +144,4 @@ ValidateCryptPrng (
   VOID\r
   );\r
 \r
-#endif\r
+#endif
\ No newline at end of file
index 265b731a90c2664ee8a20ea7619f3c27c61deded..11175e55bc145cc001953091835204c81b2ccea2 100644 (file)
@@ -38,6 +38,7 @@
   RsaVerify.c\r
   RsaVerify2.c\r
   AuthenticodeVerify.c\r
+  TSVerify.c\r
   DhVerify.c\r
   RandVerify.c\r
   \r
@@ -57,4 +58,4 @@
 \r
 [UserExtensions.TianoCore."ExtraFiles"]\r
   CryptestExtra.uni\r
-  
\ No newline at end of file
+  \r
index 455d85b6d2e7c643b75a7af075d4cc74d90bd75e..6384a8a697c9b331b678a6e64c0ec98c3b3ab50a 100644 (file)
@@ -1,7 +1,7 @@
-/** @file  \r
+/** @file\r
   Application for Diffie-Hellman Primitives Validation.\r
 \r
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -41,6 +41,14 @@ ValidateCryptDh (
 \r
   Print (L"\nUEFI-OpenSSL DH Engine Testing:\n");\r
 \r
+  //\r
+  // Initialize Key Length\r
+  //\r
+  PublicKey1Length = sizeof (PublicKey1);\r
+  PublicKey2Length = sizeof (PublicKey2);\r
+  Key1Length       = sizeof (Key1);\r
+  Key2Length       = sizeof (Key2);\r
+\r
   //\r
   // Generate & Initialize DH Context\r
   //\r
@@ -114,4 +122,4 @@ ValidateCryptDh (
   Print (L"[Pass]\n");\r
 \r
   return EFI_SUCCESS;\r
-}\r
+}
\ No newline at end of file
index 107ff45cc8f5cc311f00976439148d9be7e4acf6..ca64361c3890a3eeafed0672af78e70a10c11942 100644 (file)
@@ -1,7 +1,7 @@
-/** @file  \r
+/** @file\r
   Application for Hash Primitives Validation.\r
 \r
-Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -54,6 +54,25 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha256Digest[SHA256_DIGEST_SIZE] = {
   0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad\r
   };\r
 \r
+//\r
+// Result for SHA-384("abc"). (From "D.1 SHA-384 Example" of NIST FIPS 180-2)\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha384Digest[SHA384_DIGEST_SIZE] = {\r
+  0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,\r
+  0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,\r
+  0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23, 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7\r
+  };\r
+\r
+//\r
+// Result for SHA-512("abc"). (From "C.1 SHA-512 Example" of NIST FIPS 180-2)\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 Sha512Digest[SHA512_DIGEST_SIZE] = {\r
+  0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,\r
+  0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,\r
+  0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8, 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,\r
+  0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e, 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f\r
+  };\r
+\r
 /**\r
   Validate UEFI-OpenSSL Digest Interfaces.\r
 \r
@@ -76,7 +95,7 @@ ValidateCryptDigest (
   DataSize = AsciiStrLen (HashData);\r
 \r
   Print (L"- MD4:    ");\r
-  \r
+\r
   //\r
   // MD4 Digest Validation\r
   //\r
@@ -234,6 +253,86 @@ ValidateCryptDigest (
   }\r
 \r
   Print (L"[Pass]\n");\r
-  \r
+\r
+  Print (L"- SHA384: ");\r
+\r
+  //\r
+  // SHA384 Digest Validation\r
+  //\r
+  ZeroMem (Digest, MAX_DIGEST_SIZE);\r
+  CtxSize = Sha384GetContextSize ();\r
+  HashCtx = AllocatePool (CtxSize);\r
+\r
+  Print (L"Init... ");\r
+  Status  = Sha384Init (HashCtx);\r
+  if (!Status) {\r
+    Print (L"[Fail]");\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  Print (L"Update... ");\r
+  Status  = Sha384Update (HashCtx, HashData, DataSize);\r
+  if (!Status) {\r
+    Print (L"[Fail]");\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  Print (L"Finalize... ");\r
+  Status  = Sha384Final (HashCtx, Digest);\r
+  if (!Status) {\r
+    Print (L"[Fail]");\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  FreePool (HashCtx);\r
+\r
+  Print (L"Check Value... ");\r
+  if (CompareMem (Digest, Sha384Digest, SHA384_DIGEST_SIZE) != 0) {\r
+    Print (L"[Fail]");\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  Print (L"[Pass]\n");\r
+\r
+  Print (L"- SHA512: ");\r
+\r
+  //\r
+  // SHA512 Digest Validation\r
+  //\r
+  ZeroMem (Digest, MAX_DIGEST_SIZE);\r
+  CtxSize = Sha512GetContextSize ();\r
+  HashCtx = AllocatePool (CtxSize);\r
+\r
+  Print (L"Init... ");\r
+  Status  = Sha512Init (HashCtx);\r
+  if (!Status) {\r
+    Print (L"[Fail]");\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  Print (L"Update... ");\r
+  Status  = Sha512Update (HashCtx, HashData, DataSize);\r
+  if (!Status) {\r
+    Print (L"[Fail]");\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  Print (L"Finalize... ");\r
+  Status  = Sha512Final (HashCtx, Digest);\r
+  if (!Status) {\r
+    Print (L"[Fail]");\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  FreePool (HashCtx);\r
+\r
+  Print (L"Check Value... ");\r
+  if (CompareMem (Digest, Sha512Digest, SHA512_DIGEST_SIZE) != 0) {\r
+    Print (L"[Fail]");\r
+    return EFI_ABORTED;\r
+  }\r
+\r
+  Print (L"[Pass]\n");\r
+\r
   return EFI_SUCCESS;\r
 }\r
diff --git a/CryptoPkg/Application/Cryptest/TSVerify.c b/CryptoPkg/Application/Cryptest/TSVerify.c
new file mode 100644 (file)
index 0000000..7a8d107
--- /dev/null
@@ -0,0 +1,501 @@
+/** @file\r
+  Sample Implementation for RFC3161 Time Stamping Verification.\r
+\r
+Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "Cryptest.h"\r
+\r
+//\r
+// Sample Authenticode Data with RFC3161 time stamping signature.\r
+// The data retrieved from one signed sample UEFI image, which is generated by MSFT's signtool \r
+// utility in conjunction with RFC3161 timestamping, as the following command:\r
+//   signtool sign /ac <xxx.cer> / f <xxx.pfx> /p <pass> /fd <digestAlg> \r
+//     /tr http://timestamp.comodoca.com/rfc3161 sample.efi\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 AuthenticodeWithTS[] = {\r
+  0x30, 0x82, 0x0c, 0x00, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,\r
+  0x82, 0x0b, 0xf1, 0x30, 0x82, 0x0b, 0xed, 0x02, 0x01, 0x01, 0x31, 0x0f, 0x30, 0x0d, 0x06, 0x09,\r
+  0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x30, 0x78, 0x06, 0x0a, 0x2b,\r
+  0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04, 0xa0, 0x6a, 0x30, 0x68, 0x30, 0x33, 0x06,\r
+  0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0f, 0x30, 0x25, 0x03, 0x01, 0x00,\r
+  0xa0, 0x20, 0xa2, 0x1e, 0x80, 0x1c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x4f, 0x00, 0x62,\r
+  0x00, 0x73, 0x00, 0x6f, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x3e, 0x00, 0x3e,\r
+  0x00, 0x3e, 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02,\r
+  0x01, 0x05, 0x00, 0x04, 0x20, 0x1e, 0x9e, 0x74, 0x31, 0xe1, 0x3e, 0x51, 0x46, 0xab, 0xce, 0x10,\r
+  0x0d, 0x7c, 0x38, 0x66, 0x34, 0xd4, 0xdd, 0x04, 0xa5, 0xe7, 0x75, 0x40, 0xdd, 0x99, 0x73, 0xf3,\r
+  0x2a, 0x54, 0x3e, 0xa8, 0x18, 0xa0, 0x82, 0x01, 0xee, 0x30, 0x82, 0x01, 0xea, 0x30, 0x82, 0x01,\r
+  0x57, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x2c, 0x65, 0xcf, 0xcf, 0xdd, 0x61, 0x7b, 0xa4,\r
+  0x41, 0xad, 0x26, 0x1b, 0x63, 0xce, 0x91, 0x0f, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02,\r
+  0x1d, 0x05, 0x00, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x08,\r
+  0x54, 0x65, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x34, 0x30, 0x37,\r
+  0x32, 0x38, 0x30, 0x37, 0x33, 0x38, 0x35, 0x39, 0x5a, 0x17, 0x0d, 0x33, 0x39, 0x31, 0x32, 0x33,\r
+  0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x12, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03,\r
+  0x55, 0x04, 0x03, 0x13, 0x07, 0x54, 0x65, 0x73, 0x74, 0x53, 0x75, 0x62, 0x30, 0x81, 0x9f, 0x30,\r
+  0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,\r
+  0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0x94, 0xa6, 0x02, 0x15, 0x87, 0xd6, 0xbf,\r
+  0x71, 0xe8, 0xc6, 0x68, 0xf6, 0x9f, 0x66, 0x09, 0x6c, 0xe7, 0x39, 0x52, 0xf4, 0x4e, 0xaf, 0xf5,\r
+  0xe0, 0xba, 0x0f, 0xfd, 0xe6, 0x77, 0xa9, 0x71, 0x5b, 0x5c, 0x92, 0x50, 0x1d, 0xfd, 0x9b, 0x6e,\r
+  0x52, 0x92, 0x9e, 0x3a, 0x75, 0x86, 0x41, 0x2a, 0x41, 0x30, 0x1b, 0x67, 0x66, 0x91, 0xde, 0x71,\r
+  0x84, 0xe0, 0x90, 0xc3, 0x50, 0x36, 0x78, 0xb5, 0xa0, 0x1e, 0x72, 0xde, 0xe7, 0x66, 0x42, 0x4f,\r
+  0x59, 0x5e, 0x3d, 0xf3, 0x85, 0x82, 0x0b, 0xa8, 0x26, 0x2d, 0xd9, 0xe3, 0x14, 0xda, 0x9d, 0x2e,\r
+  0x3f, 0x53, 0x4d, 0x8d, 0x10, 0xbf, 0xa4, 0x7c, 0xe5, 0xaf, 0x3a, 0xa6, 0xaf, 0x49, 0x64, 0xb0,\r
+  0x60, 0x17, 0x87, 0x71, 0x77, 0x59, 0x52, 0xe5, 0x5a, 0xed, 0x96, 0x7d, 0x7e, 0x5d, 0xc1, 0xef,\r
+  0x6b, 0xfb, 0x80, 0xc5, 0x2b, 0x10, 0xfe, 0xe7, 0xd3, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x48,\r
+  0x30, 0x46, 0x30, 0x44, 0x06, 0x03, 0x55, 0x1d, 0x01, 0x04, 0x3d, 0x30, 0x3b, 0x80, 0x10, 0x19,\r
+  0x8d, 0x48, 0xa1, 0xb9, 0xf3, 0x5e, 0x3c, 0x13, 0xb4, 0x08, 0xb6, 0xd9, 0xf3, 0x4f, 0x0a, 0xa1,\r
+  0x15, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x08, 0x54, 0x65,\r
+  0x73, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x82, 0x10, 0x27, 0xcb, 0x16, 0x33, 0x8b, 0xed, 0x4d, 0xa8,\r
+  0x47, 0xf0, 0x86, 0x47, 0x10, 0xef, 0x15, 0xd9, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02,\r
+  0x1d, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x51, 0x94, 0xed, 0x7a, 0x5c, 0x0b, 0x34, 0x16, 0x9c,\r
+  0xf4, 0x5f, 0x88, 0x16, 0xa8, 0x4b, 0x13, 0xfc, 0xa4, 0x0a, 0xc7, 0xd9, 0x20, 0xb1, 0x93, 0xc5,\r
+  0x81, 0x4f, 0x35, 0x3a, 0x89, 0x10, 0x04, 0xc4, 0xcc, 0x10, 0x34, 0xc3, 0x15, 0x57, 0x06, 0x97,\r
+  0xee, 0x06, 0x2f, 0xf3, 0x24, 0xa1, 0xe6, 0x3a, 0x89, 0x4d, 0xb4, 0x7b, 0x12, 0x87, 0x90, 0x8c,\r
+  0xfc, 0x5b, 0xb0, 0xf0, 0xdd, 0xaa, 0x3a, 0x24, 0x6d, 0x55, 0x47, 0x8a, 0xf2, 0x61, 0x08, 0x7a,\r
+  0x59, 0x5f, 0x6e, 0x7b, 0xcb, 0x34, 0xbe, 0xb6, 0x5d, 0xcb, 0x60, 0xae, 0xc4, 0xda, 0x62, 0xbb,\r
+  0x7f, 0x17, 0x1e, 0x73, 0xd1, 0x4e, 0x9f, 0x6e, 0xd3, 0xc8, 0x35, 0x58, 0x30, 0xd2, 0x89, 0xe5,\r
+  0x22, 0x5e, 0x86, 0xac, 0x7a, 0x56, 0xd6, 0x70, 0xdb, 0x54, 0x10, 0x6c, 0xd3, 0xd5, 0x38, 0xfb,\r
+  0x69, 0xcb, 0x4f, 0x36, 0x83, 0xc2, 0xe8, 0x31, 0x82, 0x09, 0x69, 0x30, 0x82, 0x09, 0x65, 0x02,\r
+  0x01, 0x01, 0x30, 0x27, 0x30, 0x13, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13,\r
+  0x08, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x02, 0x10, 0x2c, 0x65, 0xcf, 0xcf, 0xdd,\r
+  0x61, 0x7b, 0xa4, 0x41, 0xad, 0x26, 0x1b, 0x63, 0xce, 0x91, 0x0f, 0x30, 0x0d, 0x06, 0x09, 0x60,\r
+  0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0xa0, 0x5e, 0x30, 0x10, 0x06, 0x0a,\r
+  0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x0c, 0x31, 0x02, 0x30, 0x00, 0x30, 0x19,\r
+  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x03, 0x31, 0x0c, 0x06, 0x0a, 0x2b,\r
+  0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04, 0x30, 0x2f, 0x06, 0x09, 0x2a, 0x86, 0x48,\r
+  0x86, 0xf7, 0x0d, 0x01, 0x09, 0x04, 0x31, 0x22, 0x04, 0x20, 0x97, 0x6e, 0x29, 0x47, 0xc4, 0x03,\r
+  0x68, 0x70, 0x1c, 0x99, 0x2c, 0x61, 0xb0, 0xbc, 0xde, 0x77, 0xe1, 0xa1, 0xeb, 0x4c, 0x1c, 0xac,\r
+  0x4c, 0x64, 0xf6, 0x43, 0x96, 0x94, 0x0b, 0xc0, 0xbb, 0x03, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,\r
+  0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x81, 0x80, 0x85, 0x93, 0xad, 0x93,\r
+  0x92, 0x9e, 0xa4, 0x94, 0x30, 0x02, 0xe1, 0xc8, 0xcd, 0x37, 0xb2, 0xe1, 0xcb, 0xb2, 0x0f, 0x1c,\r
+  0x67, 0xd1, 0xc9, 0xeb, 0x4d, 0x68, 0x85, 0x97, 0x5a, 0xa6, 0x0c, 0x03, 0xc7, 0x86, 0xae, 0xb3,\r
+  0x35, 0xb4, 0x1d, 0x0e, 0x95, 0x5f, 0xed, 0x37, 0x13, 0x6b, 0x1e, 0x94, 0x80, 0xf1, 0xac, 0x55,\r
+  0x73, 0xd1, 0x31, 0xf9, 0xad, 0x13, 0x7b, 0x26, 0xbf, 0xe7, 0x55, 0x7b, 0xb2, 0xf9, 0x21, 0x42,\r
+  0x23, 0x64, 0xe6, 0x45, 0x03, 0x67, 0xcb, 0x42, 0xd3, 0x71, 0x3f, 0xd5, 0x29, 0x17, 0x4b, 0x49,\r
+  0x45, 0x0e, 0x8b, 0xba, 0x1f, 0x15, 0x5a, 0x7f, 0x7b, 0x5e, 0x9b, 0x22, 0x46, 0xa7, 0x9c, 0x0d,\r
+  0x25, 0x9c, 0x76, 0x25, 0x02, 0xc8, 0x15, 0x00, 0x51, 0xe6, 0x73, 0x39, 0xac, 0x8d, 0x41, 0x7b,\r
+  0xc8, 0x42, 0xc9, 0xdb, 0x1b, 0x16, 0x13, 0xf6, 0x44, 0x32, 0xef, 0x17, 0xa1, 0x82, 0x08, 0x34,\r
+  0x30, 0x82, 0x08, 0x30, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x03, 0x03, 0x01,\r
+  0x31, 0x82, 0x08, 0x20,\r
+  0x30, 0x82, 0x08, 0x1c, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,\r
+  0x82, 0x08, 0x0d, 0x30, 0x82, 0x08, 0x09, 0x02, 0x01, 0x03, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x05,\r
+  0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x30, 0x81, 0xf6, 0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86,\r
+  0xf7, 0x0d, 0x01, 0x09, 0x10, 0x01, 0x04, 0xa0, 0x81, 0xe6, 0x04, 0x81, 0xe3, 0x30, 0x81, 0xe0,\r
+  0x02, 0x01, 0x01, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xb2, 0x31, 0x02, 0x01, 0x01, 0x30,\r
+  0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xcd, 0x06,\r
+  0xf0, 0xbd, 0x8b, 0xcd, 0x5c, 0x2e, 0x5a, 0x7c, 0x42, 0x56, 0x2c, 0x20, 0x4a, 0x15, 0xcb, 0x1d,\r
+  0x8b, 0x0e, 0x02, 0x15, 0x00, 0xb6, 0xff, 0x47, 0x05, 0xb6, 0x2d, 0x15, 0xac, 0x3f, 0x5d, 0xd9,\r
+  0xcf, 0x9d, 0x54, 0x35, 0x56, 0x7c, 0xc1, 0x6e, 0x8b, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x34, 0x30,\r
+  0x37, 0x32, 0x38, 0x30, 0x38, 0x35, 0x30, 0x30, 0x33, 0x5a, 0xa0, 0x81, 0x83, 0xa4, 0x81, 0x80,\r
+  0x30, 0x7e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42, 0x31,\r
+  0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x12, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65,\r
+  0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x74, 0x65, 0x72, 0x31, 0x10, 0x30, 0x0e,\r
+  0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x53, 0x61, 0x6c, 0x66, 0x6f, 0x72, 0x64, 0x31, 0x1a,\r
+  0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x11, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20,\r
+  0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03,\r
+  0x55, 0x04, 0x03, 0x13, 0x1b, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x54, 0x69, 0x6d, 0x65,\r
+  0x20, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72,\r
+  0xa0, 0x82, 0x04, 0x97, 0x30, 0x82, 0x04, 0x93, 0x30, 0x82, 0x03, 0x7b, 0xa0, 0x03, 0x02, 0x01,\r
+  0x02, 0x02, 0x10, 0x47, 0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2,\r
+  0x87, 0x07, 0xbe, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,\r
+  0x05, 0x00, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,\r
+  0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31,\r
+  0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c,\r
+  0x61, 0x6b, 0x65, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04,\r
+  0x0a, 0x13, 0x15, 0x54, 0x68, 0x65, 0x20, 0x55, 0x53, 0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54,\r
+  0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04,\r
+  0x0b, 0x13, 0x18, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73,\r
+  0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1d, 0x30, 0x1b, 0x06,\r
+  0x03, 0x55, 0x04, 0x03, 0x13, 0x14, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69,\r
+  0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30,\r
+  0x30, 0x35, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31, 0x35, 0x30,\r
+  0x35, 0x31, 0x30, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x7e, 0x31, 0x0b, 0x30, 0x09,\r
+  0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55,\r
+  0x04, 0x08, 0x13, 0x12, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63,\r
+  0x68, 0x65, 0x73, 0x74, 0x65, 0x72, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,\r
+  0x07, 0x53, 0x61, 0x6c, 0x66, 0x6f, 0x72, 0x64, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04,\r
+  0x0a, 0x13, 0x11, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d,\r
+  0x69, 0x74, 0x65, 0x64, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1b, 0x43,\r
+  0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6d, 0x70,\r
+  0x69, 0x6e, 0x67, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d,\r
+  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01,\r
+  0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbc, 0x35, 0xa0, 0x36, 0x70,\r
+  0x22, 0x81, 0x11, 0xc3, 0xb2, 0x83, 0xb9, 0xd3, 0x28, 0xc6, 0x36, 0xcd, 0x25, 0x6b, 0xa9, 0x7b,\r
+  0xb2, 0x1c, 0xf6, 0x9b, 0x51, 0x9c, 0xef, 0x35, 0xf4, 0xed, 0x08, 0x8e, 0x5e, 0x38, 0x08, 0xf8,\r
+  0x77, 0x3c, 0x0a, 0x42, 0xe0, 0xf3, 0x70, 0xdc, 0xa3, 0xd7, 0xca, 0xf5, 0x4c, 0x0b, 0xcf, 0xff,\r
+  0x22, 0x9c, 0x0a, 0x7e, 0x68, 0xd6, 0x09, 0xa2, 0x2a, 0x84, 0x7b, 0xa6, 0x9d, 0xb4, 0xa9, 0xc1,\r
+  0x33, 0xe2, 0xef, 0x1f, 0x17, 0x48, 0xca, 0x3a, 0xcd, 0x46, 0xe6, 0xc5, 0xaa, 0x77, 0xbd, 0xe3,\r
+  0x77, 0x9a, 0xfa, 0x47, 0x53, 0x40, 0x28, 0x59, 0x43, 0x93, 0xf1, 0xa4, 0x81, 0xea, 0xef, 0x80,\r
+  0xb5, 0x4f, 0xa7, 0x08, 0xce, 0xba, 0x6e, 0xbc, 0xca, 0x76, 0x0c, 0x97, 0x64, 0x59, 0x86, 0x24,\r
+  0xbb, 0x3d, 0x82, 0x90, 0xa8, 0x55, 0xb1, 0x92, 0xd3, 0xa0, 0xa7, 0x05, 0xac, 0x9f, 0x53, 0x25,\r
+  0x08, 0x10, 0x47, 0x99, 0xcd, 0x98, 0xde, 0x68, 0xe5, 0xb4, 0x50, 0x78, 0xa3, 0xaf, 0x01, 0xcc,\r
+  0x59, 0x43, 0x58, 0xe4, 0x76, 0x6e, 0x7e, 0xac, 0xc7, 0xe2, 0x9e, 0x1f, 0x4f, 0xb0, 0x47, 0x2d,\r
+  0xc8, 0x0c, 0xa3, 0x49, 0x27, 0x80, 0x75, 0x8c, 0xbb, 0x06, 0x91, 0x65, 0x0f, 0x90, 0x9b, 0xf4,\r
+  0xba, 0xd1, 0x81, 0xc8, 0x5c, 0x6a, 0xec, 0x14, 0xe9, 0x25, 0x09, 0xbf, 0x23, 0x16, 0xf4, 0x95,\r
+  0x46, 0x40, 0x40, 0x21, 0xbb, 0x83, 0x96, 0xfd, 0x86, 0x1f, 0x7a, 0xc8, 0x0d, 0x10, 0x8e, 0xa2,\r
+  0xf8, 0x19, 0x07, 0x58, 0x7f, 0x9f, 0xbd, 0x37, 0x02, 0x60, 0xf2, 0xa4, 0xe9, 0x9d, 0x44, 0x3f,\r
+  0x30, 0x05, 0xe4, 0xa7, 0x70, 0x99, 0x51, 0x9a, 0xe8, 0x17, 0xf1, 0x55, 0xca, 0xb2, 0x61, 0x89,\r
+  0x65, 0x46, 0xa7, 0x6a, 0xf2, 0x58, 0x46, 0x7e, 0xaa, 0xa0, 0x07, 0x02, 0x03, 0x01, 0x00, 0x01,\r
+  0xa3, 0x81, 0xf4, 0x30, 0x81, 0xf1, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30,\r
+  0x16, 0x80, 0x14, 0xda, 0xed, 0x64, 0x74, 0x14, 0x9c, 0x14, 0x3c, 0xab, 0xdd, 0x99, 0xa9, 0xbd,\r
+  0x5b, 0x28, 0x4d, 0x8b, 0x3c, 0xc9, 0xd8, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16,\r
+  0x04, 0x14, 0x2e, 0x2d, 0xb0, 0x0a, 0x44, 0x4a, 0xd3, 0x87, 0xc0, 0x02, 0x07, 0xce, 0x97, 0x7d,\r
+  0x50, 0x62, 0x20, 0xfd, 0x0f, 0x83, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff,\r
+  0x04, 0x04, 0x03, 0x02, 0x06, 0xc0, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,\r
+  0x04, 0x02, 0x30, 0x00, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x01, 0x01, 0xff, 0x04, 0x0c,\r
+  0x30, 0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x08, 0x30, 0x42, 0x06, 0x03,\r
+  0x55, 0x1d, 0x1f, 0x04, 0x3b, 0x30, 0x39, 0x30, 0x37, 0xa0, 0x35, 0xa0, 0x33, 0x86, 0x31, 0x68,\r
+  0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72,\r
+  0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52,\r
+  0x46, 0x69, 0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x63, 0x72, 0x6c,\r
+  0x30, 0x35, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x29, 0x30, 0x27,\r
+  0x30, 0x25, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x19, 0x68, 0x74,\r
+  0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72,\r
+  0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,\r
+  0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0xc8, 0xfb, 0x63, 0xf8, 0x0b,\r
+  0x75, 0x75, 0x2c, 0x3a, 0xf1, 0xf2, 0x13, 0xa7, 0x2d, 0xb6, 0xa3, 0x1a, 0x9c, 0xad, 0x01, 0x07,\r
+  0xd3, 0x34, 0x8e, 0x77, 0xe0, 0xc2, 0x6e, 0xae, 0x02, 0x5d, 0x48, 0x4f, 0xa4, 0xd2, 0x21, 0xb6,\r
+  0x36, 0xfd, 0x2a, 0x35, 0x43, 0x7c, 0x6b, 0xdf, 0x80, 0x87, 0x0b, 0x15, 0xf0, 0x76, 0x32, 0x00,\r
+  0xb4, 0xce, 0xb5, 0x67, 0xa4, 0x2f, 0x2f, 0x20, 0x1b, 0x9c, 0x54, 0x9e, 0x83, 0x3f, 0x1f, 0x5f,\r
+  0x14, 0x95, 0x62, 0x82, 0x0f, 0x22, 0x41, 0x22, 0x1f, 0x70, 0xb3, 0xf3, 0xf7, 0x42, 0xde, 0x6c,\r
+  0x51, 0xcd, 0x4b, 0xf8, 0x21, 0xac, 0x9b, 0x3b, 0x8c, 0xb1, 0xe5, 0xe6, 0x28, 0x8f, 0xce, 0x2a,\r
+  0x8a, 0xf9, 0xaa, 0x52, 0x4d, 0x8c, 0x5b, 0x77, 0xba, 0x4d, 0x5a, 0x58, 0xdb, 0xbb, 0x6a, 0x04,\r
+  0xcc, 0x52, 0x1e, 0x9d, 0xe2, 0x28, 0x37, 0x0e, 0xbb, 0xe7, 0x0e, 0x91, 0xc7, 0xf8, 0xdb, 0xf1,\r
+  0x81, 0x98, 0xeb, 0xcd, 0x37, 0xb3, 0x0e, 0xab, 0x65, 0xd3, 0x62, 0xec, 0x3a, 0xa5, 0x76, 0xeb,\r
+  0x13, 0xa8, 0x35, 0x93, 0xc9, 0x2e, 0x0a, 0x01, 0xec, 0xc0, 0xe8, 0xcc, 0x3d, 0x7e, 0xb6, 0xeb,\r
+  0xe2, 0xc1, 0xec, 0xd3, 0x14, 0x92, 0x82, 0x66, 0x87, 0x50, 0xdc, 0xfd, 0x50, 0x97, 0xac, 0xb3,\r
+  0x4a, 0x76, 0x73, 0x06, 0xc4, 0x86, 0x11, 0x3a, 0xb3, 0x5f, 0x43, 0x04, 0x52, 0x6f, 0xea, 0xb3,\r
+  0xd0, 0x74, 0x36, 0x4c, 0xca, 0xf1, 0x1b, 0x79, 0x84, 0x37, 0x70, 0x63, 0xad, 0x74, 0xb9, 0xaa,\r
+  0x0e, 0xf3, 0x98, 0xb0, 0x86, 0x08, 0xeb, 0xdb, 0xe0, 0x1f, 0x8c, 0x10, 0xf2, 0x39, 0x64, 0x9b,\r
+  0xae, 0x4f, 0x0a, 0x2c, 0x92, 0x8a, 0x4f, 0x18, 0xb5, 0x91, 0xe5, 0x8d, 0x1a, 0x93, 0x5f, 0x1f,\r
+  0xae, 0xf1, 0xa6, 0xf0, 0x2e, 0x97, 0xd0, 0xd2, 0xf6, 0x2b, 0x3c, 0x31, 0x82, 0x02, 0x61, 0x30,\r
+  0x82, 0x02, 0x5d, 0x02, 0x01, 0x01, 0x30, 0x81, 0xaa, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09,\r
+  0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,\r
+  0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,\r
+  0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c, 0x61, 0x6b, 0x65, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31,\r
+  0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15, 0x54, 0x68, 0x65, 0x20, 0x55, 0x53,\r
+  0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31,\r
+  0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x18, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,\r
+  0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63,\r
+  0x6f, 0x6d, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x14, 0x55, 0x54, 0x4e,\r
+  0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, 0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63,\r
+  0x74, 0x02, 0x10, 0x47, 0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2,\r
+  0x87, 0x07, 0xbe, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0xa0, 0x81,\r
+  0x8c, 0x30, 0x1a, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x03, 0x31, 0x0d,\r
+  0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x10, 0x01, 0x04, 0x30, 0x1c, 0x06,\r
+  0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x05, 0x31, 0x0f, 0x17, 0x0d, 0x31, 0x34,\r
+  0x30, 0x37, 0x32, 0x38, 0x30, 0x38, 0x35, 0x30, 0x30, 0x33, 0x5a, 0x30, 0x23, 0x06, 0x09, 0x2a,\r
+  0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x04, 0x31, 0x16, 0x04, 0x14, 0x7a, 0xad, 0x35, 0xdc,\r
+  0x5b, 0xd6, 0x00, 0xd7, 0x44, 0xac, 0x80, 0x8f, 0x4f, 0xb6, 0xb4, 0x03, 0x62, 0x34, 0x53, 0xdc,\r
+  0x30, 0x2b, 0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x10, 0x02, 0x0c, 0x31,\r
+  0x1c, 0x30, 0x1a, 0x30, 0x18, 0x30, 0x16, 0x04, 0x14, 0x3d, 0xbb, 0x6d, 0xb5, 0x08, 0x5c, 0x6d,\r
+  0xd5, 0xa1, 0xca, 0x7f, 0x9c, 0xf8, 0x4e, 0xcb, 0x1a, 0x39, 0x10, 0xca, 0xc8, 0x30, 0x0d, 0x06,\r
+  0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00,\r
+  0x73, 0x64, 0xb9, 0xa3, 0x54, 0x6f, 0x50, 0x97, 0x01, 0xa7, 0xf6, 0x0d, 0xb8, 0xce, 0x4b, 0xaa,\r
+  0x43, 0xa2, 0x8f, 0xa3, 0xea, 0x93, 0xf2, 0xa3, 0xd0, 0x46, 0xde, 0xdd, 0x45, 0xe5, 0x94, 0x5a,\r
+  0x45, 0xc2, 0x13, 0x1b, 0x90, 0x9b, 0xcf, 0x73, 0xcd, 0x28, 0x70, 0xf0, 0xf4, 0x54, 0xb5, 0x2d,\r
+  0x31, 0xf9, 0xf3, 0x2d, 0x38, 0x78, 0xfe, 0x68, 0xea, 0x3c, 0xc0, 0xbe, 0x0b, 0x5a, 0x91, 0x49,\r
+  0x63, 0xeb, 0x26, 0x32, 0x5b, 0x86, 0xcf, 0xe5, 0x8a, 0xa5, 0x9d, 0xe6, 0x4b, 0x57, 0x91, 0x8f,\r
+  0x3c, 0xdc, 0xa6, 0x53, 0xd8, 0xdb, 0x8a, 0xfd, 0x3e, 0x7e, 0x19, 0x6f, 0x27, 0x72, 0x95, 0xc2,\r
+  0x79, 0x73, 0xdf, 0xfb, 0x08, 0x5c, 0x5b, 0xc8, 0xb7, 0x94, 0x75, 0x88, 0x7a, 0x9a, 0x85, 0x9f,\r
+  0x1b, 0xa3, 0x98, 0x30, 0x91, 0xee, 0xc0, 0x52, 0xd2, 0x75, 0x9c, 0xcb, 0x45, 0x0d, 0x94, 0x43,\r
+  0x67, 0x7a, 0x49, 0x1c, 0xb1, 0x89, 0x9d, 0x6e, 0xfa, 0x87, 0xd2, 0x4d, 0x6e, 0x74, 0x90, 0xf5,\r
+  0x80, 0x8c, 0x92, 0xda, 0xd9, 0xa1, 0x48, 0x20, 0x31, 0x02, 0x79, 0xde, 0xe3, 0xbd, 0x09, 0x04,\r
+  0xa8, 0xd4, 0x99, 0xd7, 0x3b, 0xea, 0xf8, 0xdf, 0xb3, 0xb9, 0xd7, 0xa3, 0x36, 0xa1, 0xdb, 0xd3,\r
+  0xec, 0x65, 0x8c, 0xb8, 0x8f, 0xfb, 0xd6, 0xef, 0x9c, 0x32, 0x3e, 0xab, 0x20, 0x74, 0xb9, 0x65,\r
+  0x4c, 0xc6, 0x15, 0x2f, 0x31, 0x2a, 0x34, 0x3e, 0x84, 0x09, 0xb4, 0x75, 0xbc, 0xbe, 0xaf, 0xb3,\r
+  0x9e, 0x85, 0xf1, 0xbb, 0x99, 0x1a, 0x07, 0xbd, 0x20, 0xa6, 0xed, 0xcf, 0xd1, 0xa6, 0x9a, 0x22,\r
+  0xb2, 0x6d, 0x75, 0xf4, 0x23, 0x58, 0x13, 0x78, 0x73, 0x1a, 0xb2, 0x84, 0xde, 0xad, 0xe8, 0x6d,\r
+  0xe6, 0xe7, 0x5c, 0xb6, 0xe6, 0x5b, 0x10, 0x37, 0x1f, 0xe3, 0x6e, 0xbd, 0x83, 0xd7, 0x51, 0xb1,\r
+  0x00, 0x00, 0x00, 0x00, 0x0a\r
+  };\r
+\r
+//\r
+// The RFC3161 timestamping counterSignature retrieved from the above AuthenticodeWithTS.\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TSCounterSignature[] = {\r
+  0x30, 0x82, 0x08, 0x1c, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0,\r
+  0x82, 0x08, 0x0d, 0x30, 0x82, 0x08, 0x09, 0x02, 0x01, 0x03, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x05,\r
+  0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x30, 0x81, 0xf6, 0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86,\r
+  0xf7, 0x0d, 0x01, 0x09, 0x10, 0x01, 0x04, 0xa0, 0x81, 0xe6, 0x04, 0x81, 0xe3, 0x30, 0x81, 0xe0,\r
+  0x02, 0x01, 0x01, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xb2, 0x31, 0x02, 0x01, 0x01, 0x30,\r
+  0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xcd, 0x06,\r
+  0xf0, 0xbd, 0x8b, 0xcd, 0x5c, 0x2e, 0x5a, 0x7c, 0x42, 0x56, 0x2c, 0x20, 0x4a, 0x15, 0xcb, 0x1d,\r
+  0x8b, 0x0e, 0x02, 0x15, 0x00, 0xb6, 0xff, 0x47, 0x05, 0xb6, 0x2d, 0x15, 0xac, 0x3f, 0x5d, 0xd9,\r
+  0xcf, 0x9d, 0x54, 0x35, 0x56, 0x7c, 0xc1, 0x6e, 0x8b, 0x18, 0x0f, 0x32, 0x30, 0x31, 0x34, 0x30,\r
+  0x37, 0x32, 0x38, 0x30, 0x38, 0x35, 0x30, 0x30, 0x33, 0x5a, 0xa0, 0x81, 0x83, 0xa4, 0x81, 0x80,\r
+  0x30, 0x7e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42, 0x31,\r
+  0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x12, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65,\r
+  0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x74, 0x65, 0x72, 0x31, 0x10, 0x30, 0x0e,\r
+  0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x53, 0x61, 0x6c, 0x66, 0x6f, 0x72, 0x64, 0x31, 0x1a,\r
+  0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x11, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20,\r
+  0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03,\r
+  0x55, 0x04, 0x03, 0x13, 0x1b, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x54, 0x69, 0x6d, 0x65,\r
+  0x20, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x69, 0x6e, 0x67, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72,\r
+  0xa0, 0x82, 0x04, 0x97, 0x30, 0x82, 0x04, 0x93, 0x30, 0x82, 0x03, 0x7b, 0xa0, 0x03, 0x02, 0x01,\r
+  0x02, 0x02, 0x10, 0x47, 0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2,\r
+  0x87, 0x07, 0xbe, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,\r
+  0x05, 0x00, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,\r
+  0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31,\r
+  0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c,\r
+  0x61, 0x6b, 0x65, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04,\r
+  0x0a, 0x13, 0x15, 0x54, 0x68, 0x65, 0x20, 0x55, 0x53, 0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54,\r
+  0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04,\r
+  0x0b, 0x13, 0x18, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73,\r
+  0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1d, 0x30, 0x1b, 0x06,\r
+  0x03, 0x55, 0x04, 0x03, 0x13, 0x14, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69,\r
+  0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30,\r
+  0x30, 0x35, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31, 0x35, 0x30,\r
+  0x35, 0x31, 0x30, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x7e, 0x31, 0x0b, 0x30, 0x09,\r
+  0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x47, 0x42, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55,\r
+  0x04, 0x08, 0x13, 0x12, 0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63,\r
+  0x68, 0x65, 0x73, 0x74, 0x65, 0x72, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,\r
+  0x07, 0x53, 0x61, 0x6c, 0x66, 0x6f, 0x72, 0x64, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04,\r
+  0x0a, 0x13, 0x11, 0x43, 0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d,\r
+  0x69, 0x74, 0x65, 0x64, 0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1b, 0x43,\r
+  0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6d, 0x70,\r
+  0x69, 0x6e, 0x67, 0x20, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d,\r
+  0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01,\r
+  0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbc, 0x35, 0xa0, 0x36, 0x70,\r
+  0x22, 0x81, 0x11, 0xc3, 0xb2, 0x83, 0xb9, 0xd3, 0x28, 0xc6, 0x36, 0xcd, 0x25, 0x6b, 0xa9, 0x7b,\r
+  0xb2, 0x1c, 0xf6, 0x9b, 0x51, 0x9c, 0xef, 0x35, 0xf4, 0xed, 0x08, 0x8e, 0x5e, 0x38, 0x08, 0xf8,\r
+  0x77, 0x3c, 0x0a, 0x42, 0xe0, 0xf3, 0x70, 0xdc, 0xa3, 0xd7, 0xca, 0xf5, 0x4c, 0x0b, 0xcf, 0xff,\r
+  0x22, 0x9c, 0x0a, 0x7e, 0x68, 0xd6, 0x09, 0xa2, 0x2a, 0x84, 0x7b, 0xa6, 0x9d, 0xb4, 0xa9, 0xc1,\r
+  0x33, 0xe2, 0xef, 0x1f, 0x17, 0x48, 0xca, 0x3a, 0xcd, 0x46, 0xe6, 0xc5, 0xaa, 0x77, 0xbd, 0xe3,\r
+  0x77, 0x9a, 0xfa, 0x47, 0x53, 0x40, 0x28, 0x59, 0x43, 0x93, 0xf1, 0xa4, 0x81, 0xea, 0xef, 0x80,\r
+  0xb5, 0x4f, 0xa7, 0x08, 0xce, 0xba, 0x6e, 0xbc, 0xca, 0x76, 0x0c, 0x97, 0x64, 0x59, 0x86, 0x24,\r
+  0xbb, 0x3d, 0x82, 0x90, 0xa8, 0x55, 0xb1, 0x92, 0xd3, 0xa0, 0xa7, 0x05, 0xac, 0x9f, 0x53, 0x25,\r
+  0x08, 0x10, 0x47, 0x99, 0xcd, 0x98, 0xde, 0x68, 0xe5, 0xb4, 0x50, 0x78, 0xa3, 0xaf, 0x01, 0xcc,\r
+  0x59, 0x43, 0x58, 0xe4, 0x76, 0x6e, 0x7e, 0xac, 0xc7, 0xe2, 0x9e, 0x1f, 0x4f, 0xb0, 0x47, 0x2d,\r
+  0xc8, 0x0c, 0xa3, 0x49, 0x27, 0x80, 0x75, 0x8c, 0xbb, 0x06, 0x91, 0x65, 0x0f, 0x90, 0x9b, 0xf4,\r
+  0xba, 0xd1, 0x81, 0xc8, 0x5c, 0x6a, 0xec, 0x14, 0xe9, 0x25, 0x09, 0xbf, 0x23, 0x16, 0xf4, 0x95,\r
+  0x46, 0x40, 0x40, 0x21, 0xbb, 0x83, 0x96, 0xfd, 0x86, 0x1f, 0x7a, 0xc8, 0x0d, 0x10, 0x8e, 0xa2,\r
+  0xf8, 0x19, 0x07, 0x58, 0x7f, 0x9f, 0xbd, 0x37, 0x02, 0x60, 0xf2, 0xa4, 0xe9, 0x9d, 0x44, 0x3f,\r
+  0x30, 0x05, 0xe4, 0xa7, 0x70, 0x99, 0x51, 0x9a, 0xe8, 0x17, 0xf1, 0x55, 0xca, 0xb2, 0x61, 0x89,\r
+  0x65, 0x46, 0xa7, 0x6a, 0xf2, 0x58, 0x46, 0x7e, 0xaa, 0xa0, 0x07, 0x02, 0x03, 0x01, 0x00, 0x01,\r
+  0xa3, 0x81, 0xf4, 0x30, 0x81, 0xf1, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30,\r
+  0x16, 0x80, 0x14, 0xda, 0xed, 0x64, 0x74, 0x14, 0x9c, 0x14, 0x3c, 0xab, 0xdd, 0x99, 0xa9, 0xbd,\r
+  0x5b, 0x28, 0x4d, 0x8b, 0x3c, 0xc9, 0xd8, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16,\r
+  0x04, 0x14, 0x2e, 0x2d, 0xb0, 0x0a, 0x44, 0x4a, 0xd3, 0x87, 0xc0, 0x02, 0x07, 0xce, 0x97, 0x7d,\r
+  0x50, 0x62, 0x20, 0xfd, 0x0f, 0x83, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff,\r
+  0x04, 0x04, 0x03, 0x02, 0x06, 0xc0, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff,\r
+  0x04, 0x02, 0x30, 0x00, 0x30, 0x16, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x01, 0x01, 0xff, 0x04, 0x0c,\r
+  0x30, 0x0a, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x08, 0x30, 0x42, 0x06, 0x03,\r
+  0x55, 0x1d, 0x1f, 0x04, 0x3b, 0x30, 0x39, 0x30, 0x37, 0xa0, 0x35, 0xa0, 0x33, 0x86, 0x31, 0x68,\r
+  0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72,\r
+  0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52,\r
+  0x46, 0x69, 0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x63, 0x72, 0x6c,\r
+  0x30, 0x35, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x29, 0x30, 0x27,\r
+  0x30, 0x25, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x19, 0x68, 0x74,\r
+  0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72,\r
+  0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7,\r
+  0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0xc8, 0xfb, 0x63, 0xf8, 0x0b,\r
+  0x75, 0x75, 0x2c, 0x3a, 0xf1, 0xf2, 0x13, 0xa7, 0x2d, 0xb6, 0xa3, 0x1a, 0x9c, 0xad, 0x01, 0x07,\r
+  0xd3, 0x34, 0x8e, 0x77, 0xe0, 0xc2, 0x6e, 0xae, 0x02, 0x5d, 0x48, 0x4f, 0xa4, 0xd2, 0x21, 0xb6,\r
+  0x36, 0xfd, 0x2a, 0x35, 0x43, 0x7c, 0x6b, 0xdf, 0x80, 0x87, 0x0b, 0x15, 0xf0, 0x76, 0x32, 0x00,\r
+  0xb4, 0xce, 0xb5, 0x67, 0xa4, 0x2f, 0x2f, 0x20, 0x1b, 0x9c, 0x54, 0x9e, 0x83, 0x3f, 0x1f, 0x5f,\r
+  0x14, 0x95, 0x62, 0x82, 0x0f, 0x22, 0x41, 0x22, 0x1f, 0x70, 0xb3, 0xf3, 0xf7, 0x42, 0xde, 0x6c,\r
+  0x51, 0xcd, 0x4b, 0xf8, 0x21, 0xac, 0x9b, 0x3b, 0x8c, 0xb1, 0xe5, 0xe6, 0x28, 0x8f, 0xce, 0x2a,\r
+  0x8a, 0xf9, 0xaa, 0x52, 0x4d, 0x8c, 0x5b, 0x77, 0xba, 0x4d, 0x5a, 0x58, 0xdb, 0xbb, 0x6a, 0x04,\r
+  0xcc, 0x52, 0x1e, 0x9d, 0xe2, 0x28, 0x37, 0x0e, 0xbb, 0xe7, 0x0e, 0x91, 0xc7, 0xf8, 0xdb, 0xf1,\r
+  0x81, 0x98, 0xeb, 0xcd, 0x37, 0xb3, 0x0e, 0xab, 0x65, 0xd3, 0x62, 0xec, 0x3a, 0xa5, 0x76, 0xeb,\r
+  0x13, 0xa8, 0x35, 0x93, 0xc9, 0x2e, 0x0a, 0x01, 0xec, 0xc0, 0xe8, 0xcc, 0x3d, 0x7e, 0xb6, 0xeb,\r
+  0xe2, 0xc1, 0xec, 0xd3, 0x14, 0x92, 0x82, 0x66, 0x87, 0x50, 0xdc, 0xfd, 0x50, 0x97, 0xac, 0xb3,\r
+  0x4a, 0x76, 0x73, 0x06, 0xc4, 0x86, 0x11, 0x3a, 0xb3, 0x5f, 0x43, 0x04, 0x52, 0x6f, 0xea, 0xb3,\r
+  0xd0, 0x74, 0x36, 0x4c, 0xca, 0xf1, 0x1b, 0x79, 0x84, 0x37, 0x70, 0x63, 0xad, 0x74, 0xb9, 0xaa,\r
+  0x0e, 0xf3, 0x98, 0xb0, 0x86, 0x08, 0xeb, 0xdb, 0xe0, 0x1f, 0x8c, 0x10, 0xf2, 0x39, 0x64, 0x9b,\r
+  0xae, 0x4f, 0x0a, 0x2c, 0x92, 0x8a, 0x4f, 0x18, 0xb5, 0x91, 0xe5, 0x8d, 0x1a, 0x93, 0x5f, 0x1f,\r
+  0xae, 0xf1, 0xa6, 0xf0, 0x2e, 0x97, 0xd0, 0xd2, 0xf6, 0x2b, 0x3c, 0x31, 0x82, 0x02, 0x61, 0x30,\r
+  0x82, 0x02, 0x5d, 0x02, 0x01, 0x01, 0x30, 0x81, 0xaa, 0x30, 0x81, 0x95, 0x31, 0x0b, 0x30, 0x09,\r
+  0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55,\r
+  0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13,\r
+  0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c, 0x61, 0x6b, 0x65, 0x20, 0x43, 0x69, 0x74, 0x79, 0x31,\r
+  0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15, 0x54, 0x68, 0x65, 0x20, 0x55, 0x53,\r
+  0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x31,\r
+  0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x18, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,\r
+  0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e, 0x63,\r
+  0x6f, 0x6d, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x14, 0x55, 0x54, 0x4e,\r
+  0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, 0x72, 0x73, 0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63,\r
+  0x74, 0x02, 0x10, 0x47, 0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2,\r
+  0x87, 0x07, 0xbe, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0xa0, 0x81,\r
+  0x8c, 0x30, 0x1a, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x03, 0x31, 0x0d,\r
+  0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x10, 0x01, 0x04, 0x30, 0x1c, 0x06,\r
+  0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x05, 0x31, 0x0f, 0x17, 0x0d, 0x31, 0x34,\r
+  0x30, 0x37, 0x32, 0x38, 0x30, 0x38, 0x35, 0x30, 0x30, 0x33, 0x5a, 0x30, 0x23, 0x06, 0x09, 0x2a,\r
+  0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x04, 0x31, 0x16, 0x04, 0x14, 0x7a, 0xad, 0x35, 0xdc,\r
+  0x5b, 0xd6, 0x00, 0xd7, 0x44, 0xac, 0x80, 0x8f, 0x4f, 0xb6, 0xb4, 0x03, 0x62, 0x34, 0x53, 0xdc,\r
+  0x30, 0x2b, 0x06, 0x0b, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x10, 0x02, 0x0c, 0x31,\r
+  0x1c, 0x30, 0x1a, 0x30, 0x18, 0x30, 0x16, 0x04, 0x14, 0x3d, 0xbb, 0x6d, 0xb5, 0x08, 0x5c, 0x6d,\r
+  0xd5, 0xa1, 0xca, 0x7f, 0x9c, 0xf8, 0x4e, 0xcb, 0x1a, 0x39, 0x10, 0xca, 0xc8, 0x30, 0x0d, 0x06,\r
+  0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x82, 0x01, 0x00,\r
+  0x73, 0x64, 0xb9, 0xa3, 0x54, 0x6f, 0x50, 0x97, 0x01, 0xa7, 0xf6, 0x0d, 0xb8, 0xce, 0x4b, 0xaa,\r
+  0x43, 0xa2, 0x8f, 0xa3, 0xea, 0x93, 0xf2, 0xa3, 0xd0, 0x46, 0xde, 0xdd, 0x45, 0xe5, 0x94, 0x5a,\r
+  0x45, 0xc2, 0x13, 0x1b, 0x90, 0x9b, 0xcf, 0x73, 0xcd, 0x28, 0x70, 0xf0, 0xf4, 0x54, 0xb5, 0x2d,\r
+  0x31, 0xf9, 0xf3, 0x2d, 0x38, 0x78, 0xfe, 0x68, 0xea, 0x3c, 0xc0, 0xbe, 0x0b, 0x5a, 0x91, 0x49,\r
+  0x63, 0xeb, 0x26, 0x32, 0x5b, 0x86, 0xcf, 0xe5, 0x8a, 0xa5, 0x9d, 0xe6, 0x4b, 0x57, 0x91, 0x8f,\r
+  0x3c, 0xdc, 0xa6, 0x53, 0xd8, 0xdb, 0x8a, 0xfd, 0x3e, 0x7e, 0x19, 0x6f, 0x27, 0x72, 0x95, 0xc2,\r
+  0x79, 0x73, 0xdf, 0xfb, 0x08, 0x5c, 0x5b, 0xc8, 0xb7, 0x94, 0x75, 0x88, 0x7a, 0x9a, 0x85, 0x9f,\r
+  0x1b, 0xa3, 0x98, 0x30, 0x91, 0xee, 0xc0, 0x52, 0xd2, 0x75, 0x9c, 0xcb, 0x45, 0x0d, 0x94, 0x43,\r
+  0x67, 0x7a, 0x49, 0x1c, 0xb1, 0x89, 0x9d, 0x6e, 0xfa, 0x87, 0xd2, 0x4d, 0x6e, 0x74, 0x90, 0xf5,\r
+  0x80, 0x8c, 0x92, 0xda, 0xd9, 0xa1, 0x48, 0x20, 0x31, 0x02, 0x79, 0xde, 0xe3, 0xbd, 0x09, 0x04,\r
+  0xa8, 0xd4, 0x99, 0xd7, 0x3b, 0xea, 0xf8, 0xdf, 0xb3, 0xb9, 0xd7, 0xa3, 0x36, 0xa1, 0xdb, 0xd3,\r
+  0xec, 0x65, 0x8c, 0xb8, 0x8f, 0xfb, 0xd6, 0xef, 0x9c, 0x32, 0x3e, 0xab, 0x20, 0x74, 0xb9, 0x65,\r
+  0x4c, 0xc6, 0x15, 0x2f, 0x31, 0x2a, 0x34, 0x3e, 0x84, 0x09, 0xb4, 0x75, 0xbc, 0xbe, 0xaf, 0xb3,\r
+  0x9e, 0x85, 0xf1, 0xbb, 0x99, 0x1a, 0x07, 0xbd, 0x20, 0xa6, 0xed, 0xcf, 0xd1, 0xa6, 0x9a, 0x22,\r
+  0xb2, 0x6d, 0x75, 0xf4, 0x23, 0x58, 0x13, 0x78, 0x73, 0x1a, 0xb2, 0x84, 0xde, 0xad, 0xe8, 0x6d,\r
+  0xe6, 0xe7, 0x5c, 0xb6, 0xe6, 0x5b, 0x10, 0x37, 0x1f, 0xe3, 0x6e, 0xbd, 0x83, 0xd7, 0x51, 0xb1,\r
+  0x00, 0x00, 0x00, 0x00, 0x0a\r
+  };\r
+\r
+//\r
+// The Comodo Time Stamping Signer Certificate Used for the verification of TimeStamp signature.\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINT8 TSTrustedCert[] = {\r
+  0x30, 0x82, 0x04, 0x93, 0x30, 0x82, 0x03, 0x7b, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x47,\r
+  0x8a, 0x8e, 0xfb, 0x59, 0xe1, 0xd8, 0x3f, 0x0c, 0xe1, 0x42, 0xd2, 0xa2, 0x87, 0x07, 0xbe, 0x30,\r
+  0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x30, 0x81,\r
+  0x95, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x55, 0x53, 0x31, 0x0b,\r
+  0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x02, 0x55, 0x54, 0x31, 0x17, 0x30, 0x15, 0x06,\r
+  0x03, 0x55, 0x04, 0x07, 0x13, 0x0e, 0x53, 0x61, 0x6c, 0x74, 0x20, 0x4c, 0x61, 0x6b, 0x65, 0x20,\r
+  0x43, 0x69, 0x74, 0x79, 0x31, 0x1e, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x15, 0x54,\r
+  0x68, 0x65, 0x20, 0x55, 0x53, 0x45, 0x52, 0x54, 0x52, 0x55, 0x53, 0x54, 0x20, 0x4e, 0x65, 0x74,\r
+  0x77, 0x6f, 0x72, 0x6b, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x18, 0x68,\r
+  0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72,\r
+  0x75, 0x73, 0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x31, 0x1d, 0x30, 0x1b, 0x06, 0x03, 0x55, 0x04, 0x03,\r
+  0x13, 0x14, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, 0x72, 0x73, 0x74, 0x2d,\r
+  0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x30, 0x30, 0x35, 0x31, 0x30,\r
+  0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a, 0x17, 0x0d, 0x31, 0x35, 0x30, 0x35, 0x31, 0x30, 0x32,\r
+  0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x7e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04,\r
+  0x06, 0x13, 0x02, 0x47, 0x42, 0x31, 0x1b, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x12,\r
+  0x47, 0x72, 0x65, 0x61, 0x74, 0x65, 0x72, 0x20, 0x4d, 0x61, 0x6e, 0x63, 0x68, 0x65, 0x73, 0x74,\r
+  0x65, 0x72, 0x31, 0x10, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x07, 0x53, 0x61, 0x6c,\r
+  0x66, 0x6f, 0x72, 0x64, 0x31, 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x11, 0x43,\r
+  0x4f, 0x4d, 0x4f, 0x44, 0x4f, 0x20, 0x43, 0x41, 0x20, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x64,\r
+  0x31, 0x24, 0x30, 0x22, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1b, 0x43, 0x4f, 0x4d, 0x4f, 0x44,\r
+  0x4f, 0x20, 0x54, 0x69, 0x6d, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x69, 0x6e, 0x67, 0x20,\r
+  0x53, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86,\r
+  0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82,\r
+  0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbc, 0x35, 0xa0, 0x36, 0x70, 0x22, 0x81, 0x11, 0xc3,\r
+  0xb2, 0x83, 0xb9, 0xd3, 0x28, 0xc6, 0x36, 0xcd, 0x25, 0x6b, 0xa9, 0x7b, 0xb2, 0x1c, 0xf6, 0x9b,\r
+  0x51, 0x9c, 0xef, 0x35, 0xf4, 0xed, 0x08, 0x8e, 0x5e, 0x38, 0x08, 0xf8, 0x77, 0x3c, 0x0a, 0x42,\r
+  0xe0, 0xf3, 0x70, 0xdc, 0xa3, 0xd7, 0xca, 0xf5, 0x4c, 0x0b, 0xcf, 0xff, 0x22, 0x9c, 0x0a, 0x7e,\r
+  0x68, 0xd6, 0x09, 0xa2, 0x2a, 0x84, 0x7b, 0xa6, 0x9d, 0xb4, 0xa9, 0xc1, 0x33, 0xe2, 0xef, 0x1f,\r
+  0x17, 0x48, 0xca, 0x3a, 0xcd, 0x46, 0xe6, 0xc5, 0xaa, 0x77, 0xbd, 0xe3, 0x77, 0x9a, 0xfa, 0x47,\r
+  0x53, 0x40, 0x28, 0x59, 0x43, 0x93, 0xf1, 0xa4, 0x81, 0xea, 0xef, 0x80, 0xb5, 0x4f, 0xa7, 0x08,\r
+  0xce, 0xba, 0x6e, 0xbc, 0xca, 0x76, 0x0c, 0x97, 0x64, 0x59, 0x86, 0x24, 0xbb, 0x3d, 0x82, 0x90,\r
+  0xa8, 0x55, 0xb1, 0x92, 0xd3, 0xa0, 0xa7, 0x05, 0xac, 0x9f, 0x53, 0x25, 0x08, 0x10, 0x47, 0x99,\r
+  0xcd, 0x98, 0xde, 0x68, 0xe5, 0xb4, 0x50, 0x78, 0xa3, 0xaf, 0x01, 0xcc, 0x59, 0x43, 0x58, 0xe4,\r
+  0x76, 0x6e, 0x7e, 0xac, 0xc7, 0xe2, 0x9e, 0x1f, 0x4f, 0xb0, 0x47, 0x2d, 0xc8, 0x0c, 0xa3, 0x49,\r
+  0x27, 0x80, 0x75, 0x8c, 0xbb, 0x06, 0x91, 0x65, 0x0f, 0x90, 0x9b, 0xf4, 0xba, 0xd1, 0x81, 0xc8,\r
+  0x5c, 0x6a, 0xec, 0x14, 0xe9, 0x25, 0x09, 0xbf, 0x23, 0x16, 0xf4, 0x95, 0x46, 0x40, 0x40, 0x21,\r
+  0xbb, 0x83, 0x96, 0xfd, 0x86, 0x1f, 0x7a, 0xc8, 0x0d, 0x10, 0x8e, 0xa2, 0xf8, 0x19, 0x07, 0x58,\r
+  0x7f, 0x9f, 0xbd, 0x37, 0x02, 0x60, 0xf2, 0xa4, 0xe9, 0x9d, 0x44, 0x3f, 0x30, 0x05, 0xe4, 0xa7,\r
+  0x70, 0x99, 0x51, 0x9a, 0xe8, 0x17, 0xf1, 0x55, 0xca, 0xb2, 0x61, 0x89, 0x65, 0x46, 0xa7, 0x6a,\r
+  0xf2, 0x58, 0x46, 0x7e, 0xaa, 0xa0, 0x07, 0x02, 0x03, 0x01, 0x00, 0x01, 0xa3, 0x81, 0xf4, 0x30,\r
+  0x81, 0xf1, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xda,\r
+  0xed, 0x64, 0x74, 0x14, 0x9c, 0x14, 0x3c, 0xab, 0xdd, 0x99, 0xa9, 0xbd, 0x5b, 0x28, 0x4d, 0x8b,\r
+  0x3c, 0xc9, 0xd8, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x2e, 0x2d,\r
+  0xb0, 0x0a, 0x44, 0x4a, 0xd3, 0x87, 0xc0, 0x02, 0x07, 0xce, 0x97, 0x7d, 0x50, 0x62, 0x20, 0xfd,\r
+  0x0f, 0x83, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, 0x03, 0x02,\r
+  0x06, 0xc0, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x02, 0x30, 0x00,\r
+  0x30, 0x16, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x01, 0x01, 0xff, 0x04, 0x0c, 0x30, 0x0a, 0x06, 0x08,\r
+  0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x08, 0x30, 0x42, 0x06, 0x03, 0x55, 0x1d, 0x1f, 0x04,\r
+  0x3b, 0x30, 0x39, 0x30, 0x37, 0xa0, 0x35, 0xa0, 0x33, 0x86, 0x31, 0x68, 0x74, 0x74, 0x70, 0x3a,\r
+  0x2f, 0x2f, 0x63, 0x72, 0x6c, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e,\r
+  0x63, 0x6f, 0x6d, 0x2f, 0x55, 0x54, 0x4e, 0x2d, 0x55, 0x53, 0x45, 0x52, 0x46, 0x69, 0x72, 0x73,\r
+  0x74, 0x2d, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x35, 0x06, 0x08,\r
+  0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x29, 0x30, 0x27, 0x30, 0x25, 0x06, 0x08,\r
+  0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x86, 0x19, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f,\r
+  0x2f, 0x6f, 0x63, 0x73, 0x70, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x74, 0x72, 0x75, 0x73, 0x74, 0x2e,\r
+  0x63, 0x6f, 0x6d, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05,\r
+  0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0xc8, 0xfb, 0x63, 0xf8, 0x0b, 0x75, 0x75, 0x2c, 0x3a,\r
+  0xf1, 0xf2, 0x13, 0xa7, 0x2d, 0xb6, 0xa3, 0x1a, 0x9c, 0xad, 0x01, 0x07, 0xd3, 0x34, 0x8e, 0x77,\r
+  0xe0, 0xc2, 0x6e, 0xae, 0x02, 0x5d, 0x48, 0x4f, 0xa4, 0xd2, 0x21, 0xb6, 0x36, 0xfd, 0x2a, 0x35,\r
+  0x43, 0x7c, 0x6b, 0xdf, 0x80, 0x87, 0x0b, 0x15, 0xf0, 0x76, 0x32, 0x00, 0xb4, 0xce, 0xb5, 0x67,\r
+  0xa4, 0x2f, 0x2f, 0x20, 0x1b, 0x9c, 0x54, 0x9e, 0x83, 0x3f, 0x1f, 0x5f, 0x14, 0x95, 0x62, 0x82,\r
+  0x0f, 0x22, 0x41, 0x22, 0x1f, 0x70, 0xb3, 0xf3, 0xf7, 0x42, 0xde, 0x6c, 0x51, 0xcd, 0x4b, 0xf8,\r
+  0x21, 0xac, 0x9b, 0x3b, 0x8c, 0xb1, 0xe5, 0xe6, 0x28, 0x8f, 0xce, 0x2a, 0x8a, 0xf9, 0xaa, 0x52,\r
+  0x4d, 0x8c, 0x5b, 0x77, 0xba, 0x4d, 0x5a, 0x58, 0xdb, 0xbb, 0x6a, 0x04, 0xcc, 0x52, 0x1e, 0x9d,\r
+  0xe2, 0x28, 0x37, 0x0e, 0xbb, 0xe7, 0x0e, 0x91, 0xc7, 0xf8, 0xdb, 0xf1, 0x81, 0x98, 0xeb, 0xcd,\r
+  0x37, 0xb3, 0x0e, 0xab, 0x65, 0xd3, 0x62, 0xec, 0x3a, 0xa5, 0x76, 0xeb, 0x13, 0xa8, 0x35, 0x93,\r
+  0xc9, 0x2e, 0x0a, 0x01, 0xec, 0xc0, 0xe8, 0xcc, 0x3d, 0x7e, 0xb6, 0xeb, 0xe2, 0xc1, 0xec, 0xd3,\r
+  0x14, 0x92, 0x82, 0x66, 0x87, 0x50, 0xdc, 0xfd, 0x50, 0x97, 0xac, 0xb3, 0x4a, 0x76, 0x73, 0x06,\r
+  0xc4, 0x86, 0x11, 0x3a, 0xb3, 0x5f, 0x43, 0x04, 0x52, 0x6f, 0xea, 0xb3, 0xd0, 0x74, 0x36, 0x4c,\r
+  0xca, 0xf1, 0x1b, 0x79, 0x84, 0x37, 0x70, 0x63, 0xad, 0x74, 0xb9, 0xaa, 0x0e, 0xf3, 0x98, 0xb0,\r
+  0x86, 0x08, 0xeb, 0xdb, 0xe0, 0x1f, 0x8c, 0x10, 0xf2, 0x39, 0x64, 0x9b, 0xae, 0x4f, 0x0a, 0x2c,\r
+  0x92, 0x8a, 0x4f, 0x18, 0xb5, 0x91, 0xe5, 0x8d, 0x1a, 0x93, 0x5f, 0x1f, 0xae, 0xf1, 0xa6, 0xf0,\r
+  0x2e, 0x97, 0xd0, 0xd2, 0xf6, 0x2b, 0x3c, 0x0a\r
+  };\r
+\r
+/**\r
+  Validate MSFT Authenticode & Timestamping CounterSignature.\r
+\r
+  @retval  TRUE  Validation succeeded.\r
+  @retval  FALSE Validation failed.\r
+\r
+**/\r
+BOOLEAN\r
+VerifyTSCounterSignature (\r
+  VOID\r
+  )\r
+{\r
+  BOOLEAN   Status;\r
+  EFI_TIME  SigningTime;\r
+\r
+  Status = FALSE;\r
+\r
+  Print (L"\n- Verify RFC3161 TimeStamp CounterSignature in PE/COFF Authenticode ... ");\r
+  //\r
+  // Verify RFC3161 Timestamp CounterSignature.\r
+  //\r
+  Status = ImageTimestampVerify (\r
+             AuthenticodeWithTS,\r
+             sizeof (AuthenticodeWithTS),\r
+             TSTrustedCert,\r
+             sizeof (TSTrustedCert),\r
+             &SigningTime\r
+             );\r
+  if (Status) {\r
+    Print (L"[Pass]\n");\r
+    Print (L" --> The PE/COFF was signed at <%t>", &SigningTime);\r
+  } else {\r
+    Print (L"[Fail]");\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Validate UEFI-OpenSSL RFC3161 Timestamp CounterSignature Verification Interfaces.\r
+\r
+  @retval  EFI_SUCCESS  Validation succeeded.\r
+  @retval  EFI_ABORTED  Validation failed.\r
+\r
+**/\r
+EFI_STATUS\r
+ValidateTSCounterSignature (\r
+  VOID\r
+  )\r
+{\r
+  BOOLEAN Status;\r
+\r
+  Print (L"\nUEFI-OpenSSL RFC3161 Timestamp Signature Testing: ");\r
+\r
+  Status = VerifyTSCounterSignature ();\r
+\r
+  Print (L"\n");\r
+\r
+  if (Status) {\r
+    return EFI_SUCCESS;\r
+  } else {\r
+    return EFI_ABORTED;\r
+  }\r
+}\r
index 504f405396b9bcc69eb06d5c06ab642a4d969016..e36041bf4f782c3c60e14c73f770b682fc299e8e 100644 (file)
@@ -4,7 +4,7 @@
   primitives (Hash Serials, HMAC, RSA, Diffie-Hellman, etc) for UEFI security\r
   functionality enabling.\r
 \r
-Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -38,6 +38,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 ///\r
 #define SHA256_DIGEST_SIZE  32\r
 \r
+///\r
+/// SHA-384 digest size in bytes\r
+///\r
+#define SHA384_DIGEST_SIZE  48\r
+\r
+///\r
+/// SHA-512 digest size in bytes\r
+///\r
+#define SHA512_DIGEST_SIZE  64\r
+\r
 ///\r
 /// TDES block size in bytes\r
 ///\r
@@ -513,6 +523,215 @@ Sha256Final (
   OUT     UINT8  *HashValue\r
   );\r
 \r
+/**\r
+  Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.\r
+\r
+  @return  The size, in bytes, of the context buffer required for SHA-384 hash operations.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+Sha384GetContextSize (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for\r
+  subsequent use.\r
+\r
+  If Sha384Context is NULL, then return FALSE.\r
+\r
+  @param[out]  Sha384Context  Pointer to SHA-384 context being initialized.\r
+\r
+  @retval TRUE   SHA-384 context initialization succeeded.\r
+  @retval FALSE  SHA-384 context initialization failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Init (\r
+  OUT  VOID  *Sha384Context\r
+  );\r
+\r
+/**\r
+  Makes a copy of an existing SHA-384 context.\r
+\r
+  If Sha384Context is NULL, then return FALSE.\r
+  If NewSha384Context is NULL, then return FALSE.\r
+  If this interface is not supported, then return FALSE.\r
+\r
+  @param[in]  Sha384Context     Pointer to SHA-384 context being copied.\r
+  @param[out] NewSha384Context  Pointer to new SHA-384 context.\r
+\r
+  @retval TRUE   SHA-384 context copy succeeded.\r
+  @retval FALSE  SHA-384 context copy failed.\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Duplicate (\r
+  IN   CONST VOID  *Sha384Context,\r
+  OUT  VOID        *NewSha384Context\r
+  );\r
+\r
+/**\r
+  Digests the input data and updates SHA-384 context.\r
+\r
+  This function performs SHA-384 digest on a data buffer of the specified size.\r
+  It can be called multiple times to compute the digest of long or discontinuous data streams.\r
+  SHA-384 context should be already correctly intialized by Sha384Init(), and should not be finalized\r
+  by Sha384Final(). Behavior with invalid context is undefined.\r
+\r
+  If Sha384Context is NULL, then return FALSE.\r
+\r
+  @param[in, out]  Sha384Context  Pointer to the SHA-384 context.\r
+  @param[in]       Data           Pointer to the buffer containing the data to be hashed.\r
+  @param[in]       DataSize       Size of Data buffer in bytes.\r
+\r
+  @retval TRUE   SHA-384 data digest succeeded.\r
+  @retval FALSE  SHA-384 data digest failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Update (\r
+  IN OUT  VOID        *Sha384Context,\r
+  IN      CONST VOID  *Data,\r
+  IN      UINTN       DataSize\r
+  );\r
+\r
+/**\r
+  Completes computation of the SHA-384 digest value.\r
+\r
+  This function completes SHA-384 hash computation and retrieves the digest value into\r
+  the specified memory. After this function has been called, the SHA-384 context cannot\r
+  be used again.\r
+  SHA-384 context should be already correctly intialized by Sha384Init(), and should not be\r
+  finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.\r
+\r
+  If Sha384Context is NULL, then return FALSE.\r
+  If HashValue is NULL, then return FALSE.\r
+\r
+  @param[in, out]  Sha384Context  Pointer to the SHA-384 context.\r
+  @param[out]      HashValue      Pointer to a buffer that receives the SHA-384 digest\r
+                                  value (48 bytes).\r
+\r
+  @retval TRUE   SHA-384 digest computation succeeded.\r
+  @retval FALSE  SHA-384 digest computation failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Final (\r
+  IN OUT  VOID   *Sha384Context,\r
+  OUT     UINT8  *HashValue\r
+  );\r
+\r
+/**\r
+  Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.\r
+\r
+  @return  The size, in bytes, of the context buffer required for SHA-512 hash operations.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+Sha512GetContextSize (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for\r
+  subsequent use.\r
+\r
+  If Sha512Context is NULL, then return FALSE.\r
+\r
+  @param[out]  Sha512Context  Pointer to SHA-512 context being initialized.\r
+\r
+  @retval TRUE   SHA-512 context initialization succeeded.\r
+  @retval FALSE  SHA-512 context initialization failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Init (\r
+  OUT  VOID  *Sha512Context\r
+  );\r
+\r
+/**\r
+  Makes a copy of an existing SHA-512 context.\r
+\r
+  If Sha512Context is NULL, then return FALSE.\r
+  If NewSha512Context is NULL, then return FALSE.\r
+  If this interface is not supported, then return FALSE.\r
+\r
+  @param[in]  Sha512Context     Pointer to SHA-512 context being copied.\r
+  @param[out] NewSha512Context  Pointer to new SHA-512 context.\r
+\r
+  @retval TRUE   SHA-512 context copy succeeded.\r
+  @retval FALSE  SHA-512 context copy failed.\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Duplicate (\r
+  IN   CONST VOID  *Sha512Context,\r
+  OUT  VOID        *NewSha512Context\r
+  );\r
+\r
+/**\r
+  Digests the input data and updates SHA-512 context.\r
+\r
+  This function performs SHA-512 digest on a data buffer of the specified size.\r
+  It can be called multiple times to compute the digest of long or discontinuous data streams.\r
+  SHA-512 context should be already correctly intialized by Sha512Init(), and should not be finalized\r
+  by Sha512Final(). Behavior with invalid context is undefined.\r
+\r
+  If Sha512Context is NULL, then return FALSE.\r
+\r
+  @param[in, out]  Sha512Context  Pointer to the SHA-512 context.\r
+  @param[in]       Data           Pointer to the buffer containing the data to be hashed.\r
+  @param[in]       DataSize       Size of Data buffer in bytes.\r
+\r
+  @retval TRUE   SHA-512 data digest succeeded.\r
+  @retval FALSE  SHA-512 data digest failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Update (\r
+  IN OUT  VOID        *Sha512Context,\r
+  IN      CONST VOID  *Data,\r
+  IN      UINTN       DataSize\r
+  );\r
+\r
+/**\r
+  Completes computation of the SHA-512 digest value.\r
+\r
+  This function completes SHA-512 hash computation and retrieves the digest value into\r
+  the specified memory. After this function has been called, the SHA-512 context cannot\r
+  be used again.\r
+  SHA-512 context should be already correctly intialized by Sha512Init(), and should not be\r
+  finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.\r
+\r
+  If Sha512Context is NULL, then return FALSE.\r
+  If HashValue is NULL, then return FALSE.\r
+\r
+  @param[in, out]  Sha512Context  Pointer to the SHA-512 context.\r
+  @param[out]      HashValue      Pointer to a buffer that receives the SHA-512 digest\r
+                                  value (64 bytes).\r
+\r
+  @retval TRUE   SHA-512 digest computation succeeded.\r
+  @retval FALSE  SHA-512 digest computation failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Final (\r
+  IN OUT  VOID   *Sha512Context,\r
+  OUT     UINT8  *HashValue\r
+  );\r
 \r
 //=====================================================================================\r
 //    MAC (Message Authentication Code) Primitive\r
@@ -754,7 +973,6 @@ HmacSha1Final (
   OUT     UINT8  *HmacValue\r
   );\r
 \r
-\r
 //=====================================================================================\r
 //    Symmetric Cryptography Primitive\r
 //=====================================================================================\r
@@ -1395,7 +1613,7 @@ RsaGetKey (
   @param[in, out]  RsaContext           Pointer to RSA context being set.\r
   @param[in]       ModulusLength        Length of RSA modulus N in bits.\r
   @param[in]       PublicExponent       Pointer to RSA public exponent.\r
-  @param[in]       PublicExponentSize   Size of RSA public exponent buffer in bytes. \r
+  @param[in]       PublicExponentSize   Size of RSA public exponent buffer in bytes.\r
 \r
   @retval  TRUE   RSA key component was generated successfully.\r
   @retval  FALSE  Invalid RSA key component tag.\r
@@ -1519,7 +1737,6 @@ RsaPkcs1Verify (
   @retval  TRUE   RSA Private Key was retrieved successfully.\r
   @retval  FALSE  Invalid PEM key data or incorrect password.\r
   @retval  FALSE  This interface is not supported.\r
-  \r
 \r
 **/\r
 BOOLEAN\r
@@ -1648,7 +1865,7 @@ X509ConstructCertificate (
   @param           ...        A list of DER-encoded single certificate data followed\r
                               by certificate size. A NULL terminates the list. The\r
                               pairs are the arguments to X509ConstructCertificate().\r
-                                 \r
+\r
   @retval     TRUE            The X509 stack construction succeeded.\r
   @retval     FALSE           The construction operation failed.\r
   @retval     FALSE           This interface is not supported.\r
@@ -1658,7 +1875,7 @@ BOOLEAN
 EFIAPI\r
 X509ConstructCertificateStack (\r
   IN OUT  UINT8  **X509Stack,\r
-  ...  \r
+  ...\r
   );\r
 \r
 /**\r
@@ -1845,6 +2062,35 @@ AuthenticodeVerify (
   IN  UINTN        HashSize\r
   );\r
 \r
+/**\r
+  Verifies the validility of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode\r
+  signature.\r
+\r
+  If AuthData is NULL, then return FALSE.\r
+\r
+  @param[in]  AuthData     Pointer to the Authenticode Signature retrieved from signed\r
+                           PE/COFF image to be verified.\r
+  @param[in]  DataSize     Size of the Authenticode Signature in bytes.\r
+  @param[in]  TsaCert      Pointer to a trusted/root TSA certificate encoded in DER, which\r
+                           is used for TSA certificate chain verification.\r
+  @param[in]  CertSize     Size of the trusted certificate in bytes.\r
+  @param[out] SigningTime  Return the time of timestamp generation time if the timestamp\r
+                           signature is valid.\r
+\r
+  @retval  TRUE   The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.\r
+  @retval  FALSE  No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ImageTimestampVerify (\r
+  IN  CONST UINT8  *AuthData,\r
+  IN  UINTN        DataSize,\r
+  IN  CONST UINT8  *TsaCert,\r
+  IN  UINTN        CertSize,\r
+  OUT EFI_TIME     *SigningTime\r
+  );\r
+\r
 //=====================================================================================\r
 //    DH Key Exchange Primitive\r
 //=====================================================================================\r
@@ -1882,7 +2128,7 @@ DhFree (
 \r
   Given generator g, and length of prime number p in bits, this function generates p,\r
   and sets DH context according to value of g and p.\r
-  \r
+\r
   Before this function can be invoked, pseudorandom number generator must be correctly\r
   initialized by RandomSeed().\r
 \r
@@ -1945,7 +2191,7 @@ DhSetParameter (
 /**\r
   Generates DH public key.\r
 \r
-  This function generates random secret exponent, and computes the public key, which is \r
+  This function generates random secret exponent, and computes the public key, which is\r
   returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly.\r
   If the PublicKey buffer is too small to hold the public key, FALSE is returned and\r
   PublicKeySize is set to the required buffer size to obtain the public key.\r
@@ -2060,4 +2306,4 @@ RandomBytes (
   IN   UINTN  Size\r
   );\r
 \r
-#endif // __BASE_CRYPT_LIB_H__\r
+#endif // __BASE_CRYPT_LIB_H__
\ No newline at end of file
index a6e6dcafab3be262f495d9b4a693a37e4d64d354..550afd912b9a7a870f35c8a200f173a0840d00d4 100644 (file)
@@ -3,7 +3,7 @@
 #\r
 #  Caution: This module requires additional review when modified.\r
 #  This library will have external input - signature.\r
-#  This external input must be validated carefully to avoid security issues such as \r
+#  This external input must be validated carefully to avoid security issues such as\r
 #  buffer overflow or integer overflow.\r
 #\r
 #  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
-#  \r
+#\r
 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#  \r
+#\r
 ##\r
 \r
 [Defines]\r
@@ -38,6 +38,7 @@
   Hash/CryptMd5.c\r
   Hash/CryptSha1.c\r
   Hash/CryptSha256.c\r
+  Hash/CryptSha512.c\r
   Hmac/CryptHmacMd5.c\r
   Hmac/CryptHmacSha1.c\r
   Cipher/CryptAes.c\r
@@ -50,6 +51,7 @@
   Pk/CryptDh.c\r
   Pk/CryptX509.c\r
   Pk/CryptAuthenticode.c\r
+  Pk/CryptTs.c\r
   Pem/CryptPem.c\r
 \r
   SysCall/CrtWrapper.c\r
   SysCall/BaseMemAllocation.c\r
 \r
 [Sources.Ia32]\r
-  SysCall/Ia32/MathMultS64x64.c     | MSFT\r
-  SysCall/Ia32/MathDivU64x64.c      | MSFT\r
-  SysCall/Ia32/MathReminderU64x64.c | MSFT\r
-  SysCall/Ia32/MathLShiftS64.c      | MSFT\r
-  SysCall/Ia32/MathRShiftU64.c      | MSFT\r
-\r
-  SysCall/Ia32/MathMultS64x64.c     | INTEL\r
-  SysCall/Ia32/MathDivU64x64.c      | INTEL\r
-  SysCall/Ia32/MathReminderU64x64.c | INTEL\r
-  SysCall/Ia32/MathLShiftS64.c      | INTEL\r
-  SysCall/Ia32/MathRShiftU64.c      | INTEL\r
-\r
-  SysCall/Ia32/MathMultS64x64.S     | GCC\r
-  SysCall/Ia32/MathDivU64x64.S      | GCC\r
-  SysCall/Ia32/MathReminderU64x64.S | GCC\r
-  SysCall/Ia32/MathLShiftS64.S      | GCC\r
-  SysCall/Ia32/MathRShiftU64.S      | GCC\r
-\r
   Rand/CryptRandTsc.c\r
 \r
 [Sources.X64]\r
 # Remove these [BuildOptions] after this library is cleaned up\r
 #\r
 [BuildOptions]\r
+  # suppress the following warnings so we do not break the build with warnings-as-errors:\r
+  #   C4305: truncation from type1 to type2 (Introduced by RFC3161 Timestamp ASN.1 declarations)\r
+  MSFT:*_*_X64_CC_FLAGS = /wd4305\r
   GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" "-D__declspec(t)=__attribute__((t))"\r
diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512.c
new file mode 100644 (file)
index 0000000..491f45d
--- /dev/null
@@ -0,0 +1,354 @@
+/** @file\r
+  SHA-384 and SHA-512 Digest Wrapper Implementations over OpenSSL.\r
+\r
+Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "InternalCryptLib.h"\r
+#include <openssl/sha.h>\r
+\r
+/**\r
+  Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.\r
+\r
+  @return  The size, in bytes, of the context buffer required for SHA-384 hash operations.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+Sha384GetContextSize (\r
+  VOID\r
+  )\r
+{\r
+  //\r
+  // Retrieves OpenSSL SHA-384 Context Size\r
+  //\r
+  return (UINTN) (sizeof (SHA512_CTX));\r
+}\r
+\r
+/**\r
+  Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for\r
+  subsequent use.\r
+\r
+  If Sha384Context is NULL, then return FALSE.\r
+\r
+  @param[out]  Sha384Context  Pointer to SHA-384 context being initialized.\r
+\r
+  @retval TRUE   SHA-384 context initialization succeeded.\r
+  @retval FALSE  SHA-384 context initialization failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Init (\r
+  OUT  VOID  *Sha384Context\r
+  )\r
+{\r
+  //\r
+  // Check input parameters.\r
+  //\r
+  if (Sha384Context == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // OpenSSL SHA-384 Context Initialization\r
+  //\r
+  return (BOOLEAN) (SHA384_Init ((SHA512_CTX *) Sha384Context));\r
+}\r
+\r
+/**\r
+  Makes a copy of an existing SHA-384 context.\r
+\r
+  If Sha384Context is NULL, then return FALSE.\r
+  If NewSha384Context is NULL, then return FALSE.\r
+  If this interface is not supported, then return FALSE.\r
+\r
+  @param[in]  Sha384Context     Pointer to SHA-384 context being copied.\r
+  @param[out] NewSha384Context  Pointer to new SHA-384 context.\r
+\r
+  @retval TRUE   SHA-384 context copy succeeded.\r
+  @retval FALSE  SHA-384 context copy failed.\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Duplicate (\r
+  IN   CONST VOID  *Sha384Context,\r
+  OUT  VOID        *NewSha384Context\r
+  )\r
+{\r
+  //\r
+  // Check input parameters.\r
+  //\r
+  if (Sha384Context == NULL || NewSha384Context == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  CopyMem (NewSha384Context, Sha384Context, sizeof (SHA512_CTX));\r
+\r
+  return TRUE;\r
+}\r
+\r
+/**\r
+  Digests the input data and updates SHA-384 context.\r
+\r
+  This function performs SHA-384 digest on a data buffer of the specified size.\r
+  It can be called multiple times to compute the digest of long or discontinuous data streams.\r
+  SHA-384 context should be already correctly intialized by Sha384Init(), and should not be finalized\r
+  by Sha384Final(). Behavior with invalid context is undefined.\r
+\r
+  If Sha384Context is NULL, then return FALSE.\r
+\r
+  @param[in, out]  Sha384Context  Pointer to the SHA-384 context.\r
+  @param[in]       Data           Pointer to the buffer containing the data to be hashed.\r
+  @param[in]       DataSize       Size of Data buffer in bytes.\r
+\r
+  @retval TRUE   SHA-384 data digest succeeded.\r
+  @retval FALSE  SHA-384 data digest failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Update (\r
+  IN OUT  VOID        *Sha384Context,\r
+  IN      CONST VOID  *Data,\r
+  IN      UINTN       DataSize\r
+  )\r
+{\r
+  //\r
+  // Check input parameters.\r
+  //\r
+  if (Sha384Context == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // Check invalid parameters, in case that only DataLength was checked in OpenSSL\r
+  //\r
+  if (Data == NULL && DataSize != 0) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // OpenSSL SHA-384 Hash Update\r
+  //\r
+  return (BOOLEAN) (SHA384_Update ((SHA512_CTX *) Sha384Context, Data, DataSize));\r
+}\r
+\r
+/**\r
+  Completes computation of the SHA-384 digest value.\r
+\r
+  This function completes SHA-384 hash computation and retrieves the digest value into\r
+  the specified memory. After this function has been called, the SHA-384 context cannot\r
+  be used again.\r
+  SHA-384 context should be already correctly intialized by Sha384Init(), and should not be\r
+  finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.\r
+\r
+  If Sha384Context is NULL, then return FALSE.\r
+  If HashValue is NULL, then return FALSE.\r
+\r
+  @param[in, out]  Sha384Context  Pointer to the SHA-384 context.\r
+  @param[out]      HashValue      Pointer to a buffer that receives the SHA-384 digest\r
+                                  value (48 bytes).\r
+\r
+  @retval TRUE   SHA-384 digest computation succeeded.\r
+  @retval FALSE  SHA-384 digest computation failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Final (\r
+  IN OUT  VOID   *Sha384Context,\r
+  OUT     UINT8  *HashValue\r
+  )\r
+{\r
+  //\r
+  // Check input parameters.\r
+  //\r
+  if (Sha384Context == NULL || HashValue == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // OpenSSL SHA-384 Hash Finalization\r
+  //\r
+  return (BOOLEAN) (SHA384_Final (HashValue, (SHA512_CTX *) Sha384Context));\r
+}\r
+\r
+/**\r
+  Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.\r
+\r
+  @return  The size, in bytes, of the context buffer required for SHA-512 hash operations.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+Sha512GetContextSize (\r
+  VOID\r
+  )\r
+{\r
+  //\r
+  // Retrieves OpenSSL SHA-512 Context Size\r
+  //\r
+  return (UINTN) (sizeof (SHA512_CTX));\r
+}\r
+\r
+/**\r
+  Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for\r
+  subsequent use.\r
+\r
+  If Sha512Context is NULL, then return FALSE.\r
+\r
+  @param[out]  Sha512Context  Pointer to SHA-512 context being initialized.\r
+\r
+  @retval TRUE   SHA-512 context initialization succeeded.\r
+  @retval FALSE  SHA-512 context initialization failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Init (\r
+  OUT  VOID  *Sha512Context\r
+  )\r
+{\r
+  //\r
+  // Check input parameters.\r
+  //\r
+  if (Sha512Context == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // OpenSSL SHA-512 Context Initialization\r
+  //\r
+  return (BOOLEAN) (SHA512_Init ((SHA512_CTX *) Sha512Context));\r
+}\r
+\r
+/**\r
+  Makes a copy of an existing SHA-512 context.\r
+\r
+  If Sha512Context is NULL, then return FALSE.\r
+  If NewSha512Context is NULL, then return FALSE.\r
+  If this interface is not supported, then return FALSE.\r
+\r
+  @param[in]  Sha512Context     Pointer to SHA-512 context being copied.\r
+  @param[out] NewSha512Context  Pointer to new SHA-512 context.\r
+\r
+  @retval TRUE   SHA-512 context copy succeeded.\r
+  @retval FALSE  SHA-512 context copy failed.\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Duplicate (\r
+  IN   CONST VOID  *Sha512Context,\r
+  OUT  VOID        *NewSha512Context\r
+  )\r
+{\r
+  //\r
+  // Check input parameters.\r
+  //\r
+  if (Sha512Context == NULL || NewSha512Context == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  CopyMem (NewSha512Context, Sha512Context, sizeof (SHA512_CTX));\r
+\r
+  return TRUE;\r
+}\r
+\r
+/**\r
+  Digests the input data and updates SHA-512 context.\r
+\r
+  This function performs SHA-512 digest on a data buffer of the specified size.\r
+  It can be called multiple times to compute the digest of long or discontinuous data streams.\r
+  SHA-512 context should be already correctly intialized by Sha512Init(), and should not be finalized\r
+  by Sha512Final(). Behavior with invalid context is undefined.\r
+\r
+  If Sha512Context is NULL, then return FALSE.\r
+\r
+  @param[in, out]  Sha512Context  Pointer to the SHA-512 context.\r
+  @param[in]       Data           Pointer to the buffer containing the data to be hashed.\r
+  @param[in]       DataSize       Size of Data buffer in bytes.\r
+\r
+  @retval TRUE   SHA-512 data digest succeeded.\r
+  @retval FALSE  SHA-512 data digest failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Update (\r
+  IN OUT  VOID        *Sha512Context,\r
+  IN      CONST VOID  *Data,\r
+  IN      UINTN       DataSize\r
+  )\r
+{\r
+  //\r
+  // Check input parameters.\r
+  //\r
+  if (Sha512Context == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // Check invalid parameters, in case that only DataLength was checked in OpenSSL\r
+  //\r
+  if (Data == NULL && DataSize != 0) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // OpenSSL SHA-512 Hash Update\r
+  //\r
+  return (BOOLEAN) (SHA512_Update ((SHA512_CTX *) Sha512Context, Data, DataSize));\r
+}\r
+\r
+/**\r
+  Completes computation of the SHA-512 digest value.\r
+\r
+  This function completes SHA-512 hash computation and retrieves the digest value into\r
+  the specified memory. After this function has been called, the SHA-512 context cannot\r
+  be used again.\r
+  SHA-512 context should be already correctly intialized by Sha512Init(), and should not be\r
+  finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.\r
+\r
+  If Sha512Context is NULL, then return FALSE.\r
+  If HashValue is NULL, then return FALSE.\r
+\r
+  @param[in, out]  Sha512Context  Pointer to the SHA-512 context.\r
+  @param[out]      HashValue      Pointer to a buffer that receives the SHA-512 digest\r
+                                  value (64 bytes).\r
+\r
+  @retval TRUE   SHA-512 digest computation succeeded.\r
+  @retval FALSE  SHA-512 digest computation failed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Final (\r
+  IN OUT  VOID   *Sha512Context,\r
+  OUT     UINT8  *HashValue\r
+  )\r
+{\r
+  //\r
+  // Check input parameters.\r
+  //\r
+  if (Sha512Context == NULL || HashValue == NULL) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // OpenSSL SHA-512 Hash Finalization\r
+  //\r
+  return (BOOLEAN) (SHA384_Final (HashValue, (SHA512_CTX *) Sha512Context));\r
+}\r
diff --git a/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512Null.c b/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha512Null.c
new file mode 100644 (file)
index 0000000..89aeacc
--- /dev/null
@@ -0,0 +1,231 @@
+/** @file\r
+  SHA-384 and SHA-512 Digest Wrapper Implementations which does not provide real capabilities.\r
+\r
+Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "InternalCryptLib.h"\r
+\r
+/**\r
+  Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.\r
+\r
+  Return zero to indicate this interface is not supported.\r
+\r
+  @retval  0   This interface is not supported.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+Sha384GetContextSize (\r
+  VOID\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for\r
+  subsequent use.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[out]  Sha384Context  Pointer to SHA-384 context being initialized.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Init (\r
+  OUT  VOID  *Sha384Context\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Makes a copy of an existing SHA-384 context.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in]  Sha384Context     Pointer to SHA-384 context being copied.\r
+  @param[out] NewSha384Context  Pointer to new SHA-384 context.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Duplicate (\r
+  IN   CONST VOID  *Sha384Context,\r
+  OUT  VOID        *NewSha384Context\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Digests the input data and updates SHA-384 context.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  Sha384Context  Pointer to the SHA-384 context.\r
+  @param[in]       Data           Pointer to the buffer containing the data to be hashed.\r
+  @param[in]       DataSize       Size of Data buffer in bytes.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Update (\r
+  IN OUT  VOID        *Sha384Context,\r
+  IN      CONST VOID  *Data,\r
+  IN      UINTN       DataSize\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Completes computation of the SHA-384 digest value.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  Sha384Context  Pointer to the SHA-384 context.\r
+  @param[out]      HashValue      Pointer to a buffer that receives the SHA-384 digest\r
+                                  value (48 bytes).\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha384Final (\r
+  IN OUT  VOID   *Sha384Context,\r
+  OUT     UINT8  *HashValue\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.\r
+\r
+  Return zero to indicate this interface is not supported.\r
+\r
+  @retval  0   This interface is not supported.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+Sha512GetContextSize (\r
+  VOID\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return 0;\r
+}\r
+\r
+/**\r
+  Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for\r
+  subsequent use.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[out]  Sha512Context  Pointer to SHA-512 context being initialized.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Init (\r
+  OUT  VOID  *Sha512Context\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Makes a copy of an existing SHA-512 context.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in]  Sha512Context     Pointer to SHA-512 context being copied.\r
+  @param[out] NewSha512Context  Pointer to new SHA-512 context.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Duplicate (\r
+  IN   CONST VOID  *Sha512Context,\r
+  OUT  VOID        *NewSha512Context\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Digests the input data and updates SHA-512 context.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  Sha512Context  Pointer to the SHA-512 context.\r
+  @param[in]       Data           Pointer to the buffer containing the data to be hashed.\r
+  @param[in]       DataSize       Size of Data buffer in bytes.\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Update (\r
+  IN OUT  VOID        *Sha512Context,\r
+  IN      CONST VOID  *Data,\r
+  IN      UINTN       DataSize\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
+\r
+/**\r
+  Completes computation of the SHA-512 digest value.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in, out]  Sha512Context  Pointer to the SHA-512 context.\r
+  @param[out]      HashValue      Pointer to a buffer that receives the SHA-512 digest\r
+                                  value (64 bytes).\r
+\r
+  @retval FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+Sha512Final (\r
+  IN OUT  VOID   *Sha512Context,\r
+  OUT     UINT8  *HashValue\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
index 74ca6a9cd97b11789c615a6927887912ebe9cfa4..b522a3628badca8a16911b0cb91225f7284de062 100644 (file)
@@ -3,24 +3,25 @@
 #\r
 #  Caution: This module requires additional review when modified.\r
 #  This library will have external input - signature.\r
-#  This external input must be validated carefully to avoid security issues such as \r
+#  This external input must be validated carefully to avoid security issues such as\r
 #  buffer overflow or integer overflow.\r
 #\r
-#  Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/\r
-#  TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions,\r
-#  Diffie-Hellman functions, X.509 certificate handler functions, authenticode\r
-#  signature verification functions, PEM handler functions, and pseudorandom number\r
-#  generator functions are not supported in this instance.\r
+#  Note: MD4 Digest functions, SHA-384 Digest functions, SHA-512 Digest functions,\r
+#  HMAC-MD5 functions, HMAC-SHA1 functions, AES/TDES/ARC4 functions, RSA external \r
+#  functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, X.509 \r
+#  certificate handler functions, authenticode signature verification functions, \r
+#  PEM handler functions, and pseudorandom number generator functions are not \r
+#  supported in this instance.\r
 #\r
 #  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
-#  \r
+#\r
 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#  \r
+#\r
 ##\r
 \r
 [Defines]\r
@@ -43,6 +44,7 @@
   Hash/CryptMd5.c\r
   Hash/CryptSha1.c\r
   Hash/CryptSha256.c\r
+  Hash/CryptSha512Null.c\r
   Hmac/CryptHmacMd5Null.c\r
   Hmac/CryptHmacSha1Null.c\r
   Cipher/CryptAesNull.c\r
@@ -57,6 +59,7 @@
   Pk/CryptDhNull.c\r
   Pk/CryptX509Null.c\r
   Pk/CryptAuthenticodeNull.c\r
+  Pk/CryptTsNull.c\r
   Pem/CryptPemNull.c\r
 \r
   Rand/CryptRandNull.c\r
   SysCall/ConstantTimeClock.c\r
   SysCall/BaseMemAllocation.c\r
 \r
-\r
-[Sources.Ia32]\r
-  SysCall/Ia32/MathMultS64x64.c     | MSFT\r
-  SysCall/Ia32/MathDivU64x64.c      | MSFT\r
-  SysCall/Ia32/MathReminderU64x64.c | MSFT\r
-  SysCall/Ia32/MathLShiftS64.c      | MSFT\r
-  SysCall/Ia32/MathRShiftU64.c      | MSFT\r
-\r
-  SysCall/Ia32/MathMultS64x64.c     | INTEL\r
-  SysCall/Ia32/MathDivU64x64.c      | INTEL\r
-  SysCall/Ia32/MathReminderU64x64.c | INTEL\r
-  SysCall/Ia32/MathLShiftS64.c      | INTEL\r
-  SysCall/Ia32/MathRShiftU64.c      | INTEL\r
-\r
-  SysCall/Ia32/MathMultS64x64.S     | GCC\r
-  SysCall/Ia32/MathDivU64x64.S      | GCC\r
-  SysCall/Ia32/MathReminderU64x64.S | GCC\r
-  SysCall/Ia32/MathLShiftS64.S      | GCC\r
-  SysCall/Ia32/MathRShiftU64.S      | GCC\r
-\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
   CryptoPkg/CryptoPkg.dec\r
 #\r
 [BuildOptions]\r
   GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" "-D__declspec(t)=__attribute__((t))"\r
-  \r
index 7b8bca53e741154f0be5166112647f8eb4071b52..4ce2b06b161c6d85341a89bf63567a006750e2c7 100644 (file)
@@ -9,7 +9,7 @@
   AuthenticodeVerify() will get PE/COFF Authenticode and will do basic check for\r
   data structure.\r
 \r
-Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -123,7 +123,7 @@ AuthenticodeVerify (
     // Un-matched SPC_INDIRECT_DATA_OBJID.\r
     //\r
     goto _Exit;\r
-  }  \r
+  }\r
 \r
 \r
   SpcIndirectDataContent = (UINT8 *)(Pkcs7->d.sign->contents->d.other->value.asn1_string->data);\r
@@ -135,16 +135,27 @@ AuthenticodeVerify (
 \r
   if ((Asn1Byte & 0x80) == 0) {\r
     //\r
-    // Short Form of Length Encoding\r
+    // Short Form of Length Encoding (Length < 128)\r
     //\r
     ContentSize = (UINTN) (Asn1Byte & 0x7F);\r
     //\r
     // Skip the SEQUENCE Tag;\r
     //\r
     SpcIndirectDataContent += 2;\r
+\r
+  } else if ((Asn1Byte & 0x81) == 0x81) {\r
+    //\r
+    // Long Form of Length Encoding (128 <= Length < 255, Single Octet)\r
+    //\r
+    ContentSize = (UINTN) (*(UINT8 *)(SpcIndirectDataContent + 2));\r
+    //\r
+    // Skip the SEQUENCE Tag;\r
+    //\r
+    SpcIndirectDataContent += 3;\r
+\r
   } else if ((Asn1Byte & 0x82) == 0x82) {\r
     //\r
-    // Long Form of Length Encoding, only support two bytes.\r
+    // Long Form of Length Encoding (Length > 255, Two Octet)\r
     //\r
     ContentSize = (UINTN) (*(UINT8 *)(SpcIndirectDataContent + 2));\r
     ContentSize = (ContentSize << 8) + (UINTN)(*(UINT8 *)(SpcIndirectDataContent + 3));\r
@@ -152,6 +163,7 @@ AuthenticodeVerify (
     // Skip the SEQUENCE Tag;\r
     //\r
     SpcIndirectDataContent += 4;\r
+\r
   } else {\r
     goto _Exit;\r
   }\r
index 05c3f877430ad67c1ec09f11135b6a33b2747fb0..a9665d50473f544d464918eb170ed28557eb2943 100644 (file)
@@ -10,7 +10,7 @@
   WrapPkcs7Data(), Pkcs7GetSigners(), Pkcs7Verify() will get UEFI Authenticated\r
   Variable and will do basic check for data structure.\r
 \r
-Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -123,7 +123,7 @@ X509VerifyCb (
   @param[in]  P7Length     Length of the PKCS#7 message in bytes.\r
   @param[out] WrapFlag     If TRUE P7Data is a ContentInfo structure, otherwise\r
                            return FALSE.\r
-  @param[out] WrapData     If return status of this function is TRUE: \r
+  @param[out] WrapData     If return status of this function is TRUE:\r
                            1) when WrapFlag is TRUE, pointer to P7Data.\r
                            2) when WrapFlag is FALSE, pointer to a new ContentInfo\r
                            structure. It's caller's responsibility to free this\r
@@ -227,7 +227,7 @@ WrapPkcs7Data (
   @param[in]  X509Stack       Pointer to a X509 stack object.\r
   @param[out] Cert            Pointer to a X509 certificate.\r
   @param[out] CertSize        Length of output X509 certificate in bytes.\r
-                                 \r
+\r
   @retval     TRUE            The X509 stack pop succeeded.\r
   @retval     FALSE           The pop operation failed.\r
 \r
@@ -359,7 +359,7 @@ Pkcs7GetSigners (
       (TrustedCert == NULL) || (CertLength == NULL) || (P7Length > INT_MAX)) {\r
     return FALSE;\r
   }\r
-  \r
+\r
   Status = WrapPkcs7Data (P7Data, P7Length, &Wrapped, &SignedData, &SignedDataSize);\r
   if (!Status) {\r
     return Status;\r
@@ -410,7 +410,7 @@ Pkcs7GetSigners (
   //\r
   BufferSize = sizeof (UINT8);\r
   OldSize    = BufferSize;\r
-  \r
+\r
   for (Index = 0; ; Index++) {\r
     Status = X509PopCertificate (Stack, &SingleCert, &SingleCertSize);\r
     if (!Status) {\r
@@ -455,7 +455,7 @@ Pkcs7GetSigners (
     *CertStack   = CertBuf;\r
     *StackLength = BufferSize;\r
     Status = TRUE;\r
-  } \r
+  }\r
 \r
 _Exit:\r
   //\r
@@ -485,7 +485,7 @@ _Exit:
   if (OldBuf != NULL) {\r
     free (OldBuf);\r
   }\r
-  \r
+\r
   return Status;\r
 }\r
 \r
@@ -556,11 +556,11 @@ Pkcs7Verify (
   //\r
   // Check input parameters.\r
   //\r
-  if (P7Data == NULL || TrustedCert == NULL || InData == NULL || \r
+  if (P7Data == NULL || TrustedCert == NULL || InData == NULL ||\r
     P7Length > INT_MAX || CertLength > INT_MAX || DataLength > INT_MAX) {\r
     return FALSE;\r
   }\r
-  \r
+\r
   Pkcs7     = NULL;\r
   DataBio   = NULL;\r
   Cert      = NULL;\r
@@ -578,18 +578,23 @@ Pkcs7Verify (
   if (EVP_add_digest (EVP_sha256 ()) == 0) {\r
     return FALSE;\r
   }\r
+  if (EVP_add_digest (EVP_sha384 ()) == 0) {\r
+    return FALSE;\r
+  }\r
+  if (EVP_add_digest (EVP_sha512 ()) == 0) {\r
+    return FALSE;\r
+  }\r
   if (EVP_add_digest_alias (SN_sha1WithRSAEncryption, SN_sha1WithRSA) == 0) {\r
     return FALSE;\r
   }\r
 \r
-\r
   Status = WrapPkcs7Data (P7Data, P7Length, &Wrapped, &SignedData, &SignedDataSize);\r
   if (!Status) {\r
     return Status;\r
   }\r
 \r
   Status = FALSE;\r
-  \r
+\r
   //\r
   // Retrieve PKCS#7 Data (DER encoding)\r
   //\r
@@ -674,4 +679,4 @@ _Exit:
   }\r
 \r
   return Status;\r
-}\r
+}
\ No newline at end of file
diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c
new file mode 100644 (file)
index 0000000..6cb12cc
--- /dev/null
@@ -0,0 +1,724 @@
+/** @file\r
+  RFC3161 Timestamp Countersignature Verification over OpenSSL.\r
+  The timestamp is generated by a TimeStamping Authority (TSA) and asserts that a\r
+  publisher's signature existed before the specified time. The timestamp extends\r
+  the lifetime of the signature when a signing certificate expires or is later\r
+  revoked.\r
+\r
+Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "InternalCryptLib.h"\r
+\r
+#include <openssl/asn1.h>\r
+#include <openssl/asn1t.h>\r
+#include <openssl/x509.h>\r
+#include <openssl/x509v3.h>\r
+#include <openssl/pkcs7.h>\r
+\r
+//\r
+// OID ASN.1 Value for SPC_RFC3161_OBJID ("1.3.6.1.4.1.311.3.3.1")\r
+//\r
+UINT8 mSpcRFC3161OidValue[] = {\r
+  0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x03, 0x03, 0x01\r
+  };\r
+\r
+///\r
+/// The messageImprint field SHOULD contain the hash of the datum to be\r
+/// time-stamped.  The hash is represented as an OCTET STRING.  Its\r
+/// length MUST match the length of the hash value for that algorithm\r
+/// (e.g., 20 bytes for SHA-1 or 16 bytes for MD5).\r
+///\r
+/// MessageImprint ::= SEQUENCE  {\r
+///   hashAlgorithm                AlgorithmIdentifier,\r
+///   hashedMessage                OCTET STRING  }\r
+///\r
+typedef struct {\r
+  X509_ALGOR         *HashAlgorithm;\r
+  ASN1_OCTET_STRING  *HashedMessage;\r
+} TS_MESSAGE_IMPRINT;\r
+\r
+//\r
+// ASN.1 Functions for TS_MESSAGE_IMPRINT\r
+//\r
+DECLARE_ASN1_FUNCTIONS (TS_MESSAGE_IMPRINT)\r
+ASN1_SEQUENCE (TS_MESSAGE_IMPRINT) = {\r
+  ASN1_SIMPLE (TS_MESSAGE_IMPRINT, HashAlgorithm, X509_ALGOR),\r
+  ASN1_SIMPLE (TS_MESSAGE_IMPRINT, HashedMessage, ASN1_OCTET_STRING)\r
+} ASN1_SEQUENCE_END (TS_MESSAGE_IMPRINT)\r
+IMPLEMENT_ASN1_FUNCTIONS (TS_MESSAGE_IMPRINT)\r
+\r
+///\r
+/// Accuracy represents the time deviation around the UTC time contained\r
+/// in GeneralizedTime of time-stamp token.\r
+///\r
+/// Accuracy ::= SEQUENCE {\r
+///       seconds        INTEGER              OPTIONAL,\r
+///       millis     [0] INTEGER  (1..999)    OPTIONAL,\r
+///       micros     [1] INTEGER  (1..999)    OPTIONAL  }\r
+///\r
+typedef struct {\r
+  ASN1_INTEGER  *Seconds;\r
+  ASN1_INTEGER  *Millis;\r
+  ASN1_INTEGER  *Micros;\r
+} TS_ACCURACY;\r
+\r
+//\r
+// ASN.1 Functions for TS_ACCURACY\r
+//\r
+DECLARE_ASN1_FUNCTIONS (TS_ACCURACY)\r
+ASN1_SEQUENCE (TS_ACCURACY) = {\r
+  ASN1_OPT     (TS_ACCURACY, Seconds, ASN1_INTEGER),\r
+  ASN1_IMP_OPT (TS_ACCURACY, Millis,  ASN1_INTEGER, 0),\r
+  ASN1_IMP_OPT (TS_ACCURACY, Micros,  ASN1_INTEGER, 1)\r
+} ASN1_SEQUENCE_END (TS_ACCURACY)\r
+IMPLEMENT_ASN1_FUNCTIONS (TS_ACCURACY)\r
+\r
+///\r
+/// The timestamp token info resulting from a successful timestamp request,\r
+/// as defined in RFC 3161.\r
+///\r
+///  TSTInfo ::= SEQUENCE  {\r
+///     version                      INTEGER  { v1(1) },\r
+///     policy                       TSAPolicyId,\r
+///     messageImprint               MessageImprint,\r
+///       -- MUST have the same value as the similar field in\r
+///       -- TimeStampReq\r
+///     serialNumber                 INTEGER,\r
+///       -- Time-Stamping users MUST be ready to accommodate integers\r
+///       -- up to 160 bits.\r
+///     genTime                      GeneralizedTime,\r
+///     accuracy                     Accuracy                 OPTIONAL,\r
+///     ordering                     BOOLEAN             DEFAULT FALSE,\r
+///     nonce                        INTEGER                  OPTIONAL,\r
+///       -- MUST be present if the similar field was present\r
+///       -- in TimeStampReq.  In that case it MUST have the same value.\r
+///     tsa                          [0] GeneralName          OPTIONAL,\r
+///     extensions                   [1] IMPLICIT Extensions   OPTIONAL  }\r
+///\r
+typedef struct {\r
+  ASN1_INTEGER              *Version;\r
+  ASN1_OBJECT               *Policy;\r
+  TS_MESSAGE_IMPRINT        *MessageImprint;\r
+  ASN1_INTEGER              *SerialNumber;\r
+  ASN1_GENERALIZEDTIME      *GenTime;\r
+  TS_ACCURACY               *Accuracy;\r
+  ASN1_BOOLEAN              Ordering;\r
+  ASN1_INTEGER              *Nonce;\r
+  GENERAL_NAME              *Tsa;\r
+  STACK_OF(X509_EXTENSION)  *Extensions;\r
+} TS_TST_INFO;\r
+\r
+//\r
+// ASN.1 Functions for TS_TST_INFO\r
+//\r
+DECLARE_ASN1_FUNCTIONS (TS_TST_INFO)\r
+ASN1_SEQUENCE (TS_TST_INFO) = {\r
+  ASN1_SIMPLE (TS_TST_INFO, Version, ASN1_INTEGER),\r
+  ASN1_SIMPLE (TS_TST_INFO, Policy, ASN1_OBJECT),\r
+  ASN1_SIMPLE (TS_TST_INFO, MessageImprint, TS_MESSAGE_IMPRINT),\r
+  ASN1_SIMPLE (TS_TST_INFO, SerialNumber, ASN1_INTEGER),\r
+  ASN1_SIMPLE (TS_TST_INFO, GenTime, ASN1_GENERALIZEDTIME),\r
+  ASN1_OPT    (TS_TST_INFO, Accuracy, TS_ACCURACY),\r
+  ASN1_OPT    (TS_TST_INFO, Ordering, ASN1_FBOOLEAN),\r
+  ASN1_OPT    (TS_TST_INFO, Nonce, ASN1_INTEGER),\r
+  ASN1_EXP_OPT(TS_TST_INFO, Tsa, GENERAL_NAME, 0),\r
+  ASN1_IMP_SEQUENCE_OF_OPT (TS_TST_INFO, Extensions, X509_EXTENSION, 1)\r
+} ASN1_SEQUENCE_END (TS_TST_INFO)\r
+IMPLEMENT_ASN1_FUNCTIONS (TS_TST_INFO)\r
+\r
+\r
+/**\r
+  Verification callback function to override any existing callbacks in OpenSSL\r
+  for intermediate TSA certificate supports.\r
+\r
+  @param[in]  Status   Original status before calling this callback.\r
+  @param[in]  Context  X509 store context.\r
+\r
+  @retval     1        Current X509 certificate is verified successfully.\r
+  @retval     0        Verification failed.\r
+\r
+**/\r
+int\r
+TSVerifyCallback (\r
+  IN int             Status,\r
+  IN X509_STORE_CTX  *Context\r
+  )\r
+{\r
+  X509_OBJECT  *Obj;\r
+  INTN         Error;\r
+  INTN         Index;\r
+  INTN         Count;\r
+\r
+  Obj   = NULL;\r
+  Error = (INTN) X509_STORE_CTX_get_error (Context);\r
+\r
+  //\r
+  // X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT and X509_V_ERR_UNABLE_TO_GET_ISSUER_\r
+  // CERT_LOCALLY mean a X509 certificate is not self signed and its issuer\r
+  // can not be found in X509_verify_cert of X509_vfy.c.\r
+  // In order to support intermediate certificate node, we override the\r
+  // errors if the certification is obtained from X509 store, i.e. it is\r
+  // a trusted ceritifcate node that is enrolled by user.\r
+  // Besides,X509_V_ERR_CERT_UNTRUSTED and X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE\r
+  // are also ignored to enable such feature.\r
+  //\r
+  if ((Error == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT) ||\r
+      (Error == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY)) {\r
+    Obj = (X509_OBJECT *) malloc (sizeof (X509_OBJECT));\r
+    if (Obj == NULL) {\r
+      return 0;\r
+    }\r
+\r
+    Obj->type      = X509_LU_X509;\r
+    Obj->data.x509 = Context->current_cert;\r
+\r
+    CRYPTO_w_lock (CRYPTO_LOCK_X509_STORE);\r
+\r
+    if (X509_OBJECT_retrieve_match (Context->ctx->objs, Obj)) {\r
+      Status = 1;\r
+    } else {\r
+      //\r
+      // If any certificate in the chain is enrolled as trusted certificate,\r
+      // pass the certificate verification.\r
+      //\r
+      if (Error == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY) {\r
+        Count = (INTN) sk_X509_num (Context->chain);\r
+        for (Index = 0; Index < Count; Index++) {\r
+          Obj->data.x509 = sk_X509_value (Context->chain, (int) Index);\r
+          if (X509_OBJECT_retrieve_match (Context->ctx->objs, Obj)) {\r
+            Status = 1;\r
+            break;\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
+    CRYPTO_w_unlock (CRYPTO_LOCK_X509_STORE);\r
+  }\r
+\r
+  if ((Error == X509_V_ERR_CERT_UNTRUSTED) ||\r
+      (Error == X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE)) {\r
+    Status = 1;\r
+  }\r
+\r
+  if (Obj != NULL) {\r
+    OPENSSL_free (Obj);\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Convert ASN.1 GeneralizedTime to EFI Time.\r
+\r
+  @param[in]  Asn1Time         Pointer to the ASN.1 GeneralizedTime to be converted.\r
+  @param[out] SigningTime      Return the corresponding EFI Time.\r
+\r
+  @retval  TRUE   The time convertion succeeds.\r
+  @retval  FALSE  Invalid parameters.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ConvertAsn1TimeToEfiTime (\r
+  IN  ASN1_TIME  *Asn1Time,\r
+  OUT EFI_TIME   *EfiTime\r
+  )\r
+{\r
+  CONST CHAR8  *Str;\r
+  UINTN        Index;\r
+\r
+  if ((Asn1Time == NULL) || (EfiTime == NULL)) {\r
+    return FALSE;\r
+  }\r
+\r
+  Str = (CONST CHAR8*)Asn1Time->data;\r
+  SetMem (EfiTime, 0, sizeof (EFI_TIME));\r
+\r
+  Index = 0;\r
+  if (Asn1Time->type == V_ASN1_UTCTIME) {               /* two digit year */\r
+    EfiTime->Year  = (Str[Index++] - '0') * 10;\r
+    EfiTime->Year += (Str[Index++] - '0');\r
+    if (EfiTime->Year < 70) {\r
+      EfiTime->Year += 100;\r
+    }\r
+  } else if (Asn1Time->type == V_ASN1_GENERALIZEDTIME) { /* four digit year */\r
+    EfiTime->Year  = (Str[Index++] - '0') * 1000;\r
+    EfiTime->Year += (Str[Index++] - '0') * 100;\r
+    EfiTime->Year += (Str[Index++] - '0') * 10;\r
+    EfiTime->Year += (Str[Index++] - '0');\r
+    if ((EfiTime->Year < 1900) || (EfiTime->Year > 9999)) {\r
+      return FALSE;\r
+    }\r
+  }\r
+\r
+  EfiTime->Month   = (Str[Index++] - '0') * 10;\r
+  EfiTime->Month  += (Str[Index++] - '0');\r
+  if ((EfiTime->Month < 1) || (EfiTime->Month > 12)) {\r
+    return FALSE;\r
+  }\r
+\r
+  EfiTime->Day     = (Str[Index++] - '0') * 10;\r
+  EfiTime->Day    += (Str[Index++] - '0');\r
+  if ((EfiTime->Day < 1) || (EfiTime->Day > 31)) {\r
+    return FALSE;\r
+  }\r
+\r
+  EfiTime->Hour    = (Str[Index++] - '0') * 10;\r
+  EfiTime->Hour   += (Str[Index++] - '0');\r
+  if (EfiTime->Hour > 23) {\r
+    return FALSE;\r
+  }\r
+\r
+  EfiTime->Minute  = (Str[Index++] - '0') * 10;\r
+  EfiTime->Minute += (Str[Index++] - '0');\r
+  if (EfiTime->Minute > 59) {\r
+    return FALSE;\r
+  }\r
+\r
+  EfiTime->Second  = (Str[Index++] - '0') * 10;\r
+  EfiTime->Second += (Str[Index++] - '0');\r
+  if (EfiTime->Second > 59) {\r
+    return FALSE;\r
+  }\r
+\r
+  /* Note: we did not adjust the time based on time zone information */\r
+\r
+  return TRUE;\r
+}\r
+\r
+/**\r
+\r
+  Check the validity of TimeStamp Token Information.\r
+\r
+  @param[in]  TstInfo          Pointer to the TS_TST_INFO structure.\r
+  @param[in]  TimestampedData  Pointer to the data to be time-stamped.\r
+  @param[in]  DataSize         Size of timestamped data in bytes.\r
+\r
+  @retval  TRUE   The TimeStamp Token Information is valid.\r
+  @retval  FALSE  Invalid TimeStamp Token Information.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+CheckTSTInfo (\r
+  IN  CONST TS_TST_INFO  *TstInfo,\r
+  IN  CONST UINT8        *TimestampedData,\r
+  IN  UINTN              DataSize\r
+  )\r
+{\r
+  BOOLEAN             Status;\r
+  TS_MESSAGE_IMPRINT  *Imprint;\r
+  X509_ALGOR          *HashAlgo;\r
+  CONST EVP_MD        *Md;\r
+  EVP_MD_CTX          MdCtx;\r
+  UINTN               MdSize;\r
+  UINT8               *HashedMsg;\r
+\r
+  //\r
+  // Initialization\r
+  //\r
+  Status    = FALSE;\r
+  HashAlgo  = NULL;\r
+  HashedMsg = NULL;\r
+\r
+  //\r
+  // -- Check version number of Timestamp:\r
+  //   The version field (currently v1) describes the version of the time-stamp token.\r
+  //   Conforming time-stamping servers MUST be able to provide version 1 time-stamp tokens.\r
+  //\r
+  if ((ASN1_INTEGER_get (TstInfo->Version)) != 1) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // -- Check Policies\r
+  //   The policy field MUST indicate the TSA's policy under which the response was produced.\r
+  //\r
+  if (TstInfo->Policy == NULL) {\r
+    /// NOTE: Need to check if the requested and returned policies.\r
+    ///       We have no information about the Requested TSA Policy.\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // -- Compute & Check Message Imprint\r
+  //\r
+  Imprint  = TstInfo->MessageImprint;\r
+  HashAlgo = X509_ALGOR_dup (Imprint->HashAlgorithm);\r
+\r
+  Md = EVP_get_digestbyobj (HashAlgo->algorithm);\r
+  if (Md == NULL) {\r
+    goto _Exit;\r
+  }\r
+\r
+  MdSize = EVP_MD_size (Md);\r
+  HashedMsg = AllocateZeroPool (MdSize);\r
+  if (HashedMsg == NULL) {\r
+    goto _Exit;\r
+  }\r
+  EVP_DigestInit (&MdCtx, Md);\r
+  EVP_DigestUpdate (&MdCtx, TimestampedData, DataSize);\r
+  EVP_DigestFinal (&MdCtx, HashedMsg, NULL);\r
+  if ((MdSize == (UINTN)ASN1_STRING_length (Imprint->HashedMessage)) &&\r
+      (CompareMem (HashedMsg, ASN1_STRING_data (Imprint->HashedMessage), MdSize) != 0)) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // -- Check Nonces\r
+  //\r
+  if (TstInfo->Nonce != NULL) {\r
+    //\r
+    // Nonces is optional, No error if no nonce is returned;\r
+    //\r
+  }\r
+\r
+  //\r
+  // -- Check if the TSA name and signer certificate is matched.\r
+  //\r
+  if (TstInfo->Tsa != NULL) {\r
+    //\r
+    //  Ignored the optional Tsa field checking.\r
+    //\r
+  }\r
+\r
+  Status = TRUE;\r
+\r
+_Exit:\r
+  X509_ALGOR_free (HashAlgo);\r
+  if (HashedMsg != NULL) {\r
+    FreePool (HashedMsg);\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Verifies the validility of a TimeStamp Token as described in RFC 3161 ("Internet\r
+  X.509 Public Key Infrastructure Time-Stamp Protocol (TSP)").\r
+\r
+  If TSToken is NULL, then return FALSE.\r
+  If TimestampedData is NULL, then return FALSE.\r
+\r
+  @param[in]  TSToken          Pointer to the RFC3161 TimeStamp Token, which is generated\r
+                               by a TSA and located in the software publisher's SignerInfo\r
+                               structure.\r
+  @param[in]  TokenSize        Size of the TimeStamp Token in bytes.\r
+  @param[in]  TsaCert          Pointer to a trusted/root TSA certificate encoded in DER.\r
+  @param[in]  CertSize         Size of the trusted TSA certificate in bytes.\r
+  @param[in]  TimestampedData  Pointer to the data to be time-stamped.\r
+  @param[in]  DataSize         Size of timestamped data in bytes.\r
+  @param[out] SigningTime      Return the time of timestamp generation time if the timestamp\r
+                               signature is valid.\r
+\r
+  @retval  TRUE   The specified timestamp token is valid.\r
+  @retval  FALSE  Invalid timestamp token.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+TimestampTokenVerify (\r
+  IN  CONST UINT8  *TSToken,\r
+  IN  UINTN        TokenSize,\r
+  IN  CONST UINT8  *TsaCert,\r
+  IN  UINTN        CertSize,\r
+  IN  CONST UINT8  *TimestampedData,\r
+  IN  UINTN        DataSize,\r
+  OUT EFI_TIME     *SigningTime\r
+  )\r
+{\r
+  BOOLEAN      Status;\r
+  CONST UINT8  *TokenTemp;\r
+  PKCS7        *Pkcs7;\r
+  X509         *Cert;\r
+  X509_STORE   *CertStore;\r
+  BIO          *OutBio;\r
+  UINT8        *TstData;\r
+  UINTN        TstSize;\r
+  UINT8        *TstTemp;\r
+  TS_TST_INFO  *TstInfo;\r
+\r
+  Status = FALSE;\r
+\r
+  //\r
+  // Check input parameters\r
+  //\r
+  if ((TSToken == NULL) || (TsaCert == NULL) || (TimestampedData == NULL) ||\r
+      (TokenSize > INT_MAX) || (CertSize > INT_MAX) || (DataSize > INT_MAX)) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // Initializations\r
+  //\r
+  if (SigningTime != NULL) {\r
+    SetMem (SigningTime, sizeof (EFI_TIME), 0);\r
+  }\r
+  Pkcs7     = NULL;\r
+  Cert      = NULL;\r
+  CertStore = NULL;\r
+  OutBio    = NULL;\r
+  TstData   = NULL;\r
+  TstInfo   = NULL;\r
+\r
+  //\r
+  // TimeStamp Token should contain one valid DER-encoded ASN.1 PKCS#7 structure.\r
+  //\r
+  TokenTemp = TSToken;\r
+  Pkcs7     = d2i_PKCS7 (NULL, (const unsigned char **) &TokenTemp, (int) TokenSize);\r
+  if (Pkcs7 == NULL) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // The timestamp signature (TSA's response) will be one PKCS#7 signed data.\r
+  //\r
+  if (!PKCS7_type_is_signed (Pkcs7)) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Read the trusted TSA certificate (DER-encoded), and Construct X509 Certificate.\r
+  //\r
+  Cert = d2i_X509 (NULL, &TsaCert, (long) CertSize);\r
+  if (Cert == NULL) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Setup X509 Store for trusted certificate.\r
+  //\r
+  CertStore = X509_STORE_new ();\r
+  if ((CertStore == NULL) || !(X509_STORE_add_cert (CertStore, Cert))) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Register customized X509 verification callback function to support\r
+  // trusted intermediate TSA certificate anchor.\r
+  //\r
+  CertStore->verify_cb = TSVerifyCallback;\r
+\r
+  X509_STORE_set_purpose (CertStore, X509_PURPOSE_ANY);\r
+\r
+  //\r
+  // Verifies the PKCS#7 signedData structure, and output the signed contents.\r
+  //\r
+  OutBio = BIO_new (BIO_s_mem ());\r
+  if (OutBio == NULL) {\r
+    goto _Exit;\r
+  }\r
+  if (!PKCS7_verify (Pkcs7, NULL, CertStore, NULL, OutBio, PKCS7_BINARY)) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Read the signed contents detached in timestamp signature.\r
+  //\r
+  TstData = AllocateZeroPool (2048);\r
+  if (TstData == NULL) {\r
+    goto _Exit;\r
+  }\r
+  TstSize = BIO_read (OutBio, (void *) TstData, 2048);\r
+\r
+  //\r
+  // Construct TS_TST_INFO structure from the signed contents.\r
+  //\r
+  TstTemp = TstData;\r
+  TstInfo = d2i_TS_TST_INFO (NULL, &TstTemp, (int)TstSize);\r
+  if (TstInfo == NULL) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Check TS_TST_INFO structure.\r
+  //\r
+  Status = CheckTSTInfo (TstInfo, TimestampedData, DataSize);\r
+  if (!Status) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Retrieve the signing time from TS_TST_INFO structure.\r
+  //\r
+  if (SigningTime != NULL) {\r
+    SetMem (SigningTime, sizeof (EFI_TIME), 0);\r
+    Status = ConvertAsn1TimeToEfiTime (TstInfo->GenTime, SigningTime);\r
+  }\r
+\r
+_Exit:\r
+  //\r
+  // Release Resources\r
+  //\r
+  PKCS7_free (Pkcs7);\r
+  X509_free (Cert);\r
+  X509_STORE_free (CertStore);\r
+  BIO_free (OutBio);\r
+  TS_TST_INFO_free (TstInfo);\r
+\r
+  if (TstData != NULL) {\r
+    FreePool (TstData);\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Verifies the validility of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode\r
+  signature.\r
+\r
+  If AuthData is NULL, then return FALSE.\r
+\r
+  @param[in]  AuthData     Pointer to the Authenticode Signature retrieved from signed\r
+                           PE/COFF image to be verified.\r
+  @param[in]  DataSize     Size of the Authenticode Signature in bytes.\r
+  @param[in]  TsaCert      Pointer to a trusted/root TSA certificate encoded in DER, which\r
+                           is used for TSA certificate chain verification.\r
+  @param[in]  CertSize     Size of the trusted certificate in bytes.\r
+  @param[out] SigningTime  Return the time of timestamp generation time if the timestamp\r
+                           signature is valid.\r
+\r
+  @retval  TRUE   The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.\r
+  @retval  FALSE  No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ImageTimestampVerify (\r
+  IN  CONST UINT8  *AuthData,\r
+  IN  UINTN        DataSize,\r
+  IN  CONST UINT8  *TsaCert,\r
+  IN  UINTN        CertSize,\r
+  OUT EFI_TIME     *SigningTime\r
+  )\r
+{\r
+  BOOLEAN                      Status;\r
+  PKCS7                        *Pkcs7;\r
+  STACK_OF(PKCS7_SIGNER_INFO)  *SignerInfos;\r
+  PKCS7_SIGNER_INFO            *SignInfo;\r
+  UINTN                        Index;\r
+  STACK_OF(X509_ATTRIBUTE)     *Sk;\r
+  X509_ATTRIBUTE               *Xa;\r
+  ASN1_TYPE                    *Asn1Type;\r
+  ASN1_OCTET_STRING            *EncDigest;\r
+  UINT8                        *TSToken;\r
+  UINTN                        TokenSize;\r
+\r
+  //\r
+  // Input Parameters Checking.\r
+  //\r
+  if ((AuthData == NULL) || (TsaCert == NULL)) {\r
+    return FALSE;\r
+  }\r
+\r
+  if ((DataSize > INT_MAX) || (CertSize > INT_MAX)) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // Register & Initialize necessary digest algorithms for PKCS#7 Handling.\r
+  //\r
+  if ((EVP_add_digest (EVP_md5 ()) == 0) || (EVP_add_digest (EVP_sha1 ()) == 0) ||\r
+      (EVP_add_digest (EVP_sha256 ()) == 0) || (EVP_add_digest_alias (SN_sha1WithRSAEncryption, SN_sha1WithRSA)) == 0) {\r
+    return FALSE;\r
+  }\r
+\r
+  //\r
+  // Initialization.\r
+  //\r
+  Status    = FALSE;\r
+  Pkcs7     = NULL;\r
+  SignInfo  = NULL;\r
+\r
+  //\r
+  // Decode ASN.1-encoded Authenticode data into PKCS7 structure.\r
+  //\r
+  Pkcs7 = d2i_PKCS7 (NULL, (const unsigned char **) &AuthData, (int) DataSize);\r
+  if (Pkcs7 == NULL) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Check if there is one and only one signer.\r
+  //\r
+  SignerInfos = PKCS7_get_signer_info (Pkcs7);\r
+  if (!SignerInfos || (sk_PKCS7_SIGNER_INFO_num (SignerInfos) != 1)) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Locate the TimeStamp CounterSignature.\r
+  //\r
+  SignInfo = sk_PKCS7_SIGNER_INFO_value (SignerInfos, 0);\r
+  if (SignInfo == NULL) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // Locate Message Digest which will be the data to be time-stamped.\r
+  //\r
+  EncDigest = SignInfo->enc_digest;\r
+  if (EncDigest == NULL) {\r
+    goto _Exit;\r
+  }\r
+\r
+  //\r
+  // The RFC3161 timestamp counterSignature is contained in unauthenticatedAttributes field\r
+  // of SignerInfo.\r
+  //\r
+  Sk = SignInfo->unauth_attr;\r
+  if (Sk == NULL) {             // No timestamp counterSignature.\r
+    goto _Exit;\r
+  }\r
+\r
+  Asn1Type = NULL;\r
+  for (Index = 0; Index < (UINTN) sk_X509_ATTRIBUTE_num (Sk); Index++) {\r
+    //\r
+    // Search valid RFC3161 timestamp counterSignature based on OBJID.\r
+    //\r
+    Xa = sk_X509_ATTRIBUTE_value (Sk, (int)Index);\r
+    if ((Xa->object->length != sizeof (mSpcRFC3161OidValue)) ||\r
+        (CompareMem (Xa->object->data, mSpcRFC3161OidValue, sizeof (mSpcRFC3161OidValue)) != 0)) {\r
+      continue;\r
+    }\r
+    Asn1Type = sk_ASN1_TYPE_value (Xa->value.set, 0);\r
+  }\r
+\r
+  if (Asn1Type == NULL) {\r
+    Status = FALSE;\r
+    goto _Exit;\r
+  }\r
+  TSToken   = Asn1Type->value.octet_string->data;\r
+  TokenSize = Asn1Type->value.octet_string->length;\r
+\r
+  //\r
+  // TimeStamp counterSignature (Token) verification.\r
+  //\r
+  Status = TimestampTokenVerify (\r
+             TSToken,\r
+             TokenSize,\r
+             TsaCert,\r
+             CertSize,\r
+             EncDigest->data,\r
+             EncDigest->length,\r
+             SigningTime\r
+             );\r
+\r
+_Exit:\r
+  //\r
+  // Release Resources\r
+  //\r
+  PKCS7_free (Pkcs7);\r
+\r
+  return Status;\r
+}\r
diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptTsNull.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptTsNull.c
new file mode 100644 (file)
index 0000000..eb32aaf
--- /dev/null
@@ -0,0 +1,48 @@
+/** @file\r
+  RFC3161 Timestamp Countersignature Verification Wrapper Implementation which does\r
+  not provide real capabilities.\r
+\r
+Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "InternalCryptLib.h"\r
+\r
+/**\r
+  Verifies the validility of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode\r
+  signature.\r
+\r
+  Return FALSE to indicate this interface is not supported.\r
+\r
+  @param[in]  AuthData     Pointer to the Authenticode Signature retrieved from signed\r
+                           PE/COFF image to be verified.\r
+  @param[in]  DataSize     Size of the Authenticode Signature in bytes.\r
+  @param[in]  TsaCert      Pointer to a trusted/root TSA certificate encoded in DER, which\r
+                           is used for TSA certificate chain verification.\r
+  @param[in]  CertSize     Size of the trusted certificate in bytes.\r
+  @param[out] SigningTime  Return the time of timestamp generation time if the timestamp\r
+                           signature is valid.\r
+\r
+  @retval  FALSE  This interface is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+ImageTimestampVerify (\r
+  IN  CONST UINT8  *AuthData,\r
+  IN  UINTN        DataSize,\r
+  IN  CONST UINT8  *TsaCert,\r
+  IN  UINTN        CertSize,\r
+  OUT EFI_TIME     *SigningTime\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return FALSE;\r
+}\r
index 355ecc49697d1725f435ba72137487e0ccbde035..cf38b51ff20df743e382c27c52e69e4d5b396203 100644 (file)
@@ -3,23 +3,23 @@
 #\r
 #  Caution: This module requires additional review when modified.\r
 #  This library will have external input - signature.\r
-#  This external input must be validated carefully to avoid security issues such as \r
+#  This external input must be validated carefully to avoid security issues such as\r
 #  buffer overflow or integer overflow.\r
 #\r
-#  Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/\r
-#  TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions,\r
-#  Diffie-Hellman functions, and authenticode signature verification functions are\r
-#  not supported in this instance.\r
+#  Note: MD4 Digest functions, SHA-384 Digest functions, SHA-512 Digest functions,\r
+#  HMAC-MD5 functions, HMAC-SHA1 functions, AES/TDES/ARC4 functions, RSA external\r
+#  functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and \r
+#  authenticode signature verification functions are not supported in this instance.\r
 #\r
 #  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
-#  \r
+#\r
 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#  \r
+#\r
 ##\r
 \r
 [Defines]\r
@@ -43,6 +43,7 @@
   Hash/CryptMd5.c\r
   Hash/CryptSha1.c\r
   Hash/CryptSha256.c\r
+  Hash/CryptSha512Null.c\r
   Hmac/CryptHmacMd5Null.c\r
   Hmac/CryptHmacSha1Null.c\r
   Cipher/CryptAesNull.c\r
   Pk/CryptRsaBasic.c\r
   Pk/CryptRsaExtNull.c\r
   Pk/CryptPkcs7SignNull.c\r
-  Pk/CryptPkcs7Verify.c \r
+  Pk/CryptPkcs7Verify.c\r
   Pk/CryptDhNull.c\r
   Pk/CryptX509.c\r
   Pk/CryptAuthenticodeNull.c\r
+  Pk/CryptTsNull.c\r
   Pem/CryptPem.c\r
 \r
   SysCall/CrtWrapper.c\r
   SysCall/RuntimeMemAllocation.c\r
 \r
 [Sources.Ia32]\r
-  SysCall/Ia32/MathMultS64x64.c     | MSFT\r
-  SysCall/Ia32/MathDivU64x64.c      | MSFT\r
-  SysCall/Ia32/MathReminderU64x64.c | MSFT\r
-  SysCall/Ia32/MathLShiftS64.c      | MSFT\r
-  SysCall/Ia32/MathRShiftU64.c      | MSFT\r
-\r
-  SysCall/Ia32/MathMultS64x64.c     | INTEL\r
-  SysCall/Ia32/MathDivU64x64.c      | INTEL\r
-  SysCall/Ia32/MathReminderU64x64.c | INTEL\r
-  SysCall/Ia32/MathLShiftS64.c      | INTEL\r
-  SysCall/Ia32/MathRShiftU64.c      | INTEL\r
-\r
-  SysCall/Ia32/MathMultS64x64.S     | GCC\r
-  SysCall/Ia32/MathDivU64x64.S      | GCC\r
-  SysCall/Ia32/MathReminderU64x64.S | GCC\r
-  SysCall/Ia32/MathLShiftS64.S      | GCC\r
-  SysCall/Ia32/MathRShiftU64.S      | GCC\r
-\r
   Rand/CryptRandTsc.c\r
 \r
 [Sources.X64]\r
 #\r
 [BuildOptions]\r
   GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" "-D__declspec(t)=__attribute__((t))"\r
-  \r
index c62da1a3d426077cc17b3737e2ac1cbe2828f7d2..4bf68a291a54ed143024b311cd67428de3af967d 100644 (file)
@@ -3,23 +3,23 @@
 #\r
 #  Caution: This module requires additional review when modified.\r
 #  This library will have external input - signature.\r
-#  This external input must be validated carefully to avoid security issues such as \r
+#  This external input must be validated carefully to avoid security issues such as\r
 #  buffer overflow or integer overflow.\r
 #\r
-#  Note: MD4 Digest functions, HMAC-MD5 functions, HMAC-SHA1 functions, AES/\r
-#  TDES/ARC4 functions, RSA external functions, PKCS#7 SignedData sign functions,\r
-#  Diffie-Hellman functions, and authenticode signature verification functions are\r
-#  not supported in this instance.\r
+#  Note: MD4 Digest functions, SHA-384 Digest functions, SHA-512 Digest functions,\r
+#  HMAC-MD5 functions, HMAC-SHA1 functions, AES/TDES/ARC4 functions, RSA external\r
+#  functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and \r
+#  authenticode signature verification functions are not supported in this instance.\r
 #\r
 #  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
-#  \r
+#\r
 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#  \r
+#\r
 ##\r
 \r
 [Defines]\r
@@ -43,6 +43,7 @@
   Hash/CryptMd5.c\r
   Hash/CryptSha1.c\r
   Hash/CryptSha256.c\r
+  Hash/CryptSha512Null.c\r
   Hmac/CryptHmacMd5Null.c\r
   Hmac/CryptHmacSha1Null.c\r
   Cipher/CryptAesNull.c\r
@@ -55,6 +56,7 @@
   Pk/CryptDhNull.c\r
   Pk/CryptX509.c\r
   Pk/CryptAuthenticodeNull.c\r
+  Pk/CryptTsNull.c\r
   Pem/CryptPem.c\r
 \r
   SysCall/CrtWrapper.c\r
   SysCall/BaseMemAllocation.c\r
 \r
 [Sources.Ia32]\r
-  SysCall/Ia32/MathMultS64x64.c     | MSFT\r
-  SysCall/Ia32/MathDivU64x64.c      | MSFT\r
-  SysCall/Ia32/MathReminderU64x64.c | MSFT\r
-  SysCall/Ia32/MathLShiftS64.c      | MSFT\r
-  SysCall/Ia32/MathRShiftU64.c      | MSFT\r
-\r
-  SysCall/Ia32/MathMultS64x64.c     | INTEL\r
-  SysCall/Ia32/MathDivU64x64.c      | INTEL\r
-  SysCall/Ia32/MathReminderU64x64.c | INTEL\r
-  SysCall/Ia32/MathLShiftS64.c      | INTEL\r
-  SysCall/Ia32/MathRShiftU64.c      | INTEL\r
-\r
-  SysCall/Ia32/MathMultS64x64.S     | GCC\r
-  SysCall/Ia32/MathDivU64x64.S      | GCC\r
-  SysCall/Ia32/MathReminderU64x64.S | GCC\r
-  SysCall/Ia32/MathLShiftS64.S      | GCC\r
-  SysCall/Ia32/MathRShiftU64.S      | GCC\r
-\r
   Rand/CryptRandTsc.c\r
 \r
 [Sources.X64]\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.S b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.S
deleted file mode 100644 (file)
index f46d5b8..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.  The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-# Module Name:\r
-#\r
-#   MathDivU64x64.S\r
-#\r
-# Abstract:\r
-#\r
-#   64-bit Math Worker Function.\r
-#   Divides a 64-bit unsigned value with a 64-bit unsigned value and returns\r
-#   a 64-bit unsigned result.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-    .686:\r
-    .code:\r
-\r
-ASM_GLOBAL ASM_PFX(__udivdi3), ASM_PFX(DivU64x64Remainder)\r
-\r
-#------------------------------------------------------------------------------\r
-#\r
-# void __cdecl __udivdi3 (void)\r
-#\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(__udivdi3):\r
-    # Original local stack when calling __udivdi3\r
-    #               -----------------\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |               |\r
-    #               |--  Divisor  --|\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |               |\r
-    #               |--  Dividend --|\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |  ReturnAddr** |\r
-    #       ESP---->|---------------|\r
-    #\r
-\r
-    #\r
-    # Set up the local stack for NULL Reminder pointer\r
-    #\r
-    xorl    %eax, %eax\r
-    push    %eax\r
-\r
-    #\r
-    # Set up the local stack for Divisor parameter\r
-    #\r
-    movl    20(%esp), %eax\r
-    push    %eax\r
-    movl    20(%esp), %eax\r
-    push    %eax\r
-\r
-    #\r
-    # Set up the local stack for Dividend parameter\r
-    #\r
-    movl    20(%esp), %eax\r
-    push    %eax\r
-    movl    20(%esp), %eax\r
-    push    %eax\r
-\r
-    #\r
-    # Call native DivU64x64Remainder of BaseLib\r
-    #\r
-    jmp     ASM_PFX(DivU64x64Remainder)\r
-\r
-    #\r
-    # Adjust stack\r
-    #\r
-    addl    $20, %esp\r
-\r
-    ret     $16\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.c b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathDivU64x64.c
deleted file mode 100644 (file)
index 4011653..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file\r
-  64-bit Math Worker Function.\r
-  The 32-bit versions of C compiler generate calls to library routines\r
-  to handle 64-bit math. These functions use non-standard calling conventions.\r
-\r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-\r
-\r
-/*\r
- * Divides a 64-bit unsigned value with a 64-bit unsigned value and returns\r
- * a 64-bit unsigned result.\r
- */\r
-__declspec(naked) void __cdecl _aulldiv (void)\r
-{\r
-  //\r
-  // Wrapper Implementation over EDKII DivU64x64Reminder() routine\r
-  //    UINT64\r
-  //    EFIAPI\r
-  //    DivU64x64Remainder (\r
-  //      IN      UINT64     Dividend,\r
-  //      IN      UINT64     Divisor,\r
-  //      OUT     UINT64     *Remainder  OPTIONAL\r
-  //      )\r
-  //\r
-  _asm {\r
-\r
-    ; Original local stack when calling _aulldiv\r
-    ;               -----------------\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |               |\r
-    ;               |--  Divisor  --|\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |               |\r
-    ;               |--  Dividend --|\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |  ReturnAddr** |\r
-    ;       ESP---->|---------------|\r
-    ;\r
-\r
-    ;\r
-    ; Set up the local stack for NULL Reminder pointer\r
-    ;\r
-    xor  eax, eax\r
-    push eax\r
-\r
-    ;\r
-    ; Set up the local stack for Divisor parameter\r
-    ;\r
-    mov  eax, [esp + 20]\r
-    push eax\r
-    mov  eax, [esp + 20]\r
-    push eax\r
-\r
-    ;\r
-    ; Set up the local stack for Dividend parameter\r
-    ;\r
-    mov  eax, [esp + 20]\r
-    push eax\r
-    mov  eax, [esp + 20]\r
-    push eax\r
-\r
-    ;\r
-    ; Call native DivU64x64Remainder of BaseLib\r
-    ;\r
-    call DivU64x64Remainder\r
-\r
-    ;\r
-    ; Adjust stack\r
-    ;\r
-    add  esp, 20\r
-\r
-    ret  16\r
-  }\r
-}\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathLShiftS64.S b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathLShiftS64.S
deleted file mode 100644 (file)
index e89f553..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.  The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-# Module Name:\r
-#\r
-#   MathLShiftS64.S\r
-#\r
-# Abstract:\r
-#\r
-#   64-bit Math Worker Function.\r
-#   Shifts a 64-bit signed value left by a certain number of bits.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-    .686:\r
-    .code:\r
-\r
-ASM_GLOBAL ASM_PFX(__ashldi3)\r
-\r
-#------------------------------------------------------------------------------\r
-#\r
-# void __cdecl __ashldi3 (void)\r
-#\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(__ashldi3):\r
-    #\r
-    # Handle shifting of 64 or more bits (return 0)\r
-    #\r
-    cmpb    $64, %cl\r
-    jae     ReturnZero\r
-\r
-    #\r
-    # Handle shifting of between 0 and 31 bits\r
-    #\r
-    cmpb    $32, %cl\r
-    jae     More32\r
-    shld    %cl, %eax, %edx\r
-    shl     %cl, %eax\r
-    ret\r
-\r
-    #\r
-    # Handle shifting of between 32 and 63 bits\r
-    #\r
-More32:\r
-    movl    %eax, %edx\r
-    xor     %eax, %eax\r
-    and     $31, %cl\r
-    shl     %cl, %edx\r
-    ret\r
-\r
-ReturnZero:\r
-    xor     %eax, %eax\r
-    xor     %edx, %edx\r
-    ret\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathLShiftS64.c b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathLShiftS64.c
deleted file mode 100644 (file)
index 2ea628a..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @file\r
-  64-bit Math Worker Function.\r
-  The 32-bit versions of C compiler generate calls to library routines\r
-  to handle 64-bit math. These functions use non-standard calling conventions.\r
-\r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-\r
-/*\r
- * Shifts a 64-bit signed value left by a particular number of bits.\r
- */\r
-__declspec(naked) void __cdecl _allshl (void)\r
-{\r
-  _asm {\r
-    ;\r
-    ; Handle shifting of 64 or more bits (return 0)\r
-    ;\r
-    cmp     cl, 64\r
-    jae     short ReturnZero\r
-\r
-    ;\r
-    ; Handle shifting of between 0 and 31 bits\r
-    ;\r
-    cmp     cl, 32              \r
-    jae     short More32\r
-    shld    edx, eax, cl\r
-    shl     eax, cl\r
-    ret\r
-\r
-    ;\r
-    ; Handle shifting of between 32 and 63 bits\r
-    ;\r
-More32:\r
-    mov     edx, eax\r
-    xor     eax, eax\r
-    and     cl, 31\r
-    shl     edx, cl\r
-    ret\r
-\r
-ReturnZero:\r
-    xor     eax,eax\r
-    xor     edx,edx\r
-    ret\r
-  }\r
-}\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathMultS64x64.S b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathMultS64x64.S
deleted file mode 100644 (file)
index 8a5f330..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.  The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-# Module Name:\r
-#\r
-#   MathMultS64x64.S\r
-#\r
-# Abstract:\r
-#\r
-#   64-bit Math Worker Function.\r
-#   Multiplies a 64-bit signed or unsigned value by a 64-bit signed or unsigned value\r
-#   and returns a 64-bit result\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-    .686:\r
-    .code:\r
-\r
-ASM_GLOBAL ASM_PFX(_mulll), ASM_PFX(MultS64x64)\r
-\r
-#------------------------------------------------------------------------------\r
-#\r
-# void __cdecl __mulll (void)\r
-#\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(__mulll):\r
-    # Original local stack when calling __mulll\r
-    #               -----------------\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |               |\r
-    #               |--Multiplier --|\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |               |\r
-    #               |--Multiplicand-|\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |  ReturnAddr** |\r
-    #       ESP---->|---------------|\r
-    #\r
-\r
-    #\r
-    # Set up the local stack for Multiplicand parameter\r
-    #\r
-    movl    16(%esp), %eax\r
-    push    %eax\r
-    movl    16(%esp), %eax\r
-    push    %eax\r
-\r
-    #\r
-    # Set up the local stack for Multiplier parameter\r
-    #\r
-    movl    16(%esp), %eax\r
-    push    %eax\r
-    movl    16(%esp), %eax\r
-    push    %eax\r
-\r
-    #\r
-    # Call native MulS64x64 of BaseLib\r
-    #\r
-    jmp     ASM_PFX(MultS64x64)\r
-\r
-    #\r
-    # Adjust stack\r
-    #\r
-    add     $16, %esp\r
-\r
-    ret     $16\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathMultS64x64.c b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathMultS64x64.c
deleted file mode 100644 (file)
index 17a20bf..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/** @file\r
-  64-bit Math Worker Function.\r
-  The 32-bit versions of C compiler generate calls to library routines\r
-  to handle 64-bit math. These functions use non-standard calling conventions.\r
-  \r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-\r
-/*\r
- * Multiplies a 64-bit signed or unsigned value by a 64-bit signed or unsigned value\r
- * and returns a 64-bit result.\r
- */\r
-__declspec(naked) void __cdecl _allmul (void)\r
-{\r
-  //\r
-  // Wrapper Implementation over EDKII MultS64x64() routine\r
-  //    INT64\r
-  //    EFIAPI\r
-  //    MultS64x64 (\r
-  //      IN      INT64      Multiplicand,\r
-  //      IN      INT64      Multiplier\r
-  //      )\r
-  //\r
-  _asm {\r
-    ; Original local stack when calling _allmul\r
-    ;               -----------------\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |               |\r
-    ;               |--Multiplier --|\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |               |\r
-    ;               |--Multiplicand-|\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |  ReturnAddr** |\r
-    ;       ESP---->|---------------|\r
-    ;\r
-\r
-    ;\r
-    ; Set up the local stack for Multiplicand parameter\r
-    ;\r
-    mov  eax, [esp + 16]\r
-    push eax\r
-    mov  eax, [esp + 16]\r
-    push eax\r
-\r
-    ;\r
-    ; Set up the local stack for Multiplier parameter\r
-    ;\r
-    mov  eax, [esp + 16]\r
-    push eax\r
-    mov  eax, [esp + 16]\r
-    push eax\r
-\r
-    ;\r
-    ; Call native MulS64x64 of BaseLib\r
-    ;\r
-    call MultS64x64\r
-\r
-    ;\r
-    ; Adjust stack\r
-    ;\r
-    add  esp, 16\r
-\r
-    ret  16\r
-  }\r
-} \r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.S b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.S
deleted file mode 100644 (file)
index bf05875..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.  The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-# Module Name:\r
-#\r
-#   MathRShiftU64.S\r
-#\r
-# Abstract:\r
-#\r
-#   64-bit Math Worker Function.\r
-#   Shifts a 64-bit unsigned value right by a certain number of bits.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-\r
-    .686:\r
-    .code:\r
-\r
-ASM_GLOBAL ASM_PFX(__ashrdi3)\r
-\r
-#------------------------------------------------------------------------------\r
-#\r
-# void __cdecl __ashrdi3 (void)\r
-#\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(__ashrdi3):\r
-    #\r
-    # Checking: Only handle 64bit shifting or more\r
-    #\r
-    cmpb    $64, %cl\r
-    jae     _Exit\r
-\r
-    #\r
-    # Handle shifting between 0 and 31 bits\r
-    #\r
-    cmpb    $32, %cl\r
-    jae     More32\r
-    shrd    %cl, %edx, %eax\r
-    shr     %cl, %edx\r
-    ret\r
-\r
-    #\r
-    # Handle shifting of 32-63 bits\r
-    #\r
-More32:\r
-    movl    %edx, %eax\r
-    xor     %edx, %edx\r
-    and     $31, %cl\r
-    shr     %cl, %eax\r
-    ret\r
-\r
-    #\r
-    # Invalid number (less then 32bits), return 0\r
-    #\r
-_Exit:\r
-    xor     %eax, %eax\r
-    xor     %edx, %edx\r
-    ret\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.c b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathRShiftU64.c
deleted file mode 100644 (file)
index b7224d6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file\r
-  64-bit Math Worker Function.\r
-  The 32-bit versions of C compiler generate calls to library routines\r
-  to handle 64-bit math. These functions use non-standard calling conventions.\r
-\r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-\r
-/*\r
- * Shifts a 64-bit unsigned value right by a certain number of bits.\r
- */\r
-__declspec(naked) void __cdecl _aullshr (void)\r
-{\r
-  _asm {\r
-    ;\r
-    ; Checking: Only handle 64bit shifting or more\r
-    ;\r
-    cmp     cl, 64\r
-    jae     _Exit\r
-\r
-    ;\r
-    ; Handle shifting between 0 and 31 bits\r
-    ;\r
-    cmp     cl, 32\r
-    jae     More32\r
-    shrd    eax, edx, cl\r
-    shr     edx, cl\r
-    ret\r
-\r
-    ;\r
-    ; Handle shifting of 32-63 bits\r
-    ;\r
-More32:\r
-    mov     eax, edx\r
-    xor     edx, edx\r
-    and     cl, 31\r
-    shr     eax, cl\r
-    ret\r
-\r
-    ;\r
-    ; Invalid number (less then 32bits), return 0\r
-    ;\r
-_Exit:\r
-    xor     eax, eax\r
-    xor     edx, edx\r
-    ret\r
-  }\r
-}\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathReminderU64x64.S b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathReminderU64x64.S
deleted file mode 100644 (file)
index 7c1f971..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution.  The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php.\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-# Module Name:\r
-#\r
-#   MathReminderU64x64.S\r
-#\r
-# Abstract:\r
-#\r
-#   64-bit Math Worker Function.\r
-#   Divides a 64-bit unsigned value by another 64-bit unsigned value and returns\r
-#   the 64-bit unsigned remainder\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-    .686:\r
-    .code:\r
-\r
-ASM_GLOBAL ASM_PFX(__umoddi3), ASM_PFX(DivU64x64Remainder)\r
-\r
-#------------------------------------------------------------------------------\r
-#\r
-# void __cdecl __umoddi3 (void)\r
-#\r
-#------------------------------------------------------------------------------\r
-ASM_PFX(__umoddi3):\r
-    # Original local stack when calling __umoddi3\r
-    #               -----------------\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |               |\r
-    #               |--  Divisor  --|\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |               |\r
-    #               |--  Dividend --|\r
-    #               |               |\r
-    #               |---------------|\r
-    #               |  ReturnAddr** |\r
-    #       ESP---->|---------------|\r
-    #\r
-\r
-    #\r
-    # Set up the local stack for Reminder pointer\r
-    #\r
-    sub     $8, %esp\r
-    push    %esp\r
-\r
-    #\r
-    # Set up the local stack for Divisor parameter\r
-    #\r
-    movl    28(%esp), %eax\r
-    push    %eax\r
-    movl    28(%esp), %eax\r
-    push    %eax\r
-\r
-    #\r
-    # Set up the local stack for Dividend parameter\r
-    #\r
-    movl    28(%esp), %eax\r
-    push    %eax\r
-    movl    28(%esp), %eax\r
-    push    %eax\r
-\r
-    #\r
-    # Call native DivU64x64Remainder of BaseLib\r
-    #\r
-    jmp     ASM_PFX(DivU64x64Remainder)\r
-\r
-    #\r
-    # Put the Reminder in EDX:EAX as return value\r
-    #\r
-    movl    20(%esp), %eax\r
-    movl    24(%esp), %edx\r
-\r
-    #\r
-    # Adjust stack\r
-    #\r
-    add     $28, %esp\r
-    \r
-    ret     $16\r
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathReminderU64x64.c b/CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/MathReminderU64x64.c
deleted file mode 100644 (file)
index be70770..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file\r
-  64-bit Math Worker Function.\r
-  The 32-bit versions of C compiler generate calls to library routines\r
-  to handle 64-bit math. These functions use non-standard calling conventions.\r
-\r
-Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-\r
-\r
-/*\r
- * Divides a 64-bit unsigned value by another 64-bit unsigned value and returns\r
- * the 64-bit unsigned remainder.\r
- */\r
-__declspec(naked) void __cdecl _aullrem(void)\r
-{\r
-  //\r
-  // Wrapper Implementation over EDKII DivU64x64Remainder() routine\r
-  //    UINT64\r
-  //    EFIAPI\r
-  //    DivU64x64Remainder (\r
-  //      IN      UINT64     Dividend,\r
-  //      IN      UINT64     Divisor,\r
-  //      OUT     UINT64     *Remainder  OPTIONAL\r
-  //      )\r
-  //\r
-  _asm {\r
-    ; Original local stack when calling _aullrem\r
-    ;               -----------------\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |               |\r
-    ;               |--  Divisor  --|\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |               |\r
-    ;               |--  Dividend --|\r
-    ;               |               |\r
-    ;               |---------------|\r
-    ;               |  ReturnAddr** |\r
-    ;       ESP---->|---------------|\r
-    ;\r
-\r
-    ;\r
-    ; Set up the local stack for Reminder pointer\r
-    ;\r
-    sub  esp, 8\r
-    push esp\r
-\r
-    ;\r
-    ; Set up the local stack for Divisor parameter\r
-    ;\r
-    mov  eax, [esp + 28]\r
-    push eax\r
-    mov  eax, [esp + 28]\r
-    push eax\r
-\r
-    ;\r
-    ; Set up the local stack for Dividend parameter\r
-    ;\r
-    mov  eax, [esp + 28]\r
-    push eax\r
-    mov  eax, [esp + 28]\r
-    push eax\r
-\r
-    ;\r
-    ; Call native DivU64x64Remainder of BaseLib\r
-    ;\r
-    call DivU64x64Remainder\r
-\r
-    ;\r
-    ; Put the Reminder in EDX:EAX as return value\r
-    ;\r
-    mov  eax, [esp + 20]\r
-    mov  edx, [esp + 24]\r
-\r
-    ;\r
-    ; Adjust stack\r
-    ;\r
-    add  esp, 28\r
-\r
-    ret  16\r
-  }\r
-}\r
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
new file mode 100644 (file)
index 0000000..7031a59
--- /dev/null
@@ -0,0 +1,62 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php.\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   MathLShiftS64.S\r
+#\r
+# Abstract:\r
+#\r
+#   64-bit Math Worker Function.\r
+#   Shifts a 64-bit signed value left by a certain number of bits.\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+    .686:\r
+    .code:\r
+\r
+ASM_GLOBAL ASM_PFX(__ashldi3)\r
+\r
+#------------------------------------------------------------------------------\r
+#\r
+# void __cdecl __ashldi3 (void)\r
+#\r
+#------------------------------------------------------------------------------\r
+ASM_PFX(__ashldi3):\r
+    #\r
+    # Handle shifting of 64 or more bits (return 0)\r
+    #\r
+    cmpb    $64, %cl\r
+    jae     ReturnZero\r
+\r
+    #\r
+    # Handle shifting of between 0 and 31 bits\r
+    #\r
+    cmpb    $32, %cl\r
+    jae     More32\r
+    shld    %cl, %eax, %edx\r
+    shl     %cl, %eax\r
+    ret\r
+\r
+    #\r
+    # Handle shifting of between 32 and 63 bits\r
+    #\r
+More32:\r
+    movl    %eax, %edx\r
+    xor     %eax, %eax\r
+    and     $31, %cl\r
+    shl     %cl, %edx\r
+    ret\r
+\r
+ReturnZero:\r
+    xor     %eax, %eax\r
+    xor     %edx, %edx\r
+    ret\r
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.c
new file mode 100644 (file)
index 0000000..0c0835d
--- /dev/null
@@ -0,0 +1,54 @@
+/** @file\r
+  64-bit Math Worker Function.\r
+  The 32-bit versions of C compiler generate calls to library routines\r
+  to handle 64-bit math. These functions use non-standard calling conventions.\r
+\r
+Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+\r
+/*\r
+ * Shifts a 64-bit signed value left by a particular number of bits.\r
+ */\r
+__declspec(naked) void __cdecl _allshl (void)\r
+{\r
+  _asm {\r
+    ;\r
+    ; Handle shifting of 64 or more bits (return 0)\r
+    ;\r
+    cmp     cl, 64\r
+    jae     short ReturnZero\r
+\r
+    ;\r
+    ; Handle shifting of between 0 and 31 bits\r
+    ;\r
+    cmp     cl, 32\r
+    jae     short More32\r
+    shld    edx, eax, cl\r
+    shl     eax, cl\r
+    ret\r
+\r
+    ;\r
+    ; Handle shifting of between 32 and 63 bits\r
+    ;\r
+More32:\r
+    mov     edx, eax\r
+    xor     eax, eax\r
+    and     cl, 31\r
+    shl     edx, cl\r
+    ret\r
+\r
+ReturnZero:\r
+    xor     eax,eax\r
+    xor     edx,edx\r
+    ret\r
+  }\r
+}\r
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
new file mode 100644 (file)
index 0000000..24142b0
--- /dev/null
@@ -0,0 +1,66 @@
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php.\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Module Name:\r
+#\r
+#   MathRShiftU64.S\r
+#\r
+# Abstract:\r
+#\r
+#   64-bit Math Worker Function.\r
+#   Shifts a 64-bit unsigned value right by a certain number of bits.\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+\r
+    .686:\r
+    .code:\r
+\r
+ASM_GLOBAL ASM_PFX(__ashrdi3)\r
+\r
+#------------------------------------------------------------------------------\r
+#\r
+# void __cdecl __ashrdi3 (void)\r
+#\r
+#------------------------------------------------------------------------------\r
+ASM_PFX(__ashrdi3):\r
+    #\r
+    # Checking: Only handle 64bit shifting or more\r
+    #\r
+    cmpb    $64, %cl\r
+    jae     _Exit\r
+\r
+    #\r
+    # Handle shifting between 0 and 31 bits\r
+    #\r
+    cmpb    $32, %cl\r
+    jae     More32\r
+    shrd    %cl, %edx, %eax\r
+    shr     %cl, %edx\r
+    ret\r
+\r
+    #\r
+    # Handle shifting of 32-63 bits\r
+    #\r
+More32:\r
+    movl    %edx, %eax\r
+    xor     %edx, %edx\r
+    and     $31, %cl\r
+    shr     %cl, %eax\r
+    ret\r
+\r
+    #\r
+    # Invalid number (less then 32bits), return 0\r
+    #\r
+_Exit:\r
+    xor     %eax, %eax\r
+    xor     %edx, %edx\r
+    ret\r
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.c
new file mode 100644 (file)
index 0000000..86b1004
--- /dev/null
@@ -0,0 +1,57 @@
+/** @file\r
+  64-bit Math Worker Function.\r
+  The 32-bit versions of C compiler generate calls to library routines\r
+  to handle 64-bit math. These functions use non-standard calling conventions.\r
+\r
+Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+\r
+/*\r
+ * Shifts a 64-bit unsigned value right by a certain number of bits.\r
+ */\r
+__declspec(naked) void __cdecl _aullshr (void)\r
+{\r
+  _asm {\r
+    ;\r
+    ; Checking: Only handle 64bit shifting or more\r
+    ;\r
+    cmp     cl, 64\r
+    jae     _Exit\r
+\r
+    ;\r
+    ; Handle shifting between 0 and 31 bits\r
+    ;\r
+    cmp     cl, 32\r
+    jae     More32\r
+    shrd    eax, edx, cl\r
+    shr     edx, cl\r
+    ret\r
+\r
+    ;\r
+    ; Handle shifting of 32-63 bits\r
+    ;\r
+More32:\r
+    mov     eax, edx\r
+    xor     edx, edx\r
+    and     cl, 31\r
+    shr     eax, cl\r
+    ret\r
+\r
+    ;\r
+    ; Invalid number (less then 32bits), return 0\r
+    ;\r
+_Exit:\r
+    xor     eax, eax\r
+    xor     edx, edx\r
+    ret\r
+  }\r
+}\r
index 0c1f96cd875b391faaec769b1cd948d8d816ded2..de61dc40ea43bce0d495063972d5db5c0203b878 100644 (file)
@@ -6,10 +6,10 @@
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
-#  \r
+#\r
 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#  \r
+#\r
 ##\r
 \r
 [Defines]\r
 [Sources.IA32]\r
   CopyMem.c\r
 \r
+  Ia32/MathLShiftS64.c      | MSFT\r
+  Ia32/MathRShiftU64.c      | MSFT\r
+\r
+  Ia32/MathLShiftS64.c      | INTEL\r
+  Ia32/MathRShiftU64.c      | INTEL\r
+\r
+  Ia32/MathLShiftS64.S      | GCC\r
+  Ia32/MathRShiftU64.S      | GCC\r
+\r
 [Sources.X64]\r
   CopyMem.c\r
 \r
@@ -70,4 +79,4 @@
    MSFT:DEBUG_*_IPF_CC_FLAGS              == /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /FIAutoGen.h /QIPF_fr32 /Zi\r
    MSFT:RELEASE_*_IPF_CC_FLAGS            == /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /FIAutoGen.h /QIPF_fr32\r
   INTEL:*_*_*_CC_FLAGS                    =  /Oi-\r
-    GCC:*_*_*_CC_FLAGS                    =  -fno-builtin\r
+    GCC:*_*_*_CC_FLAGS                    =  -fno-builtin
\ No newline at end of file
index f32afb9b65ffc093e79952dee7982f029a88b11a..ab44e89b72198c5f115cc06473733774737a3227 100644 (file)
@@ -1,15 +1,15 @@
 ## @file\r
 #  This module provides openSSL Library implementation.\r
-# \r
+#\r
 #  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution.  The full text of the license may be found at\r
 #  http://opensource.org/licenses/bsd-license.php\r
-#  \r
+#\r
 #  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 #  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#  \r
+#\r
 ##\r
 \r
 [Defines]\r
   LIBRARY_CLASS                  = OpensslLib\r
   DEFINE OPENSSL_PATH            = openssl-0.9.8zb\r
   DEFINE OPENSSL_FLAGS           = -DOPENSSL_SYSNAME_UWIN -DOPENSSL_SYS_UEFI -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_CAMELLIA -DOPENSSL_NO_SEED -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_SOCK -DOPENSSL_NO_CMS -DOPENSSL_NO_JPAKE -DOPENSSL_NO_CAPIENG -DOPENSSL_NO_ERR -DOPENSSL_NO_KRB5 -DOPENSSL_NO_DYNAMIC_ENGINE -DGETPID_IS_MEANINGLESS -DOPENSSL_NO_STDIO -DOPENSSL_NO_FP_API -DOPENSSL_NO_DGRAM -DOPENSSL_NO_ASM\r
-  DEFINE OPENSSL_EXFLAGS         = -DOPENSSL_SMALL_FOOTPRINT -DOPENSSL_NO_MD2 -DOPENSSL_NO_SHA0 -DOPENSSL_NO_SHA512 -DOPENSSL_NO_LHASH -DOPENSSL_NO_HW -DOPENSSL_NO_OCSP -DOPENSSL_NO_LOCKING -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_RIPEMD -DOPENSSL_NO_RC2 -DOPENSSL_NO_IDEA -DOPENSSL_NO_BF -DOPENSSL_NO_CAST -DOPENSSL_NO_WHIRLPOOL -DOPENSSL_NO_DSA -DOPENSSL_NO_EC -DOPENSSL_NO_ECDH -DOPENSSL_NO_ECDSA -DOPENSSL_NO_ENGINE\r
-  \r
+  DEFINE OPENSSL_EXFLAGS         = -DOPENSSL_SMALL_FOOTPRINT -DOPENSSL_NO_MD2 -DOPENSSL_NO_SHA0 -DOPENSSL_NO_LHASH -DOPENSSL_NO_HW -DOPENSSL_NO_OCSP -DOPENSSL_NO_LOCKING -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_RIPEMD -DOPENSSL_NO_RC2 -DOPENSSL_NO_IDEA -DOPENSSL_NO_BF -DOPENSSL_NO_CAST -DOPENSSL_NO_WHIRLPOOL -DOPENSSL_NO_DSA -DOPENSSL_NO_EC -DOPENSSL_NO_ECDH -DOPENSSL_NO_ECDSA -DOPENSSL_NO_ENGINE\r
+\r
 #\r
-# OPENSSL_FLAGS is set to define the following flags to be compatible with \r
-# EDK II build system and UEFI executiuon environment \r
+# OPENSSL_FLAGS is set to define the following flags to be compatible with\r
+# EDK II build system and UEFI executiuon environment\r
 #\r
 #   OPENSSL_SYSNAME_UWIN\r
-#   OPENSSL_SYS_UEFI \r
-#   L_ENDIAN \r
-#   _CRT_SECURE_NO_DEPRECATE \r
-#   _CRT_NONSTDC_NO_DEPRECATE \r
-#   OPENSSL_NO_CAMELLIA \r
-#   OPENSSL_NO_SEED \r
-#   OPENSSL_NO_RC5 \r
-#   OPENSSL_NO_MDC2 \r
-#   OPENSSL_NO_SOCK \r
-#   OPENSSL_NO_CMS \r
-#   OPENSSL_NO_JPAKE \r
-#   OPENSSL_NO_CAPIENG \r
-#   OPENSSL_NO_ERR \r
-#   OPENSSL_NO_KRB5 \r
-#   OPENSSL_NO_DYNAMIC_ENGINE \r
-#   GETPID_IS_MEANINGLESS \r
-#   OPENSSL_NO_STDIO \r
-#   OPENSSL_NO_FP_API \r
-#   OPENSSL_NO_DGRAM  \r
+#   OPENSSL_SYS_UEFI\r
+#   L_ENDIAN\r
+#   _CRT_SECURE_NO_DEPRECATE\r
+#   _CRT_NONSTDC_NO_DEPRECATE\r
+#   OPENSSL_NO_CAMELLIA\r
+#   OPENSSL_NO_SEED\r
+#   OPENSSL_NO_RC5\r
+#   OPENSSL_NO_MDC2\r
+#   OPENSSL_NO_SOCK\r
+#   OPENSSL_NO_CMS\r
+#   OPENSSL_NO_JPAKE\r
+#   OPENSSL_NO_CAPIENG\r
+#   OPENSSL_NO_ERR\r
+#   OPENSSL_NO_KRB5\r
+#   OPENSSL_NO_DYNAMIC_ENGINE\r
+#   GETPID_IS_MEANINGLESS\r
+#   OPENSSL_NO_STDIO\r
+#   OPENSSL_NO_FP_API\r
+#   OPENSSL_NO_DGRAM\r
 #   OPENSSL_NO_ASM\r
 #\r
-  \r
+\r
 #\r
 #  VALID_ARCHITECTURES           = IA32 X64 IPF ARM AARCH64\r
 #\r
   # Not required for UEFI.\r
   #\r
   # $(OPENSSL_PATH)/crypto/bio/b_print.c\r
-  \r
+\r
   $(OPENSSL_PATH)/crypto/bio/b_dump.c\r
   $(OPENSSL_PATH)/crypto/bio/bf_nbio.c\r
   $(OPENSSL_PATH)/crypto/bio/bss_log.c\r
    # 1296: Extended constant initialiser used\r
    RVCT:*_*_ARM_CC_FLAGS                  = $(OPENSSL_FLAGS) $(OPENSSL_EXFLAGS) --library_interface=aeabi_clib99 --fpu=vfpv3 -DTHIRTY_TWO_BIT --diag_suppress=1296,1295,550,1293,111,68,177,223,144,513,188\r
    XCODE:*_*_IA32_CC_FLAGS                = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_EXFLAGS) -w -DTHIRTY_TWO_BIT\r
-   XCODE:*_*_X64_CC_FLAGS                 = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_EXFLAGS) -w -DSIXTY_FOUR_BIT_LONG\r
+   XCODE:*_*_X64_CC_FLAGS                 = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) $(OPENSSL_EXFLAGS) -w -DSIXTY_FOUR_BIT_LONG
\ No newline at end of file