Skip to main content

Module macho

Module macho 

Source
Expand description

Just enough of 64-bit Mach-O (macOS executables) to carry a program so the executable still signs cleanly: codesign wants every byte of the file inside a segment, its signature last. The carried program goes at the end of the last segment (__LINKEDIT), whose size grows to cover it; the old signature is dropped first. Anything that is not a 64-bit little-endian Mach-O (Linux’s ELF) passes unchanged.

Constants§

MAX_HEADER_BYTES
Enough of an executable’s start to hold its header and load commands

Functions§

extend_last_segment_to_end
Make the segment that ends the file (__LINKEDIT) reach the end of the file: what was appended becomes its content
signature_offset
Where the code signature starts, if the executable is a signed Mach-O
unsigned
The executable without its code signature: the signature’s bytes and its load command removed