|
@@ -151,8 +151,8 @@ using namespace google::protobuf::io;
|
|
|
|
|
|
input_ciphertext_plus_tag_length = protobuf_msg.msg().length();
|
|
|
// TODO: MAKE SURE THIS IS NOT 0XFFFFFFFF.
|
|
|
- input_ciphertext_plus_tag = (uint8_t*) malloc(input_ciphertext_plus_tag_length);
|
|
|
- output_ciphertext_plus_tag = (uint8_t*) malloc(input_ciphertext_plus_tag_length); //128 = client public key token length?
|
|
|
+ input_ciphertext_plus_tag = (uint8_t*) malloc(1000); //malloc(input_ciphertext_plus_tag_length);
|
|
|
+ output_ciphertext_plus_tag = (uint8_t*) malloc(1000); //malloc(input_ciphertext_plus_tag_length); //128 = client public key token length?
|
|
|
protobuf_msg_ptr = (uint8_t*) protobuf_msg.msg().c_str();
|
|
|
|
|
|
for(counter=0; counter<input_ciphertext_plus_tag_length; counter++)
|
|
@@ -162,19 +162,22 @@ using namespace google::protobuf::io;
|
|
|
}
|
|
|
// Just so that the ciphertext - client data - is returned back to Apache in case this function fails.
|
|
|
// client data is after public key (64 bytes) + signature (64 bytes) = 128 bytes.
|
|
|
- for(counter=64; counter<input_ciphertext_plus_tag_length; counter++)
|
|
|
- output_ciphertext_plus_tag[counter] = input_ciphertext_plus_tag[counter];
|
|
|
- output_ciphertext_plus_tag_length=input_ciphertext_plus_tag_length;
|
|
|
+ for(counter=0; counter<input_ciphertext_plus_tag_length-64; counter++)
|
|
|
+ output_ciphertext_plus_tag[counter] = input_ciphertext_plus_tag[counter+64];
|
|
|
+ output_ciphertext_plus_tag_length=input_ciphertext_plus_tag_length - 64;
|
|
|
protobuf_msg.set_msg((void*) output_ciphertext_plus_tag, output_ciphertext_plus_tag_length);
|
|
|
|
|
|
// We assume that the output is not changed unless it is successful throughout.
|
|
|
- // Return value is not sent back..
|
|
|
-// Decryptor_process_apache_message_generate_response_wrapper(own_enclave_id, &sgx_ret_status, input_ciphertext_plus_tag, input_ciphertext_plus_tag_length, output_ciphertext_plus_tag, &output_ciphertext_plus_tag_length);
|
|
|
+ Decryptor_process_apache_message_generate_response_wrapper(own_enclave_id, &sgx_ret_status, input_ciphertext_plus_tag, input_ciphertext_plus_tag_length, output_ciphertext_plus_tag, &output_ciphertext_plus_tag_length);
|
|
|
free(input_ciphertext_plus_tag);
|
|
|
if(sgx_ret_status!=0)
|
|
|
{
|
|
|
protobuf_msg.set_msg((void*) output_ciphertext_plus_tag, output_ciphertext_plus_tag_length);
|
|
|
}
|
|
|
+ printf("Returning this: \n");
|
|
|
+ for(counter=0;counter<output_ciphertext_plus_tag_length;counter++)
|
|
|
+ printf("%02x ",output_ciphertext_plus_tag[counter]);
|
|
|
+ printf("\n");
|
|
|
free(output_ciphertext_plus_tag);
|
|
|
if(write_protobuf_msg_to_fd(fd, protobuf_msg)!=0)
|
|
|
return 0xfc;
|