|
@@ -1,4 +1,4 @@
|
|
|
-localAttestation.verifier_mr_enclave
|
|
|
+
|
|
|
* Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
|
|
|
*
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -31,29 +31,9 @@ localAttestation.verifier_mr_enclave
|
|
|
|
|
|
|
|
|
|
|
|
-#include "sgx_eid.h"
|
|
|
-#include "sgx_tcrypto.h"
|
|
|
-#include "Decryptor_t.h"
|
|
|
-#include "EnclaveMessageExchange.h"
|
|
|
-#include "error_codes.h"
|
|
|
-#include "sgx_thread.h"
|
|
|
-#include "sgx_dh.h"
|
|
|
-#include <map>
|
|
|
-#include "sgx_tcrypto.h"
|
|
|
-#include "LocalAttestationCode_t.h"
|
|
|
-#include "sgx_tseal.h"
|
|
|
-#include "Openssl_crypto.h"
|
|
|
-
|
|
|
-#include "sgx_tseal.h"
|
|
|
-
|
|
|
-
|
|
|
-static class Decryptor {
|
|
|
- uint8_t apache_mrsigner[32];
|
|
|
- ECDSASignatureBox signatureBox;
|
|
|
- HybridEncryptionBox hybridEncryptionBoxClient;
|
|
|
- LocalAttestationTrusted localAttestation;
|
|
|
-
|
|
|
- uint32_t create_mitigator_token_M(uint8_t* token)
|
|
|
+#include "Decryptor.h"
|
|
|
+
|
|
|
+ uint32_t Decryptor::create_mitigator_token_M(uint8_t* token)
|
|
|
{
|
|
|
uint32_t internal_return_status;
|
|
|
uint32_t counter;
|
|
@@ -71,7 +51,7 @@ static class Decryptor {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- uint32_t create_mitigator_header_H(uint8_t* signature_data, uint8_t* signature)
|
|
|
+ uint32_t Decryptor::create_mitigator_header_H(uint8_t* signature_data, uint8_t* signature)
|
|
|
{
|
|
|
uint32_t internal_return_status;
|
|
|
uint8_t local_signature[64];
|
|
@@ -94,7 +74,7 @@ static class Decryptor {
|
|
|
}
|
|
|
|
|
|
|
|
|
- uint32_t create_long_term_signing_keypair(uint8_t* private_public_key_string)
|
|
|
+ uint32_t Decryptor::create_long_term_signing_keypair(uint8_t* private_public_key_string)
|
|
|
{
|
|
|
uint32_t internal_return_status;
|
|
|
internal_return_status = signatureBox.generate_keypair();
|
|
@@ -108,7 +88,7 @@ static class Decryptor {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- uint32_t initialize_symmetric_key_decrypt_client_data(uint8_t* plaintext_client_public_key_plus_encrypted_data_plus_tag, uint32_t total_length, uint8_t* plaintext_client_data, uint32_t* plaintext_client_data_length)
|
|
|
+ uint32_t Decryptor::initialize_symmetric_key_decrypt_client_data(uint8_t* plaintext_client_public_key_plus_encrypted_data_plus_tag, uint32_t total_length, uint8_t* plaintext_client_data, uint32_t* plaintext_client_data_length)
|
|
|
{
|
|
|
uint8_t* ciphertext;
|
|
|
uint32_t ciphertext_length;
|
|
@@ -127,12 +107,9 @@ static class Decryptor {
|
|
|
return internal_return_status;
|
|
|
}
|
|
|
|
|
|
- public:
|
|
|
- Decryptor(): signatureBox(), hybridEncryptionBoxClient(), localAttestation();
|
|
|
- ~Decryptor();
|
|
|
|
|
|
|
|
|
- uint32_t create_and_seal_long_term_signing_key_pair(uint32_t* sealed_data_length, uint8_t* sealed_data)
|
|
|
+ uint32_t Decryptor::create_and_seal_long_term_signing_key_pair(uint32_t* sealed_data_length, uint8_t* sealed_data)
|
|
|
{
|
|
|
uint32_t sgx_libcall_status;
|
|
|
uint32_t internal_return_status;
|
|
@@ -162,7 +139,7 @@ static class Decryptor {
|
|
|
}
|
|
|
|
|
|
|
|
|
- uint32_t create_and_encrypt_mitigator_header_H(uint8_t* ciphertext_token_H_plus_tag)
|
|
|
+ uint32_t Decryptor::create_and_encrypt_mitigator_header_H(uint8_t* ciphertext_token_H_plus_tag)
|
|
|
{
|
|
|
uint32_t counter;
|
|
|
uint8_t sign_data_and_sign[signatureBox.ECDH_PUBLIC_KEY_SIZE + 32 + 64];
|
|
@@ -195,7 +172,7 @@ static class Decryptor {
|
|
|
}
|
|
|
|
|
|
|
|
|
- uint32_t unseal_and_restore_long_term_signing_key_pair(uint8_t* sealed_data, uint32_t* sgx_sealed_data_length)
|
|
|
+ uint32_t Decryptor::unseal_and_restore_long_term_signing_key_pair(uint8_t* sealed_data, uint32_t* sgx_sealed_data_length)
|
|
|
{
|
|
|
uint32_t temp_plaintext_length;
|
|
|
uint8_t* temp_plaintext;
|
|
@@ -226,7 +203,7 @@ static class Decryptor {
|
|
|
}
|
|
|
|
|
|
|
|
|
- uint32_t decrypt_verifiers_message_set_apache_mrsigner(uint8_t* ciphertext_plus_tag)
|
|
|
+ uint32_t Decryptor::decrypt_verifiers_message_set_apache_mrsigner(uint8_t* ciphertext_plus_tag)
|
|
|
{
|
|
|
uint8_t temp_apache_mrsigner[32+10];
|
|
|
uint32_t temp_apache_mrsigner_length;
|
|
@@ -249,7 +226,7 @@ static class Decryptor {
|
|
|
}
|
|
|
|
|
|
|
|
|
- uint32_t process_apache_message_generate_response(uint8_t* input_ciphertext, uint32_t input_ciphertext_plus_tag_length, uint8_t* output_ciphertext, uint32_t* output_ciphertext_plus_tag_length)
|
|
|
+ uint32_t Decryptor::process_apache_message_generate_response(uint8_t* input_ciphertext, uint32_t input_ciphertext_plus_tag_length, uint8_t* output_ciphertext, uint32_t* output_ciphertext_plus_tag_length)
|
|
|
{
|
|
|
uint8_t* first_decryption_output, plaintext_client_data, temp_output_ciphertext;
|
|
|
uint32_t first_decryption_output_length, plaintext_client_data_length, temp_output_ciphertext_plus_tag_length, internal_return_status;
|
|
@@ -285,4 +262,4 @@ static class Decryptor {
|
|
|
free(temp_output_ciphertext);
|
|
|
return 0;
|
|
|
}
|
|
|
- };
|
|
|
+
|