OpenCore
1.0.4
OpenCore Bootloader
|
#include <Base.h>
#include <Uefi.h>
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/BaseOverflowLib.h>
#include <Library/PeCoffLib2.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiLib.h>
#include <Library/OcCryptoLib.h>
#include <Library/OcAppleKeysLib.h>
#include <Library/OcStringLib.h>
#include <Guid/AppleCertificate.h>
#include "OcPeCoffExtInternal.h"
Go to the source code of this file.
Functions | |
STATIC RETURN_STATUS | PeCoffGetSecurityDirectoryEntry (IN PE_COFF_LOADER_IMAGE_CONTEXT *Context, IN UINT32 FileSize, OUT CONST EFI_IMAGE_DATA_DIRECTORY **DirectoryEntry) |
STATIC EFI_STATUS | PeCoffGetAppleCertificateInfo (IN PE_COFF_LOADER_IMAGE_CONTEXT *Context, IN UINT32 FileSize, OUT APPLE_EFI_CERTIFICATE_INFO **CertInfo, OUT UINT32 *SecDirOffset, OUT UINT32 *SignedFileSize) |
STATIC EFI_STATUS | PeCoffGetAppleSignature (IN PE_COFF_LOADER_IMAGE_CONTEXT *Context, IN APPLE_EFI_CERTIFICATE_INFO *CertInfo, OUT APPLE_SIGNATURE_CONTEXT *SignatureContext) |
STATIC EFI_STATUS | PeCoffSanitiseAppleImage (IN PE_COFF_LOADER_IMAGE_CONTEXT *Context, IN UINT32 SecDirOffset, IN UINT32 SignedFileSize, IN UINT32 FileSize) |
STATIC VOID | PeCoffHashAppleImage (IN PE_COFF_LOADER_IMAGE_CONTEXT *Context, IN UINT32 SecDirOffset, IN UINT32 SignedFileSize, OUT UINT8 *Hash) |
STATIC EFI_STATUS | InternalPeCoffVerifyAppleSignatureFromContext (IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, IN OUT UINT32 *ImageSize) |
EFI_STATUS | PeCoffVerifyAppleSignature (IN OUT VOID *PeImage, IN OUT UINT32 *ImageSize) |
STATIC EFI_STATUS | InternalPeCoffGetApfsDriverVersionFromContext (IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext, IN UINT32 DriverSize, OUT APFS_DRIVER_VERSION **DriverVersionPtr) |
EFI_STATUS | PeCoffGetApfsDriverVersion (IN VOID *DriverBuffer, IN UINT32 DriverSize, OUT APFS_DRIVER_VERSION **DriverVersionPtr) |
EFI_STATUS | OcPatchLegacyEfi (IN VOID *DriverBuffer, IN UINT32 DriverSize) |
AppleDxeImageVerificationLib
Copyright (c) 2018, savvas
All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcPeCoffExtLib.c.
STATIC EFI_STATUS InternalPeCoffGetApfsDriverVersionFromContext | ( | IN PE_COFF_LOADER_IMAGE_CONTEXT * | ImageContext, |
IN UINT32 | DriverSize, | ||
OUT APFS_DRIVER_VERSION ** | DriverVersionPtr ) |
Definition at line 484 of file OcPeCoffExtLib.c.
STATIC EFI_STATUS InternalPeCoffVerifyAppleSignatureFromContext | ( | IN OUT PE_COFF_LOADER_IMAGE_CONTEXT * | ImageContext, |
IN OUT UINT32 * | ImageSize ) |
Definition at line 383 of file OcPeCoffExtLib.c.
EFI_STATUS OcPatchLegacyEfi | ( | IN VOID * | DriverBuffer, |
IN UINT32 | DriverSize ) |
Detect and patch W^X and overlapping section errors in legacy boot.efi. Expected to fix overlapping sections in 10.4 and 10.5 32-bit only, and W^X errors in most macOS binaries.
[in] | DriverBuffer | Image buffer. |
[in] | DriverSize | Size of the image. |
EFI_SUCCESS | on success. |
Definition at line 577 of file OcPeCoffExtLib.c.
EFI_STATUS PeCoffGetApfsDriverVersion | ( | IN VOID * | DriverBuffer, |
IN UINT32 | DriverSize, | ||
OUT APFS_DRIVER_VERSION ** | DriverVersionPtr ) |
Obtain APFS driver version.
[in] | DriverBuffer | Image buffer. |
[in] | DriverSize | Size of the image. |
[out] | DriverVersionPtr | Driver version within image buffer. |
EFI_SUCCESS | on success. |
Definition at line 553 of file OcPeCoffExtLib.c.
STATIC EFI_STATUS PeCoffGetAppleCertificateInfo | ( | IN PE_COFF_LOADER_IMAGE_CONTEXT * | Context, |
IN UINT32 | FileSize, | ||
OUT APPLE_EFI_CERTIFICATE_INFO ** | CertInfo, | ||
OUT UINT32 * | SecDirOffset, | ||
OUT UINT32 * | SignedFileSize ) |
Definition at line 110 of file OcPeCoffExtLib.c.
STATIC EFI_STATUS PeCoffGetAppleSignature | ( | IN PE_COFF_LOADER_IMAGE_CONTEXT * | Context, |
IN APPLE_EFI_CERTIFICATE_INFO * | CertInfo, | ||
OUT APPLE_SIGNATURE_CONTEXT * | SignatureContext ) |
Definition at line 167 of file OcPeCoffExtLib.c.
STATIC RETURN_STATUS PeCoffGetSecurityDirectoryEntry | ( | IN PE_COFF_LOADER_IMAGE_CONTEXT * | Context, |
IN UINT32 | FileSize, | ||
OUT CONST EFI_IMAGE_DATA_DIRECTORY ** | DirectoryEntry ) |
Definition at line 43 of file OcPeCoffExtLib.c.
STATIC VOID PeCoffHashAppleImage | ( | IN PE_COFF_LOADER_IMAGE_CONTEXT * | Context, |
IN UINT32 | SecDirOffset, | ||
IN UINT32 | SignedFileSize, | ||
OUT UINT8 * | Hash ) |
Definition at line 332 of file OcPeCoffExtLib.c.
STATIC EFI_STATUS PeCoffSanitiseAppleImage | ( | IN PE_COFF_LOADER_IMAGE_CONTEXT * | Context, |
IN UINT32 | SecDirOffset, | ||
IN UINT32 | SignedFileSize, | ||
IN UINT32 | FileSize ) |
Definition at line 266 of file OcPeCoffExtLib.c.
EFI_STATUS PeCoffVerifyAppleSignature | ( | IN OUT VOID * | PeImage, |
IN OUT UINT32 * | ImageSize ) |
Verify Apple COFF legacy signature. Image buffer is sanitized where necessary (zeroed), and an updated length is returned through size parameter.
[in,out] | PeImage | Image buffer. |
[in,out] | ImageSize | Size of the image. |
EFI_SUCCESS | on success. |
Definition at line 458 of file OcPeCoffExtLib.c.