intel / sgx-ra-sample

Other
178 stars 65 forks source link

Entry point sgx_get_quote_ex could not find while run in windows #31

Closed Jim8y closed 4 years ago

Jim8y commented 5 years ago

The problem is because of calling the function sgx_ra_get_msg1, but I can't go further.

The whole error message is: The procedure entry point sgx_get_quote_ex could not be located in the dynamic link library

jmechalas commented 5 years ago

Which version of the Platform Software do you have installed? The minimum version is 2.5 as this function did not exist prior to that.

Jim8y commented 5 years ago

Which version of the Platform Software do you have installed? The minimum version is 2.5 as this function did not exist prior to that.

Thank you for your reply. It must be the version reason then, I just checked my PSW version, which is 2.4.

jmechalas commented 5 years ago

Actually, I am mistaken. The most recent Windows version is 2.4. It's possible we included a function in the distribution that wasn't yet released in the Windows package. I am investigating this now.

Jim8y commented 5 years ago

Actually, I am mistaken. The most recent Windows version is 2.4. It's possible we included a function in the distribution that wasn't yet released in the Windows package. I am investigating this now.

Thank you for your timely reply. But this project works fine in my ubuntu machine, the error shows only when I run it in my windows 10 64bit platform

jmechalas commented 5 years ago

And I just verified that it works on Win 10 64-bit here, on both machines I tested. We aren't calling sgx_get_quote_ex() directly, either, though I believe sgx_get_quote() does call sgx_get_quote_ex() internally. Have you tried cleaning your project in VS and rebuilding? This feels like it might be stale object file issue, but that's just a guess.

Jim8y commented 5 years ago

Haven’t done that yet, will try.

From: John Mechalas notifications@github.com Sent: Monday, August 26, 2019 4:18 PM To: intel/sgx-ra-sample sgx-ra-sample@noreply.github.com Cc: Jinghui Liao jinghui@wayne.edu; Author author@noreply.github.com Subject: Re: [intel/sgx-ra-sample] Entry point sgx_get_quote_ex could not find while run in windows (#31)

And I just verified that it works on Win 10 64-bit here, on both machines I tested. We aren't calling sgx_get_quote_ex() directly, either, though I believe sgx_get_quote() does call sgx_get_quote_ex() internally. Have you tried cleaning your project in VS and rebuilding? This feels like it might be stale object file issue, but that's just a guess.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/intel/sgx-ra-sample/issues/31?email_source=notifications&email_token=ACNXVR3WWAKY2UBQM3O5QFTQGQ3BHA5CNFSM4IPET2BKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FRRGA#issuecomment-525015192, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACNXVR5R2J6NRAY2UUVMC63QGQ3BHANCNFSM4IPET2BA.

labramusic commented 5 years ago

I am having the same problem and rebuilding the solution did not help. I cannot run the server as well, as running run-server.cmd prints the error message "IAS Subscription Key must be 32-byte hex string", which confuses me because the command it invokes specifies a 32-byte hex string of all zeros with "sp.exe -i -j -s 00000000000000000000000000000000 ..."

jmechalas commented 5 years ago

OK. I need to dig into this some more, then. @labramusic your error about the SPID is probably a bug in the hex parser. Even though a SPID of all 0's is not a "true" SPID, it should still parse like one.

What version of Windows 10 do the two of you have? You can run "ver" from the command prompt to get this.

labramusic commented 5 years ago

I am running Microsoft Windows Version 10.0.17763.678

loreum commented 5 years ago

I've run into the same issue with Intel SGX SDK for Windows v2.4.100.51291. It looks like sgx_get_quote_ex() is exported in sgx_uae_service.lib, which references sgx_uae_service.dll found in SysWOW64. sgx_uae_service.dll does not have sgx_get_quote_ex() entry. Below's the exported functions list (from DLL Export Viewer). So it appears that the linker is happy but at runtime, the Dll loader breaks. sgx_get_quote_ex() is, however, defined in the sim dll.

close_session_ocall 0x10001b20 0x00001b20 7 (0x7) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
close_sessionocall 0x10001b20 0x00001b20 12 (0xc) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
create_session_ocall 0x10001800 0x00001800 8 (0x8) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
create_sessionocall 0x10001800 0x00001800 10 (0xa) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
exchange_report_ocall 0x10001980 0x00001980 9 (0x9) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
exchange_reportocall 0x10001980 0x00001980 11 (0xb) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
get_launch_token 0x10001000 0x00001000 15 (0xf) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
get_launchtoken 0x10001000 0x00001000 1 (0x1) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
invoke_service_ocall 0x10001c70 0x00001c70 16 (0x10) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
invoke_serviceocall 0x10001c70 0x00001c70 13 (0xd) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_calc_quote_size 0x10002860 0x00002860 17 (0x11) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_calc_quotesize 0x10002860 0x00002860 14 (0xe) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_enable_device 0x10002290 0x00002290 18 (0x12) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_enabledevice 0x10002290 0x00002290 20 (0x14) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_extended_epid_group_id 0x10004a10 0x00004a10 19 (0x13) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_extended_epid_groupid 0x10004a10 0x00004a10 25 (0x19) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_ps_cap 0x10001550 0x00001550 27 (0x1b) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_pscap 0x10001550 0x00001550 6 (0x6) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_quote 0x10001360 0x00001360 28 (0x1c) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_getquote 0x10001360 0x00001360 3 (0x3) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_quote_size 0x10002910 0x00002910 29 (0x1d) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_quotesize 0x10002910 0x00002910 2 (0x2) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_whitelist 0x10001ed0 0x00001ed0 30 (0x1e) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_getwhitelist 0x10001ed0 0x00001ed0 24 (0x18) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_whitelist_size 0x10001df0 0x00001df0 31 (0x1f) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_get_whitelistsize 0x10001df0 0x00001df0 23 (0x17) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_init_quote 0x100011e0 0x000011e0 32 (0x20) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_initquote 0x100011e0 0x000011e0 4 (0x4) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_register_wl_cert_chaina 0x10002760 0x00002760 33 (0x21) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_register_wl_certchaina 0x10002760 0x00002760 22 (0x16) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_register_wl_cert_chainw 0x10002660 0x00002660 34 (0x22) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_register_wl_certchainw 0x10002660 0x00002660 21 (0x15) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_report_attestation_status 0x10001680 0x00001680 35 (0x23) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_report_attestationstatus 0x10001680 0x00001680 5 (0x5) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_switch_extended_epid_group 0x10004d20 0x00004d20 36 (0x24) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function
sgx_switch_extended_epidgroup 0x10004d20 0x00004d20 26 (0x1a) sgx_uae_service.dll C:\Windows\SysWOW64\sgx_uae_service.dll Exported Function

jmechalas commented 5 years ago

Just posting a note to say we haven't forgotten about this. I've not been able to reproduce it yet but I have some theories still and am spinning up Win 10 builds with various configurations to try and test them out.

loreum commented 5 years ago

Thank you for looking into this. BTW, Linux builds run fine and the example produces the desired results.

khiemfle commented 5 years ago

FYI, I have got the same problem on Windows 10 with the method sgx_get_quote_ex at the version SGX 2.4.100.51291. But after upgrading to 2.5.100.2, the problem was fixed. My Windows 10 version is the build 17763.

jmechalas commented 5 years ago

I am pretty sure this has come down to a conflict between SDK builds and PSW software. This may be complicated by changes to how the PSW is installed, too. Prior to Windows 10 RS3, you had to install the PSW manually using an EXE or INF installer. RS3 and beyond, Windows Update actually takes care of installation of the PSW, and keeps it up to date as well.

What's not clear to me is what happens when you have a system that started pre-RS3 with the "old" installer. Do you have to manually migrate that system to an INF installer, or will Windows update do that for you? I will take this question to the SGX SDK team.

loreum commented 5 years ago

I can confirm that 2.5.100.2 resolves the issue on Win 10 1903. Build 18362.356

  1. Installed latest Intel ME updates. Apparently PSW drivers have not been included yet in the ME update, so proceeded with the manual update.
  2. Offline Installation. executed the following commands:   pnputil /add-driver sgx_base.inf /install pnputil /add-driver sgx_psw.inf /install
jmechalas commented 4 years ago

This has been fixed. The PSW on Windows broke some of the .libs into smaller chunks, including adding sgx_quote_ex.lib.