Skip to content

Commit 4baa19d

Browse files
committed
Fix signature verification error in sgx_report_attestation_status
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>
1 parent bcd3c27 commit 4baa19d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

psw/ae/aesm_service/source/upse/u_certificate_provisioning.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,15 +700,21 @@ ae_error_t pib_verify_signature(platform_info_blob_wrapper_t& piBlobWrapper)
700700
//BREAK_IF_TRUE((sizeof(publicKey) != sizeof(s_pib_pub_key_big_endian)), ae_err, AE_FAILURE);
701701
//BREAK_IF_TRUE((sizeof(signature) != sizeof(piBlobWrapper.platform_info_blob.signature)), ae_err, AE_FAILURE);
702702

703+
// convert the public key to little endian
703704
if(0!=memcpy_s(&publicKey, sizeof(publicKey), s_pib_pub_key_big_endian, sizeof(s_pib_pub_key_big_endian))){
704705
ae_err = AE_FAILURE;
705706
break;
706707
}
708+
SwapEndian_32B(((uint8_t*)&publicKey) + 0);
709+
SwapEndian_32B(((uint8_t*)&publicKey) + 32);
707710

711+
// convert the signature to little endian
708712
if(0!=memcpy_s(&signature, sizeof(signature), &piBlobWrapper.platform_info_blob.signature, sizeof(piBlobWrapper.platform_info_blob.signature))){
709713
ae_err = AE_FAILURE;
710714
break;
711715
}
716+
SwapEndian_32B(((uint8_t*)&signature) + 0);
717+
SwapEndian_32B(((uint8_t*)&signature) + 32);
712718

713719
sgx_status = sgx_ecc256_open_context(&ecc_handle);
714720
BREAK_IF_TRUE((SGX_SUCCESS != sgx_status), ae_err, AE_FAILURE);

0 commit comments

Comments
 (0)