]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / InternalCryptLib.h
index 35a8eb1cbcb8956db2e096a83004ef50c76d88d4..3412acc676920be11738f09ce86d682d7e46d911 100644 (file)
@@ -1,34 +1,62 @@
-/** @file  \r
+/** @file\r
   Internal include file for BaseCryptLib.\r
 \r
-Copyright (c) 2010 - 2012, 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
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #ifndef __INTERNAL_CRYPT_LIB_H__\r
 #define __INTERNAL_CRYPT_LIB_H__\r
 \r
+#undef _WIN32\r
+#undef _WIN64\r
+\r
 #include <Library/BaseLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseCryptLib.h>\r
 \r
-#include "OpenSslSupport.h"\r
+#include "CrtLibSupport.h"\r
 \r
-//\r
-// Environment Setting for OpenSSL-based UEFI Crypto Library.\r
-//\r
-#ifndef OPENSSL_SYSNAME_UWIN\r
-#define OPENSSL_SYSNAME_UWIN\r
-#endif\r
+#include <openssl/opensslv.h>\r
 \r
+#if OPENSSL_VERSION_NUMBER < 0x10100000L\r
+#define OBJ_get0_data(o)  ((o)->data)\r
+#define OBJ_length(o)     ((o)->length)\r
 #endif\r
 \r
+/**\r
+  Check input P7Data is a wrapped ContentInfo structure or not. If not construct\r
+  a new structure to wrap P7Data.\r
+\r
+  Caution: This function may receive untrusted input.\r
+  UEFI Authenticated Variable is external input, so this function will do basic\r
+  check for PKCS#7 data structure.\r
+\r
+  @param[in]  P7Data       Pointer to the PKCS#7 message to verify.\r
+  @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
+                           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
+                           buffer.\r
+  @param[out] WrapDataSize Length of ContentInfo structure in bytes.\r
+\r
+  @retval     TRUE         The operation is finished successfully.\r
+  @retval     FALSE        The operation is failed due to lack of resources.\r
+\r
+**/\r
+BOOLEAN\r
+WrapPkcs7Data (\r
+  IN  CONST UINT8  *P7Data,\r
+  IN  UINTN        P7Length,\r
+  OUT BOOLEAN      *WrapFlag,\r
+  OUT UINT8        **WrapData,\r
+  OUT UINTN        *WrapDataSize\r
+  );\r
+\r
+#endif\r