You've already forked slimbootloader
mirror of
https://github.com/Dasharo/slimbootloader.git
synced 2026-03-06 15:26:20 -08:00
b24fd2759c
This will fully support PatchCheck.py. - Remove all trailing whitespace - Convert LF to CRLF by default - Update EFI_D_* to DEBUG_* - Re-enable CRLF check in PatchCheck.py Signed-off-by: Aiden Park <aiden.park@intel.com>
123 lines
4.8 KiB
C
123 lines
4.8 KiB
C
/** @file
|
|
|
|
Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#ifndef __VARIABLE_SERVICE_H__
|
|
#define __VARIABLE_SERVICE_H__
|
|
|
|
#include <Guid/BootLoaderServiceGuid.h>
|
|
|
|
#define VARIABLE_SERVICE_SIGNATURE SIGNATURE_32 ('V', 'A', 'R', ' ')
|
|
#define VARIABLE_SERVICE_VERSION 1
|
|
|
|
/**
|
|
|
|
This code finds variable in storage blocks (Volatile or Non-Volatile).
|
|
|
|
Caution: This function may receive untrusted input.
|
|
This function may be invoked in SMM mode, and datasize is external input.
|
|
This function will do basic validation, before parse the data.
|
|
|
|
@param VariableName Name of Variable to be found.
|
|
@param Attributes Attribute value of the variable found.
|
|
@param DataSize Size of Data found. If size is less than the
|
|
data, this value contains the required size.
|
|
@param Data The buffer to return the contents of the variable. May be NULL
|
|
with a zero DataSize in order to determine the size buffer needed.
|
|
|
|
@return EFI_INVALID_PARAMETER Invalid parameter.
|
|
@return EFI_SUCCESS Find the specified variable.
|
|
@return EFI_NOT_FOUND Not found.
|
|
@return EFI_BUFFER_TO_SMALL DataSize is too small for the result.
|
|
|
|
**/
|
|
typedef
|
|
EFI_STATUS
|
|
(EFIAPI *GET_VARIABLE) (
|
|
IN CHAR8 *VariableName,
|
|
OUT UINT8 *Attributes OPTIONAL,
|
|
IN OUT UINTN *DataSize,
|
|
OUT VOID *Data OPTIONAL
|
|
);
|
|
|
|
|
|
/**
|
|
|
|
This code Finds the Next available variable.
|
|
|
|
Caution: This function may receive untrusted input.
|
|
This function may be invoked in SMM mode. This function will do basic validation, before parse the data.
|
|
|
|
@param VariableNameSize The size of the VariableName buffer. The size must be large
|
|
enough to fit input string supplied in VariableName buffer.
|
|
@param VariableName Pointer to variable name.
|
|
@param VariableKey Pointer to variable key.
|
|
|
|
@retval EFI_SUCCESS The function completed successfully.
|
|
@retval EFI_NOT_FOUND The next variable was not found.
|
|
@retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.
|
|
VariableNameSize has been updated with the size needed to complete the request.
|
|
@retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
|
|
@retval EFI_INVALID_PARAMETER VariableName is NULL.
|
|
@retval EFI_INVALID_PARAMETER VendorGuid is NULL.
|
|
@retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and
|
|
GUID of an existing variable.
|
|
@retval EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of
|
|
the input VariableName buffer.
|
|
|
|
**/
|
|
typedef
|
|
EFI_STATUS
|
|
(EFIAPI *GET_NEXT_VARIABLE_NAME) (
|
|
IN OUT UINTN *VariableNameSize,
|
|
IN OUT CHAR8 *VariableName,
|
|
IN OUT UINTN *VariableKey
|
|
);
|
|
|
|
|
|
/**
|
|
|
|
This code sets variable in storage blocks (Volatile or Non-Volatile).
|
|
|
|
Caution: This function may receive untrusted input.
|
|
This function may be invoked in SMM mode, and datasize and data are external input.
|
|
This function will do basic validation, before parse the data.
|
|
This function will parse the authentication carefully to avoid security issues, like
|
|
buffer overflow, integer overflow.
|
|
This function will check attribute carefully to avoid authentication bypass.
|
|
|
|
@param VariableName Name of Variable to be found.
|
|
@param Attributes Attribute value of the variable found
|
|
@param DataSize Size of Data found. If size is less than the
|
|
data, this value contains the required size.
|
|
@param Data Data pointer.
|
|
|
|
@return EFI_INVALID_PARAMETER Invalid parameter.
|
|
@return EFI_SUCCESS Set successfully.
|
|
@return EFI_OUT_OF_RESOURCES Resource not enough to set variable.
|
|
@return EFI_NOT_FOUND Not found.
|
|
@return EFI_WRITE_PROTECTED Variable is read-only.
|
|
|
|
**/
|
|
typedef
|
|
EFI_STATUS
|
|
(EFIAPI *SET_VARIABLE) (
|
|
IN CHAR8 *VariableName,
|
|
IN UINT8 Attributes,
|
|
IN UINTN DataSize,
|
|
IN VOID *Data
|
|
);
|
|
|
|
|
|
typedef struct {
|
|
SERVICE_COMMON_HEADER Header;
|
|
GET_VARIABLE GetVariable;
|
|
GET_NEXT_VARIABLE_NAME GetNextVariableName;
|
|
SET_VARIABLE SetVariable;
|
|
} VARIABLE_SERVICE;
|
|
|
|
#endif
|