OvmfPkg/EnrollDefaultKeys: describe functions with leading comment blocks

The GetExact(), GetSettings(), PrintSettings(), and ShellAppMain()
functions lack leading comment blocks. Supply those.

While at it, make sure that every such comment block is preceded by two
blank lines.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@arm.com>
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1747
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Gary Lin <glin@suse.com>
This commit is contained in:
Laszlo Ersek 2019-04-25 17:03:15 +02:00
parent 7eeaa7585a
commit 86bf2672a3
1 changed files with 73 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include "EnrollDefaultKeys.h" #include "EnrollDefaultKeys.h"
/** /**
Enroll a set of certificates in a global variable, overwriting it. Enroll a set of certificates in a global variable, overwriting it.
@ -193,6 +194,44 @@ Out:
} }
/**
Read a UEFI variable into a caller-allocated buffer, enforcing an exact size.
@param[in] VariableName The name of the variable to read; passed to
gRT->GetVariable().
@param[in] VendorGuid The vendor (namespace) GUID of the variable to read;
passed to gRT->GetVariable().
@param[out] Data The caller-allocated buffer that is supposed to
receive the variable's contents. On error, the
contents of Data are indeterminate.
@param[in] DataSize The size in bytes that the caller requires the UEFI
variable to have. The caller is responsible for
providing room for DataSize bytes in Data.
@param[in] AllowMissing If FALSE, the variable is required to exist. If
TRUE, the variable is permitted to be missing.
@retval EFI_SUCCESS The UEFI variable exists, has the required size
(DataSize), and has been read into Data.
@retval EFI_SUCCESS The UEFI variable doesn't exist, and
AllowMissing is TRUE. DataSize bytes in Data
have been zeroed out.
@retval EFI_NOT_FOUND The UEFI variable doesn't exist, and
AllowMissing is FALSE.
@retval EFI_BUFFER_TOO_SMALL The UEFI variable exists, but its size is
greater than DataSize.
@retval EFI_PROTOCOL_ERROR The UEFI variable exists, but its size is
smaller than DataSize.
@return Error codes propagated from gRT->GetVariable().
**/
STATIC STATIC
EFI_STATUS EFI_STATUS
GetExact ( GetExact (
@ -228,6 +267,31 @@ GetExact (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Populate a SETTINGS structure from the underlying UEFI variables.
The following UEFI variables are standard variables:
- L"SetupMode" (EFI_SETUP_MODE_NAME)
- L"SecureBoot" (EFI_SECURE_BOOT_MODE_NAME)
- L"VendorKeys" (EFI_VENDOR_KEYS_VARIABLE_NAME)
The following UEFI variables are edk2 extensions:
- L"SecureBootEnable" (EFI_SECURE_BOOT_ENABLE_NAME)
- L"CustomMode" (EFI_CUSTOM_MODE_NAME)
The L"SecureBootEnable" UEFI variable is permitted to be missing, in which
case the corresponding field in the SETTINGS object will be zeroed out. The
rest of the covered UEFI variables are required to exist; otherwise, the
function will fail.
@param[out] Settings The SETTINGS object to fill.
@retval EFI_SUCCESS Settings has been populated.
@return Error codes propagated from the GetExact() function. The
contents of Settings are indeterminate.
**/
STATIC STATIC
EFI_STATUS EFI_STATUS
GetSettings ( GetSettings (
@ -266,6 +330,12 @@ GetSettings (
return Status; return Status;
} }
/**
Print the contents of a SETTINGS structure to the UEFI console.
@param[in] Settings The SETTINGS object to print the contents of.
**/
STATIC STATIC
VOID VOID
PrintSettings ( PrintSettings (
@ -278,6 +348,9 @@ PrintSettings (
} }
/**
Entry point function of this shell application.
**/
INTN INTN
EFIAPI EFIAPI
ShellAppMain ( ShellAppMain (