|
@@ -707,8 +707,8 @@ uint32_t unseal_signing_key_pair_from_disk(int fd, __attribute__((unused)) sgx_
|
|
free(sgx_sealed_msg);
|
|
free(sgx_sealed_msg);
|
|
return ret_status;
|
|
return ret_status;
|
|
}
|
|
}
|
|
-
|
|
|
|
-uint32_t create_and_seal_signing_key_pair_to_disk(int fd, sgx_ec256_public_t* pub_key, uint32_t* actual_sealed_msg_length)
|
|
|
|
|
|
+*/
|
|
|
|
+uint32_t create_and_seal_signing_key_pair_to_disk( __attribute__((unused)) int fd, sgx_ec256_public_t* pub_key, uint32_t* actual_sealed_msg_length)
|
|
{
|
|
{
|
|
uint32_t ret_status;
|
|
uint32_t ret_status;
|
|
// Generating a signing ECDSA key to sign the encryption key.
|
|
// Generating a signing ECDSA key to sign the encryption key.
|
|
@@ -719,7 +719,7 @@ uint32_t create_and_seal_signing_key_pair_to_disk(int fd, sgx_ec256_public_t* pu
|
|
printf("%x bytes for sealed msg\n", *actual_sealed_msg_length); fflush(stdout);
|
|
printf("%x bytes for sealed msg\n", *actual_sealed_msg_length); fflush(stdout);
|
|
uint8_t* sealed_data=(uint8_t*) malloc(*actual_sealed_msg_length);
|
|
uint8_t* sealed_data=(uint8_t*) malloc(*actual_sealed_msg_length);
|
|
printf("Made call to sgx_calc_sealed_data_size\n"); fflush(stdout);
|
|
printf("Made call to sgx_calc_sealed_data_size\n"); fflush(stdout);
|
|
- Decryptor_create_and_seal_ecdsa_signing_key_pair(e2_enclave_id, &ret_status, (sgx_ec256_public_t*)pub_key, actual_sealed_msg_length, sealed_data);
|
|
|
|
|
|
+ Decryptor_create_and_seal_ecdsa_signing_key_pair(e2_enclave_id, &ret_status, pub_key, actual_sealed_msg_length, sealed_data);
|
|
if(ret_status != SGX_SUCCESS)
|
|
if(ret_status != SGX_SUCCESS)
|
|
{
|
|
{
|
|
printf("create_and_seal called returned an error: %x", ret_status);
|
|
printf("create_and_seal called returned an error: %x", ret_status);
|
|
@@ -727,11 +727,11 @@ uint32_t create_and_seal_signing_key_pair_to_disk(int fd, sgx_ec256_public_t* pu
|
|
return 0xFFFFFFFF;
|
|
return 0xFFFFFFFF;
|
|
}
|
|
}
|
|
printf("It returned sgx_success\n"); fflush(stdout);
|
|
printf("It returned sgx_success\n"); fflush(stdout);
|
|
- ret_status = write_to_fd(fd, sealed_data, actual_sealed_msg_length);
|
|
|
|
|
|
+/* ret_status = write_to_fd(fd, sealed_data, actual_sealed_msg_length);
|
|
free(sealed_data);
|
|
free(sealed_data);
|
|
- return ret_status;
|
|
|
|
|
|
+ return ret_status;*/ return 0;
|
|
}
|
|
}
|
|
-*/
|
|
|
|
|
|
+
|
|
int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[])
|
|
int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[])
|
|
{
|
|
{
|
|
uint32_t ret_status;
|
|
uint32_t ret_status;
|
|
@@ -740,10 +740,10 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[])
|
|
int launch_token_updated;
|
|
int launch_token_updated;
|
|
sgx_launch_token_t launch_token;
|
|
sgx_launch_token_t launch_token;
|
|
// uint8_t* pub_key = (uint8_t*) malloc(2*SGX_ECP256_KEY_SIZE);
|
|
// uint8_t* pub_key = (uint8_t*) malloc(2*SGX_ECP256_KEY_SIZE);
|
|
-// sgx_ec256_public_t pub_key;
|
|
|
|
|
|
+ sgx_ec256_public_t pub_key;
|
|
|
|
|
|
|
|
|
|
- // uint32_t actual_sealed_msg_length;
|
|
|
|
|
|
+ uint32_t actual_sealed_msg_length;
|
|
status = sgx_create_enclave(Decryptor_PATH, SGX_DEBUG_FLAG, &launch_token, &launch_token_updated, &e2_enclave_id, NULL);
|
|
status = sgx_create_enclave(Decryptor_PATH, SGX_DEBUG_FLAG, &launch_token, &launch_token_updated, &e2_enclave_id, NULL);
|
|
if(status != SGX_SUCCESS)
|
|
if(status != SGX_SUCCESS)
|
|
{
|
|
{
|
|
@@ -758,7 +758,7 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[])
|
|
printf("local attestation did not successfully return: %x\n", ret_status); fflush(stdout); return 0xFFFFFFFF;
|
|
printf("local attestation did not successfully return: %x\n", ret_status); fflush(stdout); return 0xFFFFFFFF;
|
|
|
|
|
|
}
|
|
}
|
|
-/* int sealed_signing_key_fd = open("sealed_signing_key.txt", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
|
|
|
|
|
+ int sealed_signing_key_fd = open("sealed_signing_key.txt", O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
|
if(sealed_signing_key_fd == -1)
|
|
if(sealed_signing_key_fd == -1)
|
|
{
|
|
{
|
|
perror("\nError in opening the file sealed_signing_key.txt - ");
|
|
perror("\nError in opening the file sealed_signing_key.txt - ");
|
|
@@ -784,7 +784,7 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[])
|
|
printf("\n Generated the ecdsa key pair successfully - gx, gy\n");
|
|
printf("\n Generated the ecdsa key pair successfully - gx, gy\n");
|
|
fflush(stdout);
|
|
fflush(stdout);
|
|
}
|
|
}
|
|
- else {
|
|
|
|
|
|
+/* else {
|
|
start = lseek(sealed_signing_key_fd, 0, SEEK_CUR);
|
|
start = lseek(sealed_signing_key_fd, 0, SEEK_CUR);
|
|
if(actual_sealed_msg_length == 0)
|
|
if(actual_sealed_msg_length == 0)
|
|
actual_sealed_msg_length = end - start;
|
|
actual_sealed_msg_length = end - start;
|