- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
While developing the enclave in simulation mode, it'd be productive to allow printf for debugging. I see that is isn't a part of libsgx_tstdc.a. Also, a part of my enclave code has been sourced from Torch which calls printf, exit etc to perform error handling. Performing error handling when SGX_MODE=SIM would also make the development productive. I have added appropriate fences to not include the error handling code when SGX_MODE=HW.
Please suggest include and link flags that would link the enclave to use the system libraries to enable these error handling routines.
Thanks,
Sanjay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can try this prototype I created on Linux (limited testing on Ubuntu 16.04): https://github.com/haitaohuang/linux-sgx/commit/a5605b7f42bf772baa8e1f0010dce8a488cb3e88
It modifies the Makefile in SampleEnclave that comes with SDK. Please be aware error handling is critical for security sensitive code. So this is only for prototyping and debugging purpose. You probably need replace error handling logic with trusted libs in real HW mode for production, not just compile them out.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can try this prototype I created on Linux (limited testing on Ubuntu 16.04): https://github.com/haitaohuang/linux-sgx/commit/a5605b7f42bf772baa8e1f0010dce8a488cb3e88
It modifies the Makefile in SampleEnclave that comes with SDK. Please be aware error handling is critical for security sensitive code. So this is only for prototyping and debugging purpose. You probably need replace error handling logic with trusted libs in real HW mode for production, not just compile them out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Huang !
Thanks for the code !!
I've implemented printf inside the enclave by,
- Applying the formatting through the internally provided vsnprintf.
- Printing the resulting string by passing it to printf or puts through an OCALL.
exit can be implemented through similar means.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page