-
Notifications
You must be signed in to change notification settings - Fork 957
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement telfhash for ELF import table (#936)
* Implement telfhash for import table and add TLSH to the project * comment the import symbol filter regexes * Use std::set for faster lookup * Address code review comments * better formatting * Move TLSH to deps/ using cmake * Forgot to commit tlsh headers * Restructure elf_format to get symbols in the same manner as telfhash * Ignore symbols from dynamic segments * First exclude then convert to lower_case * mask out symbol visibility from others * Move telfhash outside import table to elf_format, use TLSH for all imphashes, create default imphash for ELF * Fix uninitialized value * Fixed TLSH build on Windows * fileformat/CMakeLists.txt: do not add tlsh-related stuff * deps/tlsh: refactor CMake * cmake/options.cmake: move TLSH to deps section * deps/tlsh/cmake: add new line at the end * fileformat/elf_format: C comment -> C++ comment * fileformat/elf_import_table.h: add missing new line * fileformat: remove trailing spaces Co-authored-by: Peter Matula <peter.matula@avast.com> Co-authored-by: Peter Matula <p3t3r.matula@gmail.com>
- Loading branch information
1 parent
dca4d73
commit 0cdc9a1
Showing
33 changed files
with
7,290 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
add_library(tlsh STATIC | ||
tlsh.cpp | ||
tlsh_impl.cpp | ||
tlsh_util.cpp | ||
) | ||
add_library(retdec::deps::tlsh ALIAS tlsh) | ||
|
||
target_include_directories(tlsh | ||
SYSTEM INTERFACE | ||
$<BUILD_INTERFACE:${RETDEC_DEPS_DIR}/tlsh/include> | ||
$<INSTALL_INTERFACE:${RETDEC_INSTALL_DEPS_INCLUDE_DIR}> | ||
PRIVATE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/tlsh> | ||
) | ||
|
||
set_target_properties(tlsh | ||
PROPERTIES | ||
OUTPUT_NAME "retdec-tlsh" | ||
) | ||
|
||
if(MSVC) | ||
target_compile_definitions(tlsh PUBLIC WINDOWS TLSH_EXPORTS TLSH_LIB) | ||
endif() | ||
|
||
# Install includes. | ||
install( | ||
DIRECTORY ${RETDEC_DEPS_DIR}/tlsh/include/ | ||
DESTINATION ${RETDEC_INSTALL_DEPS_INCLUDE_DIR} | ||
) | ||
|
||
# Install libs. | ||
install(TARGETS tlsh | ||
EXPORT tlsh-targets | ||
ARCHIVE DESTINATION ${RETDEC_INSTALL_LIB_DIR} | ||
LIBRARY DESTINATION ${RETDEC_INSTALL_LIB_DIR} | ||
) | ||
|
||
# Export targets. | ||
install(EXPORT tlsh-targets | ||
FILE "retdec-tlsh-targets.cmake" | ||
NAMESPACE retdec::deps:: | ||
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR} | ||
) | ||
|
||
# Install CMake files. | ||
install( | ||
FILES | ||
"${CMAKE_CURRENT_LIST_DIR}/retdec-tlsh-config.cmake" | ||
DESTINATION | ||
"${RETDEC_INSTALL_CMAKE_DIR}" | ||
) |
Oops, something went wrong.