Introduce the MorLockInitAtEndOfDxe() hook, in order to allow MorLockInit() to delay / queue operations until EndOfDxe. (Or, if the platform never signals EndOfDxe, until ReadyToBoot.) Call MorLockInitAtEndOfDxe() whenever we set "mEndOfDxe" to TRUE: - in VariableRuntimeDxe: - in the OnReadyToBoot() function, - in the OnEndOfDxe() function; - in VariableSmm: - on the SMM_VARIABLE_FUNCTION_READY_TO_BOOT SMI request, - in the SmmEndOfDxeCallback() function. For now, implement MorLockInitAtEndOfDxe() as a no-op in both VariableRuntimeDxe and VariableSmm. Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ladi Prosek <lprosek@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Tested-by: Ladi Prosek <lprosek@redhat.com>
		
			
				
	
	
		
			88 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			2.9 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/** @file
 | 
						|
  Polymorphic functions that are called from both the privileged driver (i.e.,
 | 
						|
  the DXE_SMM variable module) and the non-privileged drivers (i.e., one or
 | 
						|
  both of the DXE_RUNTIME variable modules).
 | 
						|
 | 
						|
  Each of these functions has two implementations, appropriate for privileged
 | 
						|
  vs. non-privileged driver code.
 | 
						|
 | 
						|
  Copyright (c) 2017, Red Hat, Inc.<BR>
 | 
						|
  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
 | 
						|
 | 
						|
  This program and the accompanying materials are licensed and made available
 | 
						|
  under the terms and conditions of the BSD License which accompanies this
 | 
						|
  distribution.  The full text of the license may be found at
 | 
						|
  http://opensource.org/licenses/bsd-license.php
 | 
						|
 | 
						|
  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
 | 
						|
  WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 | 
						|
**/
 | 
						|
#ifndef _PRIVILEGE_POLYMORPHIC_H_
 | 
						|
#define _PRIVILEGE_POLYMORPHIC_H_
 | 
						|
 | 
						|
#include <Uefi/UefiBaseType.h>
 | 
						|
 | 
						|
/**
 | 
						|
  SecureBoot Hook for auth variable update.
 | 
						|
 | 
						|
  @param[in] VariableName                 Name of Variable to be found.
 | 
						|
  @param[in] VendorGuid                   Variable vendor GUID.
 | 
						|
**/
 | 
						|
VOID
 | 
						|
EFIAPI
 | 
						|
SecureBootHook (
 | 
						|
  IN CHAR16                                 *VariableName,
 | 
						|
  IN EFI_GUID                               *VendorGuid
 | 
						|
  );
 | 
						|
 | 
						|
/**
 | 
						|
  Initialization for MOR Control Lock.
 | 
						|
 | 
						|
  @retval EFI_SUCCESS     MorLock initialization success.
 | 
						|
  @return Others          Some error occurs.
 | 
						|
**/
 | 
						|
EFI_STATUS
 | 
						|
MorLockInit (
 | 
						|
  VOID
 | 
						|
  );
 | 
						|
 | 
						|
/**
 | 
						|
  Delayed initialization for MOR Control Lock at EndOfDxe.
 | 
						|
 | 
						|
  This function performs any operations queued by MorLockInit().
 | 
						|
**/
 | 
						|
VOID
 | 
						|
MorLockInitAtEndOfDxe (
 | 
						|
  VOID
 | 
						|
  );
 | 
						|
 | 
						|
/**
 | 
						|
  This service is an MOR/MorLock checker handler for the SetVariable().
 | 
						|
 | 
						|
  @param[in]  VariableName the name of the vendor's variable, as a
 | 
						|
                           Null-Terminated Unicode String
 | 
						|
  @param[in]  VendorGuid   Unify identifier for vendor.
 | 
						|
  @param[in]  Attributes   Attributes bitmask to set for the variable.
 | 
						|
  @param[in]  DataSize     The size in bytes of Data-Buffer.
 | 
						|
  @param[in]  Data         Point to the content of the variable.
 | 
						|
 | 
						|
  @retval  EFI_SUCCESS            The MOR/MorLock check pass, and Variable
 | 
						|
                                  driver can store the variable data.
 | 
						|
  @retval  EFI_INVALID_PARAMETER  The MOR/MorLock data or data size or
 | 
						|
                                  attributes is not allowed for MOR variable.
 | 
						|
  @retval  EFI_ACCESS_DENIED      The MOR/MorLock is locked.
 | 
						|
  @retval  EFI_ALREADY_STARTED    The MorLock variable is handled inside this
 | 
						|
                                  function. Variable driver can just return
 | 
						|
                                  EFI_SUCCESS.
 | 
						|
**/
 | 
						|
EFI_STATUS
 | 
						|
SetVariableCheckHandlerMor (
 | 
						|
  IN CHAR16     *VariableName,
 | 
						|
  IN EFI_GUID   *VendorGuid,
 | 
						|
  IN UINT32     Attributes,
 | 
						|
  IN UINTN      DataSize,
 | 
						|
  IN VOID       *Data
 | 
						|
  );
 | 
						|
 | 
						|
#endif
 |