|
@@ -101,7 +101,7 @@ int set_up_socket_connect(int port)
|
|
|
return sock;
|
|
|
}
|
|
|
|
|
|
-int do_local_attestation(int port)
|
|
|
+int local_attestation_initiator(int port)
|
|
|
{
|
|
|
|
|
|
protobuf_sgx_dh_msg1_t protobuf_msg1;
|
|
@@ -146,6 +146,7 @@ int do_local_attestation(int port)
|
|
|
{
|
|
|
printf("Error in process_protobuf_dh_msg3: 0x%x", protobuf_sgx_ret); fflush(stdout); return protobuf_sgx_ret;
|
|
|
}
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
uint32_t post_local_attestation_get_mitigator_header(unsigned char* base64_encoded_token_H, uint32_t* base64_encoded_token_H_length)
|
|
@@ -177,20 +178,20 @@ uint32_t post_local_attestation_get_mitigator_header(unsigned char* base64_encod
|
|
|
internal_return_status = aes_gcm_wrapper(0, encrypted_token_H_and_tag, encrypted_token_H_and_tag_length, plaintext_token_H, &plaintext_token_H_length);
|
|
|
if(internal_return_status != 0)
|
|
|
{
|
|
|
- printf("Error in decryption 0x%x", ret_decrypt); fflush(stdout); return internal_return_status;
|
|
|
+ printf("Error in decryption 0x%x", internal_return_status); fflush(stdout); return internal_return_status;
|
|
|
}
|
|
|
|
|
|
printf("Decryptor's short-term public key\n");
|
|
|
for(count=0;count<64;count++)
|
|
|
- printf("0x%02x ", plaintext_token[count]);
|
|
|
+ printf("0x%02x ", plaintext_token_H[count]);
|
|
|
printf("\n"); fflush(stdout);
|
|
|
|
|
|
printf("Verifier mrenclave\n");
|
|
|
for(count=64;count<96;count++)
|
|
|
- printf("0x%02x ", plaintext_token[count]);
|
|
|
+ printf("0x%02x ", plaintext_token_H[count]);
|
|
|
printf("\n"); fflush(stdout);
|
|
|
|
|
|
- *base64_encoded_token_H_length=base64_encoding_wrapper(plaintext_token, base64_encoded_token_H, plaintext_token_H_length);
|
|
|
+ *base64_encoded_token_H_length=base64_encoding_wrapper(base64_encoded_token_H, plaintext_token_H, plaintext_token_H_length);
|
|
|
|
|
|
|
|
|
if(!(base64_encoded_token_H_length <= 4 * Math.ceil(plaintext_token_H_length/3) && base64_encoded_token_H_length > 4 * (Math.ceil(plaintext_token_H_length/3) - 1)))
|
|
@@ -203,48 +204,39 @@ uint32_t post_local_attestation_get_mitigator_header(unsigned char* base64_encod
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+uint32_t base64_decoding_on_all_client_data(unsigned char* ip_base64_client_public_key_ciphertext,
|
|
|
+ uint32_t ip_base64_client_public_key_ciphertext_length,
|
|
|
+ unsigned char* op_client_public_key_ciphertext,
|
|
|
+ uint32_t* op_client_public_key_ciphertext_length
|
|
|
+)
|
|
|
{
|
|
|
- int openssl_ret_status; uint32_t counter;
|
|
|
- unsigned long list_size;
|
|
|
- std::string op_string;
|
|
|
- unsigned char* op_array;
|
|
|
-
|
|
|
- list_size=ip_base64_client_public_key_ciphertexts.size();
|
|
|
- for(std::string ip_base64_string: ip_base64_client_public_key_ciphertexts)
|
|
|
- {
|
|
|
- openssl_ret_status=base64_decoding_wrapper(ip_base64_string.c_str(), op_string, ip_base64_string.length());
|
|
|
+ uint32_t openssl_ret_status;
|
|
|
+ openssl_ret_status=base64_decoding_wrapper(ip_base64_client_public_key_ciphertext, op_client_public_key_ciphertext, ip_base64_client_public_key_ciphertext_length);
|
|
|
if(openssl_ret_status == -1)
|
|
|
return 0xfe;
|
|
|
-
|
|
|
- *op_ciphertext_length = base64_decoding_wrapper(base64_ciphertext, op_client_public_key_and_ciphertext + 64, base64_ciphertext_length);
|
|
|
- if(*op_ciphertext_length == -1)
|
|
|
- {
|
|
|
- return 0x33;
|
|
|
- }
|
|
|
- }
|
|
|
- return 0;
|
|
|
+ *op_client_public_key_ciphertext_length = openssl_ret_status;
|
|
|
+ return 0;
|
|
|
|
|
|
}
|
|
|
-*/
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
-int decrypt_client_data_through_decryptor( unsigned char* ip_base64_client_public_key_ciphertext,
|
|
|
+int decrypt_client_data_through_decryptor( unsigned char* ip_base64_client_public_key_ciphertext,
|
|
|
uint32_t ip_base64_client_public_key_ciphertext_length,
|
|
|
unsigned char* op_plaintext,
|
|
|
- uint32_t op_plaintext_length
|
|
|
+ uint32_t* op_plaintext_length
|
|
|
)
|
|
|
{
|
|
|
- unsigned char* ciphertext_to_decryptor, *ciphertext_from_decryptor;
|
|
|
+
|
|
|
uint32_t ciphertext_to_decryptor_length, ciphertext_from_decryptor_length;
|
|
|
uint32_t internal_return_status;
|
|
|
+ protobuf_post_LA_encrypted_msg_t protobuf_encrypted_msg;
|
|
|
|
|
|
|
|
|
- ciphertext_to_decryptor=(unsigned char*) malloc(ip_base64_client_public_key_ciphertext + 16);
|
|
|
+ ciphertext_to_decryptor=(unsigned char*) malloc(ip_base64_client_public_key_ciphertext_length + 16);
|
|
|
internal_return_status = aes_gcm_wrapper(1, ip_base64_client_public_key_ciphertext, ip_base64_client_public_key_ciphertext_length,
|
|
|
- ciphertext_to_decryptor, ciphertext_to_decryptor_length
|
|
|
- );
|
|
|
+ ciphertext_to_decryptor, &ciphertext_to_decryptor_length );
|
|
|
|
|
|
if(internal_return_status != 0)
|
|
|
{
|
|
@@ -270,15 +262,15 @@ int decrypt_client_data_through_decryptor( unsigned char* ip_base64_client_publi
|
|
|
printf("Not all of the decryptor's message was read\n"); fflush(stdout); return 0xf3;
|
|
|
}
|
|
|
printf("Done reading msg from decryptor\n"); fflush(stdout);
|
|
|
- ciphertext_from_decryptor_length = protobuf_encrypted_msg.length();
|
|
|
- ciphertext_from_decryptor = protobuf_encrypted_msg.c_str();
|
|
|
+ ciphertext_from_decryptor_length = protobuf_encrypted_msg.msg().length();
|
|
|
+ ciphertext_from_decryptor = protobuf_encrypted_msg.msg().c_str();
|
|
|
|
|
|
|
|
|
- internal_return_status = aes_gcm_wrapper(0, ciphertext_from_decryptor, ciphertext_from_decryptor_length,
|
|
|
+ internal_return_status = aes_gcm_wrapper(0, (unsigned char*) ciphertext_from_decryptor, ciphertext_from_decryptor_length,
|
|
|
op_plaintext, op_plaintext_length
|
|
|
);
|
|
|
if(internal_return_status != 0)
|
|
|
return internal_return_status;
|
|
|
-
|
|
|
+*/
|
|
|
return 0;
|
|
|
}
|