REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1403 Add support for PKCS 1v2 RSAES-OAEP PKI encryption in BaseCryptLib. Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Cc: Ting Ye <ting.ye@intel.com> Cc: Gang Wei <gang.wei@intel.com> Cc: Wang Jian J <jian.j.wang@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Michael Turner <Michael.Turner@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /** @file
 | |
|   This file contains UEFI wrapper functions for RSA PKCS1v2 OAEP encryption routines.
 | |
| 
 | |
|   SPDX-License-Identifier: BSD-2-Clause-Patent
 | |
| 
 | |
|   Copyright (C) 2016 Microsoft Corporation. All Rights Reserved.
 | |
|   Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
 | |
| 
 | |
| **/
 | |
| 
 | |
| #include "InternalCryptLib.h"
 | |
| 
 | |
| /**
 | |
|   Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the
 | |
|   encrypted message in a newly allocated buffer.
 | |
| 
 | |
|   Return FALSE to indicate this interface is not supported.
 | |
| 
 | |
|   @param[in]  PublicKey           A pointer to the DER-encoded X509 certificate that
 | |
|                                   will be used to encrypt the data.
 | |
|   @param[in]  PublicKeySize       Size of the X509 cert buffer.
 | |
|   @param[in]  InData              Data to be encrypted.
 | |
|   @param[in]  InDataSize          Size of the data buffer.
 | |
|   @param[in]  PrngSeed            [Optional] If provided, a pointer to a random seed buffer
 | |
|                                   to be used when initializing the PRNG. NULL otherwise.
 | |
|   @param[in]  PrngSeedSize        [Optional] If provided, size of the random seed buffer.
 | |
|                                   0 otherwise.
 | |
|   @param[out] EncryptedData       Pointer to an allocated buffer containing the encrypted
 | |
|                                   message.
 | |
|   @param[out] EncryptedDataSize   Size of the encrypted message buffer.
 | |
| 
 | |
|   @retval FALSE                   This interface is not supported.
 | |
| 
 | |
| **/
 | |
| BOOLEAN
 | |
| EFIAPI
 | |
| Pkcs1v2Encrypt (
 | |
|   IN   CONST UINT8  *PublicKey,
 | |
|   IN   UINTN        PublicKeySize,
 | |
|   IN   UINT8        *InData,
 | |
|   IN   UINTN        InDataSize,
 | |
|   IN   CONST UINT8  *PrngSeed,  OPTIONAL
 | |
|   IN   UINTN        PrngSeedSize,  OPTIONAL
 | |
|   OUT  UINT8        **EncryptedData,
 | |
|   OUT  UINTN        *EncryptedDataSize
 | |
|   )
 | |
| {
 | |
|   ASSERT (FALSE);
 | |
|   return FALSE;
 | |
| }
 | |
| 
 |