Create module hash for each module in SGX lib-rats (#1745)

Current SGX lib-rats wasm module hash is stored in a global buffer,
which may be overwritten if there are multiple wasm module loadings.
We move the module hash into the enclave module to resolve the issue.

And rename the SGX_IPFS macro/variable in Makefile and Enclave.edl to
make the code more consistent.

And refine the sgx-ra sample document.
This commit is contained in:
Wenyong Huang
2022-11-24 21:48:50 +08:00
committed by GitHub
parent 1032aac60b
commit 29b76dd275
12 changed files with 131 additions and 26 deletions

View File

@ -357,6 +357,17 @@ wasm_runtime_load_from_sections(wasm_section_list_t section_list, bool is_aot,
WASM_RUNTIME_API_EXTERN void
wasm_runtime_unload(wasm_module_t module);
/**
* Get the module hash of a WASM module, currently only available on
* linux-sgx platform when the remote attestation feature is enabled
*
* @param module the WASM module to retrieve
*
* @return the module hash of the WASM module
*/
char *
wasm_runtime_get_module_hash(wasm_module_t module);
/**
* Set WASI parameters.
*
@ -444,6 +455,16 @@ wasm_runtime_instantiate(const wasm_module_t module,
WASM_RUNTIME_API_EXTERN void
wasm_runtime_deinstantiate(wasm_module_inst_t module_inst);
/**
* Get WASM module from WASM module instance
*
* @param module_inst the WASM module instance to retrieve
*
* @return the WASM module
*/
WASM_RUNTIME_API_EXTERN wasm_module_t
wasm_runtime_get_module(wasm_module_inst_t module_inst);
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_is_wasi_mode(wasm_module_inst_t module_inst);