From 2e6f488a2a714a01c291ed15dc0a0fd3a65b0540 Mon Sep 17 00:00:00 2001 From: Sangwan Kwon Date: Fri, 15 Dec 2023 12:37:38 +0900 Subject: [PATCH] sdk: Remove duplicated examples Signed-off-by: Sangwan Kwon --- sdk/Makefile | 6 +-- sdk/examples/aarch64.rs | 42 ------------------- .../{simulated.rs => attest_n_seal.rs} | 1 - 3 files changed, 3 insertions(+), 46 deletions(-) delete mode 100644 sdk/examples/aarch64.rs rename sdk/examples/{simulated.rs => attest_n_seal.rs} (94%) diff --git a/sdk/Makefile b/sdk/Makefile index 886d799d456f0..efa6e48c2c2ae 100644 --- a/sdk/Makefile +++ b/sdk/Makefile @@ -18,7 +18,7 @@ sdk: @$(OPENSSL_ARM64_FLAG) cargo build -r --target=aarch64-unknown-linux-gnu sdk-example: - @$(OPENSSL_ARM64_FLAG) cargo build -r --example aarch64 --target=aarch64-unknown-linux-gnu + @$(OPENSSL_ARM64_FLAG) cargo build -r --example attest_n_seal --target=aarch64-unknown-linux-gnu sdk-example-c: examples/c_api/attest_seal_test.cc @$(OPENSSL_ARM64_FLAG) RUSTFLAGS="-C target-feature=-crt-static" cargo build -r --target=aarch64-unknown-linux-gnu @@ -31,7 +31,7 @@ simulated: @cargo build -r --target=x86_64-unknown-linux-gnu run-simulated: - @cargo run -r --example simulated --target=x86_64-unknown-linux-gnu + @cargo run -r --example attest_n_seal --target=x86_64-unknown-linux-gnu run-simulated-c: @cargo build -r --target=x86_64-unknown-linux-gnu @@ -44,7 +44,7 @@ run-simulated-c: fvp: sdk sdk-example @mkdir -p $(SHARED_DIR) - @install -m755 $(ROOT)/out/aarch64-unknown-linux-gnu/release/examples/aarch64 $(SHARED_DIR)/sdk-example + @install -m755 $(ROOT)/out/aarch64-unknown-linux-gnu/release/examples/attest_n_seal $(SHARED_DIR)/sdk-example @$(MAKE) sdk-example-c @cp -p $(ROOT)/out/aarch64-unknown-linux-gnu/release/libislet_sdk.a $(SHARED_DIR) @install -m755 sdk-example-c $(SHARED_DIR) diff --git a/sdk/examples/aarch64.rs b/sdk/examples/aarch64.rs deleted file mode 100644 index 8bcebd810f24c..0000000000000 --- a/sdk/examples/aarch64.rs +++ /dev/null @@ -1,42 +0,0 @@ -use islet_sdk::prelude::*; - -fn attestation() -> Result<(), Error> { - let user_data = b"User data"; - let report = attest(user_data)?; - let claims = verify(&report)?; - print_claims(&claims); - - if let Some(ClaimData::Bstr(data)) = parse(&claims, config::STR_USER_DATA) { - assert_eq!(user_data, &data[..user_data.len()]); - } else { - assert!(false, "Wrong user data"); - } - - if let Some(ClaimData::Text(data)) = parse(&claims, config::STR_PLAT_PROFILE) { - assert_eq!(data, "http://arm.com/CCA-SSD/1.0.0"); - } else { - assert!(false, "Wrong platform profile"); - } - - if let Some(ClaimData::Bstr(data)) = parse(&claims, config::STR_REALM_INITIAL_MEASUREMENT) { - println!("Realm initial measurement: {:X?}", &data); - } else { - assert!(false, "Wrong RIM"); - } - - Ok(()) -} - -fn sealing() -> Result<(), Error> { - let plaintext = b"Plaintext"; - let sealed = seal(plaintext)?; - let unsealed = unseal(&sealed)?; - assert_eq!(plaintext, &unsealed[..]); - Ok(()) -} - -fn main() { - println!("# ISLET SDK examples: An example app running on aarch64"); - println!("Attestation result {:?}", attestation()); - println!("Sealing result {:?}", sealing()); -} diff --git a/sdk/examples/simulated.rs b/sdk/examples/attest_n_seal.rs similarity index 94% rename from sdk/examples/simulated.rs rename to sdk/examples/attest_n_seal.rs index de6086232145f..7cf8588068322 100644 --- a/sdk/examples/simulated.rs +++ b/sdk/examples/attest_n_seal.rs @@ -36,7 +36,6 @@ fn sealing() -> Result<(), Error> { } fn main() { - println!("# ISLET SDK examples: A simulated app running on x86_64"); println!("Attestation result {:?}", attestation()); println!("Sealing result {:?}", sealing()); }