Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
build(rtc_auth_enclave,rtc_data_enclave): factor out ENCLAVE_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
PiDelport committed May 28, 2021
1 parent 035359d commit 5b6f3d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions rtc_auth_enclave/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ else ifeq ($(MITIGATION-CVE-2020-0551), CF)
export MITIGATION_CVE_2020_0551=CF
endif

ENCLAVE_NAME = rtc_auth
CRATE_LIB_NAME := enclave
CRATE_BUILD_PATH := ./target/release
CODEGEN_PATH = /root/rtc-data/codegen/auth_enclave
Expand All @@ -36,11 +37,11 @@ Crate_Files := $(wildcard src/*.rs ../rtc_tenclave/src/*.rs)
Out_StaticLib := $(CRATE_BUILD_PATH)/lib$(CRATE_LIB_NAME).a
Out_Bindings := $(CODEGEN_PATH)/bindings.h

Out_EdgeObject := $(CUSTOM_LIBRARY_PATH)/rtc_auth_t.o
Out_EdgeObject := $(CUSTOM_LIBRARY_PATH)/$(ENCLAVE_NAME)_t.o
Out_Dylib := $(CUSTOM_LIBRARY_PATH)/enclave.so
Out_SignedDylib := $(CUSTOM_BIN_PATH)/enclave.signed.so

Out_CodegenFiles := $(CODEGEN_PATH)/rtc_auth_t.c $(CODEGEN_PATH)/rtc_auth_t.h $(CODEGEN_PATH)/rtc_auth_u.c $(CODEGEN_PATH)/rtc_auth_u.h
Out_CodegenFiles := $(CODEGEN_PATH)/$(ENCLAVE_NAME)_t.c $(CODEGEN_PATH)/$(ENCLAVE_NAME)_t.h $(CODEGEN_PATH)/$(ENCLAVE_NAME)_u.c $(CODEGEN_PATH)/$(ENCLAVE_NAME)_u.h

.PHONY: all

Expand Down Expand Up @@ -97,12 +98,12 @@ $(Out_StaticLib) $(Out_Bindings): $(Crate_Files)
@rm -f $(Out_StaticLib) $(Out_Bindings)
cargo build --release

$(Out_CodegenFiles): $(SGX_EDGER8R) ./rtc_auth.edl $(Out_Bindings) | $(CODEGEN_PATH)
$(SGX_EDGER8R) --use-prefix ./rtc_auth.edl --search-path $(SGX_SDK)/include --search-path $(RUST_EDL_PATH) --search-path $(RTC_EDL_PATH) --trusted-dir $(CODEGEN_PATH) --untrusted-dir $(CODEGEN_PATH)
$(Out_CodegenFiles): $(SGX_EDGER8R) ./$(ENCLAVE_NAME).edl $(Out_Bindings) | $(CODEGEN_PATH)
$(SGX_EDGER8R) --use-prefix ./$(ENCLAVE_NAME).edl --search-path $(SGX_SDK)/include --search-path $(RUST_EDL_PATH) --search-path $(RTC_EDL_PATH) --trusted-dir $(CODEGEN_PATH) --untrusted-dir $(CODEGEN_PATH)
@echo "GEN => $(Enclave_EDL_Files)"

$(Out_EdgeObject): $(Out_CodegenFiles) | $(CODEGEN_PATH) $(CUSTOM_LIBRARY_PATH)
@$(CC) $(RustEnclave_Compile_Flags) -c $(CODEGEN_PATH)/rtc_auth_t.c -o $@
@$(CC) $(RustEnclave_Compile_Flags) -c $(CODEGEN_PATH)/$(ENCLAVE_NAME)_t.c -o $@
@echo "CC <= $<"

$(Out_Dylib): $(Out_StaticLib) $(Out_EdgeObject) | $(CUSTOM_LIBRARY_PATH)
Expand Down
11 changes: 6 additions & 5 deletions rtc_data_enclave/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ else ifeq ($(MITIGATION-CVE-2020-0551), CF)
export MITIGATION_CVE_2020_0551=CF
endif

ENCLAVE_NAME = rtc_data
CRATE_LIB_NAME := enclave
CRATE_BUILD_PATH := ./target/release
CODEGEN_PATH = /root/rtc-data/codegen/data_enclave
Expand All @@ -36,11 +37,11 @@ Crate_Files := $(wildcard src/*.rs ../rtc_tenclave/src/*.rs)
Out_StaticLib := $(CRATE_BUILD_PATH)/lib$(CRATE_LIB_NAME).a
Out_Bindings := $(CODEGEN_PATH)/bindings.h

Out_EdgeObject := $(CUSTOM_LIBRARY_PATH)/rtc_data_t.o
Out_EdgeObject := $(CUSTOM_LIBRARY_PATH)/$(ENCLAVE_NAME)_t.o
Out_Dylib := $(CUSTOM_LIBRARY_PATH)/enclave.so
Out_SignedDylib := $(CUSTOM_BIN_PATH)/enclave.signed.so

Out_CodegenFiles := $(CODEGEN_PATH)/rtc_data_t.c $(CODEGEN_PATH)/rtc_data_t.h $(CODEGEN_PATH)/rtc_data_u.c $(CODEGEN_PATH)/rtc_data_u.h
Out_CodegenFiles := $(CODEGEN_PATH)/$(ENCLAVE_NAME)_t.c $(CODEGEN_PATH)/$(ENCLAVE_NAME)_t.h $(CODEGEN_PATH)/$(ENCLAVE_NAME)_u.c $(CODEGEN_PATH)/$(ENCLAVE_NAME)_u.h

.PHONY: all

Expand Down Expand Up @@ -97,12 +98,12 @@ $(Out_StaticLib) $(Out_Bindings): $(Crate_Files)
@rm -f $(Out_StaticLib) $(Out_Bindings)
cargo build --release

$(Out_CodegenFiles): $(SGX_EDGER8R) ./rtc_data.edl $(Out_Bindings) | $(CODEGEN_PATH)
$(SGX_EDGER8R) --use-prefix ./rtc_data.edl --search-path $(SGX_SDK)/include --search-path $(RUST_EDL_PATH) --search-path $(RTC_EDL_PATH) --trusted-dir $(CODEGEN_PATH) --untrusted-dir $(CODEGEN_PATH)
$(Out_CodegenFiles): $(SGX_EDGER8R) ./$(ENCLAVE_NAME).edl $(Out_Bindings) | $(CODEGEN_PATH)
$(SGX_EDGER8R) --use-prefix ./$(ENCLAVE_NAME).edl --search-path $(SGX_SDK)/include --search-path $(RUST_EDL_PATH) --search-path $(RTC_EDL_PATH) --trusted-dir $(CODEGEN_PATH) --untrusted-dir $(CODEGEN_PATH)
@echo "GEN => $(Enclave_EDL_Files)"

$(Out_EdgeObject): $(Out_CodegenFiles) | $(CODEGEN_PATH) $(CUSTOM_LIBRARY_PATH)
@$(CC) $(RustEnclave_Compile_Flags) -c $(CODEGEN_PATH)/rtc_data_t.c -o $@
@$(CC) $(RustEnclave_Compile_Flags) -c $(CODEGEN_PATH)/$(ENCLAVE_NAME)_t.c -o $@
@echo "CC <= $<"

$(Out_Dylib): $(Out_StaticLib) $(Out_EdgeObject) | $(CUSTOM_LIBRARY_PATH)
Expand Down

0 comments on commit 5b6f3d5

Please sign in to comment.