https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
		
			
				
	
	
		
			63 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/** @file
 | 
						|
  Internal include file for BaseCryptLib.
 | 
						|
 | 
						|
Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
 | 
						|
SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
						|
 | 
						|
**/
 | 
						|
 | 
						|
#ifndef __INTERNAL_CRYPT_LIB_H__
 | 
						|
#define __INTERNAL_CRYPT_LIB_H__
 | 
						|
 | 
						|
#undef _WIN32
 | 
						|
#undef _WIN64
 | 
						|
 | 
						|
#include <Library/BaseLib.h>
 | 
						|
#include <Library/BaseMemoryLib.h>
 | 
						|
#include <Library/MemoryAllocationLib.h>
 | 
						|
#include <Library/DebugLib.h>
 | 
						|
#include <Library/BaseCryptLib.h>
 | 
						|
 | 
						|
#include "CrtLibSupport.h"
 | 
						|
 | 
						|
#include <openssl/opensslv.h>
 | 
						|
 | 
						|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
 | 
						|
#define OBJ_get0_data(o) ((o)->data)
 | 
						|
#define OBJ_length(o) ((o)->length)
 | 
						|
#endif
 | 
						|
 | 
						|
/**
 | 
						|
  Check input P7Data is a wrapped ContentInfo structure or not. If not construct
 | 
						|
  a new structure to wrap P7Data.
 | 
						|
 | 
						|
  Caution: This function may receive untrusted input.
 | 
						|
  UEFI Authenticated Variable is external input, so this function will do basic
 | 
						|
  check for PKCS#7 data structure.
 | 
						|
 | 
						|
  @param[in]  P7Data       Pointer to the PKCS#7 message to verify.
 | 
						|
  @param[in]  P7Length     Length of the PKCS#7 message in bytes.
 | 
						|
  @param[out] WrapFlag     If TRUE P7Data is a ContentInfo structure, otherwise
 | 
						|
                           return FALSE.
 | 
						|
  @param[out] WrapData     If return status of this function is TRUE:
 | 
						|
                           1) when WrapFlag is TRUE, pointer to P7Data.
 | 
						|
                           2) when WrapFlag is FALSE, pointer to a new ContentInfo
 | 
						|
                           structure. It's caller's responsibility to free this
 | 
						|
                           buffer.
 | 
						|
  @param[out] WrapDataSize Length of ContentInfo structure in bytes.
 | 
						|
 | 
						|
  @retval     TRUE         The operation is finished successfully.
 | 
						|
  @retval     FALSE        The operation is failed due to lack of resources.
 | 
						|
 | 
						|
**/
 | 
						|
BOOLEAN
 | 
						|
WrapPkcs7Data (
 | 
						|
  IN  CONST UINT8  *P7Data,
 | 
						|
  IN  UINTN        P7Length,
 | 
						|
  OUT BOOLEAN      *WrapFlag,
 | 
						|
  OUT UINT8        **WrapData,
 | 
						|
  OUT UINTN        *WrapDataSize
 | 
						|
  );
 | 
						|
 | 
						|
#endif
 |