- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
during my research for a university project i wrote a SGX enabled application, which first:
- should check if SGX is installed
- if yes, run some code
When i execute the application on a SGX enabled system, the program works well. I implemented the SGX Driver dectection Code from:
https://software.intel.com/en-us/articles/properly-detecting-intel-software-guard-extensions-in-your-applications
Unfortunally i get the following error when i execute the application on a system without sgx-driver:
./sample: error while loading shared libraries: libsgx_urts.so: cannot open shared object file: No such file or directory
My target System (without SGX driver) is Ubuntu 18.04.1 LTS and i developed the SGX application on Ubuntu 16.04.6 LTS
Can someone help me? I thought implementing above code is especially preventing errors like that.
Thanks for your feedback!
regards,
Thomas
----------------------------------
Here is my Makefile:
######## Intel(R) SGX SDK Settings ########
SGX_SDK ?= /opt/intel/sgxsdk
SGX_MODE ?= SIM
SGX_ARCH ?= x64
TRUSTED_DIR=trusted
UNTRUSTED_DIR=untrusted
ifeq ($(shell getconf LONG_BIT), 32)
SGX_ARCH := x86
else ifeq ($(findstring -m32, $(CXXFLAGS)), -m32)
SGX_ARCH := x86
endif
ifeq ($(SGX_ARCH), x86)
SGX_COMMON_CFLAGS := -m32
SGX_LIBRARY_PATH := $(SGX_SDK)/lib
SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x86/sgx_sign
SGX_EDGER8R := $(SGX_SDK)/bin/x86/sgx_edger8r
else
SGX_COMMON_CFLAGS := -m64 -fno-stack-protector -z execstack
SGX_LIBRARY_PATH := $(SGX_SDK)/lib64
SGX_ENCLAVE_SIGNER := $(SGX_SDK)/bin/x64/sgx_sign
SGX_EDGER8R := $(SGX_SDK)/bin/x64/sgx_edger8r
endif
ifeq ($(SGX_DEBUG), 1)
ifeq ($(SGX_PRERELEASE), 1)
$(error Cannot set SGX_DEBUG and SGX_PRERELEASE at the same time!!)
endif
endif
ifeq ($(SGX_DEBUG), 1)
SGX_COMMON_CFLAGS += -O0 -g
else
SGX_COMMON_CFLAGS += -O2
endif
######## App Settings ########
ifneq ($(SGX_MODE), HW)
Urts_Library_Name := sgx_urts_sim
else
Urts_Library_Name := sgx_urts
endif
# App_Cpp_Files := App/App.cpp $(wildcard App/Edger8rSyntax/*.cpp) $(wildcard App/TrustedLibrary/*.cpp)
App_Cpp_Files := $(UNTRUSTED_DIR)/sample.cpp # $(wildcard App/TrustedLibrary/*.cpp)
App_Include_Paths := -IInclude -I$(UNTRUSTED_DIR) -I$(SGX_SDK)/include
App_C_Flags := -fno-stack-protector -z execstack $(SGX_COMMON_CFLAGS) -fPIC -Wno-attributes $(App_Include_Paths)
# Three configuration modes - Debug, prerelease, release
# Debug - Macro DEBUG enabled.
# Prerelease - Macro NDEBUG and EDEBUG enabled.
# Release - Macro NDEBUG enabled.
ifeq ($(SGX_DEBUG), 1)
App_C_Flags += -DDEBUG -UNDEBUG -UEDEBUG
else ifeq ($(SGX_PRERELEASE), 1)
App_C_Flags += -DNDEBUG -DEDEBUG -UDEBUG
else
App_C_Flags += -DNDEBUG -UEDEBUG -UDEBUG
endif
App_Cpp_Flags := $(App_C_Flags) -std=c++11
App_Link_Flags := -fno-stack-protector -z execstack $(SGX_COMMON_CFLAGS) -L$(SGX_LIBRARY_PATH) -l$(Urts_Library_Name) -lpthread -ldl -l:libsgx_capable.a
ifneq ($(SGX_MODE), HW)
App_Link_Flags += -lsgx_uae_service_sim
else
App_Link_Flags += -lsgx_uae_service
endif
App_Cpp_Objects := $(App_Cpp_Files:.cpp=.o)
ifeq ($(SGX_MODE), HW)
ifneq ($(SGX_DEBUG), 1)
ifneq ($(SGX_PRERELEASE), 1)
Build_Mode = HW_RELEASE
endif
endif
endif
.PHONY: all run
ifeq ($(Build_Mode), HW_RELEASE)
all: sample
@echo "Build sample [$(Build_Mode)|$(SGX_ARCH)] success!"
@echo
@echo "*********************************************************************************************************************************************************"
@echo "PLEASE NOTE: In this mode, please sign the SGXMalwareDecoder.so first using Two Step Sign mechanism before you run the app to launch and access the enclave."
@echo "*********************************************************************************************************************************************************"
@echo
else
all: sample
endif
run: all
ifneq ($(Build_Mode), HW_RELEASE)
@$(CURDIR)/sample
@echo "RUN => sample [$(SGX_MODE)|$(SGX_ARCH), OK]"
endif
######## App Objects ########
$(UNTRUSTED_DIR)/SGXMalwareDecoder_u.c: $(SGX_EDGER8R) $(TRUSTED_DIR)/SGXMalwareDecoder.edl
@cd $(UNTRUSTED_DIR) && $(SGX_EDGER8R) --untrusted ../$(TRUSTED_DIR)/SGXMalwareDecoder.edl --search-path ../$(TRUSTED_DIR) --search-path $(SGX_SDK)/include
@echo "GEN => $@"
$(UNTRUSTED_DIR)/SGXMalwareDecoder_u.o: $(UNTRUSTED_DIR)/SGXMalwareDecoder_u.c
@$(CC) $(App_C_Flags) -c $< -o $@
@echo "CC <= $<"
$(UNTRUSTED_DIR)/%.o: $(UNTRUSTED_DIR)/%.cpp
@$(CXX) $(App_Cpp_Flags) -c $< -o $@
@echo "CXX <= $<"
sample: $(UNTRUSTED_DIR)/SGXMalwareDecoder_u.o $(App_Cpp_Objects)
@$(CXX) $^ -o $@ $(App_Link_Flags)
@echo "LINK => $@"
.PHONY: clean
clean:
@rm -f sample $(App_Cpp_Objects) $(UNTRUSTED_DIR)/SGXMalwareDecoder_u.*
Link Copied
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page