build: Only copy yara crypto wrapper if it changed
This commit is contained in:
parent
a5274daeaa
commit
71b06f4b20
6
external/yara/CMakeLists.txt
vendored
6
external/yara/CMakeLists.txt
vendored
@ -94,8 +94,10 @@ set(LIBYARA_MODULES
|
|||||||
${LIBYARA_SOURCE_PATH}/modules/magic/magic.c)
|
${LIBYARA_SOURCE_PATH}/modules/magic/magic.c)
|
||||||
|
|
||||||
# Add mbedtls crypto wrappers
|
# Add mbedtls crypto wrappers
|
||||||
file(READ crypto_mbedtls.h MBEDTLS_CRYPTO_H)
|
add_custom_command(
|
||||||
file(WRITE ${LIBYARA_SOURCE_PATH}/crypto.h "${MBEDTLS_CRYPTO_H}")
|
OUTPUT ${LIBYARA_SOURCE_PATH}/crypto.h
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/crypto_mbedtls.h ${LIBYARA_SOURCE_PATH}/crypto.h
|
||||||
|
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/crypto_mbedtls.h)
|
||||||
add_compile_definitions("HAVE_MBEDTLS")
|
add_compile_definitions("HAVE_MBEDTLS")
|
||||||
|
|
||||||
add_compile_definitions("USE_NO_PROC")
|
add_compile_definitions("USE_NO_PROC")
|
||||||
|
0
tests/CMakeLists.txt
Normal file
0
tests/CMakeLists.txt
Normal file
8
tests/include/test_patterns/test_pattern.hpp
Normal file
8
tests/include/test_patterns/test_pattern.hpp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by werwo on 11/09/2021.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef IMHEX_TEST_PATTERN_HPP
|
||||||
|
#define IMHEX_TEST_PATTERN_HPP
|
||||||
|
|
||||||
|
#endif //IMHEX_TEST_PATTERN_HPP
|
30
tests/include/test_patterns/test_pattern_example.hpp
Normal file
30
tests/include/test_patterns/test_pattern_example.hpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <hex/pattern_language/pattern_data.hpp>
|
||||||
|
|
||||||
|
namespace hex::test {
|
||||||
|
|
||||||
|
class TestPattern {
|
||||||
|
public:
|
||||||
|
TestPattern() = default;
|
||||||
|
virtual TestPattern() {
|
||||||
|
for (auto &pattern : this->m_patterns)
|
||||||
|
delete pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::string getSourceCode() = 0;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
virtual const std::vector<pl::PatternData*>& getPatterns() const final { return this->m_patterns; }
|
||||||
|
virtual void addPattern(pl::PatternData *pattern) final {
|
||||||
|
this->m_patterns.push_back(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<pl::PatternData*> m_patterns;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
26
tests/include/test_patterns/test_pattern_placement.hpp
Normal file
26
tests/include/test_patterns/test_pattern_placement.hpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "test_pattern.hpp"
|
||||||
|
|
||||||
|
namespace hex::test {
|
||||||
|
|
||||||
|
class TestPatternExample : public TestPattern {
|
||||||
|
public:
|
||||||
|
TestPatternExample() {
|
||||||
|
auto placementTest = new pl::PatternDataSigned(0x00, sizeof(u32));
|
||||||
|
placementTest->setTypeName("u32");
|
||||||
|
placementTest->setVariableName("placementTest");
|
||||||
|
addPattern(placementTest);
|
||||||
|
}
|
||||||
|
~TestPatternExample() override = default;
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
std::string getSourceCode() const override {
|
||||||
|
return R"(
|
||||||
|
u32 placementTest @ 0x00;
|
||||||
|
)";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
8
tests/include/test_provider.hpp
Normal file
8
tests/include/test_provider.hpp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
//
|
||||||
|
// Created by werwo on 11/09/2021.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef IMHEX_TEST_PROVIDER_HPP
|
||||||
|
#define IMHEX_TEST_PROVIDER_HPP
|
||||||
|
|
||||||
|
#endif //IMHEX_TEST_PROVIDER_HPP
|
1
tests/source/main.cpp
Normal file
1
tests/source/main.cpp
Normal file
@ -0,0 +1 @@
|
|||||||
|
#include <catch.hpp>
|
Loading…
Reference in New Issue
Block a user