|
@@ -41,16 +41,11 @@
|
|
|
|
|
|
|
|
|
|
//Handle the request from Source Enclave for a session
|
|
//Handle the request from Source Enclave for a session
|
|
-uint32_t LocalAttestationTrusted::session_request(sgx_dh_msg1_t *dh_msg1, uint32_t *session_id)
|
|
|
|
|
|
+uint32_t LocalAttestationTrusted::session_request(sgx_dh_msg1_t *dh_msg1)
|
|
{
|
|
{
|
|
sgx_dh_session_t sgx_dh_session;
|
|
sgx_dh_session_t sgx_dh_session;
|
|
sgx_status_t status = SGX_SUCCESS;
|
|
sgx_status_t status = SGX_SUCCESS;
|
|
|
|
|
|
- if(!session_id || !dh_msg1)
|
|
|
|
- {
|
|
|
|
- return INVALID_PARAMETER_ERROR;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
//Intialize the session as a session responder
|
|
//Intialize the session as a session responder
|
|
status = sgx_dh_init_session(SGX_DH_SESSION_RESPONDER, &sgx_dh_session);
|
|
status = sgx_dh_init_session(SGX_DH_SESSION_RESPONDER, &sgx_dh_session);
|
|
if(SGX_SUCCESS != status)
|
|
if(SGX_SUCCESS != status)
|
|
@@ -58,8 +53,6 @@ uint32_t LocalAttestationTrusted::session_request(sgx_dh_msg1_t *dh_msg1, uint32
|
|
return status;
|
|
return status;
|
|
}
|
|
}
|
|
|
|
|
|
- *session_id=1;
|
|
|
|
-
|
|
|
|
global_session_info.status = IN_PROGRESS;
|
|
global_session_info.status = IN_PROGRESS;
|
|
|
|
|
|
//Generate Message1 that will be returned to Source Enclave
|
|
//Generate Message1 that will be returned to Source Enclave
|
|
@@ -74,7 +67,7 @@ uint32_t LocalAttestationTrusted::session_request(sgx_dh_msg1_t *dh_msg1, uint32
|
|
|
|
|
|
// TODO: Hope to edit the sgx_dh_responder_proc_msg2 call to return 32 byte key.
|
|
// TODO: Hope to edit the sgx_dh_responder_proc_msg2 call to return 32 byte key.
|
|
//Verify Message 2, generate Message3 and exchange Message 3 with Source Enclave
|
|
//Verify Message 2, generate Message3 and exchange Message 3 with Source Enclave
|
|
-uint32_t LocalAttestationTrusted::exchange_report(sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *dh_msg3, uint32_t* session_id)
|
|
|
|
|
|
+uint32_t LocalAttestationTrusted::exchange_report(sgx_dh_msg2_t *dh_msg2, sgx_dh_msg3_t *dh_msg3)
|
|
{
|
|
{
|
|
sgx_key_128bit_t dh_aek;
|
|
sgx_key_128bit_t dh_aek;
|
|
uint32_t status = 0;
|
|
uint32_t status = 0;
|
|
@@ -83,11 +76,8 @@ uint32_t LocalAttestationTrusted::exchange_report(sgx_dh_msg2_t *dh_msg2, sgx_dh
|
|
uint32_t verify_return;
|
|
uint32_t verify_return;
|
|
memset(&dh_aek,0, sizeof(sgx_key_128bit_t));
|
|
memset(&dh_aek,0, sizeof(sgx_key_128bit_t));
|
|
|
|
|
|
- if(!dh_msg2 || !dh_msg3)
|
|
|
|
- return INVALID_PARAMETER_ERROR;
|
|
|
|
-
|
|
|
|
if(global_session_info.status != IN_PROGRESS)
|
|
if(global_session_info.status != IN_PROGRESS)
|
|
- return INVALID_SESSION; // end_session(); // TODO: DA FUQ RETURN STH HERE.
|
|
|
|
|
|
+ return INVALID_SESSION;
|
|
|
|
|
|
memcpy(&sgx_dh_session, &global_session_info.in_progress.dh_session, sizeof(sgx_dh_session_t));
|
|
memcpy(&sgx_dh_session, &global_session_info.in_progress.dh_session, sizeof(sgx_dh_session_t));
|
|
|
|
|
|
@@ -103,13 +93,5 @@ uint32_t LocalAttestationTrusted::exchange_report(sgx_dh_msg2_t *dh_msg2, sgx_dh
|
|
if(verify_return != 0)
|
|
if(verify_return != 0)
|
|
return verify_return;
|
|
return verify_return;
|
|
|
|
|
|
- /*
|
|
|
|
- //save the session ID, status and initialize the session nonce
|
|
|
|
- global_session_info.session_id = *session_id;
|
|
|
|
- global_session_info.status = ACTIVE; // This means that you can't keep calling exchange_report over and over again.
|
|
|
|
- global_session_info.active.counter = 0;
|
|
|
|
- memcpy(&global_session_info.active.AEK, &dh_aek, sizeof(sgx_key_128bit_t));
|
|
|
|
- memset(&dh_aek,0, sizeof(sgx_key_128bit_t));
|
|
|
|
- */
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|