TianoCore EDK2 master
Loading...
Searching...
No Matches
AuthVariableLib.h File Reference

Go to the source code of this file.

Data Structures

struct  AUTH_VARIABLE_INFO
 
struct  AUTH_VAR_LIB_CONTEXT_IN
 
struct  AUTH_VAR_LIB_CONTEXT_OUT
 

Macros

#define AUTHINFO_SIZE
 
#define AUTHINFO2_SIZE(VarAuth2)
 
#define OFFSET_OF_AUTHINFO2_CERT_DATA
 
#define AUTH_VAR_LIB_CONTEXT_IN_STRUCT_VERSION   0x01
 
#define AUTH_VAR_LIB_CONTEXT_OUT_STRUCT_VERSION   0x01
 

Typedefs

typedef EFI_STATUS(EFIAPI * AUTH_VAR_LIB_FIND_VARIABLE) (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT AUTH_VARIABLE_INFO *AuthVariableInfo)
 
typedef EFI_STATUS(EFIAPI * AUTH_VAR_LIB_FIND_NEXT_VARIABLE) (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT AUTH_VARIABLE_INFO *AuthVariableInfo)
 
typedef EFI_STATUS(EFIAPI * AUTH_VAR_LIB_UPDATE_VARIABLE) (IN AUTH_VARIABLE_INFO *AuthVariableInfo)
 
typedef EFI_STATUS(EFIAPI * AUTH_VAR_LIB_GET_SCRATCH_BUFFER) (IN OUT UINTN *ScratchBufferSize, OUT VOID **ScratchBuffer)
 
typedef BOOLEAN(EFIAPI * AUTH_VAR_LIB_CHECK_REMAINING_SPACE) (IN UINT32 Attributes,...)
 
typedef BOOLEAN(EFIAPI * AUTH_VAR_LIB_AT_RUNTIME) (VOID)
 

Functions

EFI_STATUS EFIAPI AuthVariableLibInitialize (IN AUTH_VAR_LIB_CONTEXT_IN *AuthVarLibContextIn, OUT AUTH_VAR_LIB_CONTEXT_OUT *AuthVarLibContextOut)
 
EFI_STATUS EFIAPI AuthVariableLibProcessVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN VOID *Data, IN UINTN DataSize, IN UINT32 Attributes)
 

Detailed Description

Provides services to initialize and process authenticated variables.

Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file AuthVariableLib.h.

Macro Definition Documentation

◆ AUTH_VAR_LIB_CONTEXT_IN_STRUCT_VERSION

#define AUTH_VAR_LIB_CONTEXT_IN_STRUCT_VERSION   0x01

Definition at line 166 of file AuthVariableLib.h.

◆ AUTH_VAR_LIB_CONTEXT_OUT_STRUCT_VERSION

#define AUTH_VAR_LIB_CONTEXT_OUT_STRUCT_VERSION   0x01

Definition at line 186 of file AuthVariableLib.h.

◆ AUTHINFO2_SIZE

#define AUTHINFO2_SIZE (   VarAuth2)
Value:
(UINTN) ((EFI_VARIABLE_AUTHENTICATION_2 *) (VarAuth2))->AuthInfo.Hdr.dwLength)
UINT64 UINTN
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758

Definition at line 21 of file AuthVariableLib.h.

◆ AUTHINFO_SIZE

#define AUTHINFO_SIZE

◆ OFFSET_OF_AUTHINFO2_CERT_DATA

#define OFFSET_OF_AUTHINFO2_CERT_DATA
Value:

Definition at line 24 of file AuthVariableLib.h.

Typedef Documentation

◆ AUTH_VAR_LIB_AT_RUNTIME

typedef BOOLEAN(EFIAPI * AUTH_VAR_LIB_AT_RUNTIME) (VOID)

Return TRUE if at OS runtime.

Return values
TRUEIf at OS runtime.
FALSEIf at boot time.

Definition at line 161 of file AuthVariableLib.h.

◆ AUTH_VAR_LIB_CHECK_REMAINING_SPACE

typedef BOOLEAN(EFIAPI * AUTH_VAR_LIB_CHECK_REMAINING_SPACE) (IN UINT32 Attributes,...)

This function is to check if the remaining variable space is enough to set all Variables from argument list successfully. The purpose of the check is to keep the consistency of the Variables to be in variable storage.

Note: Variables are assumed to be in same storage. The set sequence of Variables will be same with the sequence of VariableEntry from argument list, so follow the argument sequence to check the Variables.

Parameters
[in]AttributesVariable attributes for Variable entries.
...The variable argument list with type VARIABLE_ENTRY_CONSISTENCY *. A NULL terminates the list. The VariableSize of VARIABLE_ENTRY_CONSISTENCY is the variable data size as input. It will be changed to variable total size as output.
Return values
TRUEHave enough variable space to set the Variables successfully.
FALSENo enough variable space to set the Variables successfully.

Definition at line 147 of file AuthVariableLib.h.

◆ AUTH_VAR_LIB_FIND_NEXT_VARIABLE

typedef EFI_STATUS(EFIAPI * AUTH_VAR_LIB_FIND_NEXT_VARIABLE) (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT AUTH_VARIABLE_INFO *AuthVariableInfo)

Finds next variable in storage blocks of volatile and non-volatile storage areas.

This code finds next variable in storage blocks of volatile and non-volatile storage areas. If VariableName is an empty string, then we just return the first qualified variable without comparing VariableName and VendorGuid.

Parameters
[in]VariableNameName of the variable to be found.
[in]VendorGuidVariable vendor GUID to be found.
[out]AuthVariableInfoPointer to AUTH_VARIABLE_INFO structure for output of the next variable.
Return values
EFI_INVALID_PARAMETERIf VariableName is not an empty string, while VendorGuid is NULL.
EFI_SUCCESSVariable successfully found.
EFI_NOT_FOUNDVariable not found

Definition at line 83 of file AuthVariableLib.h.

◆ AUTH_VAR_LIB_FIND_VARIABLE

typedef EFI_STATUS(EFIAPI * AUTH_VAR_LIB_FIND_VARIABLE) (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, OUT AUTH_VARIABLE_INFO *AuthVariableInfo)

Finds variable in storage blocks of volatile and non-volatile storage areas.

This code finds variable in storage blocks of volatile and non-volatile storage areas. If VariableName is an empty string, then we just return the first qualified variable without comparing VariableName and VendorGuid.

Parameters
[in]VariableNameName of the variable to be found.
[in]VendorGuidVariable vendor GUID to be found.
[out]AuthVariableInfoPointer to AUTH_VARIABLE_INFO structure for output of the variable found.
Return values
EFI_INVALID_PARAMETERIf VariableName is not an empty string, while VendorGuid is NULL.
EFI_SUCCESSVariable successfully found.
EFI_NOT_FOUNDVariable not found

Definition at line 57 of file AuthVariableLib.h.

◆ AUTH_VAR_LIB_GET_SCRATCH_BUFFER

typedef EFI_STATUS(EFIAPI * AUTH_VAR_LIB_GET_SCRATCH_BUFFER) (IN OUT UINTN *ScratchBufferSize, OUT VOID **ScratchBuffer)

Get scratch buffer.

Parameters
[in,out]ScratchBufferSizeScratch buffer size. If input size is greater than the maximum supported buffer size, this value contains the maximum supported buffer size as output.
[out]ScratchBufferPointer to scratch buffer address.
Return values
EFI_SUCCESSGet scratch buffer successfully.
EFI_UNSUPPORTEDIf input size is greater than the maximum supported buffer size.

Definition at line 121 of file AuthVariableLib.h.

◆ AUTH_VAR_LIB_UPDATE_VARIABLE

typedef EFI_STATUS(EFIAPI * AUTH_VAR_LIB_UPDATE_VARIABLE) (IN AUTH_VARIABLE_INFO *AuthVariableInfo)

Update the variable region with Variable information.

Parameters
[in]AuthVariableInfoPointer AUTH_VARIABLE_INFO structure for input of the variable.
Return values
EFI_SUCCESSThe update operation is success.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_WRITE_PROTECTEDVariable is write-protected.
EFI_OUT_OF_RESOURCESThere is not enough resource.

Definition at line 103 of file AuthVariableLib.h.

Function Documentation

◆ AuthVariableLibInitialize()

EFI_STATUS EFIAPI AuthVariableLibInitialize ( IN AUTH_VAR_LIB_CONTEXT_IN AuthVarLibContextIn,
OUT AUTH_VAR_LIB_CONTEXT_OUT AuthVarLibContextOut 
)

Initialization for authenticated varibale services. If this initialization returns error status, other APIs will not work and expect to be not called then.

Parameters
[in]AuthVarLibContextInPointer to input auth variable lib context.
[out]AuthVarLibContextOutPointer to output auth variable lib context.
Return values
EFI_SUCCESSFunction successfully executed.
EFI_INVALID_PARAMETERIf AuthVarLibContextIn == NULL or AuthVarLibContextOut == NULL.
EFI_OUT_OF_RESOURCESFail to allocate enough resource.
EFI_UNSUPPORTEDUnsupported to process authenticated variable.

Initialization for authenticated variable services. If this initialization returns error status, other APIs will not work and expect to be not called then.

Parameters
[in]AuthVarLibContextInPointer to input auth variable lib context.
[out]AuthVarLibContextOutPointer to output auth variable lib context.
Return values
EFI_SUCCESSFunction successfully executed.
EFI_INVALID_PARAMETERIf AuthVarLibContextIn == NULL or AuthVarLibContextOut == NULL.
EFI_OUT_OF_RESOURCESFail to allocate enough resource.
EFI_UNSUPPORTEDUnsupported to process authenticated variable.

Definition at line 28 of file AuthVariableLibNull.c.

◆ AuthVariableLibProcessVariable()

EFI_STATUS EFIAPI AuthVariableLibProcessVariable ( IN CHAR16 *  VariableName,
IN EFI_GUID VendorGuid,
IN VOID *  Data,
IN UINTN  DataSize,
IN UINT32  Attributes 
)

Process variable with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.

Parameters
[in]VariableNameName of the variable.
[in]VendorGuidVariable vendor GUID.
[in]DataData pointer.
[in]DataSizeSize of Data.
[in]AttributesAttribute value of the variable.
Return values
EFI_SUCCESSThe firmware has successfully stored the variable and its data as defined by the Attributes.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_WRITE_PROTECTEDVariable is write-protected.
EFI_OUT_OF_RESOURCESThere is not enough resource.
EFI_SECURITY_VIOLATIONThe variable is with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS set, but the AuthInfo does NOT pass the validation check carried out by the firmware.
EFI_UNSUPPORTEDUnsupported to process authenticated variable.

Process variable with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set.

Parameters
[in]VariableNameName of the variable.
[in]VendorGuidVariable vendor GUID.
[in]DataData pointer.
[in]DataSizeSize of Data.
[in]AttributesAttribute value of the variable.
Return values
EFI_SUCCESSThe firmware has successfully stored the variable and its data as defined by the Attributes.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_WRITE_PROTECTEDVariable is write-protected.
EFI_OUT_OF_RESOURCESThere is not enough resource.
EFI_SECURITY_VIOLATIONThe variable is with EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS set, but the AuthInfo does NOT pass the validation check carried out by the firmware.
EFI_UNSUPPORTEDUnsupported to process authenticated variable.

Definition at line 61 of file AuthVariableLibNull.c.