Skip to content

Uefi capsule header

uefi_capsule_header

Module for encoding and decoding a EFI_CAPSULE_HEADER with a payload.

UefiCapsuleHeaderClass

An object representing a UEFI_CAPSULE_HEADER.

Attributes:

Name Type Description
CapsuleGuid UUID

6DCBD5ED-E82D-4C44-BDA1-7194199AD92A

HeaderSize int

The size of the capsule header. This may be larger than the size of the EFI_CAPSULE_HEADER since CapsuleGuid may imply extended header entries

OemFlags int

Bit-mapped list describing the capsule attributes. The Flag values of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values of 0x10000 - 0xFFFFFFFF are defined by this specification

PersistAcrossReset bool

Flag pulled from OemFlags

PopulateSystemTable bool

Flag pulled from OemFlags

InitiateReset bool

Flag pulled from OemFlags

Payload bytes

string representing packed data as bytes (i.e. b'\x01\x00\x03')

FmpCapsuleHeader FmpCapsuleHeaderClass

Fmp Capsule Header

typedef struct {
    EFI_GUID          CapsuleGuid;
    UINT32            HeaderSize;
    UINT32            Flags;
    UINT32            CapsuleImageSize;
} EFI_CAPSULE_HEADER;

#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET          0x00010000
#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE         0x00020000
#define CAPSULE_FLAGS_INITIATE_RESET                0x00040000

__init__

__init__() -> UefiCapsuleHeaderClass

Inits an empty object.

Encode

Encode() -> bytes

Serializes the Header + payload.

Returns:

Type Description
bytes

string representing packed data as bytes (i.e. b'\x01\x00\x03')

Decode

Decode(Buffer: BytesIO) -> bytes

Loads data into the Object by parsing a buffer.

Parameters:

Name Type Description Default
Buffer obj

Buffer containing the data

required

Returns:

Type Description
str

string of binary representing the payload

Raises:

Type Description
ValueError

Invalid Buffer

ValueError

Invalid Signature

ValueError

Invalid Header size

DumpInfo

DumpInfo() -> None

Prints payload header information.