Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d9855fc7f | ||
|
|
45d772ad45 | ||
|
|
790e628b56 | ||
|
|
88bbd410e6 | ||
|
|
1347dec367 | ||
|
|
b85e785f62 | ||
|
|
b9a5f970b2 | ||
|
|
ac98429d75 | ||
|
|
19af291ab6 | ||
|
|
ebbc55fd69 | ||
|
|
1ea659535e | ||
|
|
6ed889e8cf | ||
|
|
b3d6a0737f |
@@ -0,0 +1,66 @@
|
||||
name: 'macOS-arm64'
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
osx-sdk:
|
||||
runs-on: macos-11.0
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
brew install cmake ninja ccache
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
- name: Get Date
|
||||
id: get-date
|
||||
run: |
|
||||
echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d-%H;%M;%S")"
|
||||
shell: bash
|
||||
- name: Setup cache dir
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/.ccache
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: osx-${{ runner.os }}-${{ steps.get-date.outputs.date }}
|
||||
restore-keys: |
|
||||
osx-${{ runner.os }}-
|
||||
- name: Upgrade pip
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools
|
||||
- name: Build SDK
|
||||
shell: bash
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: "11.0"
|
||||
CCACHE_DIR: ~/.ccache
|
||||
CCACHE_MAXSIZE: 10.0G
|
||||
CCACHE_CPP2: 1
|
||||
CCACHE_COMPRESS: 1
|
||||
run: |
|
||||
bash scripts/osx/package_sdk_aarch64.sh
|
||||
- name: 'Upload SDK Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: osx-sdk
|
||||
path: build/*.tar.gz
|
||||
retention-days: 3
|
||||
- name: Deploy
|
||||
env:
|
||||
LIEF_S3_KEY: ${{ secrets.LIEF_S3_KEY }}
|
||||
LIEF_S3_SECRET: ${{ secrets.LIEF_S3_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install --upgrade requests mako boto3
|
||||
python .github/deploy.py
|
||||
+1
-1
@@ -28,7 +28,7 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git"
|
||||
else()
|
||||
set(LIEF_VERSION_MAJOR "0")
|
||||
set(LIEF_VERSION_MINOR "13")
|
||||
set(LIEF_VERSION_PATCH "0")
|
||||
set(LIEF_VERSION_PATCH "2")
|
||||
endif()
|
||||
|
||||
# LIEF Project
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef C_LIEF_ELF_H_
|
||||
#define C_LIEF_ELF_H_
|
||||
|
||||
//! @defgroup elf_c_api ELF C API
|
||||
/** @defgroup elf_c_api ELF C API */
|
||||
|
||||
#include "LIEF/ELF/Binary.h"
|
||||
#include "LIEF/ELF/Symbol.h"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _LIEF_EN(N) LIEF_ELF_##N // enum LIEF_N {
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_ELF_##N // enum LIEF_N {
|
||||
#define _LIEF_EI(X) LIEF_ELF_##X // LIEF_X
|
||||
#define _LIEF_EN(N) LIEF_ELF_##N
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_ELF_##N
|
||||
#define _LIEF_EI(X) LIEF_ELF_##X
|
||||
|
||||
#include "LIEF/ELF/enums.inc"
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef C_LIEF_MACHO_H_
|
||||
#define C_LIEF_MACHO_H_
|
||||
|
||||
//! @defgroup macho_c_api MachO C API
|
||||
/** @defgroup macho_c_api MachO C API */
|
||||
|
||||
#include "LIEF/MachO/Binary.h"
|
||||
#include "LIEF/MachO/Symbol.h"
|
||||
|
||||
@@ -18,9 +18,9 @@ extern "C" {
|
||||
#undef _LIEF_EI
|
||||
#endif
|
||||
|
||||
#define _LIEF_EN(N) LIEF_MACHO_##N // enum LIEF_N {
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_MACHO_##N // enum LIEF_N {
|
||||
#define _LIEF_EI(X) LIEF_MACHO_##X // LIEF_X
|
||||
#define _LIEF_EN(N) LIEF_MACHO_##N
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_MACHO_##N
|
||||
#define _LIEF_EI(X) LIEF_MACHO_##X
|
||||
|
||||
#include "LIEF/MachO/enums.inc"
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef C_LIEF_PE_H_
|
||||
#define C_LIEF_PE_H_
|
||||
|
||||
//! @defgroup pe_c_api PE C API
|
||||
/** @defgroup pe_c_api PE C API */
|
||||
|
||||
#include "LIEF/PE/Binary.h"
|
||||
#include "LIEF/PE/EnumToString.h"
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _LIEF_EN(N) LIEF_PE_##N // enum LIEF_N {
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_PE_##N // enum LIEF_N {
|
||||
#define _LIEF_EI(X) LIEF_PE_##X // LIEF_X
|
||||
#define _LIEF_EN(N) LIEF_PE_##N
|
||||
#define _LIEF_EN_2(N, TYPE) LIEF_PE_##N
|
||||
#define _LIEF_EI(X) LIEF_PE_##X
|
||||
|
||||
#include "LIEF/PE/enums.inc"
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ class ALGORITHMS:
|
||||
class Attribute(lief.Object):
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
@property
|
||||
def type(self) -> Any: ...
|
||||
def type(self) -> lief.PE.SIG_ATTRIBUTE_TYPES: ...
|
||||
|
||||
class Binary(lief.Binary):
|
||||
class it_const_signatures:
|
||||
@@ -315,7 +315,7 @@ class Binary(lief.Binary):
|
||||
@overload
|
||||
def verify_signature(self, signature: lief.PE.Signature, checks: lief.PE.Signature.VERIFICATION_CHECKS = ...) -> lief.PE.Signature.VERIFICATION_FLAGS: ...
|
||||
@overload
|
||||
def verify_signature(self, detached) -> Any: ...
|
||||
def verify_signature(self, detached) -> lief.PE.Signature.VERIFICATION_FLAGS: ...
|
||||
def write(self, output_path: str) -> None: ...
|
||||
@property
|
||||
def authentihash_md5(self) -> bytes: ...
|
||||
@@ -2381,7 +2381,7 @@ class Signature(lief.Object):
|
||||
@property
|
||||
def raw_der(self) -> bytes: ...
|
||||
@property
|
||||
def signers(self) -> Any: ...
|
||||
def signers(self) -> List[lief.PE.SignerInfo]: ...
|
||||
@property
|
||||
def version(self) -> int: ...
|
||||
|
||||
@@ -2579,12 +2579,12 @@ class x509(lief.Object):
|
||||
@overload
|
||||
def is_trusted_by(self, ca_list: List[lief.PE.x509]) -> lief.PE.x509.VERIFICATION_FLAGS: ...
|
||||
@overload
|
||||
def is_trusted_by(self, microsoft_ca_bundle) -> Any: ...
|
||||
def is_trusted_by(self, microsoft_ca_bundle) -> lief.PE.x509.VERIFICATION_FLAGS: ...
|
||||
def parse(self, *args, **kwargs) -> lief.PE.Binary | None: ...
|
||||
@overload
|
||||
def verify(self, ca: lief.PE.x509) -> lief.PE.x509.VERIFICATION_FLAGS: ...
|
||||
@overload
|
||||
def verify(self, signer) -> Any: ...
|
||||
def verify(self, signer) -> lief.PE.x509.VERIFICATION_FLAGS: ...
|
||||
@property
|
||||
def certificate_policies(self) -> List[str]: ...
|
||||
@property
|
||||
|
||||
@@ -71,11 +71,11 @@ class Binary(Object):
|
||||
def remove_section(self, name: str, clear: bool = ...) -> None: ...
|
||||
def xref(self, virtual_address: int) -> List[int]: ...
|
||||
@property
|
||||
def abstract(self) -> object: ...
|
||||
def abstract(self) -> lief.Binary: ...
|
||||
@property
|
||||
def concrete(self) -> object: ...
|
||||
def concrete(self) -> lief.ELF.Binary | lief.PE.Binary | lief.MachO.Binary: ...
|
||||
@property
|
||||
def ctor_functions(self) -> Any: ...
|
||||
def ctor_functions(self) -> List[lief.Function]: ...
|
||||
@property
|
||||
def entrypoint(self) -> int: ...
|
||||
@property
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ class Versioning:
|
||||
IS_TAGGED_CMD = '{git} tag --list --points-at=HEAD'
|
||||
FMT_DEV = '{tag}.dev0'
|
||||
FMT_TAGGED = '{tag}'
|
||||
DEFAULT_VERSION = "0.13.0"
|
||||
DEFAULT_VERSION = "0.13.2"
|
||||
|
||||
def __init__(self):
|
||||
self._git = which("git")
|
||||
|
||||
@@ -1,6 +1,30 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
0.13.2 - June 17, 2023
|
||||
----------------------
|
||||
|
||||
:PE:
|
||||
|
||||
* Fix authenticode inconsitency (:issue:`932`)
|
||||
* Fix missing undef (:pr:`929`)
|
||||
|
||||
|
||||
0.13.1 - May 28, 2023
|
||||
----------------------
|
||||
|
||||
:PE:
|
||||
|
||||
* Fix PE signature verification issue (:issue:`912`)
|
||||
|
||||
:Misc:
|
||||
|
||||
* Fix mypy stubs (:issue:`909`)
|
||||
* Fix missing include (:issue:`918`)
|
||||
* Fix C99 comments (:issue:`916`)
|
||||
* Fix AArch64 docker image (:issue:`904`)
|
||||
|
||||
|
||||
0.13.0 - April 9, 2023
|
||||
----------------------
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define LIEF_DEX_FIELD_H
|
||||
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
|
||||
#include "LIEF/DEX/enums.hpp"
|
||||
|
||||
|
||||
@@ -640,6 +640,7 @@
|
||||
#undef DF_1_SYMINTPOSE
|
||||
#undef DF_1_GLOBAUDIT
|
||||
#undef DF_1_SINGLETON
|
||||
#undef DF_1_PIE
|
||||
|
||||
#undef RHF_NONE
|
||||
#undef RHF_QUICKSTART
|
||||
@@ -677,6 +678,15 @@
|
||||
#undef COUNT_HASH
|
||||
#undef COUNT_RELOCATIONS
|
||||
|
||||
#undef NT_ARM_VFP
|
||||
#undef NT_ARM_TLS
|
||||
#undef NT_ARM_HW_BREAK
|
||||
#undef NT_ARM_HW_WATCH
|
||||
#undef NT_ARM_SYSTEM_CALL
|
||||
#undef NT_ARM_SVE
|
||||
|
||||
#undef NT_386_TLS
|
||||
#undef NT_386_IOPERM
|
||||
|
||||
#undef NT_UNKNOWN
|
||||
#undef NT_GNU_ABI_TAG
|
||||
|
||||
+146
-145
@@ -1,12 +1,12 @@
|
||||
|
||||
|
||||
enum _LIEF_EN_2(MACHO_TYPES, uint32_t) {
|
||||
_LIEF_EI(MH_MAGIC) = 0xFEEDFACEu, ///< 32-bit big-endian magic
|
||||
_LIEF_EI(MH_CIGAM) = 0xCEFAEDFEu, ///< 32-bit little-endian magic
|
||||
_LIEF_EI(MH_MAGIC_64) = 0xFEEDFACFu, ///< 64-bit big-endian magic
|
||||
_LIEF_EI(MH_CIGAM_64) = 0xCFFAEDFEu, ///< 64-bit little-endian magic
|
||||
_LIEF_EI(FAT_MAGIC) = 0xCAFEBABEu, ///< big-endian fat magic
|
||||
_LIEF_EI(FAT_CIGAM) = 0xBEBAFECAu ///< little-endian fat magic
|
||||
_LIEF_EI(MH_MAGIC) = 0xFEEDFACEu, /**< 32-bit big-endian magic */
|
||||
_LIEF_EI(MH_CIGAM) = 0xCEFAEDFEu, /**< 32-bit little-endian magic */
|
||||
_LIEF_EI(MH_MAGIC_64) = 0xFEEDFACFu, /**< 64-bit big-endian magic */
|
||||
_LIEF_EI(MH_CIGAM_64) = 0xCFFAEDFEu, /**< 64-bit little-endian magic */
|
||||
_LIEF_EI(FAT_MAGIC) = 0xCAFEBABEu, /**< big-endian fat magic */
|
||||
_LIEF_EI(FAT_CIGAM) = 0xBEBAFECAu /**< little-endian fat magic */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(FILE_TYPES) {
|
||||
@@ -55,7 +55,7 @@ enum _LIEF_EN(HEADER_FLAGS) {
|
||||
|
||||
|
||||
enum _LIEF_EN(LOAD_COMMAND_TYPES) {
|
||||
// Constants for the "cmd" field in llvm::MachO::load_command
|
||||
/* Constants for the "cmd" field in llvm::MachO::load_command */
|
||||
_LIEF_EI(LC_SEGMENT) = 0x00000001u,
|
||||
_LIEF_EI(LC_SYMTAB) = 0x00000002u,
|
||||
_LIEF_EI(LC_SYMSEG) = 0x00000003u,
|
||||
@@ -114,86 +114,88 @@ enum _LIEF_EN(LOAD_COMMAND_TYPES) {
|
||||
|
||||
|
||||
enum {
|
||||
// Flags for the "cmd" field in llvm::MachO::load_command
|
||||
/* Flags for the "cmd" field in llvm::MachO::load_command */
|
||||
_LIEF_EI(LC_REQ_DYLD) = 0x80000000u
|
||||
};
|
||||
|
||||
|
||||
enum _LIEF_EN(MACHO_SEGMENTS_FLAGS) {
|
||||
// Constant bits for the "flags" field in llvm::MachO::segment_command
|
||||
_LIEF_EI(SG_HIGHVM) = 0x1u, ///< The file contents for this segment are for the high part of the virtual memory space; the low part is zero filled (for stacks in core files).
|
||||
_LIEF_EI(SG_FVMLIB) = 0x2u, ///< this segment is the VM that is allocated by a fixed VM library, for overlap checking in the link editor.
|
||||
_LIEF_EI(SG_NORELOC) = 0x4u, ///< This segment has nothing that was relocated in it and nothing relocated to it. It may be safely replaced without relocation.
|
||||
/* Constant bits for the "flags" field in llvm::MachO::segment_command */
|
||||
_LIEF_EI(SG_HIGHVM) = 0x1u, /**< The file contents for this segment are for the high part of the virtual memory space; the low part is zero filled (for stacks in core files). */
|
||||
_LIEF_EI(SG_FVMLIB) = 0x2u, /**< this segment is the VM that is allocated by a fixed VM library, for overlap checking in the link editor. */
|
||||
_LIEF_EI(SG_NORELOC) = 0x4u, /**< This segment has nothing that was relocated in it and nothing relocated to it. It may be safely replaced without relocation. */
|
||||
_LIEF_EI(SG_PROTECTED_VERSION_1) = 0x8u,
|
||||
};
|
||||
|
||||
enum _LIEF_EN(SECTION_FLAGS_HELPER) {
|
||||
// Constant masks for the "flags" field in llvm::MachO::section and
|
||||
// llvm::MachO::section_64
|
||||
_LIEF_EI(SECTION_TYPE_MASK) = 0x000000ffu, // SECTION_TYPE
|
||||
_LIEF_EI(SECTION_FLAGS_MASK) = 0xffffff00u, // SECTION_ATTRIBUTES
|
||||
_LIEF_EI(SECTION_FLAGS_USR_MASK) = 0xff000000u, // SECTION_ATTRIBUTES_USR
|
||||
_LIEF_EI(SECTION_FLAGS_SYS_MASK) = 0x00ffff00u // SECTION_ATTRIBUTES_SYS
|
||||
/* Constant masks for the "flags" field in llvm::MachO::section and */
|
||||
/* llvm::MachO::section_64 */
|
||||
_LIEF_EI(SECTION_TYPE_MASK) = 0x000000ffu, /* SECTION_TYPE */
|
||||
_LIEF_EI(SECTION_FLAGS_MASK) = 0xffffff00u, /* SECTION_ATTRIBUTES */
|
||||
_LIEF_EI(SECTION_FLAGS_USR_MASK) = 0xff000000u, /* SECTION_ATTRIBUTES_USR */
|
||||
_LIEF_EI(SECTION_FLAGS_SYS_MASK) = 0x00ffff00u /* SECTION_ATTRIBUTES_SYS */
|
||||
};
|
||||
|
||||
//! @brief These are the section type and attributes fields. A MachO section can
|
||||
//! have only one Type, but can have any of the attributes specified.
|
||||
/**
|
||||
* @brief These are the section type and attributes fields. A MachO section can
|
||||
* have only one Type, but can have any of the attributes specified.
|
||||
*/
|
||||
enum _LIEF_EN(MACHO_SECTION_TYPES) {
|
||||
// Constant masks for the "flags[7:0]" field in llvm::MachO::section and
|
||||
// llvm::MachO::section_64 (mask "flags" with SECTION_TYPE)
|
||||
_LIEF_EI(S_REGULAR) = 0x00u, ///< Regular section.
|
||||
_LIEF_EI(S_ZEROFILL) = 0x01u, ///< Zero fill on demand section.
|
||||
_LIEF_EI(S_CSTRING_LITERALS) = 0x02u, ///< Section with literal C strings.
|
||||
_LIEF_EI(S_4BYTE_LITERALS) = 0x03u, ///< Section with 4 byte literals.
|
||||
_LIEF_EI(S_8BYTE_LITERALS) = 0x04u, ///< Section with 8 byte literals.
|
||||
_LIEF_EI(S_LITERAL_POINTERS) = 0x05u, ///< Section with pointers to literals.
|
||||
_LIEF_EI(S_NON_LAZY_SYMBOL_POINTERS) = 0x06u, ///< Section with non-lazy symbol pointers.
|
||||
_LIEF_EI(S_LAZY_SYMBOL_POINTERS) = 0x07u, ///< Section with lazy symbol pointers.
|
||||
_LIEF_EI(S_SYMBOL_STUBS) = 0x08u, ///< Section with symbol stubs, byte size of stub in the Reserved2 field.
|
||||
_LIEF_EI(S_MOD_INIT_FUNC_POINTERS) = 0x09u, ///< Section with only function pointers for initialization.
|
||||
_LIEF_EI(S_MOD_TERM_FUNC_POINTERS) = 0x0au, ///< Section with only function pointers for termination.
|
||||
_LIEF_EI(S_COALESCED) = 0x0bu, ///< Section contains symbols that are to be coalesced.
|
||||
_LIEF_EI(S_GB_ZEROFILL) = 0x0cu, ///< Zero fill on demand section (that can be larger than 4 gigabytes).
|
||||
_LIEF_EI(S_INTERPOSING) = 0x0du, ///< Section with only pairs of function pointers for interposing.
|
||||
_LIEF_EI(S_16BYTE_LITERALS) = 0x0eu, ///< Section with only 16 byte literals.
|
||||
_LIEF_EI(S_DTRACE_DOF) = 0x0fu, ///< Section contains DTrace Object Format.
|
||||
_LIEF_EI(S_LAZY_DYLIB_SYMBOL_POINTERS) = 0x10u, ///< Section with lazy symbol pointers to lazy loaded dylibs.
|
||||
_LIEF_EI(S_THREAD_LOCAL_REGULAR) = 0x11u, ///< Thread local data section.
|
||||
_LIEF_EI(S_THREAD_LOCAL_ZEROFILL) = 0x12u, ///< Thread local zerofill section.
|
||||
_LIEF_EI(S_THREAD_LOCAL_VARIABLES) = 0x13u, ///< Section with thread local variable structure data.
|
||||
_LIEF_EI(S_THREAD_LOCAL_VARIABLE_POINTERS) = 0x14u, ///< Section with pointers to thread local structures.
|
||||
_LIEF_EI(S_THREAD_LOCAL_INIT_FUNCTION_POINTERS) = 0x15u, ///< Section with thread local variable initialization pointers to functions.
|
||||
/* Constant masks for the "flags[7:0]" field in llvm::MachO::section and */
|
||||
/* llvm::MachO::section_64 (mask "flags" with SECTION_TYPE) */
|
||||
_LIEF_EI(S_REGULAR) = 0x00u, /**< Regular section. */
|
||||
_LIEF_EI(S_ZEROFILL) = 0x01u, /**< Zero fill on demand section. */
|
||||
_LIEF_EI(S_CSTRING_LITERALS) = 0x02u, /**< Section with literal C strings. */
|
||||
_LIEF_EI(S_4BYTE_LITERALS) = 0x03u, /**< Section with 4 byte literals. */
|
||||
_LIEF_EI(S_8BYTE_LITERALS) = 0x04u, /**< Section with 8 byte literals. */
|
||||
_LIEF_EI(S_LITERAL_POINTERS) = 0x05u, /**< Section with pointers to literals. */
|
||||
_LIEF_EI(S_NON_LAZY_SYMBOL_POINTERS) = 0x06u, /**< Section with non-lazy symbol pointers. */
|
||||
_LIEF_EI(S_LAZY_SYMBOL_POINTERS) = 0x07u, /**< Section with lazy symbol pointers. */
|
||||
_LIEF_EI(S_SYMBOL_STUBS) = 0x08u, /**< Section with symbol stubs, byte size of stub in the Reserved2 field. */
|
||||
_LIEF_EI(S_MOD_INIT_FUNC_POINTERS) = 0x09u, /**< Section with only function pointers for initialization. */
|
||||
_LIEF_EI(S_MOD_TERM_FUNC_POINTERS) = 0x0au, /**< Section with only function pointers for termination. */
|
||||
_LIEF_EI(S_COALESCED) = 0x0bu, /**< Section contains symbols that are to be coalesced. */
|
||||
_LIEF_EI(S_GB_ZEROFILL) = 0x0cu, /**< Zero fill on demand section (that can be larger than 4 gigabytes). */
|
||||
_LIEF_EI(S_INTERPOSING) = 0x0du, /**< Section with only pairs of function pointers for interposing. */
|
||||
_LIEF_EI(S_16BYTE_LITERALS) = 0x0eu, /**< Section with only 16 byte literals. */
|
||||
_LIEF_EI(S_DTRACE_DOF) = 0x0fu, /**< Section contains DTrace Object Format. */
|
||||
_LIEF_EI(S_LAZY_DYLIB_SYMBOL_POINTERS) = 0x10u, /**< Section with lazy symbol pointers to lazy loaded dylibs. */
|
||||
_LIEF_EI(S_THREAD_LOCAL_REGULAR) = 0x11u, /**< Thread local data section. */
|
||||
_LIEF_EI(S_THREAD_LOCAL_ZEROFILL) = 0x12u, /**< Thread local zerofill section. */
|
||||
_LIEF_EI(S_THREAD_LOCAL_VARIABLES) = 0x13u, /**< Section with thread local variable structure data. */
|
||||
_LIEF_EI(S_THREAD_LOCAL_VARIABLE_POINTERS) = 0x14u, /**< Section with pointers to thread local structures. */
|
||||
_LIEF_EI(S_THREAD_LOCAL_INIT_FUNCTION_POINTERS) = 0x15u, /**< Section with thread local variable initialization pointers to functions. */
|
||||
|
||||
_LIEF_EI(LAST_KNOWN_SECTION_TYPE) = 0x15u, //S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
|
||||
_LIEF_EI(LAST_KNOWN_SECTION_TYPE) = 0x15u, /* S_THREAD_LOCAL_INIT_FUNCTION_POINTERS */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(MACHO_SECTION_FLAGS) {
|
||||
|
||||
// Constant masks for the "flags[31:24]" field in llvm::MachO::section and
|
||||
// llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_USR)
|
||||
_LIEF_EI(S_ATTR_PURE_INSTRUCTIONS) = 0x80000000u, ///< Section contains only true machine instructions
|
||||
_LIEF_EI(S_ATTR_NO_TOC) = 0x40000000u, ///< Section contains coalesced symbols that are not to be in a ranlib table of contents.
|
||||
_LIEF_EI(S_ATTR_STRIP_STATIC_SYMS) = 0x20000000u, ///< Ok to strip static symbols in this section in files with the MY_DYLDLINK flag.
|
||||
_LIEF_EI(S_ATTR_NO_DEAD_STRIP) = 0x10000000u, ///< No dead stripping.
|
||||
_LIEF_EI(S_ATTR_LIVE_SUPPORT) = 0x08000000u, ///< Blocks are live if they reference live blocks.
|
||||
_LIEF_EI(S_ATTR_SELF_MODIFYING_CODE) = 0x04000000u, ///< Used with i386 code stubs written on by dyld
|
||||
_LIEF_EI(S_ATTR_DEBUG) = 0x02000000u, ///< A debug section.
|
||||
/* Constant masks for the "flags[31:24]" field in llvm::MachO::section and */
|
||||
/* llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_USR) */
|
||||
_LIEF_EI(S_ATTR_PURE_INSTRUCTIONS) = 0x80000000u, /**< Section contains only true machine instructions */
|
||||
_LIEF_EI(S_ATTR_NO_TOC) = 0x40000000u, /**< Section contains coalesced symbols that are not to be in a ranlib table of contents. */
|
||||
_LIEF_EI(S_ATTR_STRIP_STATIC_SYMS) = 0x20000000u, /**< Ok to strip static symbols in this section in files with the MY_DYLDLINK flag. */
|
||||
_LIEF_EI(S_ATTR_NO_DEAD_STRIP) = 0x10000000u, /**< No dead stripping. */
|
||||
_LIEF_EI(S_ATTR_LIVE_SUPPORT) = 0x08000000u, /**< Blocks are live if they reference live blocks. */
|
||||
_LIEF_EI(S_ATTR_SELF_MODIFYING_CODE) = 0x04000000u, /**< Used with i386 code stubs written on by dyld */
|
||||
_LIEF_EI(S_ATTR_DEBUG) = 0x02000000u, /**< A debug section. */
|
||||
|
||||
// Constant masks for the "flags[23:8]" field in llvm::MachO::section and
|
||||
// llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_SYS)
|
||||
_LIEF_EI(S_ATTR_SOME_INSTRUCTIONS) = 0x00000400u, ///< Section contains some machine instructions.
|
||||
_LIEF_EI(S_ATTR_EXT_RELOC) = 0x00000200u, ///< Section has external relocation entries.
|
||||
_LIEF_EI(S_ATTR_LOC_RELOC) = 0x00000100u, ///< Section has local relocation entries.
|
||||
/* Constant masks for the "flags[23:8]" field in llvm::MachO::section and */
|
||||
/* llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_SYS) */
|
||||
_LIEF_EI(S_ATTR_SOME_INSTRUCTIONS) = 0x00000400u, /**< Section contains some machine instructions. */
|
||||
_LIEF_EI(S_ATTR_EXT_RELOC) = 0x00000200u, /**< Section has external relocation entries. */
|
||||
_LIEF_EI(S_ATTR_LOC_RELOC) = 0x00000100u, /**< Section has local relocation entries. */
|
||||
|
||||
// Constant masks for the value of an indirect symbol in an indirect
|
||||
// symbol table
|
||||
/* Constant masks for the value of an indirect symbol in an indirect */
|
||||
/* symbol table */
|
||||
_LIEF_EI(INDIRECT_SYMBOL_LOCAL) = 0x80000000u,
|
||||
_LIEF_EI(INDIRECT_SYMBOL_ABS) = 0x40000000u
|
||||
};
|
||||
|
||||
|
||||
enum _LIEF_EN(DataRegionType) {
|
||||
// Constants for the "kind" field in a data_in_code_entry structure
|
||||
/* Constants for the "kind" field in a data_in_code_entry structure */
|
||||
_LIEF_EI(DICE_KIND_DATA) = 1u,
|
||||
_LIEF_EI(DICE_KIND_JUMP_TABLE8) = 2u,
|
||||
_LIEF_EI(DICE_KIND_JUMP_TABLE16) = 3u,
|
||||
@@ -214,23 +216,24 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
//! @brief Opcodes used by Dyld info to rebase a Mach-O image
|
||||
/** @brief Opcodes used by Dyld info to rebase a Mach-O image */
|
||||
enum _LIEF_EN_2(REBASE_OPCODES, uint8_t) {
|
||||
_LIEF_EI(REBASE_OPCODE_DONE) = 0x00u, ///< It's finished
|
||||
_LIEF_EI(REBASE_OPCODE_SET_TYPE_IMM) = 0x10u, ///< Set type to immediate (lower 4-bits). Used for ordinal numbers from 0-15
|
||||
_LIEF_EI(REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB) = 0x20u, ///< Set segment's index to immediate (lower 4-bits) and segment's offset to following ULEB128 encoding.
|
||||
_LIEF_EI(REBASE_OPCODE_ADD_ADDR_ULEB) = 0x30u, ///< Add segment's offset with the following ULEB128 encoding.
|
||||
_LIEF_EI(REBASE_OPCODE_ADD_ADDR_IMM_SCALED) = 0x40u, ///< Add segment's offset with immediate scaling
|
||||
_LIEF_EI(REBASE_OPCODE_DO_REBASE_IMM_TIMES) = 0x50u, ///< Rebase in the range of ``[segment's offset; segment's offset + immediate * sizeof(ptr)]``
|
||||
_LIEF_EI(REBASE_OPCODE_DO_REBASE_ULEB_TIMES) = 0x60u, ///< Same as REBASE_OPCODE_DO_REBASE_IMM_TIMES but *immediate* is replaced with ULEB128 value
|
||||
_LIEF_EI(REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB) = 0x70u, ///< Rebase and increment segment's offset with following ULEB128 encoding + pointer's size
|
||||
_LIEF_EI(REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB) = 0x80u ///< Rebase and skip several bytes
|
||||
_LIEF_EI(REBASE_OPCODE_DONE) = 0x00u, /**< It's finished */
|
||||
_LIEF_EI(REBASE_OPCODE_SET_TYPE_IMM) = 0x10u, /**< Set type to immediate (lower 4-bits). Used for ordinal numbers from 0-15 */
|
||||
_LIEF_EI(REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB) = 0x20u, /**< Set segment's index to immediate (lower 4-bits) and segment's offset to following ULEB128 encoding. */
|
||||
_LIEF_EI(REBASE_OPCODE_ADD_ADDR_ULEB) = 0x30u, /**< Add segment's offset with the following ULEB128 encoding. */
|
||||
_LIEF_EI(REBASE_OPCODE_ADD_ADDR_IMM_SCALED) = 0x40u, /**< Add segment's offset with immediate scaling */
|
||||
_LIEF_EI(REBASE_OPCODE_DO_REBASE_IMM_TIMES) = 0x50u, /**< Rebase in the range of ``[segment's offset; segment's offset + immediate * sizeof(ptr)]`` */
|
||||
_LIEF_EI(REBASE_OPCODE_DO_REBASE_ULEB_TIMES) = 0x60u, /**< Same as REBASE_OPCODE_DO_REBASE_IMM_TIMES but *immediate* is replaced with ULEB128 value */
|
||||
_LIEF_EI(REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB) = 0x70u, /**< Rebase and increment segment's offset with following ULEB128 encoding + pointer's size */
|
||||
_LIEF_EI(REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB) = 0x80u /**< Rebase and skip several bytes */
|
||||
};
|
||||
|
||||
|
||||
//! @brief Within the dyld_info_command there are
|
||||
//! differents area of binding. These enums
|
||||
//! tag these area
|
||||
/**
|
||||
* Within the dyld_info_command there are
|
||||
* differents area of binding. These enums tag these areas.
|
||||
*/
|
||||
enum _LIEF_EN(BINDING_CLASS) {
|
||||
_LIEF_EI(BIND_CLASS_WEAK) = 1u,
|
||||
_LIEF_EI(BIND_CLASS_LAZY) = 2u,
|
||||
@@ -259,21 +262,21 @@ enum {
|
||||
_LIEF_EI(BIND_IMMEDIATE_MASK) = 0x0Fu
|
||||
};
|
||||
|
||||
//! @brief Opcodes used by Dyld info to bind symbols
|
||||
/** Opcodes used by Dyld info to bind symbols */
|
||||
enum _LIEF_EN_2(BIND_OPCODES, uint8_t) {
|
||||
_LIEF_EI(BIND_OPCODE_DONE) = 0x00u, ///< It's finished
|
||||
_LIEF_EI(BIND_OPCODE_SET_DYLIB_ORDINAL_IMM) = 0x10u, ///< Set ordinal to immediate (lower 4-bits). Used for ordinal numbers from 0-15
|
||||
_LIEF_EI(BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB) = 0x20u, ///< Set ordinal to following ULEB128 encoding. Used for ordinal numbers from 16+
|
||||
_LIEF_EI(BIND_OPCODE_SET_DYLIB_SPECIAL_IMM) = 0x30u, ///< Set ordinal, with 0 or negative number as immediate. the value is sign extended.
|
||||
_LIEF_EI(BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM) = 0x40u, ///< Set the following symbol (NULL-terminated char*).
|
||||
_LIEF_EI(BIND_OPCODE_SET_TYPE_IMM) = 0x50u, ///< Set the type to immediate (lower 4-bits). See BIND_TYPES
|
||||
_LIEF_EI(BIND_OPCODE_SET_ADDEND_SLEB) = 0x60u, ///< Set the addend field to the following SLEB128 encoding.
|
||||
_LIEF_EI(BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB) = 0x70u, ///< Set Segment to immediate value, and address to the following SLEB128 encoding
|
||||
_LIEF_EI(BIND_OPCODE_ADD_ADDR_ULEB) = 0x80u, ///< Set the address field to the following SLEB128 encoding.
|
||||
_LIEF_EI(BIND_OPCODE_DO_BIND) = 0x90u, ///< Perform binding of current table row
|
||||
_LIEF_EI(BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB) = 0xA0u, ///< Perform binding, also add following ULEB128 as address
|
||||
_LIEF_EI(BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED) = 0xB0u, ///< Perform binding, also add immediate (lower 4-bits) using scaling
|
||||
_LIEF_EI(BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB) = 0xC0u, ///< Perform binding for several symbols (as following ULEB128), and skip several bytes.
|
||||
_LIEF_EI(BIND_OPCODE_DONE) = 0x00u, /**< It's finished */
|
||||
_LIEF_EI(BIND_OPCODE_SET_DYLIB_ORDINAL_IMM) = 0x10u, /**< Set ordinal to immediate (lower 4-bits). Used for ordinal numbers from 0-15 */
|
||||
_LIEF_EI(BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB) = 0x20u, /**< Set ordinal to following ULEB128 encoding. Used for ordinal numbers from 16+ */
|
||||
_LIEF_EI(BIND_OPCODE_SET_DYLIB_SPECIAL_IMM) = 0x30u, /**< Set ordinal, with 0 or negative number as immediate. the value is sign extended. */
|
||||
_LIEF_EI(BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM) = 0x40u, /**< Set the following symbol (NULL-terminated char*). */
|
||||
_LIEF_EI(BIND_OPCODE_SET_TYPE_IMM) = 0x50u, /**< Set the type to immediate (lower 4-bits). See BIND_TYPES */
|
||||
_LIEF_EI(BIND_OPCODE_SET_ADDEND_SLEB) = 0x60u, /**< Set the addend field to the following SLEB128 encoding. */
|
||||
_LIEF_EI(BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB) = 0x70u, /**< Set Segment to immediate value, and address to the following SLEB128 encoding */
|
||||
_LIEF_EI(BIND_OPCODE_ADD_ADDR_ULEB) = 0x80u, /**< Set the address field to the following SLEB128 encoding. */
|
||||
_LIEF_EI(BIND_OPCODE_DO_BIND) = 0x90u, /**< Perform binding of current table row */
|
||||
_LIEF_EI(BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB) = 0xA0u, /**< Perform binding, also add following ULEB128 as address */
|
||||
_LIEF_EI(BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED) = 0xB0u, /**< Perform binding, also add immediate (lower 4-bits) using scaling */
|
||||
_LIEF_EI(BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB) = 0xC0u, /**< Perform binding for several symbols (as following ULEB128), and skip several bytes. */
|
||||
_LIEF_EI(BIND_OPCODE_THREADED) = 0xD0u,
|
||||
|
||||
_LIEF_EI(BIND_OPCODE_THREADED_APPLY) = 0xD0u | 0x01u,
|
||||
@@ -286,7 +289,7 @@ enum _LIEF_EN_2(BIND_SUBOPCODE_THREADED, uint8_t) {
|
||||
};
|
||||
|
||||
enum _LIEF_EN(EXPORT_SYMBOL_FLAGS) {
|
||||
_LIEF_EI(EXPORT_SYMBOL_FLAGS_KIND_MASK) = 0x03u, ///< Mask to access to EXPORT_SYMBOL_KINDS
|
||||
_LIEF_EI(EXPORT_SYMBOL_FLAGS_KIND_MASK) = 0x03u, /**< Mask to access to EXPORT_SYMBOL_KINDS */
|
||||
_LIEF_EI(EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION) = 0x04u,
|
||||
_LIEF_EI(EXPORT_SYMBOL_FLAGS_REEXPORT) = 0x08u,
|
||||
_LIEF_EI(EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER) = 0x10u
|
||||
@@ -299,41 +302,40 @@ enum _LIEF_EN(EXPORT_SYMBOL_KINDS) {
|
||||
};
|
||||
|
||||
enum _LIEF_EN(MACHO_SYMBOL_TYPES) {
|
||||
_LIEF_EI(N_STAB) = 0xe0, ///< The symbol is symbolic debugging table
|
||||
_LIEF_EI(N_PEXT) = 0x10, ///< Limited global scope symbol.
|
||||
_LIEF_EI(N_TYPE) = 0x0e, ///< Define the type of the symbol. @see N_LIST_TYPES
|
||||
_LIEF_EI(N_EXT) = 0x01 ///< External symbol, a symbol that is either defined outside this file or that is defined in this file but can be referenced by other files.
|
||||
_LIEF_EI(N_STAB) = 0xe0, /**< The symbol is symbolic debugging table */
|
||||
_LIEF_EI(N_PEXT) = 0x10, /**< Limited global scope symbol. */
|
||||
_LIEF_EI(N_TYPE) = 0x0e, /**< Define the type of the symbol. @see N_LIST_TYPES */
|
||||
_LIEF_EI(N_EXT) = 0x01 /**< External symbol, a symbol that is either defined outside this file or that is defined in this file but can be referenced by other files. */
|
||||
};
|
||||
|
||||
//! @brief Constants for the "n_type & SYMBOL_TYPES::N_TYPE" in nlist
|
||||
//! @see nlist
|
||||
/** Constants for the "n_type & SYMBOL_TYPES::N_TYPE" in nlist. @see nlist */
|
||||
enum _LIEF_EN(N_LIST_TYPES) {
|
||||
_LIEF_EI(N_UNDF) = 0x0u, ///< The symbol is undefined. It is referenced in a different module.
|
||||
_LIEF_EI(N_ABS) = 0x2u, ///< The symbol is absolute. The linker doesn't update his value.
|
||||
_LIEF_EI(N_SECT) = 0xeu, ///< The symbol is defined in the section number given in nlist_base.n_sect .
|
||||
_LIEF_EI(N_PBUD) = 0xcu, ///< The symbol is undefined and the image is using a prebound value for the symbol. Set the n_sect field to NO_SECT .
|
||||
_LIEF_EI(N_INDR) = 0xau ///< The symbol is defined to be the same as another symbol. The n_value field is an index into the string table specifying the name of the other symbol. When that symbol is linked, both this and the other symbol point to the same defined type and value.
|
||||
_LIEF_EI(N_UNDF) = 0x0u, /**< The symbol is undefined. It is referenced in a different module. */
|
||||
_LIEF_EI(N_ABS) = 0x2u, /**< The symbol is absolute. The linker doesn't update his value. */
|
||||
_LIEF_EI(N_SECT) = 0xeu, /**< The symbol is defined in the section number given in nlist_base.n_sect . */
|
||||
_LIEF_EI(N_PBUD) = 0xcu, /**< The symbol is undefined and the image is using a prebound value for the symbol. Set the n_sect field to NO_SECT . */
|
||||
_LIEF_EI(N_INDR) = 0xau /**< The symbol is defined to be the same as another symbol. The n_value field is an index into the string table specifying the name of the other symbol. When that symbol is linked, both this and the other symbol point to the same defined type and value. */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(SectionOrdinal) {
|
||||
// Constants for the "n_sect" field in llvm::MachO::nlist and
|
||||
// llvm::MachO::nlist_64
|
||||
/* Constants for the "n_sect" field in llvm::MachO::nlist and */
|
||||
/* llvm::MachO::nlist_64 */
|
||||
_LIEF_EI(NO_SECT) = 0u,
|
||||
_LIEF_EI(MAX_SECT) = 0xffu
|
||||
};
|
||||
|
||||
enum _LIEF_EN(SYMBOL_DESCRIPTIONS) {
|
||||
|
||||
// The low 3 bits are the for the REFERENCE_TYPE.
|
||||
/* The low 3 bits are the for the REFERENCE_TYPE. */
|
||||
_LIEF_EI(REFERENCE_TYPE) = 0x7,
|
||||
_LIEF_EI(REFERENCE_FLAG_UNDEFINED_NON_LAZY) = 0, ///< Reference to an external non-lazy (data) symbol.
|
||||
_LIEF_EI(REFERENCE_FLAG_UNDEFINED_LAZY) = 1, ///< Reference to an external lazy symbol - that is, to a function call.
|
||||
_LIEF_EI(REFERENCE_FLAG_DEFINED) = 2, ///< Defined in this module.
|
||||
_LIEF_EI(REFERENCE_FLAG_PRIVATE_DEFINED) = 3, ///< Defined in this module and is visible only to modules within this shared library.
|
||||
_LIEF_EI(REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) = 4, ///< Defined in another module in this file, is a non-lazy (data) symbol, and is visible only to modules within this shared library.
|
||||
_LIEF_EI(REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) = 5, ///< Defined in another module in this file, is a lazy (function) symbol, and is visible only to modules within this shared library.
|
||||
_LIEF_EI(REFERENCE_FLAG_UNDEFINED_NON_LAZY) = 0, /**< Reference to an external non-lazy (data) symbol. */
|
||||
_LIEF_EI(REFERENCE_FLAG_UNDEFINED_LAZY) = 1, /**< Reference to an external lazy symbol - that is, to a function call. */
|
||||
_LIEF_EI(REFERENCE_FLAG_DEFINED) = 2, /**< Defined in this module. */
|
||||
_LIEF_EI(REFERENCE_FLAG_PRIVATE_DEFINED) = 3, /**< Defined in this module and is visible only to modules within this shared library. */
|
||||
_LIEF_EI(REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY) = 4, /**< Defined in another module in this file, is a non-lazy (data) symbol, and is visible only to modules within this shared library. */
|
||||
_LIEF_EI(REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY) = 5, /**< Defined in another module in this file, is a lazy (function) symbol, and is visible only to modules within this shared library. */
|
||||
|
||||
// Flag bits (some overlap with the library ordinal bits).
|
||||
/* Flag bits (some overlap with the library ordinal bits). */
|
||||
_LIEF_EI(N_ARM_THUMB_DEF) = 0x0008u,
|
||||
_LIEF_EI(REFERENCED_DYNAMICALLY) = 0x0010u,
|
||||
_LIEF_EI(N_NO_DEAD_STRIP) = 0x0020u,
|
||||
@@ -342,8 +344,8 @@ enum _LIEF_EN(SYMBOL_DESCRIPTIONS) {
|
||||
_LIEF_EI(N_SYMBOL_RESOLVER) = 0x0100u,
|
||||
_LIEF_EI(N_ALT_ENTRY) = 0x0200u,
|
||||
|
||||
// For undefined symbols coming from libraries, see GET_LIBRARY_ORDINAL()
|
||||
// as these are in the top 8 bits.
|
||||
/* For undefined symbols coming from libraries, see GET_LIBRARY_ORDINAL() */
|
||||
/* as these are in the top 8 bits. */
|
||||
_LIEF_EI(SELF_LIBRARY_ORDINAL) = 0x0,
|
||||
_LIEF_EI(MAX_LIBRARY_ORDINAL) = 0xfd,
|
||||
_LIEF_EI(DYNAMIC_LOOKUP_ORDINAL) = 0xfe,
|
||||
@@ -351,8 +353,8 @@ enum _LIEF_EN(SYMBOL_DESCRIPTIONS) {
|
||||
};
|
||||
|
||||
enum _LIEF_EN(StabType) {
|
||||
// Constant values for the "n_type" field in llvm::MachO::nlist and
|
||||
// llvm::MachO::nlist_64 when "(n_type & N_STAB) != 0"
|
||||
/* Constant values for the "n_type" field in llvm::MachO::nlist and */
|
||||
/* llvm::MachO::nlist_64 when "(n_type & N_STAB) != 0" */
|
||||
_LIEF_EI(N_GSYM) = 0x20u,
|
||||
_LIEF_EI(N_FNAME) = 0x22u,
|
||||
_LIEF_EI(N_FUN) = 0x24u,
|
||||
@@ -388,12 +390,12 @@ enum _LIEF_EN(StabType) {
|
||||
|
||||
|
||||
enum {
|
||||
// Constant values for the r_symbolnum field in an
|
||||
// llvm::MachO::relocation_info structure when r_extern is 0.
|
||||
/* Constant values for the r_symbolnum field in an */
|
||||
/* llvm::MachO::relocation_info structure when r_extern is 0. */
|
||||
_LIEF_EI(R_ABS) = 0,
|
||||
|
||||
// Constant bits for the r_address field in an
|
||||
// llvm::MachO::relocation_info structure.
|
||||
/* Constant bits for the r_address field in an */
|
||||
/* llvm::MachO::relocation_info structure. */
|
||||
_LIEF_EI(R_SCATTERED) = 0x80000000
|
||||
};
|
||||
|
||||
@@ -407,7 +409,7 @@ enum _LIEF_EN(RELOCATION_ORIGINS) {
|
||||
enum _LIEF_EN(SYMBOL_ORIGINS) {
|
||||
_LIEF_EI(SYM_ORIGIN_UNKNOWN) = 0,
|
||||
_LIEF_EI(SYM_ORIGIN_DYLD_EXPORT) = 1,
|
||||
_LIEF_EI(SYM_ORIGIN_DYLD_BIND) = 2, /// The symbol comes from the binding opcodes
|
||||
_LIEF_EI(SYM_ORIGIN_DYLD_BIND) = 2, /**< The symbol comes from the binding opcodes */
|
||||
_LIEF_EI(SYM_ORIGIN_LC_SYMTAB) = 3,
|
||||
};
|
||||
|
||||
@@ -463,7 +465,7 @@ enum _LIEF_EN(ARM_RELOCATION) {
|
||||
_LIEF_EI(ARM_RELOC_PB_LA_PTR) = 4,
|
||||
_LIEF_EI(ARM_RELOC_BR24) = 5,
|
||||
_LIEF_EI(ARM_THUMB_RELOC_BR22) = 6,
|
||||
_LIEF_EI(ARM_THUMB_32BIT_BRANCH) = 7, // obsolete
|
||||
_LIEF_EI(ARM_THUMB_32BIT_BRANCH) = 7, /* obsolete */
|
||||
_LIEF_EI(ARM_RELOC_HALF) = 8,
|
||||
_LIEF_EI(ARM_RELOC_HALF_SECTDIFF) = 9,
|
||||
};
|
||||
@@ -483,54 +485,53 @@ enum _LIEF_EN(ARM64_RELOCATION) {
|
||||
_LIEF_EI(ARM64_RELOC_ADDEND) = 10, /**< Must be followed by ARM64_RELOCATION::ARM64_RELOC_PAGE21 or ARM64_RELOCATION::ARM64_RELOC_PAGEOFF12. */
|
||||
};
|
||||
|
||||
//! Values for segment_command.initprot.
|
||||
//! From <mach/vm_prot.h>
|
||||
/** Values for segment_command.initprot (From <mach/vm_prot.h>). */
|
||||
enum _LIEF_EN(VM_PROTECTIONS) {
|
||||
_LIEF_EI(VM_PROT_READ) = 0x1, ///< Reading data within the segment is allowed
|
||||
_LIEF_EI(VM_PROT_WRITE) = 0x2, ///< Writing data within the segment is allowed
|
||||
_LIEF_EI(VM_PROT_EXECUTE) = 0x4, ///< Executing data within the segment is allowed
|
||||
_LIEF_EI(VM_PROT_READ) = 0x1, /**< Reading data within the segment is allowed */
|
||||
_LIEF_EI(VM_PROT_WRITE) = 0x2, /**< Writing data within the segment is allowed */
|
||||
_LIEF_EI(VM_PROT_EXECUTE) = 0x4, /**< Executing data within the segment is allowed */
|
||||
};
|
||||
|
||||
|
||||
// Enums from <mach/machine.h>
|
||||
/* Enums from <mach/machine.h> */
|
||||
enum {
|
||||
// Capability bits used in the definition of cpu_type.
|
||||
_LIEF_EI(CPU_ARCH_MASK) = 0xff000000, // Mask for architecture bits
|
||||
_LIEF_EI(CPU_ARCH_ABI64) = 0x01000000 // 64 bit ABI
|
||||
/* Capability bits used in the definition of cpu_type. */
|
||||
_LIEF_EI(CPU_ARCH_MASK) = 0xff000000, /* Mask for architecture bits */
|
||||
_LIEF_EI(CPU_ARCH_ABI64) = 0x01000000 /* 64 bit ABI */
|
||||
};
|
||||
|
||||
// Constants for the cputype field.
|
||||
/* Constants for the cputype field. */
|
||||
enum _LIEF_EN_2(CPU_TYPES, int) {
|
||||
_LIEF_EI(CPU_TYPE_ANY) = -1,
|
||||
_LIEF_EI(CPU_TYPE_X86) = 7,
|
||||
_LIEF_EI(CPU_TYPE_I386) = 7, // CPU_TYPE_X86,
|
||||
_LIEF_EI(CPU_TYPE_X86_64) = 7 | 0x01000000, // CPU_TYPE_X86 | CPU_ARCH_ABI64,
|
||||
_LIEF_EI(CPU_TYPE_I386) = 7, /* CPU_TYPE_X86, */
|
||||
_LIEF_EI(CPU_TYPE_X86_64) = 7 | 0x01000000, /* CPU_TYPE_X86 | CPU_ARCH_ABI64, */
|
||||
/* _LIEF_EI(CPU_TYPE_MIPS) = 8, */
|
||||
_LIEF_EI(CPU_TYPE_MC98000) = 10, // Old Motorola PowerPC
|
||||
_LIEF_EI(CPU_TYPE_MC98000) = 10, /* Old Motorola PowerPC */
|
||||
_LIEF_EI(CPU_TYPE_ARM) = 12,
|
||||
_LIEF_EI(CPU_TYPE_ARM64) = 12 | 0x01000000, // CPU_TYPE_ARM | CPU_ARCH_ABI64,
|
||||
_LIEF_EI(CPU_TYPE_ARM64) = 12 | 0x01000000, /* CPU_TYPE_ARM | CPU_ARCH_ABI64, */
|
||||
_LIEF_EI(CPU_TYPE_SPARC) = 14,
|
||||
_LIEF_EI(CPU_TYPE_POWERPC) = 18,
|
||||
_LIEF_EI(CPU_TYPE_POWERPC64) = 18 | 0x01000000, // CPU_TYPE_POWERPC | CPU_ARCH_ABI64
|
||||
_LIEF_EI(CPU_TYPE_POWERPC64) = 18 | 0x01000000, /* CPU_TYPE_POWERPC | CPU_ARCH_ABI64 */
|
||||
};
|
||||
|
||||
enum {
|
||||
// Capability bits used in the definition of cpusubtype.
|
||||
_LIEF_EI(CPU_SUBTYPE_MASK) = 0xff000000, // Mask for architecture bits
|
||||
_LIEF_EI(CPU_SUBTYPE_LIB64) = 0x80000000, // 64 bit libraries
|
||||
/* Capability bits used in the definition of cpusubtype. */
|
||||
_LIEF_EI(CPU_SUBTYPE_MASK) = 0xff000000, /* Mask for architecture bits */
|
||||
_LIEF_EI(CPU_SUBTYPE_LIB64) = 0x80000000, /* 64 bit libraries */
|
||||
|
||||
// Special CPU subtype constants.
|
||||
/* Special CPU subtype constants. */
|
||||
_LIEF_EI(CPU_SUBTYPE_MULTIPLE) = ~0u
|
||||
};
|
||||
|
||||
// Constants for the cpusubtype field.
|
||||
/* Constants for the cpusubtype field. */
|
||||
enum _LIEF_EN(CPU_SUBTYPES_X86) {
|
||||
_LIEF_EI(CPU_SUBTYPE_I386_ALL) = 3,
|
||||
_LIEF_EI(CPU_SUBTYPE_386) = 3,
|
||||
_LIEF_EI(CPU_SUBTYPE_486) = 4,
|
||||
_LIEF_EI(CPU_SUBTYPE_486SX) = 0x84,
|
||||
_LIEF_EI(CPU_SUBTYPE_586) = 5,
|
||||
_LIEF_EI(CPU_SUBTYPE_PENT) = 5, // CPU_SUBTYPE_586,
|
||||
_LIEF_EI(CPU_SUBTYPE_PENT) = 5, /* CPU_SUBTYPE_586, */
|
||||
_LIEF_EI(CPU_SUBTYPE_PENTPRO) = 0x16,
|
||||
_LIEF_EI(CPU_SUBTYPE_PENTII_M3) = 0x36,
|
||||
_LIEF_EI(CPU_SUBTYPE_PENTII_M5) = 0x56,
|
||||
@@ -567,7 +568,7 @@ enum _LIEF_EN(CPU_SUBTYPES_ARM) {
|
||||
_LIEF_EI(CPU_SUBTYPE_ARM_V5TEJ) = 7,
|
||||
_LIEF_EI(CPU_SUBTYPE_ARM_XSCALE) = 8,
|
||||
_LIEF_EI(CPU_SUBTYPE_ARM_V7) = 9,
|
||||
// unused _LIEF_EI(ARM_V7F) = 10,
|
||||
/* unused _LIEF_EI(ARM_V7F) = 10, */
|
||||
_LIEF_EI(CPU_SUBTYPE_ARM_V7S) = 11,
|
||||
_LIEF_EI(CPU_SUBTYPE_ARM_V7K) = 12,
|
||||
_LIEF_EI(CPU_SUBTYPE_ARM_V6M) = 14,
|
||||
@@ -598,8 +599,8 @@ enum _LIEF_EN(CPU_SUBTYPES_POWERPC) {
|
||||
_LIEF_EI(CPU_SUBTYPE_POWERPC_7450) = 11,
|
||||
_LIEF_EI(CPU_SUBTYPE_POWERPC_970) = 100,
|
||||
|
||||
_LIEF_EI(CPU_SUBTYPE_MC980000_ALL) = 0, //CPU_SUBTYPE_POWERPC_ALL,
|
||||
_LIEF_EI(CPU_SUBTYPE_MC98601) = 1, //CPU_SUBTYPE_POWERPC_601
|
||||
_LIEF_EI(CPU_SUBTYPE_MC980000_ALL) = 0, /* CPU_SUBTYPE_POWERPC_ALL, */
|
||||
_LIEF_EI(CPU_SUBTYPE_MC98601) = 1, /* CPU_SUBTYPE_POWERPC_601 */
|
||||
};
|
||||
|
||||
|
||||
|
||||
+121
-116
@@ -60,65 +60,65 @@ enum _LIEF_EN(HEADER_CHARACTERISTICS) {
|
||||
};
|
||||
|
||||
|
||||
/// Storage class tells where and what the symbol represents
|
||||
/** Storage class tells where and what the symbol represents */
|
||||
enum _LIEF_EN_2(SYMBOL_STORAGE_CLASS, int) {
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_INVALID) = 0xFF,
|
||||
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_END_OF_FUNCTION) = -1, ///< Physical end of function
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_NULL) = 0, ///< No symbol
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_AUTOMATIC) = 1, ///< Stack variable
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_EXTERNAL) = 2, ///< External symbol
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_STATIC) = 3, ///< Static
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_REGISTER) = 4, ///< Register variable
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_EXTERNAL_DEF) = 5, ///< External definition
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_LABEL) = 6, ///< Label
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_UNDEFINED_LABEL) = 7, ///< Undefined label
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_MEMBER_OF_STRUCT) = 8, ///< Member of structure
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_ARGUMENT) = 9, ///< Function argument
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_STRUCT_TAG) = 10, ///< Structure tag
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_MEMBER_OF_UNION) = 11, ///< Member of union
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_UNION_TAG) = 12, ///< Union tag
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_TYPE_DEFINITION) = 13, ///< Type definition
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_UNDEFINED_STATIC) = 14, ///< Undefined static
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_ENUM_TAG) = 15, ///< Enumeration tag
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_MEMBER_OF_ENUM) = 16, ///< Member of enumeration
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_REGISTER_PARAM) = 17, ///< Register parameter
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_BIT_FIELD) = 18, ///< Bit field ".bb" or ".eb" - beginning or end of block
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_BLOCK) = 100, ///< ".bf" or ".ef" - beginning or end of function
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_END_OF_FUNCTION) = -1, /**< Physical end of function */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_NULL) = 0, /**< No symbol */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_AUTOMATIC) = 1, /**< Stack variable */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_EXTERNAL) = 2, /**< External symbol */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_STATIC) = 3, /**< Static */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_REGISTER) = 4, /**< Register variable */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_EXTERNAL_DEF) = 5, /**< External definition */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_LABEL) = 6, /**< Label */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_UNDEFINED_LABEL) = 7, /**< Undefined label */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_MEMBER_OF_STRUCT) = 8, /**< Member of structure */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_ARGUMENT) = 9, /**< Function argument */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_STRUCT_TAG) = 10, /**< Structure tag */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_MEMBER_OF_UNION) = 11, /**< Member of union */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_UNION_TAG) = 12, /**< Union tag */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_TYPE_DEFINITION) = 13, /**< Type definition */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_UNDEFINED_STATIC) = 14, /**< Undefined static */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_ENUM_TAG) = 15, /**< Enumeration tag */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_MEMBER_OF_ENUM) = 16, /**< Member of enumeration */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_REGISTER_PARAM) = 17, /**< Register parameter */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_BIT_FIELD) = 18, /**< Bit field ".bb" or ".eb" - beginning or end of block */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_BLOCK) = 100, /**< ".bf" or ".ef" - beginning or end of function */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_FUNCTION) = 101,
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_END_OF_STRUCT) = 102, ///< End of structure
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_FILE) = 103, ///< File name line number, reformatted as symbol
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_END_OF_STRUCT) = 102, /**< End of structure */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_FILE) = 103, /**< File name line number, reformatted as symbol */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_SECTION) = 104,
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_WEAK_EXTERNAL) = 105, ///< Duplicate tag external symbol in dmert public lib
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_WEAK_EXTERNAL) = 105, /**< Duplicate tag external symbol in dmert public lib */
|
||||
_LIEF_EI(IMAGE_SYM_CLASS_CLR_TOKEN) = 107
|
||||
};
|
||||
|
||||
|
||||
enum _LIEF_EN(SYMBOL_BASE_TYPES) {
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_NULL) = 0, ///< No type information or unknown base type.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_VOID) = 1, ///< Used with void pointers and functions.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_CHAR) = 2, ///< A character (signed byte).
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_SHORT) = 3, ///< A 2-byte signed integer.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_INT) = 4, ///< A natural integer type on the target.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_LONG) = 5, ///< A 4-byte signed integer.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_FLOAT) = 6, ///< A 4-byte floating-point number.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_DOUBLE) = 7, ///< An 8-byte floating-point number.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_STRUCT) = 8, ///< A structure.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_UNION) = 9, ///< An union.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_ENUM) = 10, ///< An enumerated type.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_MOE) = 11, ///< A member of enumeration (a specific value).
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_BYTE) = 12, ///< A byte; unsigned 1-byte integer.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_WORD) = 13, ///< A word; unsigned 2-byte integer.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_UINT) = 14, ///< An unsigned integer of natural size.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_DWORD) = 15 ///< An unsigned 4-byte integer.
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_NULL) = 0, /**< No type information or unknown base type. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_VOID) = 1, /**< Used with void pointers and functions. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_CHAR) = 2, /**< A character (signed byte). */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_SHORT) = 3, /**< A 2-byte signed integer. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_INT) = 4, /**< A natural integer type on the target. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_LONG) = 5, /**< A 4-byte signed integer. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_FLOAT) = 6, /**< A 4-byte floating-point number. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_DOUBLE) = 7, /**< An 8-byte floating-point number. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_STRUCT) = 8, /**< A structure. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_UNION) = 9, /**< An union. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_ENUM) = 10, /**< An enumerated type. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_MOE) = 11, /**< A member of enumeration (a specific value). */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_BYTE) = 12, /**< A byte; unsigned 1-byte integer. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_WORD) = 13, /**< A word; unsigned 2-byte integer. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_UINT) = 14, /**< An unsigned integer of natural size. */
|
||||
_LIEF_EI(IMAGE_SYM_TYPE_DWORD) = 15 /**< An unsigned 4-byte integer. */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(SYMBOL_COMPLEX_TYPES) {
|
||||
_LIEF_EI(IMAGE_SYM_DTYPE_NULL) = 0, ///< No complex type; simple scalar variable.
|
||||
_LIEF_EI(IMAGE_SYM_DTYPE_POINTER) = 1, ///< A pointer to base type.
|
||||
_LIEF_EI(IMAGE_SYM_DTYPE_FUNCTION) = 2, ///< A function that returns a base type.
|
||||
_LIEF_EI(IMAGE_SYM_DTYPE_ARRAY) = 3, ///< An array of base type.
|
||||
_LIEF_EI(SCT_COMPLEX_TYPE_SHIFT) = 4 ///< Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
|
||||
_LIEF_EI(IMAGE_SYM_DTYPE_NULL) = 0, /**< No complex type; simple scalar variable. */
|
||||
_LIEF_EI(IMAGE_SYM_DTYPE_POINTER) = 1, /**< A pointer to base type. */
|
||||
_LIEF_EI(IMAGE_SYM_DTYPE_FUNCTION) = 2, /**< A function that returns a base type. */
|
||||
_LIEF_EI(IMAGE_SYM_DTYPE_ARRAY) = 3, /**< An array of base type. */
|
||||
_LIEF_EI(SCT_COMPLEX_TYPE_SHIFT) = 4 /**< Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT)) */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(AuxSymbolType) {
|
||||
@@ -201,7 +201,7 @@ enum _LIEF_EN(RELOCATIONS_ARM) {
|
||||
};
|
||||
|
||||
|
||||
/// These are not documented in the spec, but are located in WinNT.h.
|
||||
/** These are not documented in the spec, but are located in WinNT.h. */
|
||||
enum _LIEF_EN(WeakExternalCharacteristics) {
|
||||
_LIEF_EI(IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY) = 1,
|
||||
_LIEF_EI(IMAGE_WEAK_EXTERN_SEARCH_LIBRARY) = 2,
|
||||
@@ -232,49 +232,49 @@ enum _LIEF_EN(DATA_DIRECTORY) {
|
||||
|
||||
|
||||
enum _LIEF_EN(SUBSYSTEM) {
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_UNKNOWN) = 0, ///< An unknown subsystem.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_NATIVE) = 1, ///< Device drivers and native Windows processes
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_WINDOWS_GUI) = 2, ///< The Windows GUI subsystem.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_WINDOWS_CUI) = 3, ///< The Windows character subsystem.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_OS2_CUI) = 5, ///< The OS/2 character subsytem.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_POSIX_CUI) = 7, ///< The POSIX character subsystem.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_NATIVE_WINDOWS) = 8, ///< Native Windows 9x driver.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_WINDOWS_CE_GUI) = 9, ///< Windows CE.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_EFI_APPLICATION) = 10, ///< An EFI application.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) = 11, ///< An EFI driver with boot services.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) = 12, ///< An EFI driver with run-time services.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_EFI_ROM) = 13, ///< An EFI ROM image.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_XBOX) = 14, ///< XBOX.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION) = 16 ///< A BCD application.
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_UNKNOWN) = 0, /**< An unknown subsystem. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_NATIVE) = 1, /**< Device drivers and native Windows processes */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_WINDOWS_GUI) = 2, /**< The Windows GUI subsystem. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_WINDOWS_CUI) = 3, /**< The Windows character subsystem. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_OS2_CUI) = 5, /**< The OS/2 character subsytem. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_POSIX_CUI) = 7, /**< The POSIX character subsystem. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_NATIVE_WINDOWS) = 8, /**< Native Windows 9x driver. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_WINDOWS_CE_GUI) = 9, /**< Windows CE. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_EFI_APPLICATION) = 10, /**< An EFI application. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) = 11, /**< An EFI driver with boot services. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER) = 12, /**< An EFI driver with run-time services. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_EFI_ROM) = 13, /**< An EFI ROM image. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_XBOX) = 14, /**< XBOX. */
|
||||
_LIEF_EI(IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION) = 16 /**< A BCD application. */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(DLL_CHARACTERISTICS) {
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA) = 0x0020, ///< ASLR with 64 bit address space.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE) = 0x0040, ///< DLL can be relocated at load time.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY) = 0x0080, ///< Code integrity checks are enforced.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_NX_COMPAT) = 0x0100, ///< Image is NX compatible.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION) = 0x0200, ///< Isolation aware, but do not isolate the image.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_NO_SEH) = 0x0400, ///< Does not use structured exception handling (SEH). No SEH handler may be called in this image.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_NO_BIND) = 0x0800, ///< Do not bind the image.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_APPCONTAINER) = 0x1000, ///< Image should execute in an AppContainer.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER) = 0x2000, ///< A WDM driver.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_GUARD_CF) = 0x4000, ///< Image supports Control Flow Guard.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE) = 0x8000 ///< Terminal Server aware.
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA) = 0x0020, /**< ASLR with 64 bit address space. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE) = 0x0040, /**< DLL can be relocated at load time. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY) = 0x0080, /**< Code integrity checks are enforced. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_NX_COMPAT) = 0x0100, /**< Image is NX compatible. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION) = 0x0200, /**< Isolation aware, but do not isolate the image. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_NO_SEH) = 0x0400, /**< Does not use structured exception handling (SEH). No SEH handler may be called in this image. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_NO_BIND) = 0x0800, /**< Do not bind the image. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_APPCONTAINER) = 0x1000, /**< Image should execute in an AppContainer. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER) = 0x2000, /**< A WDM driver. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_GUARD_CF) = 0x4000, /**< Image supports Control Flow Guard. */
|
||||
_LIEF_EI(IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE) = 0x8000 /**< Terminal Server aware. */
|
||||
};
|
||||
|
||||
|
||||
enum _LIEF_EN(DEBUG_TYPES) {
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_UNKNOWN) = 0,
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_COFF) = 1, ///< COFF debug information
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_CODEVIEW) = 2, ///< CodeView debug information (pdb & cie)
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_FPO) = 3, ///< Frame pointer omission information
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_MISC) = 4, ///< CodeView Debug Information
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_EXCEPTION) = 5, ///< A copy of .pdata section.
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_FIXUP) = 6, ///< Reserved.
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_OMAP_TO_SRC) = 7, ///< The mapping from an RVA in image to an RVA in source image.
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_OMAP_FROM_SRC) = 8, ///< The mapping from an RVA in source image to an RVA in image.
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_BORLAND) = 9, ///< Reserved for Borland.
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_RESERVED10) = 10, ///< Reserved for future use.
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_COFF) = 1, /**< COFF debug information */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_CODEVIEW) = 2, /**< CodeView debug information (pdb & cie) */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_FPO) = 3, /**< Frame pointer omission information */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_MISC) = 4, /**< CodeView Debug Information */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_EXCEPTION) = 5, /**< A copy of .pdata section. */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_FIXUP) = 6, /**< Reserved. */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_OMAP_TO_SRC) = 7, /**< The mapping from an RVA in image to an RVA in source image. */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_OMAP_FROM_SRC) = 8, /**< The mapping from an RVA in source image to an RVA in image. */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_BORLAND) = 9, /**< Reserved for Borland. */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_RESERVED10) = 10, /**< Reserved for future use. */
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_CLSID) = 11,
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_VC_FEATURE) = 12,
|
||||
_LIEF_EI(IMAGE_DEBUG_TYPE_POGO) = 13,
|
||||
@@ -285,20 +285,21 @@ enum _LIEF_EN(DEBUG_TYPES) {
|
||||
};
|
||||
|
||||
|
||||
//! Code view signatures
|
||||
//! @see: http://llvm.org/doxygen/CVDebugRecord_8h_source.html
|
||||
/** Code view signatures
|
||||
* @see: http://llvm.org/doxygen/CVDebugRecord_8h_source.html
|
||||
*/
|
||||
enum _LIEF_EN(CODE_VIEW_SIGNATURES) {
|
||||
_LIEF_EI(CVS_UNKNOWN) = 0,
|
||||
_LIEF_EI(CVS_PDB_70) = 0x53445352, // RSDS
|
||||
_LIEF_EI(CVS_PDB_20) = 0x3031424e, // NB10
|
||||
_LIEF_EI(CVS_CV_50) = 0x3131424e, // NB11
|
||||
_LIEF_EI(CVS_CV_41) = 0x3930424e, // NB09
|
||||
_LIEF_EI(CVS_PDB_70) = 0x53445352, /* RSDS */
|
||||
_LIEF_EI(CVS_PDB_20) = 0x3031424e, /* NB10 */
|
||||
_LIEF_EI(CVS_CV_50) = 0x3131424e, /* NB11 */
|
||||
_LIEF_EI(CVS_CV_41) = 0x3930424e, /* NB09 */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(POGO_SIGNATURES) {
|
||||
_LIEF_EI(POGO_UNKNOWN) = 0,
|
||||
_LIEF_EI(POGO_LCTG) = 0x4C544347, // LCTG
|
||||
_LIEF_EI(POGO_PGI) = 0x50474900 , // PGI\0
|
||||
_LIEF_EI(POGO_LCTG) = 0x4C544347, /* LCTG */
|
||||
_LIEF_EI(POGO_PGI) = 0x50474900 , /* PGI\0 */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(ImportType) {
|
||||
@@ -309,18 +310,21 @@ enum _LIEF_EN(ImportType) {
|
||||
|
||||
|
||||
enum _LIEF_EN(ImportNameType) {
|
||||
/// Import is by ordinal. This indicates that the value in the Ordinal/Hint
|
||||
/// field of the import header is the import's ordinal. If this constant is
|
||||
/// not specified, then the Ordinal/Hint field should always be interpreted
|
||||
/// as the import's hint.
|
||||
/** Import is by ordinal. This indicates that the value in the Ordinal/Hint
|
||||
* field of the import header is the import's ordinal. If this constant is
|
||||
* not specified, then the Ordinal/Hint field should always be interpreted
|
||||
* as the import's hint.
|
||||
*/
|
||||
_LIEF_EI(IMPORT_ORDINAL) = 0,
|
||||
/// The import name is identical to the public symbol name
|
||||
/** The import name is identical to the public symbol name */
|
||||
_LIEF_EI(IMPORT_NAME) = 1,
|
||||
/// The import name is the public symbol name, but skipping the leading ?,
|
||||
/// @, or optionally _.
|
||||
/** The import name is the public symbol name, but skipping the leading ?,
|
||||
* @, or optionally _.
|
||||
*/
|
||||
_LIEF_EI(IMPORT_NAME_NOPREFIX) = 2,
|
||||
/// The import name is the public symbol name, but skipping the leading ?,
|
||||
/// @, or optionally _, and truncating at the first @.
|
||||
/** The import name is the public symbol name, but skipping the leading ?,
|
||||
* @, or optionally _, and truncating at the first @.
|
||||
*/
|
||||
_LIEF_EI(IMPORT_NAME_UNDECORATE) = 3
|
||||
};
|
||||
|
||||
@@ -333,17 +337,18 @@ enum _LIEF_EN(CodeViewIdentifiers) {
|
||||
_LIEF_EI(DEBUG_STRING_TABLE_SUBSECTION) = 0xF3,
|
||||
_LIEF_EI(DEBUG_INDEX_SUBSECTION) = 0xF4,
|
||||
|
||||
// Symbol subsections are split into records of different types.
|
||||
/* Symbol subsections are split into records of different types. */
|
||||
_LIEF_EI(DEBUG_SYMBOL_TYPE_PROC_START) = 0x1147,
|
||||
_LIEF_EI(DEBUG_SYMBOL_TYPE_PROC_END) = 0x114F
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Resources
|
||||
//
|
||||
/* =========================
|
||||
* Reources
|
||||
* =========================
|
||||
*/
|
||||
|
||||
//! From https://docs.microsoft.com/en-us/windows/win32/menurc/resource-types
|
||||
/** From https://docs.microsoft.com/en-us/windows/win32/menurc/resource-types */
|
||||
enum _LIEF_EN(RESOURCE_TYPES) {
|
||||
_LIEF_EI(CURSOR) = 1,
|
||||
_LIEF_EI(BITMAP) = 2,
|
||||
@@ -748,7 +753,7 @@ enum _LIEF_EN(SECTION_CHARACTERISTICS) {
|
||||
_LIEF_EI(IMAGE_SCN_MEM_WRITE) = 0x80000000
|
||||
};
|
||||
|
||||
//! From https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles
|
||||
/** From https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles */
|
||||
enum _LIEF_EN(EXTENDED_WINDOW_STYLES) {
|
||||
_LIEF_EI(WS_EX_DLGMODALFRAME) = 0x00000001L,
|
||||
_LIEF_EI(WS_EX_NOPARENTNOTIFY) = 0x00000004L,
|
||||
@@ -773,7 +778,7 @@ enum _LIEF_EN(EXTENDED_WINDOW_STYLES) {
|
||||
_LIEF_EI(WS_EX_APPWINDOW) = 0x00040000L,
|
||||
};
|
||||
|
||||
//! From: https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles
|
||||
/** From: https://docs.microsoft.com/en-us/windows/win32/winmsg/window-styles */
|
||||
enum _LIEF_EN(WINDOW_STYLES) {
|
||||
_LIEF_EI(WS_OVERLAPPED) = 0x00000000L,
|
||||
_LIEF_EI(WS_POPUP) = 0x80000000L,
|
||||
@@ -799,7 +804,7 @@ enum _LIEF_EN(WINDOW_STYLES) {
|
||||
};
|
||||
|
||||
|
||||
//! From https://docs.microsoft.com/en-us/windows/win32/dlgbox/dialog-box-styles
|
||||
/** From https://docs.microsoft.com/en-us/windows/win32/dlgbox/dialog-box-styles */
|
||||
enum _LIEF_EN(DIALOG_BOX_STYLES) {
|
||||
_LIEF_EI(DS_ABSALIGN) = 0x0001L,
|
||||
_LIEF_EI(DS_SYSMODAL) = 0x0002L,
|
||||
@@ -815,7 +820,7 @@ enum _LIEF_EN(DIALOG_BOX_STYLES) {
|
||||
_LIEF_EI(DS_CENTER) = 0x0800L,
|
||||
_LIEF_EI(DS_CENTERMOUSE) = 0x1000L,
|
||||
_LIEF_EI(DS_CONTEXTHELP) = 0x2000L,
|
||||
_LIEF_EI(DS_SHELLFONT) = 0x0040L | 0x0008L, // DS_SETFONT | DS_FIXEDSYS
|
||||
_LIEF_EI(DS_SHELLFONT) = 0x0040L | 0x0008L, /* DS_SETFONT | DS_FIXEDSYS */
|
||||
};
|
||||
|
||||
enum _LIEF_EN(FIXED_VERSION_OS) {
|
||||
@@ -828,11 +833,11 @@ enum _LIEF_EN(FIXED_VERSION_OS) {
|
||||
_LIEF_EI(VOS_OS232) = 0x00030000L,
|
||||
_LIEF_EI(VOS__PM16) = 0x00000002L,
|
||||
_LIEF_EI(VOS__PM32) = 0x00000003L,
|
||||
_LIEF_EI(VOS_DOS_WINDOWS16) = 0x00010000L | 0x00000001L, // VOS_DOS | VOS__WINDOWS16
|
||||
_LIEF_EI(VOS_DOS_WINDOWS32) = 0x00010000L | 0x00000004L, // VOS_DOS | VOS__WINDOWS32
|
||||
_LIEF_EI(VOS_NT_WINDOWS32) = 0x00040000L | 0x00000004L, // VOS_NT | VOS__WINDOWS32
|
||||
_LIEF_EI(VOS_OS216_PM16) = 0x00020000L | 0x00000002L, // VOS_OS216 | VOS__PM16
|
||||
_LIEF_EI(VOS_OS232_PM32) = 0x00030000L | 0x00000003L, // VOS_OS232 | VOS__PM32
|
||||
_LIEF_EI(VOS_DOS_WINDOWS16) = 0x00010000L | 0x00000001L, /* VOS_DOS | VOS__WINDOWS16 */
|
||||
_LIEF_EI(VOS_DOS_WINDOWS32) = 0x00010000L | 0x00000004L, /* VOS_DOS | VOS__WINDOWS32 */
|
||||
_LIEF_EI(VOS_NT_WINDOWS32) = 0x00040000L | 0x00000004L, /* VOS_NT | VOS__WINDOWS32 */
|
||||
_LIEF_EI(VOS_OS216_PM16) = 0x00020000L | 0x00000002L, /* VOS_OS216 | VOS__PM16 */
|
||||
_LIEF_EI(VOS_OS232_PM32) = 0x00030000L | 0x00000003L, /* VOS_OS232 | VOS__PM32 */
|
||||
};
|
||||
|
||||
|
||||
@@ -877,7 +882,7 @@ enum _LIEF_EN(FIXED_VERSION_FILE_SUB_TYPES) {
|
||||
_LIEF_EI(VFT2_UNKNOWN) = 0x00000000L,
|
||||
};
|
||||
|
||||
//! Code page from https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers
|
||||
/** Code page from https://docs.microsoft.com/en-us/windows/win32/intl/code-page-identifiers */
|
||||
enum _LIEF_EN(CODE_PAGES) {
|
||||
_LIEF_EI(CP_IBM037) = 37, /**< IBM EBCDIC US-Canada */
|
||||
_LIEF_EI(CP_IBM437) = 437, /**< OEM United States */
|
||||
@@ -1047,7 +1052,7 @@ enum _LIEF_EN(GUARD_CF_FLAGS) {
|
||||
_LIEF_EI(GRF_STRICT) = 0x00080000, /**< Module requests that the OS enable return flow protection in strict mode */
|
||||
};
|
||||
|
||||
//! From https://docs.microsoft.com/en-us/windows/win32/menurc/acceltableentry
|
||||
/** From https://docs.microsoft.com/en-us/windows/win32/menurc/acceltableentry */
|
||||
enum _LIEF_EN(ACCELERATOR_FLAGS) {
|
||||
_LIEF_EI(FVIRTKEY) = 0x01,
|
||||
_LIEF_EI(FNOINVERT) = 0x02,
|
||||
@@ -1057,7 +1062,7 @@ enum _LIEF_EN(ACCELERATOR_FLAGS) {
|
||||
_LIEF_EI(END) = 0x80,
|
||||
};
|
||||
|
||||
//! From https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
|
||||
/** From https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes */
|
||||
enum _LIEF_EN(ACCELERATOR_VK_CODES) {
|
||||
_LIEF_EI(VK_LBUTTON) = 0x01,
|
||||
_LIEF_EI(VK_RBUTTON) = 0x02,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef LIEF_SYMBOL_VISIBILITY_H
|
||||
#define LIEF_SYMBOL_VISIBILITY_H
|
||||
|
||||
// Thanks to https://github.com/aguinet/dragonffi/blob/40f3fecb9530a2ef840f63882c5284ea5e8dc9e8/include/dffi/exports.h
|
||||
/* Thanks to https://github.com/aguinet/dragonffi/blob/40f3fecb9530a2ef840f63882c5284ea5e8dc9e8/include/dffi/exports.h */
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#define LIEF_HELPER_IMPORT __declspec(dllimport)
|
||||
#define LIEF_HELPER_EXPORT __declspec(dllexport)
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
|
||||
set -ex
|
||||
|
||||
export CXXFLAGS='-ffunction-sections -fdata-sections -fvisibility-inlines-hidden -static-libstdc++ -static-libgcc'
|
||||
export CFLAGS='-ffunction-sections -fdata-sections -static-libstdc++ -static-libgcc'
|
||||
export CXXFLAGS='-ffunction-sections -fdata-sections -fvisibility-inlines-hidden -static-libgcc'
|
||||
export CFLAGS='-ffunction-sections -fdata-sections -static-libgcc'
|
||||
export LDFLAGS='-Wl,--gc-sections'
|
||||
export _PYTHON_HOST_PLATFORM="manylinux2014-aarch64"
|
||||
export SETUPTOOLS_EXT_SUFFIX=$($PYTHON_BINARY -c "import sysconfig;print(sysconfig.get_config_var('EXT_SUFFIX').replace('x86_64', 'aarch64'))")
|
||||
|
||||
git config --global --add safe.directory /work
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#!/usr/bin/sh
|
||||
set -ex
|
||||
|
||||
mkdir -p build/osx-aarch64/static-release && mkdir -p build/osx-aarch64/shared-release
|
||||
mkdir -p build/osx-aarch64/static-release && \
|
||||
mkdir -p build/osx-aarch64/shared-release
|
||||
|
||||
pushd build/osx-aarch64/shared-release
|
||||
|
||||
cmake ../../.. -GNinja \
|
||||
-DBUILD_SHARED_LIBS=on \
|
||||
-DLIEF_PYTHON_API=off \
|
||||
cmake ../../.. -GNinja \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||
-DBUILD_SHARED_LIBS=on \
|
||||
-DLIEF_PYTHON_API=off \
|
||||
-DLIEF_INSTALL_COMPILED_EXAMPLES=off \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
@@ -16,9 +19,10 @@ ninja
|
||||
popd
|
||||
pushd build/osx-aarch64/static-release
|
||||
|
||||
cmake ../../.. -GNinja \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DLIEF_PYTHON_API=off \
|
||||
cmake ../../.. -GNinja \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||
-DBUILD_SHARED_LIBS=off \
|
||||
-DLIEF_PYTHON_API=off \
|
||||
-DLIEF_INSTALL_COMPILED_EXAMPLES=on \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
|
||||
@@ -109,6 +109,15 @@ int lief_mbedtls_x509_dn_gets( char *buf, size_t size, const mbedtls_x509_name *
|
||||
break;
|
||||
|
||||
c = name->val.p[i];
|
||||
|
||||
// Special characters requiring escaping, RFC 1779
|
||||
if( c && strchr( ",=+<>#;\"\\", c ) )
|
||||
{
|
||||
if( i + 1 >= MBEDTLS_X509_MAX_DN_NAME_SIZE - 1 )
|
||||
break;
|
||||
out.push_back('\\');
|
||||
}
|
||||
|
||||
if( c < 32 || c >= 127 )
|
||||
continue;
|
||||
//else s[i] = c;
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
#include "LIEF/span.hpp"
|
||||
|
||||
namespace LIEF {
|
||||
class hashstream {
|
||||
public:
|
||||
@@ -48,6 +50,13 @@ class hashstream {
|
||||
|
||||
hashstream& align(size_t size, uint8_t val = 0);
|
||||
|
||||
template<typename T>
|
||||
hashstream& write(span<const T> s) {
|
||||
static_assert(std::is_same<T, uint8_t>::value || std::is_same<T, char>::value, "Require an integer");
|
||||
write(reinterpret_cast<const uint8_t*>(s.data()), s.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<class Integer, typename = typename std::enable_if<std::is_integral<Integer>::value>>
|
||||
hashstream& write(Integer integer) {
|
||||
const auto* int_p = reinterpret_cast<const uint8_t*>(&integer);
|
||||
|
||||
@@ -209,11 +209,11 @@ def test_ms_spc_nested_signature():
|
||||
assert nvidia_cert.subject == "C=US, ST=California, L=Santa Clara, O=NVIDIA Corporation, OU=IT-MIS, CN=NVIDIA Corporation"
|
||||
assert nvidia_cert.serial_number == from_hex("62:E7:45:E9:21:65:21:3C:97:1F:5C:49:0A:EA:12:A5")
|
||||
|
||||
assert self_signed_ca.issuer == "C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2008 VeriSign, Inc. - For authorized use only, CN=VeriSign Universal Root Certification Authority"
|
||||
assert self_signed_ca.subject == "C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2008 VeriSign, Inc. - For authorized use only, CN=VeriSign Universal Root Certification Authority"
|
||||
assert self_signed_ca.issuer == "C=US, O=VeriSign\\, Inc., OU=VeriSign Trust Network, OU=(c) 2008 VeriSign\\, Inc. - For authorized use only, CN=VeriSign Universal Root Certification Authority"
|
||||
assert self_signed_ca.subject == "C=US, O=VeriSign\\, Inc., OU=VeriSign Trust Network, OU=(c) 2008 VeriSign\\, Inc. - For authorized use only, CN=VeriSign Universal Root Certification Authority"
|
||||
assert self_signed_ca.serial_number == from_hex("40:1A:C4:64:21:B3:13:21:03:0E:BB:E4:12:1A:C5:1D")
|
||||
|
||||
assert signer_cert.issuer == "C=US, O=VeriSign, Inc., OU=VeriSign Trust Network, OU=(c) 2008 VeriSign, Inc. - For authorized use only, CN=VeriSign Universal Root Certification Authority"
|
||||
assert signer_cert.issuer == "C=US, O=VeriSign\\, Inc., OU=VeriSign Trust Network, OU=(c) 2008 VeriSign\\, Inc. - For authorized use only, CN=VeriSign Universal Root Certification Authority"
|
||||
assert signer_cert.subject == "C=US, O=Symantec Corporation, OU=Symantec Trust Network, CN=Symantec Class 3 SHA256 Code Signing CA - G2"
|
||||
assert signer_cert.serial_number == from_hex("7C:1B:35:35:4A:E7:DB:74:E7:41:5F:11:69:CA:6B:A8")
|
||||
|
||||
@@ -264,5 +264,9 @@ def test_rsa_info():
|
||||
|
||||
def test_issue_703():
|
||||
sig: lief.PE.Signature = lief.PE.Signature.parse(get_sample("pkcs7/cert_issue_703.der"))
|
||||
assert sig.certificates[0].issuer == "CN=TxExoTiQueMoDz\\Tx ExoTiQueMoDz"
|
||||
assert sig.certificates[0].subject == "CN=TxExoTiQueMoDz\\Tx ExoTiQueMoDz"
|
||||
assert sig.certificates[0].issuer == "CN=TxExoTiQueMoDz\\\\Tx ExoTiQueMoDz"
|
||||
assert sig.certificates[0].subject == "CN=TxExoTiQueMoDz\\\\Tx ExoTiQueMoDz"
|
||||
|
||||
def test_issue_912():
|
||||
steam = lief.PE.parse(get_sample("PE/steam.exe"))
|
||||
assert steam.verify_signature() == lief.PE.Signature.VERIFICATION_FLAGS.OK
|
||||
|
||||
Reference in New Issue
Block a user