I am using the local attestation in the SDK. I have modified it and using it as a client-server application. The client has its own enclave and the server has it own enclave. They both exchange some data. The workflow is as follows.
1. Client sends create_session requests and server replies.
2. Client send exchange_report request and the server replies.
3. Client sends some message through its enclave by encryption.
4. The server sends the same msg to its enclave , decrypts it and reads the message.
The 3rd step goes on like a million times, and when the session counter meets the below condition, I am closing the session and creating a new session.
session_info->active.counter == ((2^32)-2)
In my experiment this condition is also met several times, may be 100s of times, but after like 4 minutes, when the client tries to close the session and restart it, on the server side the function responsible for exchange_report() fails. The below code fails with the error "SGX_ERROR_UNEXPECTED".
//Process message 2 from source enclave and obtain message 3 sgx_status_t se_ret = sgx_dh_responder_proc_msg2(dh_msg2, dh_msg3, &sgx_dh_session, &dh_aek, &initiator_identity);
Does anyone faced this issue before ?