Browse Source

Doesnt crash - decryptor throws up an error

dettanym 5 years ago
parent
commit
f663a38f39
5 changed files with 20 additions and 7 deletions
  1. 9 1
      Makefile
  2. BIN
      libsgx_tcrypto.a
  3. BIN
      libsgx_tservice.a
  4. BIN
      localattestation_decryption.so
  5. 11 6
      systemMain.cpp

+ 9 - 1
Makefile

@@ -36,5 +36,13 @@ crypto.o: crypto.cpp
 	g++ -I${Openssl_Path}/include ${CXX_FLAGS} -c $^ -o $@
 
 localattestation_decryption.so:  systemMain.o ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o
-	${CXX} ${LD_FLAGS} -Wl,--no-undefined systemMain.o ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o  -L./ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive  -l$(Service_Library_Name) -l$(Crypto_Library_Name) -lsgx_tstdc  -lprotobuf -L${Openssl_Path}/lib -lssl -lcrypto   -lphpcpp  -Wl,-Bsymbolic -Wl,-pie,-eenclave_entry -Wl,--export-dynamic  -Wl,--verbose -o $@
+	${CXX} ${LD_FLAGS} -Wl,--no-undefined systemMain.o ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o  -lphpcpp -L./ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive  -l$(Service_Library_Name) -l$(Crypto_Library_Name) -lsgx_tstdc -lprotobuf -Wl,--rpath /home/m2mazmud/plain-openssl/lib    -L${Openssl_Path}/lib -lssl -lcrypto   -Wl,-Bsymbolic -Wl,-pie,-eenclave_entry -Wl,--export-dynamic  -Wl,--verbose -o $@ 
+#ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o 
+# -L./ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive  -l$(Service_Library_Name) -l$(Crypto_Library_Name) -lsgx_tstdc -lprotobuf -Wl,--rpath /home/m2mazmud/plain-openssl/lib   -L${Openssl_Path}/lib -lssl -lcrypto  -Wl,-Bsymbolic -Wl,-pie,-eenclave_entry -Wl,--export-dynamic  -Wl,--verbose -lphpcpp -lprotobuf  -o $@
+#ProtobufLAInitiator.o SgxProtobufLAInitiator.o SgxProtobufLAInitiator_Transforms.o ProtobufLAMessages.pb.o crypto.o 
+# -L./ -Wl,--whole-archive -l$(Trts_Library_Name) -Wl,--no-whole-archive  -l$(Service_Library_Name) -l$(Crypto_Library_Name) -lsgx_tstdc 
+# -lprotobuf
+# -L${Openssl_Path}/lib -lssl -lcrypto  
+# -lphpcpp 
+# -Wl,-Bsymbolic -Wl,-pie,-eenclave_entry -Wl,--export-dynamic  -Wl,--verbose -o $@
 #-Wl,--rpath /home/m2mazmud/plain-openssl/lib -o $@

BIN
libsgx_tcrypto.a


BIN
libsgx_tservice.a


BIN
localattestation_decryption.so


+ 11 - 6
systemMain.cpp

@@ -37,6 +37,8 @@ class Mitigator : public Php::Base
 
 	static void local_attestation_initiator_wrapper() 
 	{
+		printf("Hello.\n"); fflush(stdout);
+	
 		setbuf(stdout,NULL); uint32_t count;
 		uint32_t return_sgx; 
 		unsigned char* base64_encoded_mitigator_header_and_value = (unsigned char*) malloc(mitigator_pubkey_header.length()+1+216); 
@@ -56,12 +58,13 @@ class Mitigator : public Php::Base
 			}
 		}
 		else {
-		printf("\nSuccessful LA with port %d.\n", DECRYPTOR_PORT);
-		fflush(stdout);
-		local_attestation_successful=1; 
-		printf("length of string was %d\n", mitigator_pubkey_header.length()); fflush(stdout); 
-		mitigator_pubkey_header_value=std::string((char*)base64_encoded_mitigator_header_and_value,mitigator_pubkey_header.length()+216); 
+			printf("\nSuccessful LA with port %d.\n", DECRYPTOR_PORT);
+			fflush(stdout);
+			local_attestation_successful=1; 
+			printf("length of string was %d\n", mitigator_pubkey_header.length()); fflush(stdout); 
+			mitigator_pubkey_header_value=std::string((char*)base64_encoded_mitigator_header_and_value,mitigator_pubkey_header.length()+216); 
 		}
+
 	}
 
 
@@ -75,6 +78,7 @@ class Mitigator : public Php::Base
 		// call this func onRequest 
 		static Php::Value php_decrypt_wrapper(Php::Parameters &params   )
 		{
+			/*
 			int counter; 
 			unsigned char* plaintext_user_data; 
 			unsigned char* ciphertext_user_data;
@@ -113,7 +117,8 @@ class Mitigator : public Php::Base
 
 			std::string plaintext_user_data_str = std::string((char*) plaintext_user_data, plaintext_length); 
 			// free(plaintext_user_data); // TODO: For some reason, this causes a crash. 
-			return plaintext_user_data_str; // "Miti";// plaintext_user_data_obj; // (ciphertext_user_data, ciphertext_length) ; 
+			*/
+			return "Miti";//plaintext_user_data_str; plaintext_user_data_obj; // (ciphertext_user_data, ciphertext_length) ; 
 		}
 
 };