Skip to content

Commit 9626649

Browse files
committed
UPBGE: First commit for new UPBGE blend encryption tool
0 parents  commit 9626649

File tree

11 files changed

+1654
-0
lines changed

11 files changed

+1654
-0
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build UPBGE BinaryCrypt
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, windows-latest]
11+
runs-on: ${{ matrix.os }}
12+
env:
13+
UPBGE_BINARYCRYPT_PASSWORD: ${{ runner.temp }}/pw
14+
UPBGE_BINARYCRYPT_SALT: ${{ runner.temp }}/salt
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Install Dependencies (Linux)
20+
if: matrix.os == 'ubuntu-latest'
21+
run: sudo apt update && sudo apt install -y cmake build-essential pkg-config libraylib-dev libgl1-mesa-dev openssl
22+
23+
- name: Install Dependencies (Windows)
24+
if: matrix.os == 'windows-latest'
25+
run: choco install cmake openssl -y
26+
27+
- name: Generate Random Password and Salt
28+
shell: bash
29+
run: |
30+
echo "UPBGE_BINARYCRYPT_PASSWORD=$(openssl rand -hex 32)" >> $GITHUB_ENV
31+
echo "UPBGE_BINARYCRYPT_SALT=$(openssl rand -hex 16)" >> $GITHUB_ENV
32+
33+
- name: Configure
34+
run: cmake -B build
35+
36+
- name: Build
37+
run: cmake --build build

.gitignore

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# generic files to ignore
2+
.*
3+
4+
# python temp paths
5+
__pycache__/
6+
*.py[cod]
7+
8+
# editors
9+
*~
10+
*.swp
11+
*.swo
12+
*#
13+
14+
# Indexes for emacs, vi & others
15+
TAGS
16+
tags
17+
18+
# QtCreator
19+
CMakeLists.txt.user
20+
*.cflags
21+
*.config
22+
*.cxxflags
23+
*.files
24+
*.includes
25+
*.user
26+
*.creator
27+
*.creator.user
28+
29+
# ms-windows
30+
Thumbs.db
31+
ehthumbs.db
32+
Desktop.ini
33+
.DS_Store
34+
35+
# commonly used paths in blender
36+
/blender.bin
37+
/BUILD_NOTES.txt
38+
39+
# local patches
40+
/*.patch
41+
/*.diff
42+
43+
# testing environment
44+
/Testing/
45+
46+
# Build files for VS and VS Code.
47+
/build/
48+
/out/
49+
CMakeSettings.json
50+
CMakePresets.json
51+
CMakeUserPresets.json
52+
53+
# Compile commands generated by CMake that may be linked into the source code
54+
# folder to make it easier for tools like clangd to discover.
55+
compile_commands.json
56+
57+
# Temporary Blender files.
58+
blendcache_*
59+
*.blend1
60+
*.blend2
61+
62+
# Blend encryted files
63+
*.blend
64+
*.block
65+
*.blockdyn

CMakeLists.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
project(UPBGE_BinaryCrypt C)
3+
4+
# -- Generate random password if not defined --
5+
if(NOT DEFINED ENV{UPBGE_BINARYCRYPT_PASSWORD})
6+
execute_process(COMMAND openssl rand -hex 32
7+
OUTPUT_VARIABLE GENERATED_PW
8+
OUTPUT_STRIP_TRAILING_WHITESPACE)
9+
set(ENV{UPBGE_BINARYCRYPT_PASSWORD} ${GENERATED_PW})
10+
endif()
11+
12+
# -- Generate random salt if not defined --
13+
if(NOT DEFINED ENV{UPBGE_BINARYCRYPT_SALT})
14+
execute_process(COMMAND openssl rand -hex 16
15+
OUTPUT_VARIABLE GENERATED_SALT
16+
OUTPUT_STRIP_TRAILING_WHITESPACE)
17+
set(ENV{UPBGE_BINARYCRYPT_SALT} ${GENERATED_SALT})
18+
endif()
19+
20+
# -- Compilation definitions --
21+
set(PASSWORD $ENV{UPBGE_BINARYCRYPT_PASSWORD})
22+
set(SALT_HEX $ENV{UPBGE_BINARYCRYPT_SALT})
23+
24+
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1, " SALT_BYTES "${SALT_HEX}")
25+
26+
add_compile_definitions(ENCRYPTION_PASSWORD="${PASSWORD}")
27+
add_compile_definitions(ENCRYPTION_SALT=${SALT_BYTES})
28+
29+
include_directories(aes)
30+
31+
# --- upbge_binarycrypt_tool ---
32+
add_executable(upbge_binarycrypt_tool
33+
upbge_binarycrypt_tool/main.c
34+
)
35+
find_package(raylib REQUIRED)
36+
target_link_libraries(upbge_binarycrypt_tool PRIVATE raylib PUBLIC tiny_aes)
37+
38+
# --- upbge_binarycrypt_launcher ---
39+
add_executable(upbge_binarycrypt_launcher
40+
upbge_binarycrypt_launcher/main.c
41+
)
42+
target_link_libraries(upbge_binarycrypt_launcher PUBLIC tiny_aes)

0 commit comments

Comments
 (0)