-
Notifications
You must be signed in to change notification settings - Fork 1
/
run-oh.sh
executable file
·29 lines (23 loc) · 1.03 KB
/
run-oh.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
INPUT_DEP_PATH=/usr/local/lib/
OH_PATH=/home/sip/protection/introspection-oblivious-hashing
OH_LIB=$OH_PATH/build/lib
bitcode=$1
input=$2
# compiling external libraries to bitcodes
clang++-3.9 $OH_PATH/assertions/asserts.cpp -std=c++0x -c -emit-llvm -o $OH_PATH/assertions/asserts.bc
clang-3.9 $OH_PATH/hashes/hash.c -c -emit-llvm -o $OH_PATH/hashes/hash.bc
# Running hash insertion pass
opt-3.9 -load $INPUT_DEP_PATH/libInputDependency.so -load $OH_LIB/liboblivious-hashing.so $1 -oh-insert -num-hash 1 -o out.bc
# Linking with external libraries
llvm-link-3.9 out.bc $OH_PATH/hashes/hash.bc -o out.bc
llvm-link-3.9 out.bc $OH_PATH/assertions/asserts.bc -o out.bc
# precompute hashes
clang++-3.9 -lncurses -rdynamic -std=c++0x out.bc -o out
./out $input
###rm out
#
# Running assertion insertion pass
opt-3.9 -load $INPUT_DEP_PATH/libInputDependency.so -load $OH_LIB/liboblivious-hashing.so out.bc -insert-asserts -o protected.bc
# Compiling to final protected binary
clang++-3.9 -lncurses -rdynamic -std=c++0x protected.bc -o protected