OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <Uefi/UefiSpec.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/NetLib.h>
#include <Library/PrintLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/OcFlexArrayLib.h>
#include <Library/OcStringLib.h>
#include <Library/OcVirtualFsLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Protocol/HttpBootCallback.h>
#include <Protocol/Ip4Config2.h>
#include <Protocol/LoadFile.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/OcBootEntry.h>
#include <Protocol/RamDisk.h>
#include <Guid/ImageAuthentication.h>
#include <Guid/TlsAuthentication.h>
Go to the source code of this file.
Data Structures | |
struct | IP4_CONFIG2_DATA_RECORD |
struct | IP4_CONFIG2_VARIABLE |
struct | IP4_CONFIG2_OC_CONFIG_DATA |
Macros | |
#define | IP4_CONFIG2_VARIABLE_ATTRIBUTE (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS) |
#define | IP4_ALLZERO_ADDRESS 0x00000000u |
Typedefs | |
typedef EFI_STATUS(* | VALIDATE_BOOT_DEVICE_PATH) (IN VOID *Context, IN EFI_DEVICE_PATH_PROTOCOL *Path) |
Functions | |
EFI_STATUS | Ip4Config2ConvertOcConfigDataToNvData (IN CHAR16 *VarName, IN IP4_CONFIG2_OC_CONFIG_DATA *ConfigData) |
EFI_STATUS | Ip4Config2DeleteStaticIpNvData (IN CHAR16 *VarName) |
EFI_DEVICE_PATH_PROTOCOL * | GetUriNode (EFI_DEVICE_PATH_PROTOCOL *DevicePath) |
CHAR16 * | BmGetNetworkDescription (IN EFI_HANDLE Handle) |
EFI_DEVICE_PATH_PROTOCOL * | BmExpandLoadFiles (IN EFI_DEVICE_PATH_PROTOCOL *FilePath, OUT VOID **Data, OUT UINT32 *DataSize, IN BOOLEAN ValidateHttp) |
EFI_DEVICE_PATH_PROTOCOL * | BmGetRamDiskDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath) |
VOID | BmDestroyRamDisk (IN EFI_DEVICE_PATH_PROTOCOL *RamDiskDevicePath) |
EFI_STATUS EFIAPI | HttpBootCustomFree (IN VOID *Context) |
EFI_STATUS EFIAPI | HttpBootCustomRead (IN OC_STORAGE_CONTEXT *Storage, IN OC_BOOT_ENTRY *ChosenEntry, OUT VOID **Data, OUT UINT32 *DataSize, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *StorageHandle, OUT EFI_DEVICE_PATH_PROTOCOL **StoragePath, IN OC_DMG_LOADING_SUPPORT DmgLoading, OUT OC_APPLE_DISK_IMAGE_PRELOAD_CONTEXT *DmgPreloadContext, OUT VOID **Context) |
EFI_STATUS EFIAPI | PxeBootCustomRead (IN OC_STORAGE_CONTEXT *Storage, IN OC_BOOT_ENTRY *ChosenEntry, OUT VOID **Data, OUT UINT32 *DataSize, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *StorageHandle, OUT EFI_DEVICE_PATH_PROTOCOL **StoragePath, IN OC_DMG_LOADING_SUPPORT DmgLoading, OUT OC_APPLE_DISK_IMAGE_PRELOAD_CONTEXT *DmgPreloadContext, OUT VOID **Context) |
BOOLEAN | HasHttpsUri (CHAR16 *Uri) |
EFI_STATUS | ExtractOtherUriFromDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CHAR8 *FromExt, IN CHAR8 *ToExt, OUT CHAR8 **OtherUri, IN BOOLEAN OnlySearchForFromExt) |
BOOLEAN | UriFileHasExtension (IN CHAR8 *Uri, IN CHAR8 *Ext) |
EFI_STATUS | HttpBootAddUri (EFI_DEVICE_PATH_PROTOCOL *DevicePath, VOID *Uri, OC_STRING_FORMAT StringFormat, EFI_DEVICE_PATH_PROTOCOL **UriDevicePath) |
EFI_EVENT | MonitorHttpBootCallback (EFI_HANDLE LoadFileHandle) |
BOOLEAN | UriWasValidated (VOID) |
EFI_STATUS | LogInstalledCerts (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid) |
EFI_STATUS | CertIsPresent (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN EFI_GUID *OwnerGuid, IN UINTN X509DataSize, IN VOID *X509Data) |
EFI_STATUS | DeleteCertsForOwner (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN EFI_GUID *OwnerGuid, IN UINTN X509DataSize, IN VOID *X509Data, OUT UINTN *DeletedCount) |
EFI_STATUS | EnrollX509toVariable (IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN EFI_GUID *OwnerGuid, IN UINTN X509DataSize, IN VOID *X509Data) |
EFI_STATUS | AddRemoveStaticIPs (OC_FLEX_ARRAY *ParsedLoadOptions) |
BOOLEAN | Ip4StationAddressValid (IN IP4_ADDR Ip, IN IP4_ADDR Netmask) |
UINT8 | GetSubnetMaskPrefixLength (IN EFI_IPv4_ADDRESS *SubnetMask) |
EFI_STATUS | Ip4Config2StrToIp (IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS *Ip) |
EFI_STATUS | Ip4Config2StrToIpList (IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS **PtrIpList, OUT UINTN *IpCount) |
Variables | |
BOOLEAN | gRequireHttpsUri |
OC_DMG_LOADING_SUPPORT | gDmgLoading |
Copyright (C) 2024, Mike Beaton. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
Definition in file NetworkBootInternal.h.
#define IP4_ALLZERO_ADDRESS 0x00000000u |
Definition at line 58 of file NetworkBootInternal.h.
#define IP4_CONFIG2_VARIABLE_ATTRIBUTE (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS) |
Definition at line 50 of file NetworkBootInternal.h.
typedef EFI_STATUS(* VALIDATE_BOOT_DEVICE_PATH) (IN VOID *Context, IN EFI_DEVICE_PATH_PROTOCOL *Path) |
Custom validation for network boot device path.
Path | Device path to validate. |
EFI_SUCCESS | Device path should be accepted. |
other | Device path should be rejected. |
Definition at line 100 of file NetworkBootInternal.h.
EFI_STATUS AddRemoveStaticIPs | ( | OC_FLEX_ARRAY * | ParsedLoadOptions | ) |
Definition at line 142 of file StaticIp4.c.
VOID BmDestroyRamDisk | ( | IN EFI_DEVICE_PATH_PROTOCOL * | RamDiskDevicePath | ) |
EFI_DEVICE_PATH_PROTOCOL * BmExpandLoadFiles | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath, |
OUT VOID ** | Data, | ||
OUT UINT32 * | DataSize, | ||
IN BOOLEAN | ValidateHttp ) |
Return the full device path pointing to the load option.
FilePath may:
FilePath | The media device path pointing to a LoadFile instance. |
< Sort out cramped spacing
CHAR16 * BmGetNetworkDescription | ( | IN EFI_HANDLE | Handle | ) |
Return the description for network boot device.
Handle | Controller handle. |
Definition at line 21 of file BmBootDescription.c.
EFI_DEVICE_PATH_PROTOCOL * BmGetRamDiskDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | FilePath | ) |
EFI_STATUS CertIsPresent | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
IN EFI_GUID * | OwnerGuid, | ||
IN UINTN | X509DataSize, | ||
IN VOID * | X509Data ) |
Report whether specified signature is already enrolled for given owner.
[in] | VariableName | Variable name of CA database. |
[in] | VendorGuid | Unique identifier for the CA database vendor. |
[in] | OwnerGuid | Unique identifier for owner of the certificate to be searched for. |
[in] | X509DataSize | Certificate data size. |
[in] | X509Data | Certificate data. |
EFI_SUCCESS | Certificate is already enrolled. |
EFI_OUT_OF_RESOURCES | Could not allocate needed resources. |
Definition at line 219 of file TlsAuthConfigImpl.c.
EFI_STATUS DeleteCertsForOwner | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
IN EFI_GUID * | OwnerGuid, | ||
IN UINTN | X509DataSize, | ||
IN VOID * | X509Data, | ||
OUT UINTN * | DeletedCount ) |
Delete specific entry or all entries with owner guid from signature database. (Based on original EDK 2 DeleteCert which removes one cert, identified by index.)
[in] | VariableName | The variable name of the signature database. |
[in] | VendorGuid | A unique identifier for the signature database vendor. |
[in] | OwnerGuid | A unique identifier for owner of the certificate(s) to be deleted. |
[in] | X509DataSize | Optional certificate data size. |
[in] | X509Data | Optional certificate data. If non-NULL, delete only specific certificate for owner, if present. If NULL, delete all certificates for owner. |
[in] | DeletedCount | Optional return count of deleted certificates. |
EFI_SUCCESS | Delete signature successfully. |
EFI_OUT_OF_RESOURCES | Could not allocate needed resources. |
Definition at line 259 of file TlsAuthConfigImpl.c.
EFI_STATUS EnrollX509toVariable | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid, | ||
IN EFI_GUID * | OwnerGuid, | ||
IN UINTN | X509DataSize, | ||
IN VOID * | X509Data ) |
Enroll a new X509 certificate into Variable.
[in] | VariableName | Variable name of CA database. |
[in] | VendorGuid | Unique identifier for the CA database vendor. |
[in] | OwnerGuid | Unique identifier for owner of the certificate to be installed. |
[in] | X509DataSize | Certificate data size. |
[in] | X509Data | Certificate data. |
EFI_SUCCESS | New X509 is enrolled successfully. |
EFI_OUT_OF_RESOURCES | Could not allocate needed resources. |
Definition at line 433 of file TlsAuthConfigImpl.c.
EFI_STATUS ExtractOtherUriFromDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
IN CHAR8 * | FromExt, | ||
IN CHAR8 * | ToExt, | ||
OUT CHAR8 ** | OtherUri, | ||
IN BOOLEAN | OnlySearchForFromExt ) |
UINT8 GetSubnetMaskPrefixLength | ( | IN EFI_IPv4_ADDRESS * | SubnetMask | ) |
Calculate the prefix length of the IPv4 subnet mask.
[in] | SubnetMask | The IPv4 subnet mask. |
0 | Other errors as indicated. |
Definition at line 66 of file Ip4Utils.c.
EFI_DEVICE_PATH_PROTOCOL * GetUriNode | ( | EFI_DEVICE_PATH_PROTOCOL * | DevicePath | ) |
EFI_STATUS HttpBootAddUri | ( | EFI_DEVICE_PATH_PROTOCOL * | DevicePath, |
VOID * | Uri, | ||
OC_STRING_FORMAT | StringFormat, | ||
EFI_DEVICE_PATH_PROTOCOL ** | UriDevicePath ) |
EFI_STATUS EFIAPI HttpBootCustomFree | ( | IN VOID * | Context | ) |
CustomRead.c
Definition at line 84 of file HttpBootCustomRead.c.
EFI_STATUS EFIAPI HttpBootCustomRead | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_BOOT_ENTRY * | ChosenEntry, | ||
OUT VOID ** | Data, | ||
OUT UINT32 * | DataSize, | ||
OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePath, | ||
OUT EFI_HANDLE * | StorageHandle, | ||
OUT EFI_DEVICE_PATH_PROTOCOL ** | StoragePath, | ||
IN OC_DMG_LOADING_SUPPORT | DmgLoading, | ||
OUT OC_APPLE_DISK_IMAGE_PRELOAD_CONTEXT * | DmgPreloadContext, | ||
OUT VOID ** | Context ) |
Definition at line 134 of file HttpBootCustomRead.c.
EFI_STATUS Ip4Config2ConvertOcConfigDataToNvData | ( | IN CHAR16 * | VarName, |
IN IP4_CONFIG2_OC_CONFIG_DATA * | ConfigData ) |
Definition at line 127 of file Ip4Config2Nv.c.
EFI_STATUS Ip4Config2DeleteStaticIpNvData | ( | IN CHAR16 * | VarName | ) |
Definition at line 225 of file Ip4Config2Nv.c.
EFI_STATUS Ip4Config2StrToIp | ( | IN CHAR16 * | Str, |
OUT EFI_IPv4_ADDRESS * | Ip ) |
Convert the decimal dotted IPv4 address into the binary IPv4 address.
[in] | Str | The UNICODE string. |
[out] | Ip | The storage to return the IPv4 address. |
EFI_SUCCESS | The binary IP address is returned in Ip. |
EFI_INVALID_PARAMETER | The IP string is malformatted. |
Definition at line 108 of file Ip4Utils.c.
EFI_STATUS Ip4Config2StrToIpList | ( | IN CHAR16 * | Str, |
OUT EFI_IPv4_ADDRESS ** | PtrIpList, | ||
OUT UINTN * | IpCount ) |
Convert the decimal dotted IPv4 addresses separated by space into the binary IPv4 address list.
[in] | Str | The UNICODE string contains IPv4 addresses. |
[out] | PtrIpList | The storage to return the IPv4 address list. |
[out] | IpCount | The size of the IPv4 address list. |
EFI_SUCCESS | The binary IP address list is returned in PtrIpList. |
EFI_OUT_OF_RESOURCES | Error occurs in allocating memory. |
EFI_INVALID_PARAMETER | The IP string is malformatted. |
Definition at line 173 of file Ip4Utils.c.
BOOLEAN Ip4StationAddressValid | ( | IN IP4_ADDR | Ip, |
IN IP4_ADDR | Netmask ) |
Validate that Ip/Netmask pair is OK to be used as station address. Only continuous netmasks are supported. and check that StationAddress is a unicast address on the network.
[in] | Ip | The IP address to validate. |
[in] | Netmask | The netmask of the IP. |
TRUE | The Ip/Netmask pair is valid. |
FALSE | The Ip/Netmask pair is invalid. |
Definition at line 27 of file Ip4Utils.c.
EFI_STATUS LogInstalledCerts | ( | IN CHAR16 * | VariableName, |
IN EFI_GUID * | VendorGuid ) |
Log owner GUID of each installed certificate in signature database.
[in] | VariableName | The variable name of the signature database. |
[in] | VendorGuid | A unique identifier for the signature database vendor. |
EFI_SUCCESS | Success. |
Definition at line 161 of file TlsAuthConfigImpl.c.
EFI_EVENT MonitorHttpBootCallback | ( | EFI_HANDLE | LoadFileHandle | ) |
Definition at line 245 of file HttpBootCallback.c.
EFI_STATUS EFIAPI PxeBootCustomRead | ( | IN OC_STORAGE_CONTEXT * | Storage, |
IN OC_BOOT_ENTRY * | ChosenEntry, | ||
OUT VOID ** | Data, | ||
OUT UINT32 * | DataSize, | ||
OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePath, | ||
OUT EFI_HANDLE * | StorageHandle, | ||
OUT EFI_DEVICE_PATH_PROTOCOL ** | StoragePath, | ||
IN OC_DMG_LOADING_SUPPORT | DmgLoading, | ||
OUT OC_APPLE_DISK_IMAGE_PRELOAD_CONTEXT * | DmgPreloadContext, | ||
OUT VOID ** | Context ) |
Definition at line 280 of file HttpBootCustomRead.c.
BOOLEAN UriFileHasExtension | ( | IN CHAR8 * | Uri, |
IN CHAR8 * | Ext ) |
BOOLEAN UriWasValidated | ( | VOID | ) |
Definition at line 237 of file HttpBootCallback.c.
|
extern |
Current DmgLoading setting, for HTTP BOOT callback validation.
Definition at line 16 of file HttpBootCallback.c.
|
extern |
Set if we should enforce https only within this driver.
Definition at line 14 of file OpenNetworkBoot.c.