This is an automated email from the ASF dual-hosted git repository. ivila pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git
commit 217be941f48b5face8f078bd7a4c9e021cdfd6de Author: ivila <[email protected]> AuthorDate: Wed May 7 10:53:27 2025 +0800 examples: add build_with_optee_utee_sys Signed-off-by: Zehui Chen <[email protected]> Acked-by: Yuan Zhuang <[email protected]> --- README.md | 2 +- ci/ci.sh | 1 + docs/overview-of-optee-rust-examples.md | 1 + .../build_with_optee_utee_sys-rs/Makefile | 53 ++++++----------- .../build_with_optee_utee_sys-rs/host/Cargo.toml | 35 +++++++++++ .../build_with_optee_utee_sys-rs/host/Makefile | 61 +++++++------------ .../build_with_optee_utee_sys-rs/host/src/main.rs | 39 +++++++++++++ .../build_with_optee_utee_sys-rs/proto/Cargo.toml | 28 +++++++++ .../build_with_optee_utee_sys-rs/proto/src/lib.rs | 32 ++++++++++ .../build_with_optee_utee_sys-rs/ta/Cargo.toml | 50 ++++++++++++++++ examples/build_with_optee_utee_sys-rs/ta/Makefile | 48 +++++++++++++++ examples/build_with_optee_utee_sys-rs/ta/build.rs | 40 +++++++++++++ .../build_with_optee_utee_sys-rs/ta/src/main.rs | 68 ++++++++++++++++++++++ examples/build_with_optee_utee_sys-rs/uuid.txt | 1 + .../test_build_with_optee_utee_sys.sh | 56 ++++++++---------- 15 files changed, 404 insertions(+), 111 deletions(-) diff --git a/README.md b/README.md index f5f12b9..80833ad 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ branch (`main`), please refer to the - **`no-std`**: Excludes `test_serde`, `test_message_passing_interface`, `test_tls_client`, `test_tls_server`, `test_secure_db_abstraction`. -- **`std`**: Excludes `test_mnist_rs`. +- **`std`**: Excludes `test_mnist_rs`, `test_build_with_optee_utee_sys`. ## Quick Start with the OP-TEE Repo for QEMUv8 diff --git a/ci/ci.sh b/ci/ci.sh index 53ada6f..2b1501d 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -33,6 +33,7 @@ if [ "$STD" ]; then ./test_secure_db_abstraction.sh else ./test_mnist_rs.sh + ./test_build_with_optee_utee_sys.sh fi ./test_hello_world.sh diff --git a/docs/overview-of-optee-rust-examples.md b/docs/overview-of-optee-rust-examples.md index c440eb2..5580d71 100644 --- a/docs/overview-of-optee-rust-examples.md +++ b/docs/overview-of-optee-rust-examples.md @@ -37,3 +37,4 @@ To compile one of the examples, run `make -C examples/EXAMPLE_DIR`. | secure_db_abstraction-rs | `e55291e1-521c-4dca-aa24-51e34ab32ad9` | An abstraction of database base on Secure Storage. | | mnist-rs | Train: `1b5f5b74-e9cf-4e62-8c3e-7e41da6d76f6` <br/> Infer: `ff09aa8a-fbb9-4734-ae8c-d7cd1a3f6744` | Training and Performing Inference in Trusted Application. | | client_pool-rs | `c9d73f40-ba45-4315-92c4-cf1255958729` | Generic Client Session Pool. | +| build_with_optee_utee_sys-rs | `bcac6292-5b9d-4b20-a2e5-b389d5e8ae2f` | Using `optee_utee_sys` as `build-dependencies`, requires `workspace.resolver = "2"`, which is not supported in xargo, so no_std only. | diff --git a/ci/ci.sh b/examples/build_with_optee_utee_sys-rs/Makefile old mode 100755 new mode 100644 similarity index 50% copy from ci/ci.sh copy to examples/build_with_optee_utee_sys-rs/Makefile index 53ada6f..a7a3dec --- a/ci/ci.sh +++ b/examples/build_with_optee_utee_sys-rs/Makefile @@ -1,5 +1,3 @@ -#!/bin/bash - # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -17,42 +15,25 @@ # specific language governing permissions and limitations # under the License. -set -xe +# If _HOST or _TA specific compiler/target are not specified, then use common +# compiler/target for both +CROSS_COMPILE_HOST ?= aarch64-linux-gnu- +CROSS_COMPILE_TA ?= aarch64-linux-gnu- +TARGET_HOST ?= aarch64-unknown-linux-gnu +TARGET_TA ?= aarch64-unknown-linux-gnu -pushd ../tests +.PHONY: host ta all clean -# Prioritize running specialized test suites first, as they have a higher -# probability of detecting failures early in the pipeline. -# Run std only tests -if [ "$STD" ]; then - ./test_serde.sh - ./test_message_passing_interface.sh - ./test_tls_client.sh - ./test_tls_server.sh - ./test_eth_wallet.sh - ./test_secure_db_abstraction.sh -else - ./test_mnist_rs.sh -fi +all: host ta -./test_hello_world.sh -./test_random.sh -./test_secure_storage.sh -./test_aes.sh -./test_hotp.sh -./test_acipher.sh -./test_big_int.sh -./test_diffie_hellman.sh -./test_digest.sh -./test_authentication.sh -./test_time.sh -./test_signature_verification.sh -./test_supp_plugin.sh -./test_error_handling.sh -./test_tcp_client.sh -./test_udp_socket.sh -./test_client_pool.sh -./test_inter_ta.sh +host: + $(q)make -C host TARGET=$(TARGET_HOST) \ + CROSS_COMPILE=$(CROSS_COMPILE_HOST) +ta: + $(q)make -C ta TARGET=$(TARGET_TA) \ + CROSS_COMPILE=$(CROSS_COMPILE_TA) -popd +clean: + $(q)make -C host clean + $(q)make -C ta clean diff --git a/examples/build_with_optee_utee_sys-rs/host/Cargo.toml b/examples/build_with_optee_utee_sys-rs/host/Cargo.toml new file mode 100644 index 0000000..4cea1eb --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/host/Cargo.toml @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "build_with_optee_utee_sys-rs" +version = "0.4.0" +authors = ["Teaclave Contributors <[email protected]>"] +license = "Apache-2.0" +repository = "https://github.com/apache/incubator-teaclave-trustzone-sdk.git" +description = "An example of Rust OP-TEE TrustZone SDK." +edition = "2018" + +[dependencies] +proto = { path = "../proto" } +optee-teec = { path = "../../../optee-teec" } + +[profile.release] +lto = true + +[workspace] +resolver = "2" diff --git a/ci/ci.sh b/examples/build_with_optee_utee_sys-rs/host/Makefile old mode 100755 new mode 100644 similarity index 50% copy from ci/ci.sh copy to examples/build_with_optee_utee_sys-rs/host/Makefile index 53ada6f..4c46f6e --- a/ci/ci.sh +++ b/examples/build_with_optee_utee_sys-rs/host/Makefile @@ -1,5 +1,3 @@ -#!/bin/bash - # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information @@ -17,42 +15,23 @@ # specific language governing permissions and limitations # under the License. -set -xe - -pushd ../tests - -# Prioritize running specialized test suites first, as they have a higher -# probability of detecting failures early in the pipeline. -# Run std only tests -if [ "$STD" ]; then - ./test_serde.sh - ./test_message_passing_interface.sh - ./test_tls_client.sh - ./test_tls_server.sh - ./test_eth_wallet.sh - ./test_secure_db_abstraction.sh -else - ./test_mnist_rs.sh -fi - -./test_hello_world.sh -./test_random.sh -./test_secure_storage.sh -./test_aes.sh -./test_hotp.sh -./test_acipher.sh -./test_big_int.sh -./test_diffie_hellman.sh -./test_digest.sh -./test_authentication.sh -./test_time.sh -./test_signature_verification.sh -./test_supp_plugin.sh -./test_error_handling.sh -./test_tcp_client.sh -./test_udp_socket.sh -./test_client_pool.sh -./test_inter_ta.sh - - -popd +NAME := build_with_optee_utee_sys-rs + +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" + +OUT_DIR := $(CURDIR)/target/$(TARGET)/release + + +all: host strip + +host: + @cargo build --target $(TARGET_HOST) --release --config $(LINKER_CFG) -vv + +strip: host + @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) + +clean: + @cargo clean diff --git a/examples/build_with_optee_utee_sys-rs/host/src/main.rs b/examples/build_with_optee_utee_sys-rs/host/src/main.rs new file mode 100644 index 0000000..5b7e272 --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/host/src/main.rs @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use optee_teec::{Context, ErrorKind, Operation, ParamType, Session, Uuid}; +use optee_teec::{ParamNone, ParamValue}; +use proto::{Command, UUID}; + +fn inc_value(session: &mut Session) -> optee_teec::Result<u32> { + let p0 = ParamValue::new(0, 0, ParamType::ValueOutput); + let mut operation = Operation::new(0, p0, ParamNone, ParamNone, ParamNone); + session.invoke_command(Command::IncValue as u32, &mut operation)?; + Ok(operation.parameters().0.a()) +} + +fn main() -> optee_teec::Result<()> { + let mut ctx = Context::new()?; + let uuid = Uuid::parse_str(UUID).map_err(|_|ErrorKind::BadParameters)?; + // Ensure that multiple sessions can be opened concurrently. + let mut session1= ctx.open_session(uuid.clone())?; + let mut session2= ctx.open_session(uuid)?; + // Ensure that each session can successfully perform a call. + println!("result is: {}", inc_value(&mut session1)?); + println!("result is: {}", inc_value(&mut session2)?); + Ok(()) +} diff --git a/examples/build_with_optee_utee_sys-rs/proto/Cargo.toml b/examples/build_with_optee_utee_sys-rs/proto/Cargo.toml new file mode 100644 index 0000000..91066a3 --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/proto/Cargo.toml @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "proto" +version = "0.4.0" +authors = ["Teaclave Contributors <[email protected]>"] +license = "Apache-2.0" +repository = "https://github.com/apache/incubator-teaclave-trustzone-sdk.git" +description = "Data structures and functions shared by host and TA." +edition = "2018" + +[dependencies] +num_enum = { version = "0.7.3", default-features = false } diff --git a/examples/build_with_optee_utee_sys-rs/proto/src/lib.rs b/examples/build_with_optee_utee_sys-rs/proto/src/lib.rs new file mode 100644 index 0000000..0254bf8 --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/proto/src/lib.rs @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#![no_std] +use num_enum::{FromPrimitive, IntoPrimitive}; + +#[derive(FromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Command { + IncValue, + #[default] + Unknown, +} + +// If Uuid::parse_str() returns an InvalidLength error, there may be an extra +// newline in your uuid.txt file. You can remove it by running +// `truncate -s 36 uuid.txt`. +pub const UUID: &str = &include_str!("../../uuid.txt"); diff --git a/examples/build_with_optee_utee_sys-rs/ta/Cargo.toml b/examples/build_with_optee_utee_sys-rs/ta/Cargo.toml new file mode 100644 index 0000000..79ad025 --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/ta/Cargo.toml @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "ta" +version = "0.4.0" +authors = ["Teaclave Contributors <[email protected]>"] +license = "Apache-2.0" +repository = "https://github.com/apache/incubator-teaclave-trustzone-sdk.git" +description = "An example of Rust OP-TEE TrustZone SDK." +edition = "2021" + +[dependencies] +proto = { path = "../proto" } +optee-utee-sys = { path = "../../../optee-utee/optee-utee-sys" } +optee-utee = { path = "../../../optee-utee" } + +[build-dependencies] +proto = { path = "../proto" } +optee-utee-build = { path = "../../../optee-utee-build" } +optee-utee-sys = { path = "../../../optee-utee/optee-utee-sys", features = ["no_link"] } + +[profile.release] +panic = "abort" +lto = true +opt-level = 1 + +[workspace] +# We are using Rust edition 2018 and specify optee-utee-sys in both dependencies +# and build-dependencies, so we must set workspace.resolver = "2" to prevent +# feature unification. + +# For reference: +# 1. resolver version 2: https://doc.rust-lang.org/cargo/reference/resolver.html#feature-resolver-version-2 +# 2. resolver versions: https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions +resolver = "2" diff --git a/examples/build_with_optee_utee_sys-rs/ta/Makefile b/examples/build_with_optee_utee_sys-rs/ta/Makefile new file mode 100644 index 0000000..b32b1c0 --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/ta/Makefile @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +UUID ?= $(shell cat "../uuid.txt") + +TARGET ?= aarch64-unknown-linux-gnu +CROSS_COMPILE ?= aarch64-linux-gnu- +OBJCOPY := $(CROSS_COMPILE)objcopy +# Configure the linker to use GCC, which works on both cross-compilation and ARM machines +LINKER_CFG := target.$(TARGET).linker=\"$(CROSS_COMPILE)gcc\" + +TA_SIGN_KEY ?= $(TA_DEV_KIT_DIR)/keys/default_ta.pem +SIGN := $(TA_DEV_KIT_DIR)/scripts/sign_encrypt.py +OUT_DIR := $(CURDIR)/target/$(TARGET)/release + +ifeq ($(STD),) +all: ta strip sign +else +all: + @echo "Please \`unset STD\` then rerun \`source environment\` to build the No-STD version" +endif + +ta: + @cargo build --target $(TARGET) --release --config $(LINKER_CFG) $(EXTRA_FLAGS) + +strip: ta + @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta + +sign: strip + @$(SIGN) --uuid $(UUID) --key $(TA_SIGN_KEY) --in $(OUT_DIR)/stripped_ta --out $(OUT_DIR)/$(UUID).ta + @echo "SIGN => ${UUID}" + +clean: + @cargo clean diff --git a/examples/build_with_optee_utee_sys-rs/ta/build.rs b/examples/build_with_optee_utee_sys-rs/ta/build.rs new file mode 100644 index 0000000..f3ae50f --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/ta/build.rs @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use proto; +use optee_utee_build::{TaConfig, RustEdition, Error}; + +fn main() -> Result<(), Error> { + // For Rust editions 2018 and earlier, You must set workspace.resolver = "2" + // in your Cargo.toml to prevent feature unification of optee-utee-sys when + // it is used in both dependencies and build-dependencies. + // + // For editions after 2018, this setting is enabled by default and does not + // need to be specified. + // + // For reference: + // 1. resolver version 2: https://doc.rust-lang.org/cargo/reference/resolver.html#feature-resolver-version-2 + // 2. resolver versions: https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions + let flags: u32 = optee_utee_sys::TA_FLAG_SINGLE_INSTANCE | + optee_utee_sys::TA_FLAG_MULTI_SESSION | + optee_utee_sys::TA_FLAG_INSTANCE_KEEP_ALIVE; + + let config = TaConfig::new_default_with_cargo_env(proto::UUID)?. + ta_flags(flags); + optee_utee_build::build(RustEdition::Before2024, config) + +} diff --git a/examples/build_with_optee_utee_sys-rs/ta/src/main.rs b/examples/build_with_optee_utee_sys-rs/ta/src/main.rs new file mode 100644 index 0000000..4fb8b41 --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/ta/src/main.rs @@ -0,0 +1,68 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#![no_std] +#![no_main] + +use optee_utee::{ + ta_close_session, ta_create, ta_destroy, ta_invoke_command, ta_open_session, trace_println, +}; +use optee_utee::{Error, ErrorKind, Parameters, Result}; +use proto::Command; +use core::sync::atomic::{AtomicU32, Ordering}; + +static GLOBAL_VALUE: AtomicU32 = AtomicU32::new(0); + +#[ta_create] +fn create() -> Result<()> { + GLOBAL_VALUE.store(0, Ordering::Relaxed); + trace_println!("[+] TA create"); + Ok(()) +} + +#[ta_open_session] +fn open_session(_params: &mut Parameters) -> Result<()> { + trace_println!("[+] TA open session"); + Ok(()) +} + +#[ta_close_session] +fn close_session() { + trace_println!("[+] TA close session"); +} + +#[ta_destroy] +fn destroy() { + trace_println!("[+] TA destroy"); +} + +#[ta_invoke_command] +fn invoke_command(cmd_id: u32, params: &mut Parameters) -> Result<()> { + trace_println!("[+] TA invoke command"); + let mut values = unsafe { params.0.as_value()? }; + + match Command::from(cmd_id) { + Command::IncValue => { + let result = GLOBAL_VALUE.fetch_add(1, Ordering::Relaxed); + values.set_a(result); + Ok(()) + } + _ => Err(Error::new(ErrorKind::BadParameters)), + } +} + +include!(concat!(env!("OUT_DIR"), "/user_ta_header.rs")); diff --git a/examples/build_with_optee_utee_sys-rs/uuid.txt b/examples/build_with_optee_utee_sys-rs/uuid.txt new file mode 100644 index 0000000..44bb538 --- /dev/null +++ b/examples/build_with_optee_utee_sys-rs/uuid.txt @@ -0,0 +1 @@ +bcac6292-5b9d-4b20-a2e5-b389d5e8ae2f \ No newline at end of file diff --git a/ci/ci.sh b/tests/test_build_with_optee_utee_sys.sh similarity index 50% copy from ci/ci.sh copy to tests/test_build_with_optee_utee_sys.sh index 53ada6f..55afd94 100755 --- a/ci/ci.sh +++ b/tests/test_build_with_optee_utee_sys.sh @@ -19,40 +19,30 @@ set -xe -pushd ../tests +# Include base script +source setup.sh -# Prioritize running specialized test suites first, as they have a higher -# probability of detecting failures early in the pipeline. -# Run std only tests -if [ "$STD" ]; then - ./test_serde.sh - ./test_message_passing_interface.sh - ./test_tls_client.sh - ./test_tls_server.sh - ./test_eth_wallet.sh - ./test_secure_db_abstraction.sh -else - ./test_mnist_rs.sh -fi +# Copy TA and host binary +cp ../examples/build_with_optee_utee_sys-rs/ta/target/$TARGET_TA/release/*.ta shared +cp ../examples/build_with_optee_utee_sys-rs/host/target/$TARGET_HOST/release/build_with_optee_utee_sys-rs shared -./test_hello_world.sh -./test_random.sh -./test_secure_storage.sh -./test_aes.sh -./test_hotp.sh -./test_acipher.sh -./test_big_int.sh -./test_diffie_hellman.sh -./test_digest.sh -./test_authentication.sh -./test_time.sh -./test_signature_verification.sh -./test_supp_plugin.sh -./test_error_handling.sh -./test_tcp_client.sh -./test_udp_socket.sh -./test_client_pool.sh -./test_inter_ta.sh +# Run script specific commands in QEMU +run_in_qemu "cp *.ta /lib/optee_armtz/\n" +# Run command twice, ensure the instance are keeping alive. +run_in_qemu "./build_with_optee_utee_sys-rs\n" +run_in_qemu "./build_with_optee_utee_sys-rs\n" +run_in_qemu "^C" +# Script specific checks +{ + grep -q "result is: 0" screenlog.0 && + grep -q "result is: 1" screenlog.0 && + grep -q "result is: 2" screenlog.0 && + grep -q "result is: 3" screenlog.0 +} || { + cat -v screenlog.0 + cat -v /tmp/serial.log + false +} -popd +rm screenlog.0 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
