1
0
mirror of synced 2024-12-01 02:37:18 +01:00

build: Only copy yara crypto wrapper if it changed

This commit is contained in:
WerWolv 2021-09-11 14:40:53 +02:00
parent a5274daeaa
commit 71b06f4b20
7 changed files with 77 additions and 2 deletions

View File

@ -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
View File

View 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

View 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;
};
}

View 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;
)";
}
};
}

View 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
View File

@ -0,0 +1 @@
#include <catch.hpp>