Compare commits

..

1 Commits

Author SHA1 Message Date
03f4e14b04 updated baseline 2026-02-23 04:38:21 +03:00
11 changed files with 8 additions and 106 deletions

4
.github/FUNDING.yml vendored
View File

@@ -1,4 +0,0 @@
# These are supported funding model platforms
open_collective: libomathorg
github: orange-cpp

View File

@@ -1,7 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>vmprotect</w>
</words>
</dictionary>
</component>

View File

@@ -31,10 +31,6 @@ option(OMATH_SUPRESS_SAFETY_CHECKS
option(OMATH_ENABLE_COVERAGE "Enable coverage" OFF) option(OMATH_ENABLE_COVERAGE "Enable coverage" OFF)
option(OMATH_ENABLE_FORCE_INLINE option(OMATH_ENABLE_FORCE_INLINE
"Will for compiler to make some functions to be force inlined no matter what" ON) "Will for compiler to make some functions to be force inlined no matter what" ON)
option(OMATH_VMPROTECT_INTEGRATION
"omath will use vmprotect sdk to protect sensitive parts of code from reverse engineering"
OFF)
if(VCPKG_MANIFEST_FEATURES) if(VCPKG_MANIFEST_FEATURES)
foreach(omath_feature IN LISTS VCPKG_MANIFEST_FEATURES) foreach(omath_feature IN LISTS VCPKG_MANIFEST_FEATURES)
if(omath_feature STREQUAL "imgui") if(omath_feature STREQUAL "imgui")
@@ -47,8 +43,6 @@ if(VCPKG_MANIFEST_FEATURES)
set(OMATH_BUILD_BENCHMARK ON) set(OMATH_BUILD_BENCHMARK ON)
elseif(omath_feature STREQUAL "examples") elseif(omath_feature STREQUAL "examples")
set(OMATH_BUILD_EXAMPLES ON) set(OMATH_BUILD_EXAMPLES ON)
elseif(omath_feature STREQUAL "vmprotect")
set(OMATH_VMPROTECT_INTEGRATION ON)
endif() endif()
endforeach() endforeach()
@@ -113,11 +107,6 @@ if(OMATH_IMGUI_INTEGRATION)
endif() endif()
if(OMATH_VMPROTECT_INTEGRATION)
find_package(vmprotect_sdk CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC vmprotect_sdk::vmprotect_sdk)
endif()
if(OMATH_USE_AVX2) if(OMATH_USE_AVX2)
target_compile_definitions(${PROJECT_NAME} PUBLIC OMATH_USE_AVX2) target_compile_definitions(${PROJECT_NAME} PUBLIC OMATH_USE_AVX2)
endif() endif()

View File

@@ -145,7 +145,7 @@
"hidden": true, "hidden": true,
"inherits": ["linux-base", "vcpkg-base"], "inherits": ["linux-base", "vcpkg-base"],
"cacheVariables": { "cacheVariables": {
"VCPKG_MANIFEST_FEATURES": "tests;imgui;avx2;vmprotect;examples" "VCPKG_MANIFEST_FEATURES": "tests;imgui;avx2"
} }
}, },
{ {

View File

@@ -1,37 +0,0 @@
## List of maintainers for the omath library
## This file purpose is to give newcomers to the project the responsible
## developers when submitting a pull request on GitHub, or opening a bug
## report in issues.
## This file will notably establish who is responsible for a specific
## area of omath. Being a maintainer means the following:
## - that person has good knownledge in the area
## - that person is able to enforce consistency in the area
## - that person may be available for giving help in the area
## - that person has push access on the repository
## Being a maintainer does not mean the following:
## - that person is dedicated to the area
## - that person is working full-time on the area/on omath
## - that person is paid
## - that person is always available
# omath core source code
/source @orange-cpp
/include @orange-cpp
# Tests and becnchmarks
/benchmark @orange-cpp
/tests @orange-cpp @luadebug
# Examples and documentation
/examples @luadebug @orange-cpp
/docs @orange-cpp
# Misc like formating
/scripts @luadebug
/pixi @luadebug
# CI/CD
/.github/workflows @luadbg @orange-cpp

View File

@@ -2,7 +2,7 @@ add_subdirectory(example_barycentric)
add_subdirectory(example_glfw3) add_subdirectory(example_glfw3)
add_subdirectory(example_proj_mat_builder) add_subdirectory(example_proj_mat_builder)
add_subdirectory(example_signature_scan) add_subdirectory(example_signature_scan)
add_subdirectory(exmple_var_encryption)
if(OMATH_ENABLE_VALGRIND) if(OMATH_ENABLE_VALGRIND)
omath_setup_valgrind(example_projection_matrix_builder) omath_setup_valgrind(example_projection_matrix_builder)
omath_setup_valgrind(example_signature_scan) omath_setup_valgrind(example_signature_scan)

View File

@@ -1,10 +0,0 @@
project(example_var_encryption)
add_executable(${PROJECT_NAME} main.cpp)
set_target_properties(
${PROJECT_NAME}
PROPERTIES CXX_STANDARD 23
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/out/${CMAKE_BUILD_TYPE}")
target_link_libraries(${PROJECT_NAME} PRIVATE omath::omath)

View File

@@ -1,15 +0,0 @@
//
// Created by orange on 24.02.2026.
//
#include "omath/containers/encrypted_variable.hpp"
#include <omath/omath.hpp>
#include <print>
int main()
{
OMATH_DEF_CRYPT_VAR(int, 64) var{5};
var.encrypt();
std::println("{}", var.value());
var.decrypt();
std::println("{}", var.value());
return var.value();
}

View File

@@ -2,14 +2,10 @@
// Created by Vladislav on 04.01.2026. // Created by Vladislav on 04.01.2026.
// //
#pragma once #pragma once
#include <VMProtectSDK.h>
#include <array> #include <array>
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <span> #include <span>
#include <source_location>
#ifdef OMATH_ENABLE_FORCE_INLINE #ifdef OMATH_ENABLE_FORCE_INLINE
#ifdef _MSC_VER #ifdef _MSC_VER
#define OMATH_FORCE_INLINE __forceinline #define OMATH_FORCE_INLINE __forceinline
@@ -114,18 +110,16 @@ namespace omath
bool m_is_encrypted{}; bool m_is_encrypted{};
value_type m_data{}; value_type m_data{};
OMATH_FORCE_INLINE void xor_contained_var_by_key() OMATH_FORCE_INLINE constexpr void xor_contained_var_by_key()
{ {
VMProtectBeginVirtualization(nullptr);
// Safe, keeps const-correctness, and avoids reinterpret_cast issues // Safe, keeps const-correctness, and avoids reinterpret_cast issues
auto bytes = std::as_writable_bytes(std::span<value_type, 1>{&m_data, 1}); auto bytes = std::as_writable_bytes(std::span<value_type, 1>{&m_data, 1});
for (std::size_t i = 0; i < bytes.size(); ++i) for (std::size_t i = 0; i < bytes.size(); ++i)
{ {
const auto k = static_cast<std::uint8_t>(key[i % key_size] + (i * key_size)); const std::uint8_t k = static_cast<std::uint8_t>(key[i % key_size] + (i * key_size));
bytes[i] ^= static_cast<std::byte>(k); bytes[i] ^= static_cast<std::byte>(k);
} }
VMProtectEnd();
} }
public: public:
@@ -140,7 +134,7 @@ namespace omath
return m_is_encrypted; return m_is_encrypted;
} }
OMATH_FORCE_INLINE void decrypt() OMATH_FORCE_INLINE constexpr void decrypt()
{ {
if (!m_is_encrypted) if (!m_is_encrypted)
return; return;
@@ -148,7 +142,7 @@ namespace omath
m_is_encrypted = false; m_is_encrypted = false;
} }
OMATH_FORCE_INLINE void encrypt() OMATH_FORCE_INLINE constexpr void encrypt()
{ {
if (m_is_encrypted) if (m_is_encrypted)
return; return;

View File

@@ -8,7 +8,6 @@
#include <utility> #include <utility>
#include <variant> #include <variant>
#include <vector> #include <vector>
#include <VMProtectSDK.h>
#pragma pack(push, 1) #pragma pack(push, 1)

View File

@@ -17,16 +17,9 @@
], ],
"features": { "features": {
"avx2": { "avx2": {
"description": "omath will use AVX2 to boost performance", "description": "Omath will use AVX2 to boost performance",
"supports": "!arm" "supports": "!arm"
}, },
"vmprotect": {
"description": "omath will use vmprotect sdk to protect sensitive parts of code from reverse engineering",
"supports": "windows | linux | osx | android",
"dependencies": [
"orange-vmprotect-sdk"
]
},
"benchmark": { "benchmark": {
"description": "Build benchmarks", "description": "Build benchmarks",
"dependencies": [ "dependencies": [
@@ -42,7 +35,7 @@
] ]
}, },
"imgui": { "imgui": {
"description": "omath will define method to convert omath types to imgui types", "description": "Omath will define method to convert omath types to imgui types",
"dependencies": [ "dependencies": [
"imgui" "imgui"
] ]