Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ hal-test:
cd examples/hal-test && cargo build --release
cp examples/hal-test/target/wasm32-wasip1/release/hal-test.wasm build/hal-test.wasm

platform-test:
cd examples/platform-test && cargo build --release
cp examples/platform-test/target/wasm32-wasip1/release/platform-test.wasm build/platform-test.wasm

attestation-test:
cd examples/attestation-test && cargo build --release
cp examples/attestation-test/target/wasm32-wasip1/release/attestation-test.wasm build/attestation-test.wasm

help:
@echo "Usage: make <target>"
@echo ""
Expand Down
2 changes: 1 addition & 1 deletion embed-proplet/modules/wamr/wasm-micro-runtime
Submodule wasm-micro-runtime updated 65 files
+4 −4 .github/workflows/codeql.yml
+1 −1 .github/workflows/spec_test_on_nuttx.yml
+2 −2 .github/workflows/supply_chain.yml
+1 −1 .github/workflows/wamr_wasi_extensions.yml
+3 −7 .gitignore
+1 −2 build-scripts/config_common.cmake
+0 −400 ci/install_sgx_for_applicaiton_developer.sh
+1 −1 core/iwasm/aot/aot_loader.c
+1 −4 core/iwasm/aot/aot_runtime.c
+4 −13 core/iwasm/common/wasm_c_api.c
+5 −18 core/iwasm/interpreter/wasm_interp_classic.c
+0 −10 core/iwasm/interpreter/wasm_loader.c
+0 −3 core/iwasm/libraries/lib-wasi-threads/tid_allocator.c
+1 −1 core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
+4 −18 core/iwasm/libraries/wasi-nn/src/wasi_nn_llamacpp.c
+6 −4 core/shared/mem-alloc/ems/ems_kfc.c
+14 −29 core/shared/platform/include/platform_wasi_types.h
+8 −12 core/shared/platform/zephyr/zephyr_file.c
+1 −2 product-mini/platforms/linux-sgx/enclave-sample/Enclave/Enclave.config.xml
+11 −278 product-mini/platforms/linux-sgx/enclave-sample/Enclave/Enclave.cpp
+0 −1 product-mini/platforms/linux-sgx/enclave-sample/Enclave/Enclave.edl
+7 −2 tests/fuzz/wasm-mutator-fuzz/aot-compiler/CMakeLists.txt
+8 −44 tests/fuzz/wasm-mutator-fuzz/aot-compiler/aot_compiler_fuzz.cc
+0 −145 tests/fuzz/wasm-mutator-fuzz/common/fuzzer_common.cc
+0 −77 tests/fuzz/wasm-mutator-fuzz/common/fuzzer_common.h
+0 −1 tests/fuzz/wasm-mutator-fuzz/sanitizer_flags.cmake
+2 −4 tests/fuzz/wasm-mutator-fuzz/wasm-mutator/CMakeLists.txt
+181 −22 tests/fuzz/wasm-mutator-fuzz/wasm-mutator/wasm_mutator_fuzz.cc
+4 −40 tests/unit/CMakeLists.txt
+0 −14 tests/unit/common/test_helper.h
+20 −8 tests/unit/compilation/aot_compiler_test.cc
+18 −1 tests/unit/compilation/aot_emit_aot_file_test.cc
+18 −1 tests/unit/compilation/aot_emit_control_test.cc
+18 −1 tests/unit/compilation/aot_emit_function_test.cc
+18 −1 tests/unit/compilation/aot_emit_memory_test.cc
+18 −1 tests/unit/compilation/aot_emit_numberic_test.cc
+18 −1 tests/unit/compilation/aot_emit_parametric_test.cc
+18 −1 tests/unit/compilation/aot_emit_table_test.cc
+18 −1 tests/unit/compilation/aot_llvm_test.cc
+0 −40 tests/unit/exception-handling/CMakeLists.txt
+0 −161 tests/unit/exception-handling/exception_handling_test.cc
+0 −1 tests/unit/gc/CMakeLists.txt
+19 −12 tests/unit/gc/gc_test.cc
+ tests/unit/gc/wasm-apps/nested_array_elem_any.wasm
+0 −63 tests/unit/gc/wasm-apps/nested_array_elem_any.wat
+ tests/unit/gc/wasm-apps/nested_struct_field_any.wasm
+0 −55 tests/unit/gc/wasm-apps/nested_struct_field_any.wat
+6 −33 tests/unit/linear-memory-aot/build_aot.sh
+18 −1 tests/unit/linear-memory-aot/linear_memory_aot_test.cc
+22 −7 tests/unit/linear-memory-wasm/linear_memory_wasm_test.cc
+5 −0 tests/unit/linux-perf/CMakeLists.txt
+9 −3 tests/unit/linux-perf/test_sort_func_ptrs.cc
+2 −6 tests/unit/running-modes/CMakeLists.txt
+17 −1 tests/unit/running-modes/wasm_running_modes_test.cc
+18 −1 tests/unit/runtime-common/wasm_runtime_common_test.cc
+18 −1 tests/unit/runtime-common/wasm_runtime_init_test.cc
+5 −25 tests/unit/shared-heap/CMakeLists.txt
+49 −174 tests/unit/shared-heap/shared_heap_test.cc
+88 −50 tests/unit/shared-heap/wasm-apps/CMakeLists.txt
+0 −40 tests/unit/shared-heap/wasm-apps/bulk-memory/CMakeLists.txt
+57 −38 tests/unit/shared-heap/wasm-apps/memory64/CMakeLists.txt
+4 −0 tests/unit/tid-allocator/CMakeLists.txt
+16 −0 tests/unit/unit_common.cmake
+2 −0 tests/unit/wasm-c-api/CMakeLists.txt
+6 −120 tests/wamr-test-suites/spec-test-script/gc_ignore_cases.patch
7 changes: 7 additions & 0 deletions examples/attestation-test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions examples/attestation-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "attestation-test"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "attestation-test"
path = "src/main.rs"
53 changes: 53 additions & 0 deletions examples/attestation-test/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#[link(wasm_import_module = "elastic:attestation/hal")]
unsafe extern "C" {
#[link_name = "get-attestation"]
fn get_attestation(
nonce_ptr: i32,
nonce_len: i32,
out_ptr: i32,
out_len_ptr: i32,
) -> i32;
}

const BUF: usize = 4096;

fn hex(bytes: &[u8]) -> String {
bytes.iter().map(|b| format!("{b:02x}")).collect()
}

fn run() -> i32 {
let nonce: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let mut buf = [0u8; BUF];
let mut len: u32 = 0;
let rc = unsafe {
get_attestation(
nonce.as_ptr() as i32,
nonce.len() as i32,
buf.as_mut_ptr() as i32,
&mut len as *mut u32 as i32,
)
};
if rc < 0 {
eprintln!(
"get-attestation: FAILED (rc={}) msg={}",
rc,
String::from_utf8_lossy(&buf[..len as usize])
);
return 1;
}
println!("get-attestation: ok (report len={})", len);
println!("get-attestation report: {}", hex(&buf[..len as usize]));
0
}

#[no_mangle]
pub extern "C" fn run_export() -> i32 {
run()
}

fn main() {
let result = run();
if result != 0 {
eprintln!("attestation-test failed with exit code: {}", result);
}
}
7 changes: 7 additions & 0 deletions examples/platform-test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions examples/platform-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "platform-test"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "platform-test"
path = "src/main.rs"
77 changes: 77 additions & 0 deletions examples/platform-test/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#[link(wasm_import_module = "elastic:tee-hal/platform")]
unsafe extern "C" {
#[link_name = "platform-info"]
fn get_platform_info(out_ptr: i32, out_len_ptr: i32) -> i32;

fn attestation(
report_data_ptr: i32,
report_data_len: i32,
out_ptr: i32,
out_len_ptr: i32,
) -> i32;
}

const BUF: usize = 4096;

fn hex(bytes: &[u8]) -> String {
bytes.iter().map(|b| format!("{b:02x}")).collect()
}

fn run() -> i32 {
let mut ok = true;

{
let mut buf = [0u8; BUF];
let mut len: u32 = 0;
let rc =
unsafe { get_platform_info(buf.as_mut_ptr() as i32, &mut len as *mut u32 as i32) };
if rc < 0 {
eprintln!("get-platform-info: FAILED (rc={})", rc);
ok = false;
} else {
println!(
"get-platform-info: {}",
String::from_utf8_lossy(&buf[..len as usize])
);
}
}

{
let report_data = [0x42u8; 32];
let mut buf = [0u8; BUF];
let mut len: u32 = 0;
let rc = unsafe {
attestation(
report_data.as_ptr() as i32,
report_data.len() as i32,
buf.as_mut_ptr() as i32,
&mut len as *mut u32 as i32,
)
};
if rc < 0 {
eprintln!(
"attestation: FAILED (rc={}) msg={}",
rc,
String::from_utf8_lossy(&buf[..len as usize])
);
ok = false;
} else {
println!("attestation: ok (evidence len={})", len);
println!("attestation evidence: {}", hex(&buf[..len as usize]));
}
}

if ok { 0 } else { 1 }
}

#[no_mangle]
pub extern "C" fn run_export() -> i32 {
run()
}

fn main() {
let result = run();
if result != 0 {
eprintln!("platform-test failed with exit code: {}", result);
}
}