- core/core.cc: VM 代码节名恢复为随机 ".<3字符>"(上游行为),不再是固定 .dog
- 旧名兼容:core/files.cc 新增 IsLegacySDKLibraryName() / NormalizeSDKFunctionName(),
pefile/intel/elffile/macfile 的库名匹配同时认 vmprotectsdk{32,64}.dll、vmprotectddk*.sys、
libvmprotectsdk*.so、libvmprotectsdk.dylib;dotnetfile 认旧托管程序集 VMProtect.SDK
与 VMProtect.* 命名空间
- 图标:core/main.ico、core/vmp.ico、core/help.ico、DogProtect/images/{logo,help_icon}.png、
app/dogprotect_gui.app/Contents/Resources/logo.icns 全部换成狗头(多尺寸原生渲染 + 预乘 alpha 缩放)
- lin_common.mak: Linux 目标追加 -DULTIMATE(授权子系统只在 ULTIMATE 分支编译)
- tools/dogkeygen: 序列号生成器(自带 bignum/SHA-1/base64,PKCS#1 v1.5 签名)+ testhost.c +
vmpsdk64.def + README
- BUILD-LINUX.md: 删掉改名说明,补授权与构建要点
4.4 KiB
4.4 KiB
在 Linux 上编译 DogProtect(Console / Core / SDK / Runtime)
本文件记录在 Debian 13 + clang 19 上把本仓库的 Linux 目标(-target x86_64-linux-gnu)编译通过所需的最小改动。
所有改动已在 linux-build 分支上,直接按下面顺序构建即可,不再需要手工补参数。
依赖
apt-get install -y clang make libssl-dev zlib1g-dev
third-party/libffi/libffi64.a 是仓库自带预编译库,直接用。
构建顺序(必须按这个顺序,后者依赖前者的产物)
cd core/invariant && make -f lin_invariant_core64.mak CFG_DIR=release # → bin/64/invariant_core.a
cd ../../core && make -f lin_core64.mak CFG_DIR=release # → bin/64/release/core.a(约 70MB)
cd ../sdk && make -f lin_sdk64.mak CFG_DIR=release # → bin/libDogProtectSDK64.so
cd ../DogProtectCon && make -f lin_console64.mak CFG_DIR=release # → bin/64/release/dogprotect_con
运行:
LD_LIBRARY_PATH=$PWD/bin ./bin/64/release/dogprotect_con
# DogProtect Professional v 3.5.1 (build 1024)
# Usage: dogprotect_con File [Output File] [-pf Project File] [-sf Script File] [-wm Watermark] [-we]
加壳(一份 CLI 同时吃 PE / ELF / Mach-O,取决于是哪种文件):
/dogprotect_con input.bin output.bin [-pf project.dog] [-sf script.lua]
为 Linux 编译修掉的 10 个问题
| # | 文件 | 问题 | 处理 |
|---|---|---|---|
| 1 | core/precompiled.h |
无条件 #include <sys/sysctl.h>(macOS 头) |
用 #ifdef __APPLE__ 包住 |
| 2 | lin_common.mak |
-Werror 撞 clang19 的 deprecated 警告(auto_ptr/RSA_*) |
去掉 -Werror |
| 3 | runtime/crypto.h |
自定义 __rdtsc() 与 clang 内建同名不同返回类型 |
改名 vmp_rdtsc + #define __rdtsc() vmp_rdtsc() |
| 4 | core/core.cc |
OutputDebugStringA 是 Win32 API |
#ifdef _WIN32 条件编译 |
| 5 | core/core.cc |
OpenSSL 3 里 rsa_st 是残缺类型,r->n/e/d 编译失败 |
改 RSA_get0_key(r, &n, &e, &d) |
| 6 | runtime/precompiled.h、core/intel.cc、core/processors.cc |
#include <intrin.h>(MSVC 头) |
Linux 走 #include <x86intrin.h> |
| 7 | core/objects.cc |
用了 va_start/va_end 但缺 <cstdarg> |
补 include(PCH 里也补一份) |
| 8 | core/pefile.cc |
MSVC union 写法 data.u.UnwindData / tls.u.Characteristics |
改成 data.UnwindInfoAddress / tls.Characteristics |
| 9 | 各 *.mak |
默认目标指向 clean,make -f xxx.mak 会清空产物 |
lin_common.mak 加 .DEFAULT_GOAL := all |
| 10 | DogProtectCon/lin_console.mak |
链接静态 libcrypto.a 牵出 zlib/zstd;预编译 libffi 是非 PIE;strlcpy 与 glibc 2.38+ 重名 |
改 -lcrypto -lz、加 -no-pie、加 -Wl,--allow-multiple-definition |
已验证的能力边界(源码写死,非配置)
- ELF:
core/elffile.cc只接受EM_386 / EM_486 / EM_X86_64,其它 CPU 返回osUnsupportedCPU - Mach-O:x86 / x86_64
- PE:x86 / x64,含 .NET(
core/dotnetfile.cc) - 不支持:ARM / AArch64、Android APK/DEX、iOS arm64
授权(licensing)相关
- Linux 目标统一按 Ultimate 版编译(
lin_common.mak里追加CFLAGS/CXXFLAGS += -DULTIMATE)。 授权子系统(LicensingManager、密钥对、-lf授权参数文件)只在 ULTIMATE 分支里编译; 不定义它会编译出 Professional,打包时直接报The licensing system not supported in this version。 - 工具自身注册状态:把
core/DogProtectLicense.ini复制到bin/64/release/(与dogprotect_con同目录), 横幅会变成Registered to: ...,此时才给满 10 个 VM executor 并开字节码加密。 未注册时产物只有 1 个 executor、体积差 6 倍(894KB vs 5.3MB)。 - 产物侧的序列号由
tools/dogkeygen/dogkeygen生成:用工程里<LicenseManager>的 RSA 私钥做 PKCS#1 v1.5 签名,产物端用同一工程的公钥校验。用法见tools/dogkeygen/README.md。 - 已知差异:打包产物里注入的 runtime 是仓库自带的预编译 blob(
core/*_runtime*.inc), 对自签序列号返回state=2(INVALID)。要让产物端也接受自签序列号,需要先用runtime/源码重建该 blob; 编译器侧(导入/校验序列号)走的是core.a里的同一个LicensingManager,自签序列号已验证可用。