|
|
@@ -66,29 +66,15 @@ else
|
|
|
SGX_COMMON_CFLAGS += -O2
|
|
|
endif
|
|
|
|
|
|
-######## Library Settings ########
|
|
|
-
|
|
|
-#PHPTrust_Lib_Name := libPHPLocalAttestation_Trusted.a
|
|
|
-#PHPTrustLib_Cpp_Files := $(wildcard PHPLocalAttestationCode/*.cpp)
|
|
|
-#PHPTrustLib_Cpp_Objects := $(PHPTrustLib_Cpp_Files:.cpp=.o)
|
|
|
-#PHPTrustLib_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx -I$(SGX_SDK)/include/epid -I./TrustedInclude
|
|
|
-#PHPTrustLib_Compile_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(TrustLib_Include_Paths)
|
|
|
-#PHPTrustLib_Compile_Cxx_Flags := -std=c++11 -nostdinc++
|
|
|
+######## Library Settings ######## (cannot move down as both the app and the enclave need the library path for sgxussl/sgxtssl_crypto libraries
|
|
|
+
|
|
|
OPENSSL_LIBRARY_PATH := /home/m2mazmud/old_stuff/intel-sgx-ssl/Linux/package/lib64/
|
|
|
OPENSSL_BAREBONES_LIBRARY_PATH := /home/m2mazmud/old_stuff/intel-sgx-ssl/openssl_source/openssl-1.1.0h/
|
|
|
OpenSSL_Crypto_Library_Name := sgx_tsgxssl_crypto
|
|
|
SGXSSL_Library_Name := sgx_tsgxssl
|
|
|
SgxSSL_Link_Libraries := -L$(OPENSSL_LIBRARY_PATH) -Wl,--whole-archive -l$(SGXSSL_Library_Name) -Wl,--no-whole-archive -l$(OpenSSL_Crypto_Library_Name)
|
|
|
-#Security_Link_Flags := -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -pie
|
|
|
OPENSSL_INCLUDES := /home/m2mazmud/old_stuff/intel-sgx-ssl/Linux/package/include
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-Trust_Lib_Name := libLocalAttestation_Trusted.a
|
|
|
-TrustLib_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx -I$(SGX_SDK)/include/epid -I./TrustedInclude ./Include
|
|
|
-TrustLib_Compile_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(TrustLib_Include_Paths) -Wall
|
|
|
-TrustLib_Compile_Cxx_Flags := -std=c++11 -nostdinc++
|
|
|
-
|
|
|
######## App Settings ########
|
|
|
|
|
|
ifneq ($(SGX_MODE), HW)
|
|
|
@@ -98,7 +84,7 @@ else
|
|
|
endif
|
|
|
|
|
|
App_Cpp_Files := $(wildcard App/*.cpp)
|
|
|
-App_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/ippcp -I./UntrustedInclude
|
|
|
+App_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/ippcp -I./App/UntrustedInclude
|
|
|
App_Compile_Flags := $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths) -Wall -std=c++11
|
|
|
# Three configuration modes - Debug, prerelease, release
|
|
|
# Debug - Macro DEBUG enabled.
|
|
|
@@ -137,7 +123,7 @@ endif
|
|
|
Crypto_Library_Name := sgx_tcrypto
|
|
|
|
|
|
Enclave_Cpp_Files_2 := $(wildcard Decryptor/*.cpp)
|
|
|
-Enclave_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx -I./LocalAttestationCode -I./Include
|
|
|
+Enclave_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx -I$(SGX_SDK)/include/epid -I./TrustedInclude
|
|
|
|
|
|
CC_BELOW_4_9 := $(shell expr "`$(CC) -dumpversion`" \< "4.9")
|
|
|
ifeq ($(CC_BELOW_4_9), 1)
|
|
|
@@ -166,6 +152,10 @@ Decryptor_Link_Flags := $(Common_Enclave_Link_Flags) -Wl,--version-script=$(Decr
|
|
|
Enclave_Cpp_Objects_2 := $(Enclave_Cpp_Files_2:.cpp=.o)
|
|
|
Enclave_Name_2 := libDecryptor.so
|
|
|
|
|
|
+#TrustLib_Include_Paths := -I$(SGX_SDK)/include -I$(SGX_SDK)/include/tlibc -I$(SGX_SDK)/include/libcxx -I$(SGX_SDK)/include/epid -I./TrustedInclude
|
|
|
+TrustLib_Compile_Flags := $(SGX_COMMON_CFLAGS) -nostdinc -fvisibility=hidden -fpie -fstack-protector $(Enclave_Include_Paths) -Wall
|
|
|
+TrustLib_Compile_Cxx_Flags := -std=c++11 -nostdinc++
|
|
|
+
|
|
|
|
|
|
ifeq ($(SGX_MODE), HW)
|
|
|
ifeq ($(SGX_DEBUG), 1)
|
|
|
@@ -186,17 +176,16 @@ endif
|
|
|
endif
|
|
|
|
|
|
ifeq ($(Build_Mode), HW_RELEASE)
|
|
|
-all: .config_$(Build_Mode)_$(SGX_ARCH) $(Trust_Lib_Name) $(UnTrustLib_Name) Decryptor.so $(App_Name)
|
|
|
+all: .config_$(Build_Mode)_$(SGX_ARCH) $(UnTrustLib_Name) Decryptor.so $(App_Name)
|
|
|
@echo "The project has been built in release hardware mode."
|
|
|
@echo "Please sign the enclaves (PHP.so, Decryptor.so, Enclave3.so) first with your signing keys before you run the $(App_Name) to launch and access the enclave."
|
|
|
@echo "To sign the enclaves use the following commands:"
|
|
|
- @echo " $(SGX_ENCLAVE_SIGNER) sign -key <key1> -enclave PHP.so -out <$(Enclave_Name_1)> -config PHP/PHP.config.xml"
|
|
|
@echo " $(SGX_ENCLAVE_SIGNER) sign -key <key2> -enclave Decryptor.so -out <$(Enclave_Name_2)> -config Decryptor/Decryptor.config.xml"
|
|
|
-# @echo " $(SGX_ENCLAVE_SIGNER) sign -key <key3> -enclave Enclave3.so -out <$(Enclave_Name_3)> -config Enclave3/Enclave3.config.xml"
|
|
|
@echo "You can also sign the enclaves using an external signing tool."
|
|
|
@echo "To build the project in simulation mode set SGX_MODE=SIM. To build the project in prerelease mode set SGX_PRERELEASE=1 and SGX_MODE=HW."
|
|
|
else
|
|
|
-all: .config_$(Build_Mode)_$(SGX_ARCH) $(Trust_Lib_Name) $(UnTrustLib_Name) $(Enclave_Name_2) $(App_Name)
|
|
|
+
|
|
|
+all: .config_$(Build_Mode)_$(SGX_ARCH) $(UnTrustLib_Name) $(Enclave_Name_2) $(App_Name)
|
|
|
ifeq ($(Build_Mode), HW_DEBUG)
|
|
|
@echo "The project has been built in debug hardware mode."
|
|
|
else ifeq ($(Build_Mode), SIM_DEBUG)
|
|
|
@@ -214,32 +203,6 @@ endif
|
|
|
@rm -rf .config_* $(App_Name) *.so *.a App/*.o Decryptor/*.o Decryptor/*_t.* Decryptor/*_u.* LocalAttestationCode/*.o LocalAttestationCode/*_t.* #Enclave3/*.o Enclave3/*_t.* Enclave3/*_u.*
|
|
|
@touch .config_$(Build_Mode)_$(SGX_ARCH)
|
|
|
|
|
|
-######## Library Objects ########
|
|
|
-
|
|
|
-LocalAttestationCode/LocalAttestationCode_t.c LocalAttestationCode/LocalAttestationCode_t.h : $(SGX_EDGER8R) LocalAttestationCode/LocalAttestationCode.edl
|
|
|
- @cd LocalAttestationCode && $(SGX_EDGER8R) --trusted ../LocalAttestationCode/LocalAttestationCode.edl --search-path $(SGX_SDK)/include
|
|
|
- @echo "GEN => $@"
|
|
|
-
|
|
|
-LocalAttestationCode/LocalAttestationCode_t.o: LocalAttestationCode/LocalAttestationCode_t.c
|
|
|
- @$(CC) $(TrustLib_Compile_Flags) -c $< -o $@
|
|
|
- @echo "CC <= $<"
|
|
|
-
|
|
|
-LocalAttestationCode/LocalAttestationTrustedWrapper.o: LocalAttestationCode/LAWrapper.cpp LocalAttestationCode/LocalAttestationCode_t.h
|
|
|
- @$(CXX) $(TrustLib_Compile_Flags) $(TrustLib_Compile_Cxx_Flags) -c $< -o $@
|
|
|
- @echo "CC <= $<"
|
|
|
-
|
|
|
-LocalAttestationCode/LocalAttestationTrusted.o: Decryptor/LA.cpp LocalAttestationCode/LocalAttestationCode_t.h
|
|
|
- @$(CXX) $(TrustLib_Compile_Flags) $(TrustLib_Compile_Cxx_Flags) -c $< -o $@
|
|
|
- @echo "CC <= $<"
|
|
|
-
|
|
|
-$(Trust_Lib_Name): LocalAttestationCode/LocalAttestationCode_t.o LocalAttestationCode/LocalAttestationTrustedWrapper.o LocalAttestationCode/LocalAttestationTrusted.o
|
|
|
- @$(AR) rcs $@ $^
|
|
|
- @echo "GEN => $@"
|
|
|
-
|
|
|
-CommonOpensslCode/Openssl_crypto.o: CommonOpensslCode/Openssl_crypto.cpp
|
|
|
- @$(CXX) -std=c++11 -nostdinc++ $(Enclave_Compile_Flags) -I$(OPENSSL_INCLUDES) -c $< -o $@
|
|
|
- @echo "CXX <= $<"
|
|
|
-
|
|
|
######## App Objects ########
|
|
|
Decryptor/Decryptor_u.c Decryptor/Decryptor_u.h: $(SGX_EDGER8R) Decryptor/Decryptor.edl
|
|
|
@cd Decryptor && $(SGX_EDGER8R) --use-prefix --untrusted ../Decryptor/Decryptor.edl --search-path $(SGX_SDK)/include
|
|
|
@@ -249,11 +212,11 @@ App/Decryptor_u.o: Decryptor/Decryptor_u.c
|
|
|
@$(CC) $(App_Compile_Flags) -c $< -o $@
|
|
|
@echo "CC <= $<"
|
|
|
|
|
|
-App/%.o: App/%.cpp Decryptor/Decryptor_u.h #Enclave3/Enclave3_u.h
|
|
|
+App/%.o: App/%.cpp Decryptor/Decryptor_u.h
|
|
|
@$(CXX) $(App_Compile_Flags) -c $< -o $@
|
|
|
@echo "CXX <= $<"
|
|
|
|
|
|
-$(App_Name): App/App.o App/LocalAttestationUntrusted.o App/protobufLAInitiator.o App/protobufSgxTransformsInitiator.o App/protobufSgxTransformsHelper.o App/protobufReadWrite.o App/ProtobufLAMessages.pb.o App/PostLAMessages.pb.o App/Ipc.o App/Decryptor_u.o
|
|
|
+$(App_Name): App/App.o App/SealingUntrusted.o App/LocalAttestationUntrusted.o App/protobufLAInitiator.o App/protobufSgxTransformsInitiator.o App/protobufSgxTransformsHelper.o App/protobufReadWrite.o App/ProtobufLAMessages.pb.o App/PostLAMessages.pb.o App/Ipc.o App/FileIO.o App/Decryptor_u.o
|
|
|
@$(CXX) -Wl,--no-undefined $^ -o $@ $(App_Link_Flags)
|
|
|
@echo "LINK => $@"
|
|
|
|
|
|
@@ -261,13 +224,9 @@ $(App_Name): App/App.o App/LocalAttestationUntrusted.o App/protobufLAInitiator.o
|
|
|
|
|
|
|
|
|
######## Enclave Objects ########
|
|
|
-Decryptor/Decryptor_t.c: $(SGX_EDGER8R) Decryptor/Decryptor.edl
|
|
|
- @cd Decryptor && $(SGX_EDGER8R) --use-prefix --trusted ../Decryptor/Decryptor.edl --search-path $(SGX_SDK)/include
|
|
|
- @echo "GEN => $@"
|
|
|
-
|
|
|
-Decryptor/Decryptor_t.o: Decryptor/Decryptor_t.c
|
|
|
- @$(CC) $(Enclave_Compile_Flags) -c $< -o $@
|
|
|
- @echo "CC <= $<"
|
|
|
+Decryptor/Openssl_crypto.o: Decryptor/Openssl_crypto.cpp
|
|
|
+ @$(CXX) -std=c++11 -nostdinc++ $(Enclave_Compile_Flags) -I$(OPENSSL_INCLUDES) -c $< -o $@
|
|
|
+ @echo "CXX <= $<"
|
|
|
|
|
|
Decryptor/%Box.o: Decryptor/%Box.cpp
|
|
|
@$(CXX) -std=c++11 -nostdinc++ $(Enclave_Compile_Flags) -c $< -o $@
|
|
|
@@ -277,15 +236,27 @@ Decryptor/ECDHKeypair.o: Decryptor/ECDHKeypair.cpp
|
|
|
@$(CXX) -std=c++11 -nostdinc++ $(Enclave_Compile_Flags) -c $< -o $@
|
|
|
@echo "CXX <= $<"
|
|
|
|
|
|
-Decryptor/DecryptorWrapper.o: Decryptor/DecryptorWrapper.cpp
|
|
|
- @$(CXX) -std=c++11 -nostdinc++ $(Enclave_Compile_Flags) -c $< -o $@
|
|
|
+Decryptor/LA.o: Decryptor/LA.cpp
|
|
|
+ @$(CXX) $(TrustLib_Compile_Flags) $(TrustLib_Compile_Cxx_Flags) -c $< -o $@
|
|
|
@echo "CXX <= $<"
|
|
|
|
|
|
Decryptor/Decryptor.o: Decryptor/Decryptor.cpp #Decryptor/HybridEncryptionBox.cpp Decryptor/ECDSASignatureBox.cpp Decryptor/ECDHKeypair.cpp Decryptor/SymmetricEncryptionBox.cpp
|
|
|
@$(CXX) -std=c++11 -nostdinc++ $(Enclave_Compile_Flags) -c $< -o $@
|
|
|
@echo "CXX <= $<"
|
|
|
|
|
|
-Decryptor.so: Decryptor/Decryptor_t.o Decryptor/DecryptorWrapper.o Decryptor/Decryptor.o $(Trust_Lib_Name) Decryptor/HybridEncryptionBox.o Decryptor/ECDSASignatureBox.o Decryptor/SymmetricEncryptionBox.o Decryptor/ECDHKeypair.o CommonOpensslCode/Openssl_crypto.o
|
|
|
+Decryptor/DecryptorWrapper.o: Decryptor/DecryptorWrapper.cpp
|
|
|
+ @$(CXX) -std=c++11 -nostdinc++ $(Enclave_Compile_Flags) -c $< -o $@
|
|
|
+ @echo "CXX <= $<"
|
|
|
+
|
|
|
+Decryptor/Decryptor_t.c: $(SGX_EDGER8R) Decryptor/Decryptor.edl
|
|
|
+ @cd Decryptor && $(SGX_EDGER8R) --use-prefix --trusted ../Decryptor/Decryptor.edl --search-path $(SGX_SDK)/include
|
|
|
+ @echo "GEN => $@"
|
|
|
+
|
|
|
+Decryptor/Decryptor_t.o: Decryptor/Decryptor_t.c
|
|
|
+ @$(CC) $(Enclave_Compile_Flags) -c $< -o $@
|
|
|
+ @echo "CC <= $<"
|
|
|
+
|
|
|
+Decryptor.so: Decryptor/Decryptor_t.o Decryptor/DecryptorWrapper.o Decryptor/Decryptor.o Decryptor/LA.o Decryptor/HybridEncryptionBox.o Decryptor/ECDSASignatureBox.o Decryptor/SymmetricEncryptionBox.o Decryptor/ECDHKeypair.o Decryptor/Openssl_crypto.o
|
|
|
@$(CXX) $^ -o $@ $(Decryptor_Link_Flags)
|
|
|
@echo "LINK => $@"
|
|
|
|
|
|
@@ -297,4 +268,4 @@ $(Enclave_Name_2): Decryptor.so
|
|
|
.PHONY: clean
|
|
|
|
|
|
clean:
|
|
|
- @rm -rf .config_* $(App_Name) *.so *.a App/*.o Decryptor/*.o Decryptor/*_t.* Decryptor/*_u.* LocalAttestationCode/*.o LocalAttestationCode/*_t.* CommonOpensslCode/*.o
|
|
|
+ @rm -rf .config_* $(App_Name) *.so *.a App/*.o Decryptor/*.o Decryptor/*_t.* Decryptor/*_u.*
|