Skip to content

Commit

Permalink
elf_contains_segment -> elf_contains_vaddr
Browse files Browse the repository at this point in the history
add EVP_sha256 imported function
  • Loading branch information
smx-smx committed Apr 4, 2024
1 parent 930a9ad commit 42f3f0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions xzre.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ typedef struct __attribute__((packed)) {
int (*RSA_public_decrypt)(
int flen, unsigned char *from,
unsigned char *to, RSA *rsa, int padding);
PADDING(0x58);
PADDING(0x50);
EVP_MD *(*EVP_sha256)(void);
void (*RSA_get0_key)(
const RSA *r,
const BIGNUM **n,
Expand Down Expand Up @@ -324,6 +325,7 @@ typedef struct __attribute__((packed)) {
} imported_funcs_t;

assert_offset(imported_funcs_t, RSA_public_decrypt, 0);
assert_offset(imported_funcs_t, EVP_sha256, 0x58);
assert_offset(imported_funcs_t, RSA_get0_key, 0x60);
assert_offset(imported_funcs_t, BN_num_bits, 0x68);
assert_offset(imported_funcs_t, EVP_PKEY_new_raw_public_key, 0x70);
Expand Down Expand Up @@ -495,15 +497,16 @@ extern BOOL find_function_prologue_ex(
FuncFindType find_mode);

/**
* @brief checks if given ELF file contains an elf segment with the given parameters
* @brief checks if given ELF file contains the range [vaddr, vaddr+size)
* in a segment with the specified memory protection flags
*
* @param elf_info elf context
* @param vaddr the starting virtual address of the segment
* @param size the size of the segment
* @param p_flags the segment protection flags (PF_*)
* @param vaddr starting memory address
* @param size memory size
* @param p_flags the expected segment protection flags (PF_*)
* @return BOOL TRUE if found, FALSE otherwise
*/
extern BOOL elf_contains_segment(elf_info_t *elf_info, u64 vaddr, u64 size, u32 p_flags);
extern BOOL elf_contains_vaddr(elf_info_t *elf_info, u64 vaddr, u64 size, u32 p_flags);

/**
* @brief Parses the given in-memory ELF file into elf_info
Expand Down
2 changes: 1 addition & 1 deletion xzre.lds
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SECTIONS {
"check_call_site" = ".";
*(.text.lzma_index_iter_rewina);

"elf_contains_segment" = ".";
"elf_contains_vaddr" = ".";
*(.text.parse_bcz);

"elf_parse" = ".";
Expand Down

0 comments on commit 42f3f0b

Please sign in to comment.