Skip to content

Commit 77ede05

Browse files
Bug fix: report data mismatch (#99)
1 parent 752d43f commit 77ede05

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

enclave/src/c_api/c_api.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ int get_remote_report_with_pubkey_and_nonce(
317317

318318
#else
319319
uint8_t report_data[CIPHER_PK_SIZE + CIPHER_IV_SIZE];
320-
std::copy(public_key, public_key + CIPHER_PK_SIZE, report_data);
321-
std::copy(enclave_nonce, enclave_nonce + CIPHER_IV_SIZE, report_data + CIPHER_PK_SIZE);
322-
if (generate_remote_report(report_data, CIPHER_PK_SIZE + CIPHER_IV_SIZE + CIPHER_KEY_SIZE, &report, &report_size)) {
320+
memcpy(report_data, public_key, CIPHER_PK_SIZE);
321+
memcpy(report_data + CIPHER_PK_SIZE, enclave_nonce, CIPHER_IV_SIZE);
322+
if (generate_remote_report(report_data, CIPHER_PK_SIZE + CIPHER_IV_SIZE, &report, &report_size)) {
323323
// Allocate memory on the host and copy the report over.
324324
*remote_report = (uint8_t*)oe_host_malloc(report_size);
325325
if (*remote_report == NULL) {

host/src/c_api/c_api.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,8 +1459,8 @@ XGB_DLL int verify_remote_report_and_set_pubkey_and_nonce(
14591459
// Attest the remote report and accompanying key.
14601460
size_t key_and_nonce_size = key_size + nonce_size;
14611461
uint8_t key_and_nonce[key_and_nonce_size];
1462-
memcpy(key_and_nonce, pem_key, CIPHER_KEY_SIZE);
1463-
memcpy(key_and_nonce + CIPHER_KEY_SIZE, nonce, CIPHER_IV_SIZE);
1462+
memcpy(key_and_nonce, pem_key, CIPHER_PK_SIZE);
1463+
memcpy(key_and_nonce + CIPHER_PK_SIZE, nonce, CIPHER_IV_SIZE);
14641464
if (!attest_remote_report(remote_report, remote_report_size, key_and_nonce, key_and_nonce_size)) {
14651465
std::cout << "verify_report_and_set_pubkey_and_nonce failed." << std::endl;
14661466
return -1;

0 commit comments

Comments
 (0)