File tree Expand file tree Collapse file tree 5 files changed +23
-22
lines changed
samples/hello-rust/enclave/src Expand file tree Collapse file tree 5 files changed +23
-22
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,10 @@ fmt-check:
1616clippy :
1717 @find . -name Cargo.toml -not -path " ./target/*" -exec dirname {} \; | while read dir; do \
1818 echo " Running clippy on $$ dir..." ; \
19- if echo " $$ dir" | grep -E -q " (enclave$$ |sgx-ert)" ; then \
20- echo " Skipping $$ dir" ; \
19+ if echo " $$ dir" | grep -E -q " (enclave$$ |sgx-ert|sgx-trts|sgx-tcrypto|sgx-tse|sgx-tseal)" ; then \
20+ echo " Running clippy on $$ dir with SGX target..." ; \
21+ TARGET_SPEC=" $$ (pwd)/unit-test/enclave/x86_64-unknown-unknown-sgx.json" ; \
22+ (cd " $$ dir" && cargo +nightly clippy -Z build-std=core,alloc --target=" $$ TARGET_SPEC" --all-features -- -D warnings) || exit 1; \
2123 else \
2224 (cd " $$ dir" && cargo clippy --all-targets --all-features -- -D warnings) || exit 1; \
2325 fi ; \
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ pub extern "C" fn ecall_sample(
3333 } ;
3434
3535 // Process the input (example: echo back with prefix)
36- let result = format ! ( "Hello from enclave: {}" , input_string ) ;
36+ let result = format ! ( "Hello from enclave: {input_string}" ) ;
3737 let result_bytes = result. as_bytes ( ) ;
3838
3939 // Check if output buffer is large enough
Original file line number Diff line number Diff line change @@ -2,16 +2,16 @@ use crate::utils::*;
22use crate :: TestResult ;
33use alloc:: string:: String ;
44
5- static HASH_TEST_VEC : & ' static [ & ' static str ] = & [
6- & "abc" ,
7- & "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" ,
8- & "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" ,
5+ static HASH_TEST_VEC : & [ & str ] = & [
6+ "abc" ,
7+ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" ,
8+ "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" ,
99] ;
1010
11- static HASH_SHA256_TRUTH : & ' static [ & ' static str ] = & [
12- & "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ,
13- & "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1" ,
14- & "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1" ,
11+ static HASH_SHA256_TRUTH : & [ & str ] = & [
12+ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ,
13+ "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1" ,
14+ "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1" ,
1515] ;
1616
1717pub fn test_sha2_crate ( ) -> TestResult {
Original file line number Diff line number Diff line change @@ -20,16 +20,16 @@ use crate::TestResult;
2020use alloc:: string:: String ;
2121use sgx_tcrypto:: * ;
2222
23- static HASH_TEST_VEC : & ' static [ & ' static str ] = & [
24- & "abc" ,
25- & "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" ,
26- & "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" ,
23+ static HASH_TEST_VEC : & [ & str ] = & [
24+ "abc" ,
25+ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" ,
26+ "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu" ,
2727] ;
2828
29- static HASH_SHA256_TRUTH : & ' static [ & ' static str ] = & [
30- & "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ,
31- & "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1" ,
32- & "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1" ,
29+ static HASH_SHA256_TRUTH : & [ & str ] = & [
30+ "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" ,
31+ "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1" ,
32+ "cf5b16a778af8380036ce59e7b0492370b249b11e8f07a51afac45037afee9d1" ,
3333] ;
3434
3535pub fn test_rsgx_sha256_slice ( ) -> TestResult {
Original file line number Diff line number Diff line change @@ -52,8 +52,7 @@ pub fn test_seal_unseal() -> TestResult {
5252
5353 unsafe impl ContiguousMemory for RandData { }
5454
55- let mut data = RandData :: default ( ) ;
56- data. key = 0x1234 ;
55+ let mut data = RandData { key : 0x1234 , ..Default :: default ( ) } ;
5756
5857 // Use sgx random instead of StdRng
5958 rsgx_read_rand ( & mut data. rand ) . map_err ( |_| "Failed to generate random data" ) ?;
@@ -105,7 +104,7 @@ pub fn test_mac_aadata_slice() -> TestResult {
105104 if unsealed_data. get_decrypt_txt ( ) != & text {
106105 return Err ( "Decrypted text verification failed" ) ;
107106 }
108- if unsealed_data. get_additional_txt ( ) != & aad_data {
107+ if unsealed_data. get_additional_txt ( ) != aad_data {
109108 return Err ( "AAD verification failed" ) ;
110109 }
111110
You can’t perform that action at this time.
0 commit comments