MdeModulePkg[all]  0.98
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
VariablePolicyLib.h File Reference

Functions

EFI_STATUS EFIAPI RegisterVariablePolicy (IN CONST VARIABLE_POLICY_ENTRY *NewPolicy)
 
EFI_STATUS EFIAPI ValidateSetVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data)
 
EFI_STATUS EFIAPI DisableVariablePolicy (VOID)
 
EFI_STATUS EFIAPI DumpVariablePolicy (OUT UINT8 *Policy, IN OUT UINT32 *Size)
 
BOOLEAN EFIAPI IsVariablePolicyEnabled (VOID)
 
EFI_STATUS EFIAPI LockVariablePolicy (VOID)
 
BOOLEAN EFIAPI IsVariablePolicyInterfaceLocked (VOID)
 
EFI_STATUS EFIAPI InitVariablePolicyLib (IN EFI_GET_VARIABLE GetVariableHelper)
 
BOOLEAN EFIAPI IsVariablePolicyLibInitialized (VOID)
 
EFI_STATUS EFIAPI DeinitVariablePolicyLib (VOID)
 

Function Documentation

EFI_STATUS EFIAPI DeinitVariablePolicyLib ( VOID  )

This helper function tears down the library.

Should generally only be used for test harnesses.

Return values
EFI_SUCCESS
EFI_NOT_READYDeinitialize was called without first calling initialize.
EFI_STATUS EFIAPI DisableVariablePolicy ( VOID  )

This API function disables the variable policy enforcement. If it's already been called once, will return EFI_ALREADY_STARTED.

Return values
EFI_SUCCESS
EFI_ALREADY_STARTEDHas already been called once this boot.
EFI_WRITE_PROTECTEDInterface has been locked until reboot.
EFI_WRITE_PROTECTEDInterface option is disabled by platform PCD.
EFI_NOT_READYLibrary has not yet been initialized.
EFI_STATUS EFIAPI DumpVariablePolicy ( OUT UINT8 *  Policy,
IN OUT UINT32 Size 
)

This API function will dump the entire contents of the variable policy table.

Similar to GetVariable, the first call can be made with a 0 size and it will return the size of the buffer required to hold the entire table.

Parameters
[out]PolicyPointer to the policy buffer. Can be NULL if Size is 0.
[in,out]SizeOn input, the size of the output buffer. On output, the size of the data returned.
Return values
EFI_SUCCESSPolicy data is in the output buffer and Size has been updated.
EFI_INVALID_PARAMETERSize is NULL, or Size is non-zero and Policy is NULL.
EFI_BUFFER_TOO_SMALLSize is insufficient to hold policy. Size updated with required size.
EFI_NOT_READYLibrary has not yet been initialized.
EFI_STATUS EFIAPI InitVariablePolicyLib ( IN EFI_GET_VARIABLE  GetVariableHelper)

This helper function initializes the library and sets up any required internal structures or handlers.

Also registers the internal pointer for the GetVariable helper.

Parameters
[in]GetVariableHelperA function pointer matching the EFI_GET_VARIABLE prototype that will be used to check policy criteria that involve the existence of other variables.
Return values
EFI_SUCCESS
EFI_ALREADY_STARTEDThe initialize function has been called more than once without a call to deinitialize.
BOOLEAN EFIAPI IsVariablePolicyEnabled ( VOID  )

This API function returns whether or not the policy engine is currently being enforced.

Return values
TRUE
FALSE
FALSELibrary has not yet been initialized.
BOOLEAN EFIAPI IsVariablePolicyInterfaceLocked ( VOID  )

This API function returns whether or not the policy interface is locked for the remainder of the boot.

Return values
TRUE
FALSE
FALSELibrary has not yet been initialized.
BOOLEAN EFIAPI IsVariablePolicyLibInitialized ( VOID  )

This helper function returns whether or not the library is currently initialized.

Return values
TRUE
FALSE
EFI_STATUS EFIAPI LockVariablePolicy ( VOID  )

This API function locks the interface so that no more policy updates can be performed or changes made to the enforcement until the next boot.

Return values
EFI_SUCCESS
EFI_NOT_READYLibrary has not yet been initialized.
EFI_STATUS EFIAPI RegisterVariablePolicy ( IN CONST VARIABLE_POLICY_ENTRY NewPolicy)

This API function validates and registers a new policy with the policy enforcement engine.

Parameters
[in]NewPolicyPointer to the incoming policy structure.
Return values
EFI_SUCCESS
EFI_INVALID_PARAMETERNewPolicy is NULL or is internally inconsistent.
EFI_ALREADY_STARTEDAn identical matching policy already exists.
EFI_WRITE_PROTECTEDThe interface has been locked until the next reboot.
EFI_UNSUPPORTEDPolicy enforcement has been disabled. No reason to add more policies.
EFI_ABORTEDA calculation error has prevented this function from completing.
EFI_OUT_OF_RESOURCESCannot grow the table to hold any more policies.
EFI_NOT_READYLibrary has not yet been initialized.
EFI_STATUS EFIAPI ValidateSetVariable ( IN CHAR16 *  VariableName,
IN EFI_GUID *  VendorGuid,
IN UINT32  Attributes,
IN UINTN  DataSize,
IN VOID Data 
)

This API function checks to see whether the parameters to SetVariable would be allowed according to the current variable policies.

Parameters
[in]VariableNameSame as EFI_SET_VARIABLE.
[in]VendorGuidSame as EFI_SET_VARIABLE.
[in]AttributesSame as EFI_SET_VARIABLE.
[in]DataSizeSame as EFI_SET_VARIABLE.
[in]DataSame as EFI_SET_VARIABLE.
Return values
EFI_SUCCESSA matching policy allows this update.
EFI_SUCCESSThere are currently no policies that restrict this update.
EFI_SUCCESSThe protections have been disable until the next reboot.
EFI_WRITE_PROTECTEDVariable is currently locked.
EFI_INVALID_PARAMETERAttributes or size are invalid.
EFI_ABORTEDA lock policy exists, but an error prevented evaluation.
EFI_NOT_READYLibrary has not been initialized.