Skip to content

Commit

Permalink
Test Win Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredTate committed Mar 28, 2024
1 parent 6b57a95 commit de8efcd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions contrib/devtools/security-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

import lief

# temporary constant, to be replaced with lief.ELF.ARCH.RISCV
# https://github.com/lief-project/LIEF/pull/562
LIEF_ELF_ARCH_RISCV = lief.ELF.ARCH(243)

def check_ELF_RELRO(binary) -> bool:
'''
Check for read-only relocations.
Expand Down Expand Up @@ -232,7 +236,7 @@ def check_MACHO_branch_protection(binary) -> bool:
lief.ARCHITECTURES.ARM: BASE_ELF,
lief.ARCHITECTURES.ARM64: BASE_ELF,
lief.ARCHITECTURES.PPC: BASE_ELF,
lief.ARCHITECTURES.RISCV: BASE_ELF,
LIEF_ELF_ARCH_RISCV: BASE_ELF,
},
lief.EXE_FORMATS.PE: {
lief.ARCHITECTURES.X86: BASE_PE,
Expand Down Expand Up @@ -260,9 +264,12 @@ def check_MACHO_branch_protection(binary) -> bool:
continue

if arch == lief.ARCHITECTURES.NONE:
print(f'{filename}: unknown architecture')
retval = 1
continue
if binary.header.machine_type == LIEF_ELF_ARCH_RISCV:
arch = LIEF_ELF_ARCH_RISCV
else:
print(f'{filename}: unknown architecture')
retval = 1
continue

failed: list[str] = []
for (name, func) in CHECKS[etype][arch]:
Expand Down

0 comments on commit de8efcd

Please sign in to comment.