Skip to content

Commit 2ed17f9

Browse files
committed
add winsecruntime + nigelcrypt to secured example
1 parent dc35a94 commit 2ed17f9

36 files changed

Lines changed: 10150 additions & 66 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#pragma once
2+
3+
#include "core/secure_runtime.h"
4+
5+
#ifndef WINSECRUNTIME_HEADER_ONLY
6+
#define WINSECRUNTIME_HEADER_ONLY 1
7+
#endif
8+
9+
#if defined(_WIN32) && !WINSECRUNTIME_HEADER_ONLY
10+
# ifdef WINSECRUNTIME_BUILD_SHARED
11+
# ifdef WINSECRUNTIME_EXPORTS
12+
# define WINSECRUNTIME_API __declspec(dllexport)
13+
# else
14+
# define WINSECRUNTIME_API
15+
# endif
16+
# else
17+
# define WINSECRUNTIME_API
18+
# endif
19+
#else
20+
# define WINSECRUNTIME_API
21+
#endif
22+
23+
namespace WinSecRuntime {
24+
25+
enum class Mode : uint32_t {
26+
Minimal = 0,
27+
Moderate,
28+
Aggressive,
29+
Paranoid
30+
};
31+
32+
struct Policy {
33+
Mode mode = Mode::Moderate;
34+
secure::runtime::Config cfg{};
35+
};
36+
37+
#if WINSECRUNTIME_HEADER_ONLY
38+
inline bool Initialize(Mode mode, const secure::runtime::Config& cfg = {}) {
39+
(void)mode;
40+
(void)cfg;
41+
return true;
42+
}
43+
44+
inline void StartIntegrityEngine(const Policy& p = {}) {
45+
#if SECURE_ENABLE_HEARTBEAT
46+
static secure::runtime::Heartbeat hb(5000, nullptr, p.cfg);
47+
(void)hb;
48+
#endif
49+
}
50+
51+
inline secure::Report RunAll(const Policy& p = {}) {
52+
return secure::runtime::run_all_checks(p.cfg);
53+
}
54+
55+
inline void EnableAntiDebug(const Policy& p = {}) {
56+
(void)RunAll(p);
57+
}
58+
59+
inline void EnableHookGuard(const Policy& p = {}) {
60+
(void)RunAll(p);
61+
}
62+
#else
63+
WINSECRUNTIME_API bool Initialize(Mode mode, const secure::runtime::Config& cfg = {});
64+
WINSECRUNTIME_API void StartIntegrityEngine(const Policy& p = {});
65+
WINSECRUNTIME_API secure::Report RunAll(const Policy& p = {});
66+
WINSECRUNTIME_API void EnableAntiDebug(const Policy& p = {});
67+
WINSECRUNTIME_API void EnableHookGuard(const Policy& p = {});
68+
#endif
69+
70+
} // namespace WinSecRuntime
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#include "../core/secure_runtime.h"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#include "../core/secure_runtime.h"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#include "../core/secure_runtime.h"

x64/lib/WinSecRuntime/core/core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
#include "secure_runtime.h"

0 commit comments

Comments
 (0)