Skip to content

Commit

Permalink
Fix signature verification error in sgx_report_attestation_status
Browse files Browse the repository at this point in the history
In 2.4.0, sgx_report_attestation_status always returns SGX_ERROR_INVALID_PARAMETER due to oal_map_result returns AESM_PLATFORM_INFO_BLOB_INVALID_SIG. The problem is caused by a change in u_certificate_provisioning.cpp, removing essential endian conversion. This commit aims at reverting this change and making sgx_report_attestation_status works again.

One test case on my testbed: 1502006500000800000202020401800000000000000000000007000006000000020000000000000B0D292FE7F0F37C075567E227A454318D29A3E94F035693794FADECD6C31606DE989858BF7FB718A096B52A90EFCD50270C9A0A2F4500CFAC159DD44EAA2C014179

Signed-off-by: Yu Ding <dingelish@gmail.com>
  • Loading branch information
dingelish committed Dec 31, 2018
1 parent bcd3c27 commit 4baa19d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -700,15 +700,21 @@ ae_error_t pib_verify_signature(platform_info_blob_wrapper_t& piBlobWrapper)
//BREAK_IF_TRUE((sizeof(publicKey) != sizeof(s_pib_pub_key_big_endian)), ae_err, AE_FAILURE);
//BREAK_IF_TRUE((sizeof(signature) != sizeof(piBlobWrapper.platform_info_blob.signature)), ae_err, AE_FAILURE);

// convert the public key to little endian
if(0!=memcpy_s(&publicKey, sizeof(publicKey), s_pib_pub_key_big_endian, sizeof(s_pib_pub_key_big_endian))){
ae_err = AE_FAILURE;
break;
}
SwapEndian_32B(((uint8_t*)&publicKey) + 0);
SwapEndian_32B(((uint8_t*)&publicKey) + 32);

// convert the signature to little endian
if(0!=memcpy_s(&signature, sizeof(signature), &piBlobWrapper.platform_info_blob.signature, sizeof(piBlobWrapper.platform_info_blob.signature))){
ae_err = AE_FAILURE;
break;
}
SwapEndian_32B(((uint8_t*)&signature) + 0);
SwapEndian_32B(((uint8_t*)&signature) + 32);

sgx_status = sgx_ecc256_open_context(&ecc_handle);
BREAK_IF_TRUE((SGX_SUCCESS != sgx_status), ae_err, AE_FAILURE);
Expand Down

0 comments on commit 4baa19d

Please sign in to comment.