Browse Source

Removed some printfs for testing

dettanym 5 years ago
parent
commit
872d6a5a87
3 changed files with 21 additions and 18 deletions
  1. 10 7
      ProtobufLAInitiator.cpp
  2. BIN
      localattestation_decryption.so
  3. 11 11
      systemMain.cpp

+ 10 - 7
ProtobufLAInitiator.cpp

@@ -247,39 +247,42 @@ int decrypt_client_data_through_decryptor( unsigned char* ip_base64_client_publi
     return internal_return_status;
   }
 
-  printf("Sending this ciphertext and tag to the decryptor enclave:\n"); 
+/*  printf("Sending this ciphertext and tag to the decryptor enclave:\n"); 
   for(counter=0;counter< ciphertext_to_decryptor_length;counter++)
 	printf("0x%02x ", ciphertext_to_decryptor[counter]); 
   printf("\n"); fflush(stdout);
+*/
   // write message to decryptor
   protobuf_encrypted_msg.set_msg( ciphertext_to_decryptor , ciphertext_to_decryptor_length );
   free(ciphertext_to_decryptor);
 	if(write_protobuf_msg_to_fd(global_decryptor_fd, protobuf_encrypted_msg)!=0)
 	{
-		printf("Not all of the client's pub key and ciphertext data was written\n"); fflush(stdout);   return 0xfe;
+		// printf("Not all of the client's pub key and ciphertext data was written\n"); fflush(stdout);   
+		return 0xfe;
 	}
 
 	// clear the message before setting it again
 	protobuf_encrypted_msg.clear_msg();
 
   // read encrypted data
-	printf("Reading msg from decryptor"); fflush(stdout);
+//	printf("Reading msg from decryptor"); fflush(stdout);
 	if(read_protobuf_msg_from_fd(global_decryptor_fd, protobuf_encrypted_msg)!=0)
 	{
-		printf("Not all of the decryptor's message was read\n"); fflush(stdout); return 0xf3;
+	//	printf("Not all of the decryptor's message was read\n"); fflush(stdout); 
+		return 0xf3;
 	}
-	printf("Done reading msg from decryptor\n"); fflush(stdout);
+//	printf("Done reading msg from decryptor\n"); fflush(stdout);
 
   protobuf_encrypted_msg_string=std::string(protobuf_encrypted_msg.msg());
   ciphertext_from_decryptor_length=protobuf_encrypted_msg_string.length();
   ciphertext_from_decryptor = (unsigned char*) malloc(ciphertext_from_decryptor_length);
   memcpy(ciphertext_from_decryptor, protobuf_encrypted_msg_string.c_str(), protobuf_encrypted_msg_string.length());
 
-  printf("Got this ciphertext and tag from the decryptor enclave"); 
+/*  printf("Got this ciphertext and tag from the decryptor enclave"); 
   for(counter=0;counter< ciphertext_from_decryptor_length;counter++)
         printf("0x%02x ", ciphertext_from_decryptor[counter]); 
   printf("\n");
-
+*/
   // Decrypt data from decryptor
   internal_return_status = aes_gcm_wrapper(0,  ciphertext_from_decryptor, ciphertext_from_decryptor_length,
     op_plaintext, op_plaintext_length

BIN
localattestation_decryption.so


+ 11 - 11
systemMain.cpp

@@ -95,7 +95,7 @@ class Mitigator : public Php::Base
 			plaintext_length = base64_client_ciphertext_length;
 			memcpy(plaintext_user_data, base64_client_ciphertext, base64_client_ciphertext_length);
 			plaintext_user_data_str = std::string((char*) plaintext_user_data, base64_client_ciphertext_length); 
-
+/*
 			printf("Base64 encoded key:\n");
 			for(counter=0; counter < base64_client_public_key_length; counter++)
 				printf("%c", base64_client_public_key[counter]);
@@ -105,52 +105,52 @@ class Mitigator : public Php::Base
 			for(counter=0; counter < base64_client_ciphertext_length; counter++ )
 				printf("%c", base64_client_ciphertext[counter]);
 			printf("\n"); fflush(stdout);
-			
+*/			
 			client_data = (unsigned char*) malloc(base64_client_ciphertext_length + base64_client_public_key_length); 
 			ret_status = base64_decoding_wrapper(client_data, base64_client_public_key, base64_client_public_key_length);
 			if(ret_status<=0)
 			{
-                                printf("Could not do base64 decoding correctly.\n"); fflush(stdout); 
+//                                printf("Could not do base64 decoding correctly.\n"); fflush(stdout); 
                                 free(plaintext_user_data);
                                 free(client_data);
                                 return plaintext_user_data_str; 
 			}
 			client_data_length = ret_status; 
 			old_client_data_length=client_data_length; 
-			printf("Client public key:\n"); 
+/*			printf("Client public key:\n"); 
 			for(counter=0; counter<client_data_length; counter++)
 				printf("%d ", client_data[counter]);
-
+*/
 
                         ret_status = base64_decoding_wrapper(client_data + client_data_length, base64_client_ciphertext, base64_client_ciphertext_length);
                         if(ret_status<=0)
                         {
-                                printf("Could not do base64 decoding correctly.\n"); fflush(stdout); 
+//                                printf("Could not do base64 decoding correctly.\n"); fflush(stdout); 
                                 free(plaintext_user_data);
                                 free(client_data);
                                 return plaintext_user_data_str; 
                         }
                         client_data_length += ret_status; 
 
-			printf("\n Ciphertext from client:\n"); 
+/*			printf("\n Ciphertext from client:\n"); 
                         for(counter=old_client_data_length; counter<client_data_length; counter++)
                                 printf("%d ", client_data[counter]);
 			printf("\n"); fflush(stdout);
-			
+*/			
 			ret_status=decrypt_client_data_through_decryptor(client_data, client_data_length, (unsigned char*) plaintext_user_data, &plaintext_length);
 			if(ret_status != 0)
 			{
-				printf("Received error code: 0x%02x\n", ret_status); fflush(stdout);
+//				printf("Received error code: 0x%02x\n", ret_status); fflush(stdout);
 				free(client_data);
 				free(plaintext_user_data);
 				return plaintext_user_data_str;
 			}
 			
-			printf("Going to return this plaintext:\n");
+/*			printf("Going to return this plaintext:\n");
 			for(counter=0;counter<plaintext_length;counter++)
 				printf("%c", plaintext_user_data[counter]);
 			fflush(stdout);
-
+*/
 			plaintext_user_data_str = std::string((char*) plaintext_user_data, plaintext_length);
 			free(plaintext_user_data); 
 			free(client_data);