I'm writing some code that has to be well behaved both inside and outside an SGX enclave. To that end, it would be useful to have some way to determine at runtime whether or not the code is executing inside an enclave or not. Unfortunately, after searching the documentation, I haven't been able to find a way to do this.
TL:DR; I'm looking for a bool in_sgx_context()
function which I can use to steer application behaviour depending on whether or not my code is running inside a secure enclave or not.