OpenCore  1.0.4
OpenCore Bootloader
1.0.4
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OcAppleImg4Lib.h File Reference

Go to the source code of this file.

Macros

#define OC_SB_MODEL_DEFAULT   "Default"
 
#define OC_SB_MODEL_DISABLED   "Disabled"
 
#define OC_SB_MODEL_LEGACY   "x86legacy"
 

Functions

EFI_STATUS EFIAPI OcAppleImg4Verify (IN APPLE_IMG4_VERIFICATION_PROTOCOL *This, IN UINT32 ObjType, IN CONST VOID *ImageBuffer, IN UINTN ImageSize, IN UINT8 SbMode, IN CONST VOID *ManifestBuffer, IN UINTN ManifestSize, OUT UINT8 **HashDigest OPTIONAL, OUT UINTN *DigestSize OPTIONAL)
 
VOID OcAppleImg4RegisterOverride (IN CONST UINT8 *OriginalDigest, IN CONST UINT8 *Image, IN UINT32 ImageSize)
 
CONST CHAR8 * OcAppleImg4GetHardwareModel (IN CONST CHAR8 *ModelRequest)
 
EFI_STATUS OcAppleImg4BootstrapValues (IN CONST CHAR8 *Model, IN UINT64 Ecid OPTIONAL)
 
APPLE_IMG4_VERIFICATION_PROTOCOLOcAppleImg4VerificationInstallProtocol (IN BOOLEAN Reinstall)
 

Detailed Description

Copyright (C) 2019, Download-Fritz. 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 OcAppleImg4Lib.h.

Macro Definition Documentation

◆ OC_SB_MODEL_DEFAULT

#define OC_SB_MODEL_DEFAULT   "Default"

Chooses the default model (most recent broadly supported).

Definition at line 23 of file OcAppleImg4Lib.h.

◆ OC_SB_MODEL_DISABLED

#define OC_SB_MODEL_DISABLED   "Disabled"

No secure boot mode special value.

Definition at line 28 of file OcAppleImg4Lib.h.

◆ OC_SB_MODEL_LEGACY

#define OC_SB_MODEL_LEGACY   "x86legacy"

Legacy secure boot model (for all non-gibraltar models).

Definition at line 33 of file OcAppleImg4Lib.h.

Function Documentation

◆ OcAppleImg4BootstrapValues()

EFI_STATUS OcAppleImg4BootstrapValues ( IN CONST CHAR8 * Model,
IN UINT64 Ecid OPTIONAL )

Bootstrap NVRAM and library values for secure booting.

Parameters
[in]ModelSecure boot model (without ap suffix in lower-case).
[in]EcidSecure boot ECID identifier for this model, optional.
Returns
Installed or located protocol.
Return values
NULLThere was an error locating or installing the protocol.

< Checked by calling OcAppleImg4GetHardwareModel.

Definition at line 341 of file OcAppleImg4Lib.c.

◆ OcAppleImg4GetHardwareModel()

CONST CHAR8 * OcAppleImg4GetHardwareModel ( IN CONST CHAR8 * ModelRequest)

Obtain hardware model for secure booting from the model request.

Parameters
[in]ModelRequestRaw model.
Return values
Modelin lower case on success.
NULLon failure

Definition at line 156 of file OcAppleImg4Lib.c.

◆ OcAppleImg4RegisterOverride()

VOID OcAppleImg4RegisterOverride ( IN CONST UINT8 * OriginalDigest,
IN CONST UINT8 * Image,
IN UINT32 ImageSize )

Register digest override with SHA-384 hash. This allows to replace one image with another.

Parameters
[in]OriginalDigestOriginal SHA-384 digest.
[in]ImagePointer to new image.
[in]ImageSizeImage size.

Definition at line 325 of file OcAppleImg4Lib.c.

◆ OcAppleImg4VerificationInstallProtocol()

APPLE_IMG4_VERIFICATION_PROTOCOL * OcAppleImg4VerificationInstallProtocol ( IN BOOLEAN Reinstall)

Install and initialise the Apple IMG4 verification protocol.

Parameters
[in]ReinstallReplace any installed protocol.
Returns
Installed or located protocol.
Return values
NULLThere was an error locating or installing the protocol.

Definition at line 511 of file OcAppleImg4Lib.c.

◆ OcAppleImg4Verify()

EFI_STATUS EFIAPI OcAppleImg4Verify ( IN APPLE_IMG4_VERIFICATION_PROTOCOL * This,
IN UINT32 ObjType,
IN CONST VOID * ImageBuffer,
IN UINTN ImageSize,
IN UINT8 SbMode,
IN CONST VOID * ManifestBuffer,
IN UINTN ManifestSize,
OUT UINT8 **HashDigest OPTIONAL,
OUT UINTN *DigestSize OPTIONAL )

Verify the signature of ImageBuffer against Type of its IMG4 Manifest.

Parameters
[in]ThisThe pointer to the current protocol instance.
[in]ObjTypeThe IMG4 object type to validate against.
[in]ImageBufferThe buffer to validate.
[in]ImageSizeThe size, in bytes, of ImageBuffer.
[in]SbModeThe requested IMG4 Secure Boot mode.
[in]ManifestBufferThe buffer of the IMG4 Manifest.
[in]ManifestSizeThe size, in bytes, of ManifestBuffer.
[out]HashDigestOn output, a pointer to ImageBuffer's digest.
[out]DigestSizeOn output, the size, in bytes, of *HashDigest.
Return values
EFI_SUCCESSImageBuffer is correctly signed.
EFI_INVALID_PARAMETEROne or more required parameters are NULL.
EFI_OUT_OF_RESOURCESNot enough resources are available.
EFI_SECURITY_VIOLATIONImageBuffer's signature is invalid.

Definition at line 172 of file OcAppleImg4Lib.c.