This is an automated email from the ASF dual-hosted git repository. yuanz pushed a commit to branch release-v0.3.0 in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-trustzone-sdk.git
commit 7ca860d83b102cba0b443eaf1f04c4557c99315b Author: Yuan Zhuang <[email protected]> AuthorDate: Thu Jun 27 12:40:28 2024 +0000 cargo fmt --- Makefile | 2 +- examples/acipher-rs/host/Makefile | 3 ++ examples/acipher-rs/ta/Cargo.lock | 11 ++----- examples/acipher-rs/ta/Makefile | 3 ++ examples/acipher-rs/ta/build.rs | 2 +- examples/aes-rs/host/Makefile | 2 +- examples/aes-rs/ta/Cargo.lock | 11 ++----- examples/aes-rs/ta/Makefile | 3 ++ examples/aes-rs/ta/build.rs | 2 +- examples/aes-rs/ta/src/main.rs | 9 ++++-- examples/authentication-rs/host/Makefile | 3 ++ examples/authentication-rs/ta/Cargo.lock | 11 ++----- examples/authentication-rs/ta/Makefile | 3 ++ examples/authentication-rs/ta/build.rs | 2 +- examples/authentication-rs/ta/src/main.rs | 17 +++++------ examples/big_int-rs/host/Makefile | 3 ++ examples/big_int-rs/ta/Cargo.lock | 11 ++----- examples/big_int-rs/ta/Makefile | 3 ++ examples/big_int-rs/ta/build.rs | 2 +- examples/diffie_hellman-rs/host/Makefile | 3 ++ examples/diffie_hellman-rs/host/src/main.rs | 10 +++---- examples/diffie_hellman-rs/ta/Cargo.lock | 11 ++----- examples/diffie_hellman-rs/ta/Makefile | 3 ++ examples/diffie_hellman-rs/ta/build.rs | 2 +- examples/diffie_hellman-rs/ta/src/main.rs | 4 +-- examples/digest-rs/host/Makefile | 3 ++ examples/digest-rs/ta/Cargo.lock | 11 ++----- examples/digest-rs/ta/Makefile | 3 ++ examples/digest-rs/ta/build.rs | 2 +- examples/hello_world-rs/host/Makefile | 3 ++ examples/hello_world-rs/host/src/main.rs | 2 +- examples/hello_world-rs/ta/Makefile | 3 ++ examples/hello_world-rs/ta/build.rs | 2 +- examples/hotp-rs/host/Makefile | 3 ++ examples/hotp-rs/ta/Cargo.lock | 11 ++----- examples/hotp-rs/ta/Makefile | 3 ++ examples/hotp-rs/ta/build.rs | 2 +- .../message_passing_interface-rs/host/Makefile | 3 ++ .../message_passing_interface-rs/host/src/main.rs | 15 +++++----- .../message_passing_interface-rs/ta/Cargo.lock | 11 ++----- examples/message_passing_interface-rs/ta/Makefile | 3 ++ examples/message_passing_interface-rs/ta/build.rs | 2 +- .../message_passing_interface-rs/ta/src/main.rs | 14 ++++----- examples/random-rs/host/Makefile | 3 ++ examples/random-rs/ta/Cargo.lock | 11 ++----- examples/random-rs/ta/Makefile | 3 ++ examples/random-rs/ta/build.rs | 2 +- examples/random-rs/ta/src/main.rs | 4 +-- examples/secure_storage-rs/host/Makefile | 3 ++ examples/secure_storage-rs/ta/Cargo.lock | 11 ++----- examples/secure_storage-rs/ta/Makefile | 3 ++ examples/secure_storage-rs/ta/build.rs | 2 +- examples/secure_storage-rs/ta/src/main.rs | 4 +-- examples/serde-rs/host/Makefile | 3 ++ examples/serde-rs/host/src/main.rs | 7 ++--- examples/serde-rs/ta/Cargo.lock | 11 ++----- examples/serde-rs/ta/Makefile | 3 ++ examples/serde-rs/ta/build.rs | 2 +- examples/serde-rs/ta/src/main.rs | 4 +-- examples/signature_verification-rs/host/Makefile | 3 ++ examples/signature_verification-rs/ta/Cargo.lock | 11 ++----- examples/signature_verification-rs/ta/Makefile | 3 ++ examples/supp_plugin-rs/host/Makefile | 3 ++ examples/supp_plugin-rs/host/src/main.rs | 4 +-- examples/supp_plugin-rs/plugin/Makefile | 3 ++ examples/supp_plugin-rs/plugin/build.rs | 2 +- examples/supp_plugin-rs/plugin/src/lib.rs | 21 ++++++++----- examples/supp_plugin-rs/ta/Cargo.lock | 11 ++----- examples/supp_plugin-rs/ta/Makefile | 3 ++ examples/supp_plugin-rs/ta/build.rs | 2 +- examples/supp_plugin-rs/ta/src/main.rs | 21 ++++++++----- examples/tcp_client-rs/host/Makefile | 3 ++ examples/tcp_client-rs/host/src/main.rs | 4 +-- examples/tcp_client-rs/ta/Cargo.lock | 11 ++----- examples/tcp_client-rs/ta/Makefile | 3 ++ examples/tcp_client-rs/ta/build.rs | 2 +- examples/tcp_client-rs/ta/src/main.rs | 6 ++-- examples/time-rs/host/Makefile | 3 ++ examples/time-rs/ta/Cargo.lock | 11 ++----- examples/time-rs/ta/Makefile | 3 ++ examples/time-rs/ta/build.rs | 2 +- examples/time-rs/ta/src/main.rs | 5 +++- examples/tls_client-rs/host/Makefile | 3 ++ examples/tls_client-rs/ta/Cargo.lock | 7 +---- examples/tls_client-rs/ta/Cargo.toml | 4 --- examples/tls_client-rs/ta/Makefile | 3 ++ examples/tls_client-rs/ta/src/main.rs | 35 ++++++++-------------- examples/tls_server-rs/host/Makefile | 3 ++ examples/tls_server-rs/ta/Makefile | 3 ++ examples/udp_socket-rs/host/Makefile | 3 ++ examples/udp_socket-rs/host/src/main.rs | 10 ++++--- examples/udp_socket-rs/ta/Cargo.lock | 11 ++----- examples/udp_socket-rs/ta/Makefile | 3 ++ examples/udp_socket-rs/ta/build.rs | 2 +- examples/udp_socket-rs/ta/src/main.rs | 2 +- rust-toolchain.toml | 1 + 96 files changed, 285 insertions(+), 253 deletions(-) diff --git a/Makefile b/Makefile index f614a9d..263328b 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ OPTEE_CLIENT_FLAGS ?= CROSS_COMPILE="$(CCACHE) $(AARCH_CROSS_COMPILE)" \ optee-client: make -C $(OPTEE_CLIENT_PATH) $(OPTEE_CLIENT_FLAGS) -examples: $(EXAMPLES) toolchains optee-os optee-client +examples: toolchains optee-os optee-client $(EXAMPLES) $(EXAMPLES): make -C $@ diff --git a/examples/acipher-rs/host/Makefile b/examples/acipher-rs/host/Makefile index 37bf3d4..33d86f0 100644 --- a/examples/acipher-rs/host/Makefile +++ b/examples/acipher-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/acipher-rs/ta/Cargo.lock b/examples/acipher-rs/ta/Cargo.lock index eebf7fd..0be02ab 100644 --- a/examples/acipher-rs/ta/Cargo.lock +++ b/examples/acipher-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/acipher-rs/ta/Makefile b/examples/acipher-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/acipher-rs/ta/Makefile +++ b/examples/acipher-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/acipher-rs/ta/build.rs b/examples/acipher-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/acipher-rs/ta/build.rs +++ b/examples/acipher-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/aes-rs/host/Makefile b/examples/aes-rs/host/Makefile index 7f436aa..448c672 100644 --- a/examples/aes-rs/host/Makefile +++ b/examples/aes-rs/host/Makefile @@ -36,7 +36,7 @@ OUT_DIR := $(CURDIR)/target/$(TARGET)/release all: host strip host: - @cargo build --target $(TARGET) --release + @cargo fmt && cargo build --target $(TARGET) --release strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/aes-rs/ta/Cargo.lock b/examples/aes-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/aes-rs/ta/Cargo.lock +++ b/examples/aes-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/aes-rs/ta/Makefile b/examples/aes-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/aes-rs/ta/Makefile +++ b/examples/aes-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/aes-rs/ta/build.rs b/examples/aes-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/aes-rs/ta/build.rs +++ b/examples/aes-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/aes-rs/ta/src/main.rs b/examples/aes-rs/ta/src/main.rs index 6719ed8..01464ee 100644 --- a/examples/aes-rs/ta/src/main.rs +++ b/examples/aes-rs/ta/src/main.rs @@ -17,11 +17,11 @@ #![no_main] +use optee_utee::is_algorithm_supported; use optee_utee::{ ta_close_session, ta_create, ta_destroy, ta_invoke_command, ta_open_session, trace_println, }; -use optee_utee::{is_algorithm_supported}; -use optee_utee::{AlgorithmId, ElementId, Cipher, OperationMode}; +use optee_utee::{AlgorithmId, Cipher, ElementId, OperationMode}; use optee_utee::{AttributeId, AttributeMemref, TransientObject, TransientObjectType}; use optee_utee::{Error, ErrorKind, Parameters, Result}; use proto::{Algo, Command, KeySize, Mode}; @@ -119,7 +119,10 @@ pub fn alloc_resources(aes: &mut AesCipher, params: &mut Parameters) -> Result<( aes.key_size = ta2tee_key_size(key_size_value).unwrap(); // check whether the algorithm is supported - is_algorithm_supported(ta2tee_algo_id(algo_value).unwrap() as u32, ElementId::ElementNone as u32)?; + is_algorithm_supported( + ta2tee_algo_id(algo_value).unwrap() as u32, + ElementId::ElementNone as u32, + )?; aes.cipher = Cipher::allocate( ta2tee_algo_id(algo_value).unwrap(), diff --git a/examples/authentication-rs/host/Makefile b/examples/authentication-rs/host/Makefile index f74911e..e1d968c 100644 --- a/examples/authentication-rs/host/Makefile +++ b/examples/authentication-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/authentication-rs/ta/Cargo.lock b/examples/authentication-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/authentication-rs/ta/Cargo.lock +++ b/examples/authentication-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/authentication-rs/ta/Makefile b/examples/authentication-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/authentication-rs/ta/Makefile +++ b/examples/authentication-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/authentication-rs/ta/build.rs b/examples/authentication-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/authentication-rs/ta/build.rs +++ b/examples/authentication-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/authentication-rs/ta/src/main.rs b/examples/authentication-rs/ta/src/main.rs index 3e8c529..effdae6 100644 --- a/examples/authentication-rs/ta/src/main.rs +++ b/examples/authentication-rs/ta/src/main.rs @@ -33,9 +33,7 @@ pub struct AEOp { impl Default for AEOp { fn default() -> Self { - Self { - op: AE::null() - } + Self { op: AE::null() } } } @@ -126,7 +124,7 @@ pub fn encrypt_final(digest: &mut AEOp, params: &mut Parameters) -> Result<()> { let mut p0 = unsafe { params.0.as_memref().unwrap() }; let mut p1 = unsafe { params.1.as_memref().unwrap() }; let mut p2 = unsafe { params.2.as_memref().unwrap() }; - + let mut clear = vec![0; p0.buffer().len() as usize]; clear.copy_from_slice(p0.buffer()); let mut ciph = vec![0; p1.buffer().len() as usize]; @@ -135,15 +133,14 @@ pub fn encrypt_final(digest: &mut AEOp, params: &mut Parameters) -> Result<()> { tag.copy_from_slice(p2.buffer()); match digest.op.encrypt_final(&clear, &mut ciph, &mut tag) { - Err(e) => Err(e), Ok((_ciph_len, _tag_len)) => { p0.buffer().copy_from_slice(&clear); p1.buffer().copy_from_slice(&ciph); p2.buffer().copy_from_slice(&tag); - + Ok(()) - }, + } } } @@ -151,7 +148,7 @@ pub fn decrypt_final(digest: &mut AEOp, params: &mut Parameters) -> Result<()> { let mut p0 = unsafe { params.0.as_memref().unwrap() }; let mut p1 = unsafe { params.1.as_memref().unwrap() }; let mut p2 = unsafe { params.2.as_memref().unwrap() }; - + let mut clear = vec![0; p0.buffer().len() as usize]; clear.copy_from_slice(p0.buffer()); let mut ciph = vec![0; p1.buffer().len() as usize]; @@ -166,8 +163,8 @@ pub fn decrypt_final(digest: &mut AEOp, params: &mut Parameters) -> Result<()> { p1.buffer().copy_from_slice(&ciph); p2.buffer().copy_from_slice(&tag); - Ok(()) - }, + Ok(()) + } } } diff --git a/examples/big_int-rs/host/Makefile b/examples/big_int-rs/host/Makefile index 9f618d1..bfd95d3 100644 --- a/examples/big_int-rs/host/Makefile +++ b/examples/big_int-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/big_int-rs/ta/Cargo.lock b/examples/big_int-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/big_int-rs/ta/Cargo.lock +++ b/examples/big_int-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/big_int-rs/ta/Makefile b/examples/big_int-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/big_int-rs/ta/Makefile +++ b/examples/big_int-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/big_int-rs/ta/build.rs b/examples/big_int-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/big_int-rs/ta/build.rs +++ b/examples/big_int-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/diffie_hellman-rs/host/Makefile b/examples/diffie_hellman-rs/host/Makefile index 4253125..563d30f 100644 --- a/examples/diffie_hellman-rs/host/Makefile +++ b/examples/diffie_hellman-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/diffie_hellman-rs/host/src/main.rs b/examples/diffie_hellman-rs/host/src/main.rs index 687b6bb..0163e5f 100644 --- a/examples/diffie_hellman-rs/host/src/main.rs +++ b/examples/diffie_hellman-rs/host/src/main.rs @@ -21,11 +21,11 @@ use proto::{Command, KEY_SIZE, UUID}; fn generate_key(session: &mut Session) -> Result<(Vec<u8>, Vec<u8>)> { // Pass in the prime and base - let prime_base_vec = [0xB6, 0x73, 0x91, 0xB5, 0xD6, 0xBC, 0x95, 0x73, - 0x0D, 0x53, 0x64, 0x13, 0xB0, 0x51, 0xC6, 0xB4, - 0xEB, 0x9D, 0x74, 0x57, 0x8D, 0x65, 0x3A, 0x4B, - 0x7A, 0xB2, 0x93, 0x27, 0xA6, 0xC1, 0xBC, 0xAB, - 5]; + let prime_base_vec = [ + 0xB6, 0x73, 0x91, 0xB5, 0xD6, 0xBC, 0x95, 0x73, 0x0D, 0x53, 0x64, 0x13, 0xB0, 0x51, 0xC6, + 0xB4, 0xEB, 0x9D, 0x74, 0x57, 0x8D, 0x65, 0x3A, 0x4B, 0x7A, 0xB2, 0x93, 0x27, 0xA6, 0xC1, + 0xBC, 0xAB, 5, + ]; let p0 = ParamTmpRef::new_input(&prime_base_vec); // Save public and private key size let p1 = ParamValue::new(0, 0, ParamType::ValueOutput); diff --git a/examples/diffie_hellman-rs/ta/Cargo.lock b/examples/diffie_hellman-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/diffie_hellman-rs/ta/Cargo.lock +++ b/examples/diffie_hellman-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/diffie_hellman-rs/ta/Makefile b/examples/diffie_hellman-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/diffie_hellman-rs/ta/Makefile +++ b/examples/diffie_hellman-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/diffie_hellman-rs/ta/build.rs b/examples/diffie_hellman-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/diffie_hellman-rs/ta/build.rs +++ b/examples/diffie_hellman-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/diffie_hellman-rs/ta/src/main.rs b/examples/diffie_hellman-rs/ta/src/main.rs index 7582ed3..71cd4db 100644 --- a/examples/diffie_hellman-rs/ta/src/main.rs +++ b/examples/diffie_hellman-rs/ta/src/main.rs @@ -67,8 +67,8 @@ fn generate_key(dh: &mut DiffieHellman, params: &mut Parameters) -> Result<()> { // Extract prime and base from parameters let prime_base_vec = p0.buffer(); - let prime_slice = &prime_base_vec[..KEY_SIZE/8]; - let base_slice = &prime_base_vec[KEY_SIZE/8..]; + let prime_slice = &prime_base_vec[..KEY_SIZE / 8]; + let base_slice = &prime_base_vec[KEY_SIZE / 8..]; let attr_prime = AttributeMemref::from_ref(AttributeId::DhPrime, prime_slice); let attr_base = AttributeMemref::from_ref(AttributeId::DhBase, base_slice); diff --git a/examples/digest-rs/host/Makefile b/examples/digest-rs/host/Makefile index 617b85b..9690439 100644 --- a/examples/digest-rs/host/Makefile +++ b/examples/digest-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/digest-rs/ta/Cargo.lock b/examples/digest-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/digest-rs/ta/Cargo.lock +++ b/examples/digest-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/digest-rs/ta/Makefile b/examples/digest-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/digest-rs/ta/Makefile +++ b/examples/digest-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/digest-rs/ta/build.rs b/examples/digest-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/digest-rs/ta/build.rs +++ b/examples/digest-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/hello_world-rs/host/Makefile b/examples/hello_world-rs/host/Makefile index bf46340..b094cc4 100644 --- a/examples/hello_world-rs/host/Makefile +++ b/examples/hello_world-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/hello_world-rs/host/src/main.rs b/examples/hello_world-rs/host/src/main.rs index cfa0e0c..ab88127 100644 --- a/examples/hello_world-rs/host/src/main.rs +++ b/examples/hello_world-rs/host/src/main.rs @@ -17,7 +17,7 @@ use optee_teec::{Context, Operation, ParamType, Session, Uuid}; use optee_teec::{ParamNone, ParamValue}; -use proto::{UUID, Command}; +use proto::{Command, UUID}; fn hello_world(session: &mut Session) -> optee_teec::Result<()> { let p0 = ParamValue::new(29, 0, ParamType::ValueInout); diff --git a/examples/hello_world-rs/ta/Makefile b/examples/hello_world-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/hello_world-rs/ta/Makefile +++ b/examples/hello_world-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/hello_world-rs/ta/build.rs b/examples/hello_world-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/hello_world-rs/ta/build.rs +++ b/examples/hello_world-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/hotp-rs/host/Makefile b/examples/hotp-rs/host/Makefile index fdde1c7..c555ddd 100644 --- a/examples/hotp-rs/host/Makefile +++ b/examples/hotp-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/hotp-rs/ta/Cargo.lock b/examples/hotp-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/hotp-rs/ta/Cargo.lock +++ b/examples/hotp-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/hotp-rs/ta/Makefile b/examples/hotp-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/hotp-rs/ta/Makefile +++ b/examples/hotp-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/hotp-rs/ta/build.rs b/examples/hotp-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/hotp-rs/ta/build.rs +++ b/examples/hotp-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/message_passing_interface-rs/host/Makefile b/examples/message_passing_interface-rs/host/Makefile index 61ef2b6..d4ff504 100644 --- a/examples/message_passing_interface-rs/host/Makefile +++ b/examples/message_passing_interface-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/message_passing_interface-rs/host/src/main.rs b/examples/message_passing_interface-rs/host/src/main.rs index d1c287f..0ba6b8e 100644 --- a/examples/message_passing_interface-rs/host/src/main.rs +++ b/examples/message_passing_interface-rs/host/src/main.rs @@ -15,25 +15,23 @@ // specific language governing permissions and limitations // under the License. +use optee_teec::{Context, Operation, ParamNone, ParamTmpRef, ParamType, ParamValue, Uuid}; use proto; use url; -use optee_teec::{Context, Uuid, ParamType, ParamTmpRef, ParamValue, ParamNone, Operation}; type Result<T> = optee_teec::Result<T>; pub struct EnclaveClient { uuid: String, context: optee_teec::Context, - buffer: Vec<u8> + buffer: Vec<u8>, } impl EnclaveClient { pub fn open(url: &str) -> Result<Self> { let url = url::Url::parse(url).unwrap(); match url.scheme() { - "trustzone-enclave" => { - Self::open_uuid(url.host_str().unwrap()) - }, + "trustzone-enclave" => Self::open_uuid(url.host_str().unwrap()), _ => unimplemented!(), } } @@ -43,7 +41,7 @@ impl EnclaveClient { Ok(Self { uuid: uuid.to_string(), context: context, - buffer: vec![0; 128] + buffer: vec![0; 128], }) } @@ -62,7 +60,8 @@ impl EnclaveClient { session.invoke_command(command_id, &mut operation)?; let len = operation.parameters().2.a() as usize; - let output: proto::EnclaveOutput = proto::serde_json::from_slice(&self.buffer[0..len]).unwrap(); + let output: proto::EnclaveOutput = + proto::serde_json::from_slice(&self.buffer[0..len]).unwrap(); Ok(output) } } @@ -72,7 +71,7 @@ fn main() -> optee_teec::Result<()> { let mut enclave = EnclaveClient::open(&url).unwrap(); let input = proto::EnclaveInput { command: proto::Command::Hello, - message: String::from("World!") + message: String::from("World!"), }; let output = enclave.invoke(&input).unwrap(); println!("{:?}", output); diff --git a/examples/message_passing_interface-rs/ta/Cargo.lock b/examples/message_passing_interface-rs/ta/Cargo.lock index dedbee4..a69b2d4 100644 --- a/examples/message_passing_interface-rs/ta/Cargo.lock +++ b/examples/message_passing_interface-rs/ta/Cargo.lock @@ -24,18 +24,13 @@ checksum = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -53,7 +48,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -164,7 +159,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/message_passing_interface-rs/ta/Makefile b/examples/message_passing_interface-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/message_passing_interface-rs/ta/Makefile +++ b/examples/message_passing_interface-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/message_passing_interface-rs/ta/build.rs b/examples/message_passing_interface-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/message_passing_interface-rs/ta/build.rs +++ b/examples/message_passing_interface-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/message_passing_interface-rs/ta/src/main.rs b/examples/message_passing_interface-rs/ta/src/main.rs index c8f1616..e8877ec 100644 --- a/examples/message_passing_interface-rs/ta/src/main.rs +++ b/examples/message_passing_interface-rs/ta/src/main.rs @@ -21,23 +21,23 @@ 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 std::io::Write; use proto::{self, Command}; +use std::io::Write; fn handle_invoke(command: Command, input: proto::EnclaveInput) -> Result<proto::EnclaveOutput> { match command { Command::Hello => { let output = proto::EnclaveOutput { - message: format!("Hello, {}", input.message) + message: format!("Hello, {}", input.message), }; Ok(output) - }, + } Command::Bye => { let output = proto::EnclaveOutput { - message: format!("Bye, {}", input.message) + message: format!("Bye, {}", input.message), }; Ok(output) - }, + } _ => Err(Error::new(ErrorKind::BadParameters)), } } @@ -67,8 +67,8 @@ fn destroy() { #[ta_invoke_command] fn invoke_command(cmd_id: u32, params: &mut Parameters) -> Result<()> { trace_println!("[+] TA invoke command"); - let mut p0 = unsafe { params.0.as_memref().unwrap()}; - let mut p1 = unsafe { params.1.as_memref().unwrap()}; + let mut p0 = unsafe { params.0.as_memref().unwrap() }; + let mut p1 = unsafe { params.1.as_memref().unwrap() }; let mut p2 = unsafe { params.2.as_value().unwrap() }; let input: proto::EnclaveInput = proto::serde_json::from_slice(p0.buffer()).unwrap(); diff --git a/examples/random-rs/host/Makefile b/examples/random-rs/host/Makefile index 663ed11..53ff00d 100644 --- a/examples/random-rs/host/Makefile +++ b/examples/random-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/random-rs/ta/Cargo.lock b/examples/random-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/random-rs/ta/Cargo.lock +++ b/examples/random-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/random-rs/ta/Makefile b/examples/random-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/random-rs/ta/Makefile +++ b/examples/random-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/random-rs/ta/build.rs b/examples/random-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/random-rs/ta/build.rs +++ b/examples/random-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/random-rs/ta/src/main.rs b/examples/random-rs/ta/src/main.rs index 110a03a..bf93167 100644 --- a/examples/random-rs/ta/src/main.rs +++ b/examples/random-rs/ta/src/main.rs @@ -17,11 +17,11 @@ #![no_main] +use optee_utee::Random; 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 optee_utee::{Random}; use proto::Command; #[ta_create] @@ -47,7 +47,7 @@ fn destroy() { } pub fn random_number_generate(params: &mut Parameters) -> Result<()> { - let mut p = unsafe { params.0.as_memref().unwrap()}; + let mut p = unsafe { params.0.as_memref().unwrap() }; let mut buf = vec![0; p.buffer().len() as usize]; buf.copy_from_slice(p.buffer()); diff --git a/examples/secure_storage-rs/host/Makefile b/examples/secure_storage-rs/host/Makefile index 7dbed02..376fae6 100644 --- a/examples/secure_storage-rs/host/Makefile +++ b/examples/secure_storage-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/secure_storage-rs/ta/Cargo.lock b/examples/secure_storage-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/secure_storage-rs/ta/Cargo.lock +++ b/examples/secure_storage-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/secure_storage-rs/ta/Makefile b/examples/secure_storage-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/secure_storage-rs/ta/Makefile +++ b/examples/secure_storage-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/secure_storage-rs/ta/build.rs b/examples/secure_storage-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/secure_storage-rs/ta/build.rs +++ b/examples/secure_storage-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/secure_storage-rs/ta/src/main.rs b/examples/secure_storage-rs/ta/src/main.rs index cfbf71b..51c0c0f 100644 --- a/examples/secure_storage-rs/ta/src/main.rs +++ b/examples/secure_storage-rs/ta/src/main.rs @@ -22,7 +22,7 @@ use optee_utee::{ }; use optee_utee::{DataFlag, ObjectStorageConstants, PersistentObject}; use optee_utee::{Error, ErrorKind, Parameters, Result}; -use proto::{Command}; +use proto::Command; #[ta_create] fn create() -> Result<()> { @@ -134,7 +134,7 @@ pub fn read_raw_object(params: &mut Parameters) -> Result<()> { let mut obj_id = vec![0; p0.buffer().len() as usize]; obj_id.copy_from_slice(p0.buffer()); - let mut data_buffer = vec![0;p1.buffer().len() as usize]; + let mut data_buffer = vec![0; p1.buffer().len() as usize]; data_buffer.copy_from_slice(p1.buffer()); match PersistentObject::open( diff --git a/examples/serde-rs/host/Makefile b/examples/serde-rs/host/Makefile index 8010e57..2bad4e7 100644 --- a/examples/serde-rs/host/Makefile +++ b/examples/serde-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/serde-rs/host/src/main.rs b/examples/serde-rs/host/src/main.rs index 3b8502a..cdeaab0 100644 --- a/examples/serde-rs/host/src/main.rs +++ b/examples/serde-rs/host/src/main.rs @@ -16,8 +16,8 @@ // under the License. use optee_teec::{Context, Operation, ParamNone, ParamTmpRef, Session, Uuid}; +use proto::{Command, UUID}; use serde::Deserialize; -use proto::{UUID, Command}; #[derive(Deserialize, Debug)] struct Point { @@ -28,7 +28,7 @@ struct Point { fn serde(session: &mut Session) -> optee_teec::Result<()> { let mut buffer = [0u8; 128]; let p0 = ParamTmpRef::new_output(&mut buffer); - let mut operation = Operation::new(0, p0 , ParamNone, ParamNone, ParamNone); + let mut operation = Operation::new(0, p0, ParamNone, ParamNone, ParamNone); session.invoke_command(Command::DefaultOp as u32, &mut operation)?; let updated_size = operation.parameters().0.updated_size(); @@ -41,8 +41,7 @@ fn serde(session: &mut Session) -> optee_teec::Result<()> { fn main() -> optee_teec::Result<()> { let mut ctx = Context::new()?; - let uuid = - Uuid::parse_str(UUID).unwrap(); + let uuid = Uuid::parse_str(UUID).unwrap(); let mut session = ctx.open_session(uuid)?; serde(&mut session)?; diff --git a/examples/serde-rs/ta/Cargo.lock b/examples/serde-rs/ta/Cargo.lock index d39ff4d..7c9f9e2 100644 --- a/examples/serde-rs/ta/Cargo.lock +++ b/examples/serde-rs/ta/Cargo.lock @@ -24,18 +24,13 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -53,7 +48,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -144,7 +139,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/serde-rs/ta/Makefile b/examples/serde-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/serde-rs/ta/Makefile +++ b/examples/serde-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/serde-rs/ta/build.rs b/examples/serde-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/serde-rs/ta/build.rs +++ b/examples/serde-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/serde-rs/ta/src/main.rs b/examples/serde-rs/ta/src/main.rs index e025e84..40f5fea 100644 --- a/examples/serde-rs/ta/src/main.rs +++ b/examples/serde-rs/ta/src/main.rs @@ -21,9 +21,9 @@ 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 serde::{Deserialize, Serialize}; use std::io::Write; -use proto::Command; #[ta_create] fn create() -> Result<()> { @@ -67,7 +67,7 @@ fn invoke_command(cmd_id: u32, params: &mut Parameters) -> Result<()> { let len = buffer.write(serialized.as_bytes()).unwrap(); // update size of output buffer - unsafe { (*p.raw()).size = len}; + unsafe { (*p.raw()).size = len }; // Prints serialized = {"x":1,"y":2} trace_println!("serialized = {}", serialized); diff --git a/examples/signature_verification-rs/host/Makefile b/examples/signature_verification-rs/host/Makefile index 4ab88f9..70301df 100644 --- a/examples/signature_verification-rs/host/Makefile +++ b/examples/signature_verification-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/signature_verification-rs/ta/Cargo.lock b/examples/signature_verification-rs/ta/Cargo.lock index b5319c5..fa33f70 100644 --- a/examples/signature_verification-rs/ta/Cargo.lock +++ b/examples/signature_verification-rs/ta/Cargo.lock @@ -30,18 +30,13 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -59,7 +54,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -120,7 +115,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/signature_verification-rs/ta/Makefile b/examples/signature_verification-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/signature_verification-rs/ta/Makefile +++ b/examples/signature_verification-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/supp_plugin-rs/host/Makefile b/examples/supp_plugin-rs/host/Makefile index 81a6b7a..cfa1de1 100644 --- a/examples/supp_plugin-rs/host/Makefile +++ b/examples/supp_plugin-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/supp_plugin-rs/host/src/main.rs b/examples/supp_plugin-rs/host/src/main.rs index a60a265..4c1dd40 100644 --- a/examples/supp_plugin-rs/host/src/main.rs +++ b/examples/supp_plugin-rs/host/src/main.rs @@ -15,9 +15,9 @@ // specific language governing permissions and limitations // under the License. +use optee_teec::ParamNone; use optee_teec::{Context, Operation, ParamTmpRef, Session, Uuid}; -use optee_teec::{ParamNone}; -use proto::{TA_UUID, Command}; +use proto::{Command, TA_UUID}; fn ping_ta(session: &mut Session) -> optee_teec::Result<()> { let test_data = [0x36u8; 10]; diff --git a/examples/supp_plugin-rs/plugin/Makefile b/examples/supp_plugin-rs/plugin/Makefile index bb39fe0..883c6c6 100644 --- a/examples/supp_plugin-rs/plugin/Makefile +++ b/examples/supp_plugin-rs/plugin/Makefile @@ -38,6 +38,9 @@ all: host host: @cargo build --target $(TARGET) --release + +fmt: + @cargo fmt cp $(CURDIR)/target/$(TARGET)/release/lib$(NAME).so $(CURDIR)/target/$(TARGET)/release/$(PLUGIN_UUID).plugin.so clean: @cargo clean diff --git a/examples/supp_plugin-rs/plugin/build.rs b/examples/supp_plugin-rs/plugin/build.rs index 434f52d..f50dc28 100644 --- a/examples/supp_plugin-rs/plugin/build.rs +++ b/examples/supp_plugin-rs/plugin/build.rs @@ -19,7 +19,7 @@ use proto; use std::env; use std::fs::File; use std::io::Write; -use std::path::{PathBuf}; +use std::path::PathBuf; use uuid::Uuid; fn main() -> std::io::Result<()> { diff --git a/examples/supp_plugin-rs/plugin/src/lib.rs b/examples/supp_plugin-rs/plugin/src/lib.rs index 25a6ed9..46e67df 100644 --- a/examples/supp_plugin-rs/plugin/src/lib.rs +++ b/examples/supp_plugin-rs/plugin/src/lib.rs @@ -15,10 +15,10 @@ // specific language governing permissions and limitations // under the License. -use libc::{c_char}; -use optee_teec::{Error, ErrorKind, PluginMethod, PluginParameters}; +use libc::c_char; use optee_teec::{plugin_init, plugin_invoke}; -use proto::{PluginCommand}; +use optee_teec::{Error, ErrorKind, PluginMethod, PluginParameters}; +use proto::PluginCommand; #[plugin_init] fn init() { @@ -30,15 +30,22 @@ fn invoke(params: &mut PluginParameters) { println!("*plugin*: invoke"); match PluginCommand::from(params.cmd) { PluginCommand::Print => { - println!("*plugin*: receive value: {:?} length {:?}", params.inout, params.inout.len()); + println!( + "*plugin*: receive value: {:?} length {:?}", + params.inout, + params.inout.len() + ); - let send_slice: [u8;9] = [0x40;9]; + let send_slice: [u8; 9] = [0x40; 9]; params.set_buf_from_slice(&send_slice)?; - println!("*plugin*: send value: {:?} length {:?} to ta", send_slice, send_slice.len()); + println!( + "*plugin*: send value: {:?} length {:?} to ta", + send_slice, + send_slice.len() + ); } _ => println!("Unsupported plugin command: {:?}", params.cmd), } } - include!(concat!(env!("OUT_DIR"), "/plugin_static.rs")); diff --git a/examples/supp_plugin-rs/ta/Cargo.lock b/examples/supp_plugin-rs/ta/Cargo.lock index 48b927d..be9c376 100644 --- a/examples/supp_plugin-rs/ta/Cargo.lock +++ b/examples/supp_plugin-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid 1.8.0", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/supp_plugin-rs/ta/Makefile b/examples/supp_plugin-rs/ta/Makefile index cf6a722..e5e657c 100644 --- a/examples/supp_plugin-rs/ta/Makefile +++ b/examples/supp_plugin-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/supp_plugin-rs/ta/build.rs b/examples/supp_plugin-rs/ta/build.rs index 36f162e..d894cb3 100644 --- a/examples/supp_plugin-rs/ta/build.rs +++ b/examples/supp_plugin-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/supp_plugin-rs/ta/src/main.rs b/examples/supp_plugin-rs/ta/src/main.rs index 2bd3775..5eab5c9 100644 --- a/examples/supp_plugin-rs/ta/src/main.rs +++ b/examples/supp_plugin-rs/ta/src/main.rs @@ -17,11 +17,11 @@ #![no_main] +use optee_utee::LoadablePlugin; 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, Uuid}; -use optee_utee::{LoadablePlugin}; use proto::{Command, PluginCommand, PLUGIN_SUBCMD_NULL, PLUGIN_UUID}; #[ta_create] @@ -51,19 +51,24 @@ fn invoke_command(cmd_id: u32, params: &mut Parameters) -> Result<()> { trace_println!("[+] TA invoke command"); let mut p0 = unsafe { params.0.as_memref().unwrap() }; let mut inbuf = p0.buffer().to_vec(); - trace_println!("[+] TA received value {:?} then send to plugin", p0.buffer()); + trace_println!( + "[+] TA received value {:?} then send to plugin", + p0.buffer() + ); let uuid = Uuid::parse_str(PLUGIN_UUID).unwrap(); match Command::from(cmd_id) { Command::Ping => { let mut plugin = LoadablePlugin::new(&uuid); - let outbuf = plugin.invoke( - PluginCommand::Print as u32, - PLUGIN_SUBCMD_NULL, - &inbuf - ).unwrap(); + let outbuf = plugin + .invoke(PluginCommand::Print as u32, PLUGIN_SUBCMD_NULL, &inbuf) + .unwrap(); - trace_println!("[+] TA received out value {:?} outlen {:?}", outbuf, outbuf.len()); + trace_println!( + "[+] TA received out value {:?} outlen {:?}", + outbuf, + outbuf.len() + ); trace_println!("[+] TA call invoke_supp_plugin finished"); Ok(()) diff --git a/examples/tcp_client-rs/host/Makefile b/examples/tcp_client-rs/host/Makefile index 540b970..beb23b6 100644 --- a/examples/tcp_client-rs/host/Makefile +++ b/examples/tcp_client-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/tcp_client-rs/host/src/main.rs b/examples/tcp_client-rs/host/src/main.rs index 9e032dc..75624db 100644 --- a/examples/tcp_client-rs/host/src/main.rs +++ b/examples/tcp_client-rs/host/src/main.rs @@ -15,9 +15,9 @@ // specific language governing permissions and limitations // under the License. -use optee_teec::{Context, Operation, Session, Uuid}; use optee_teec::ParamNone; -use proto::{UUID, Command}; +use optee_teec::{Context, Operation, Session, Uuid}; +use proto::{Command, UUID}; fn tcp_client(session: &mut Session) -> optee_teec::Result<()> { let mut operation = Operation::new(0, ParamNone, ParamNone, ParamNone, ParamNone); diff --git a/examples/tcp_client-rs/ta/Cargo.lock b/examples/tcp_client-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/tcp_client-rs/ta/Cargo.lock +++ b/examples/tcp_client-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/tcp_client-rs/ta/Makefile b/examples/tcp_client-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/tcp_client-rs/ta/Makefile +++ b/examples/tcp_client-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/tcp_client-rs/ta/build.rs b/examples/tcp_client-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/tcp_client-rs/ta/build.rs +++ b/examples/tcp_client-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/tcp_client-rs/ta/src/main.rs b/examples/tcp_client-rs/ta/src/main.rs index 25249ae..0f55833 100644 --- a/examples/tcp_client-rs/ta/src/main.rs +++ b/examples/tcp_client-rs/ta/src/main.rs @@ -17,11 +17,11 @@ #![no_main] +use optee_utee::net::TcpStream; 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 optee_utee::net::TcpStream; use proto::Command; use std::io::Read; use std::io::Write; @@ -62,7 +62,9 @@ fn invoke_command(cmd_id: u32, _params: &mut Parameters) -> Result<()> { fn tcp_client() { let mut stream = TcpStream::connect("teaclave.apache.org", 80).unwrap(); - stream.write_all(b"GET / HTTP/1.0\r\nHost: teaclave.apache.org\r\n\r\n").unwrap(); + stream + .write_all(b"GET / HTTP/1.0\r\nHost: teaclave.apache.org\r\n\r\n") + .unwrap(); let mut response = Vec::new(); let mut chunk = [0u8; 1024]; loop { diff --git a/examples/time-rs/host/Makefile b/examples/time-rs/host/Makefile index 52b6786..1accafd 100644 --- a/examples/time-rs/host/Makefile +++ b/examples/time-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/time-rs/ta/Cargo.lock b/examples/time-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/time-rs/ta/Cargo.lock +++ b/examples/time-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/time-rs/ta/Makefile b/examples/time-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/time-rs/ta/Makefile +++ b/examples/time-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/time-rs/ta/build.rs b/examples/time-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/time-rs/ta/build.rs +++ b/examples/time-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/time-rs/ta/src/main.rs b/examples/time-rs/ta/src/main.rs index a5ecd71..7744582 100644 --- a/examples/time-rs/ta/src/main.rs +++ b/examples/time-rs/ta/src/main.rs @@ -70,7 +70,10 @@ fn time() -> Result<()> { time.set_ta_time()?; let mut time2 = Time::new(); time2.ta_time()?; - trace_println!("[+] After set the TA time 5 seconds ahead of system time, new TA time {}.", time2); + trace_println!( + "[+] After set the TA time 5 seconds ahead of system time, new TA time {}.", + time2 + ); Ok(()) } // TA configurations diff --git a/examples/tls_client-rs/host/Makefile b/examples/tls_client-rs/host/Makefile index d68659b..85e49da 100644 --- a/examples/tls_client-rs/host/Makefile +++ b/examples/tls_client-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/tls_client-rs/ta/Cargo.lock b/examples/tls_client-rs/ta/Cargo.lock index ad9951e..20ff940 100644 --- a/examples/tls_client-rs/ta/Cargo.lock +++ b/examples/tls_client-rs/ta/Cargo.lock @@ -45,11 +45,6 @@ dependencies = [ name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "libc" version = "0.2.155" @@ -74,7 +69,7 @@ version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc 0.2.153", "optee-utee-macros", "optee-utee-sys", "uuid", diff --git a/examples/tls_client-rs/ta/Cargo.toml b/examples/tls_client-rs/ta/Cargo.toml index a604bb1..30dd481 100644 --- a/examples/tls_client-rs/ta/Cargo.toml +++ b/examples/tls_client-rs/ta/Cargo.toml @@ -48,10 +48,6 @@ opt-level = 1 [patch.crates-io] ring = { git = "https://github.com/DemesneGH/ring-optee.git", branch = "0.16.20-optee" } -# Patch optee-utee for webpki -[patch."https://github.com/veracruz-project/rust-optee-trustzone-sdk.git"] -optee-utee = { path = "../../../optee-utee" } - # Patch optee-utee for rustls [patch."https://github.com/apache/incubator-teaclave-trustzone-sdk.git"] optee-utee = { path = "../../../optee-utee" } \ No newline at end of file diff --git a/examples/tls_client-rs/ta/Makefile b/examples/tls_client-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/tls_client-rs/ta/Makefile +++ b/examples/tls_client-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/tls_client-rs/ta/src/main.rs b/examples/tls_client-rs/ta/src/main.rs index 16aba0d..07bbb4f 100644 --- a/examples/tls_client-rs/ta/src/main.rs +++ b/examples/tls_client-rs/ta/src/main.rs @@ -23,11 +23,11 @@ use optee_utee::{ }; use optee_utee::{Error, ErrorKind, Parameters, Result}; use proto::Command; +use rustls::{OwnedTrustAnchor, RootCertStore}; +use std::convert::TryInto; use std::io::Read; use std::io::Write; use std::sync::Arc; -use std::convert::TryInto; -use rustls::{OwnedTrustAnchor, RootCertStore}; #[ta_create] fn create() -> Result<()> { @@ -66,18 +66,13 @@ fn invoke_command(cmd_id: u32, _params: &mut Parameters) -> Result<()> { // copied from https://github.com/rustls/rustls/blob/v/0.21.0/examples/src/bin/simpleclient.rs fn tls_client() { let mut root_store = RootCertStore::empty(); - root_store.add_server_trust_anchors( - webpki_roots::TLS_SERVER_ROOTS - .0 - .iter() - .map(|ta| { - OwnedTrustAnchor::from_subject_spki_name_constraints( - ta.subject, - ta.spki, - ta.name_constraints, - ) - }), - ); + root_store.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| { + OwnedTrustAnchor::from_subject_spki_name_constraints( + ta.subject, + ta.spki, + ta.name_constraints, + ) + })); trace_println!("[+] root_store added"); let config = rustls::ClientConfig::builder() @@ -85,7 +80,7 @@ fn tls_client() { .with_root_certificates(root_store) .with_no_client_auth(); trace_println!("[+] config created"); - + let server_name = "google.com".try_into().unwrap(); let mut conn = rustls::ClientConnection::new(Arc::new(config), server_name).unwrap(); let mut sock = TcpStream::connect("google.com", 443).unwrap(); @@ -101,14 +96,8 @@ fn tls_client() { .as_bytes(), ) .unwrap(); - let ciphersuite = tls - .conn - .negotiated_cipher_suite() - .unwrap(); - trace_println!( - "Current ciphersuite: {:?}", - ciphersuite.suite() - ); + let ciphersuite = tls.conn.negotiated_cipher_suite().unwrap(); + trace_println!("Current ciphersuite: {:?}", ciphersuite.suite()); let mut plaintext = Vec::new(); tls.read_to_end(&mut plaintext).unwrap(); trace_println!("{}", String::from_utf8_lossy(&plaintext)); diff --git a/examples/tls_server-rs/host/Makefile b/examples/tls_server-rs/host/Makefile index 0b741ea..eaf5d6a 100644 --- a/examples/tls_server-rs/host/Makefile +++ b/examples/tls_server-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/tls_server-rs/ta/Makefile b/examples/tls_server-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/tls_server-rs/ta/Makefile +++ b/examples/tls_server-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/udp_socket-rs/host/Makefile b/examples/udp_socket-rs/host/Makefile index e765a00..7229bd2 100644 --- a/examples/udp_socket-rs/host/Makefile +++ b/examples/udp_socket-rs/host/Makefile @@ -38,6 +38,9 @@ all: host strip host: @cargo build --target $(TARGET) --release +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/$(NAME) $(OUT_DIR)/$(NAME) diff --git a/examples/udp_socket-rs/host/src/main.rs b/examples/udp_socket-rs/host/src/main.rs index 416ef50..5e1db59 100644 --- a/examples/udp_socket-rs/host/src/main.rs +++ b/examples/udp_socket-rs/host/src/main.rs @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. -use optee_teec::{Context, Operation, Session, Uuid}; use optee_teec::ParamNone; -use proto::{UUID, Command}; -use std::thread; +use optee_teec::{Context, Operation, Session, Uuid}; +use proto::{Command, UUID}; use std::net::UdpSocket; use std::str; +use std::thread; fn udp_socket(session: &mut Session) -> optee_teec::Result<()> { let mut operation = Operation::new(0, ParamNone, ParamNone, ParamNone, ParamNone); @@ -40,7 +40,9 @@ fn main() -> optee_teec::Result<()> { let mut buf = [0; 100]; let (_, src_addr) = socket.recv_from(&mut buf).unwrap(); - socket.send_to(b"[Host] Hello, Teaclave!", src_addr).unwrap(); + socket + .send_to(b"[Host] Hello, Teaclave!", src_addr) + .unwrap(); println!("{}", str::from_utf8(&buf).unwrap()); let _ = child.join(); diff --git a/examples/udp_socket-rs/ta/Cargo.lock b/examples/udp_socket-rs/ta/Cargo.lock index 96058f4..21f846b 100644 --- a/examples/udp_socket-rs/ta/Cargo.lock +++ b/examples/udp_socket-rs/ta/Cargo.lock @@ -18,18 +18,13 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" name = "libc" version = "0.2.153" -[[package]] -name = "libc" -version = "0.2.153" -source = "git+https://github.com/DemesneGH/libc.git?branch=optee#4fa30318ed3175f6ebe22da8f167f9f9b34567c3" - [[package]] name = "optee-utee" version = "0.2.0" dependencies = [ "bitflags", "hex", - "libc 0.2.153 (git+https://github.com/DemesneGH/libc.git?branch=optee)", + "libc", "optee-utee-macros", "optee-utee-sys", "uuid", @@ -47,7 +42,7 @@ dependencies = [ name = "optee-utee-sys" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", ] [[package]] @@ -90,7 +85,7 @@ dependencies = [ name = "ta" version = "0.2.0" dependencies = [ - "libc 0.2.153", + "libc", "optee-utee", "optee-utee-sys", "proto", diff --git a/examples/udp_socket-rs/ta/Makefile b/examples/udp_socket-rs/ta/Makefile index bc22657..f7b32fb 100644 --- a/examples/udp_socket-rs/ta/Makefile +++ b/examples/udp_socket-rs/ta/Makefile @@ -42,6 +42,9 @@ all: ta strip sign ta: @xargo build --target $(TARGET) --release --verbose +fmt: + @cargo fmt + strip: @$(OBJCOPY) --strip-unneeded $(OUT_DIR)/ta $(OUT_DIR)/stripped_ta diff --git a/examples/udp_socket-rs/ta/build.rs b/examples/udp_socket-rs/ta/build.rs index 33f6cc0..4b4d42d 100644 --- a/examples/udp_socket-rs/ta/build.rs +++ b/examples/udp_socket-rs/ta/build.rs @@ -47,7 +47,7 @@ fn main() -> std::io::Result<()> { Ok(ref v) if v == "arm" => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_arm.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm32/lib") - }, + } _ => { File::create(out.join("ta.lds"))?.write_all(include_bytes!("ta_aarch64.lds"))?; Path::new(&optee_os_dir).join("out/arm/export-ta_arm64/lib") diff --git a/examples/udp_socket-rs/ta/src/main.rs b/examples/udp_socket-rs/ta/src/main.rs index 11defb8..8362c42 100644 --- a/examples/udp_socket-rs/ta/src/main.rs +++ b/examples/udp_socket-rs/ta/src/main.rs @@ -17,11 +17,11 @@ #![no_main] +use optee_utee::net::UdpSocket; 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 optee_utee::net::UdpSocket; use proto::Command; use std::io::Read; use std::io::Write; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fd75996..f5affd4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -19,6 +19,7 @@ [toolchain] channel = "nightly-2024-05-15" +components = [ "rust-src" ] targets = ["aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabihf"] # minimal profile: install rustc, cargo, and rust-std profile = "minimal" \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
