Browse Source

Works with updated trts and tlibc from commit 1f2d1e7 in linux-sgx-trts-modified. When tlibc is not linked against, then the python script works (the program then throws an expected symbol lookup error for memset_s). Otherwise, if tlibc is linked against, it fails with a crash. Therefore, memset_s and consttime memequal in tlibc might be somehow messing things up.

dettanym 3 years ago
parent
commit
f9e39d4f40
5 changed files with 5 additions and 2 deletions
  1. 3 2
      Makefile
  2. BIN
      libsgx_trts.a
  3. BIN
      libsgx_tstdc.a
  4. 2 0
      systemMain.cpp
  5. BIN
      verifier

+ 3 - 2
Makefile

@@ -1,7 +1,7 @@
 CXX             = g++
 RM              = rm -f
 PYTHON_CFLAGS = -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7  -Wdate-time #-fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security  -DNDEBUG -g -fwrapv 
-PYTHON_LDFLAGS = -L/usr/lib/python2.7/config-x86_64-linux-gnu -L/usr/lib -lpython2.7   -lutil #-ldl -lm  #-Wl,-export-dynamic -Wl,-Bsymbolic-functions
+PYTHON_LDFLAGS = -L/usr/lib/python2.7/config-x86_64-linux-gnu  -lpython2.7   -lutil #-ldl -lm  #-Wl,-export-dynamic -Wl,-Bsymbolic-functions
 CXX_FLAGS       = -Wall  -O2 -std=c++11 -fpic -fdata-sections -ffunction-sections ${PYTHON_CFLAGS}
 LD              = ${CXX} -v
 LD_FLAGS        = -Wall ${PYTHON_LDFLAGS}
@@ -46,7 +46,8 @@ crypto.o: crypto.cpp
 
 verifier:  systemMain.o systemSealerWrapper.o SgxSealer.o ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o
 #	echo $(system_obj)
-	${CXX} -Wl,--noinhibit-exec systemMain.o crypto.o systemSealerWrapper.o SgxSealer.o  -L${Openssl_Path}/lib -lcrypto -lssl -L./ -l$(Service_Library_Name) -l$(Crypto_Library_Name) -L/home/m2mazmud/linux-sgx-trts-modified/build/linux  -lsgx_trts ${LD_FLAGS} -o $@ 
+	${CXX} -Wl,--noinhibit-exec systemMain.o crypto.o systemSealerWrapper.o SgxSealer.o  -L${Openssl_Path}/lib -lcrypto -lssl -L./ -l$(Service_Library_Name) -l$(Crypto_Library_Name) -L/home/m2mazmud/linux-sgx-trts-modified/build/linux -lsgx_trts  ${LD_FLAGS} -o $@ 
+#-L/home/m2mazmud/linux-sgx-trts-modified/build/linux -lsgx_tstdc -lsgx_trts ${LD_FLAGS} -o $@ 
 
 #-Wl,-rpath,$(SGX_SDK)/lib64  systemMain.o  ${LD_FLAGS} -o $@
 #systemSealerWrapper.o SgxSealer.o 

BIN
libsgx_trts.a


BIN
libsgx_tstdc.a


+ 2 - 0
systemMain.cpp

@@ -139,6 +139,7 @@ int main(int argc, char** argv)
 	printf("Could not generate RSA keypair - error 0x%x\n", return_internal); fflush(stdout); return return_internal; 
   }
   printf("Generated key pair - outside the fun\n"); fflush(stdout); 
+
   int sealed_file_fd = open("sealed_msg.txt", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
   if(sealed_file_fd == -1)
   {
@@ -148,6 +149,7 @@ int main(int argc, char** argv)
   }
   printf("\nSuccessfully opened a file to seal the apache signature keypair to.\n");
   fflush(stdout);
+
   return_sgx = seal_message_to_file(sealed_file_fd, apache_signature_keypair_private, &expected_sealed_msg_size);
   if(return_sgx!=0 && return_sgx!=0xFFFFFFFF)
   {

BIN
verifier