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 2cbdb2d6c562742fc3bc88b92b29ee8e4b9932e5
Author: ivila <[email protected]>
AuthorDate: Thu Jul 10 10:28:52 2025 +0800

    crates & examples: fix compilation errors.
    
    * remove manually `core::mem::drop`
    * include `optee_utee::ObjHandle`
    
    Signed-off-by: Zehui Chen <[email protected]>
    Reviewed-by: Yuan Zhuang <[email protected]>
    Reviewed-by: Zhaofeng Chen <[email protected]>
---
 crates/secure_db/src/backend.rs                   | 5 ++---
 examples/acipher-rs/ta/src/main.rs                | 2 +-
 examples/aes-rs/ta/src/main.rs                    | 4 ++--
 examples/authentication-rs/ta/src/main.rs         | 2 +-
 examples/diffie_hellman-rs/ta/src/main.rs         | 2 +-
 examples/hotp-rs/ta/src/main.rs                   | 2 +-
 examples/secure_storage-rs/ta/src/main.rs         | 8 +++-----
 examples/signature_verification-rs/ta/src/main.rs | 2 +-
 8 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/crates/secure_db/src/backend.rs b/crates/secure_db/src/backend.rs
index 4cf9271..38817e4 100644
--- a/crates/secure_db/src/backend.rs
+++ b/crates/secure_db/src/backend.rs
@@ -16,7 +16,7 @@
 // under the License.
 
 use anyhow::{anyhow, bail, Result};
-use optee_utee::{DataFlag, ObjectStorageConstants, PersistentObject};
+use optee_utee::{DataFlag, GenericObject, ObjectStorageConstants, 
PersistentObject};
 
 // Wrapper functions for OP-TEE raw API
 
@@ -75,9 +75,8 @@ pub fn delete_from_secure_storage(obj_id: &[u8]) -> 
Result<()> {
             bail!("[-] {:?}: failed to open object: {:?}", &obj_id, e);
         }
 
-        Ok(mut object) => {
+        Ok(object) => {
             object.close_and_delete()?;
-            std::mem::forget(object);
             Ok(())
         }
     }
diff --git a/examples/acipher-rs/ta/src/main.rs 
b/examples/acipher-rs/ta/src/main.rs
index 1f26df0..1831657 100644
--- a/examples/acipher-rs/ta/src/main.rs
+++ b/examples/acipher-rs/ta/src/main.rs
@@ -26,7 +26,7 @@ use optee_utee::{
 };
 use optee_utee::{AlgorithmId, Asymmetric, OperationMode};
 use optee_utee::{Error, ErrorKind, Parameters, Result};
-use optee_utee::{TransientObject, TransientObjectType};
+use optee_utee::{GenericObject, TransientObject, TransientObjectType};
 use proto::Command;
 
 pub struct RsaCipher {
diff --git a/examples/aes-rs/ta/src/main.rs b/examples/aes-rs/ta/src/main.rs
index 669863c..c5ffbcf 100644
--- a/examples/aes-rs/ta/src/main.rs
+++ b/examples/aes-rs/ta/src/main.rs
@@ -25,9 +25,9 @@ use alloc::boxed::Box;
 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::is_algorithm_supported;
 use optee_utee::{AlgorithmId, ElementId, Cipher, OperationMode};
-use optee_utee::{AttributeId, AttributeMemref, TransientObject, 
TransientObjectType};
+use optee_utee::{AttributeId, AttributeMemref, GenericObject, TransientObject, 
TransientObjectType};
 use optee_utee::{Error, ErrorKind, Parameters, Result};
 use proto::{Algo, Command, KeySize, Mode};
 
diff --git a/examples/authentication-rs/ta/src/main.rs 
b/examples/authentication-rs/ta/src/main.rs
index d05b5e8..24cfab5 100644
--- a/examples/authentication-rs/ta/src/main.rs
+++ b/examples/authentication-rs/ta/src/main.rs
@@ -26,7 +26,7 @@ use optee_utee::{
     ta_close_session, ta_create, ta_destroy, ta_invoke_command, 
ta_open_session, trace_println,
 };
 use optee_utee::{AlgorithmId, OperationMode, AE};
-use optee_utee::{AttributeId, AttributeMemref, TransientObject, 
TransientObjectType};
+use optee_utee::{AttributeId, AttributeMemref, GenericObject, TransientObject, 
TransientObjectType};
 use optee_utee::{Error, ErrorKind, Parameters, Result};
 use proto::{Command, Mode, AAD_LEN, BUFFER_SIZE, KEY_SIZE, TAG_LEN};
 
diff --git a/examples/diffie_hellman-rs/ta/src/main.rs 
b/examples/diffie_hellman-rs/ta/src/main.rs
index 87c7139..e8864c5 100644
--- a/examples/diffie_hellman-rs/ta/src/main.rs
+++ b/examples/diffie_hellman-rs/ta/src/main.rs
@@ -25,7 +25,7 @@ use optee_utee::{
     ta_close_session, ta_create, ta_destroy, ta_invoke_command, 
ta_open_session, trace_println,
 };
 use optee_utee::{AlgorithmId, DeriveKey};
-use optee_utee::{AttributeId, AttributeMemref, TransientObject, 
TransientObjectType};
+use optee_utee::{AttributeId, AttributeMemref, GenericObject, TransientObject, 
TransientObjectType};
 use optee_utee::{Error, ErrorKind, Parameters, Result};
 use proto::{Command, KEY_SIZE};
 
diff --git a/examples/hotp-rs/ta/src/main.rs b/examples/hotp-rs/ta/src/main.rs
index c8792fb..397f7eb 100644
--- a/examples/hotp-rs/ta/src/main.rs
+++ b/examples/hotp-rs/ta/src/main.rs
@@ -25,7 +25,7 @@ use optee_utee::{
     ta_close_session, ta_create, ta_destroy, ta_invoke_command, 
ta_open_session, trace_println,
 };
 use optee_utee::{AlgorithmId, Mac};
-use optee_utee::{AttributeId, AttributeMemref, TransientObject, 
TransientObjectType};
+use optee_utee::{AttributeId, AttributeMemref, GenericObject, TransientObject, 
TransientObjectType};
 use optee_utee::{Error, ErrorKind, Parameters, Result};
 use proto::Command;
 
diff --git a/examples/secure_storage-rs/ta/src/main.rs 
b/examples/secure_storage-rs/ta/src/main.rs
index 4ca534f..aca4a16 100644
--- a/examples/secure_storage-rs/ta/src/main.rs
+++ b/examples/secure_storage-rs/ta/src/main.rs
@@ -24,9 +24,9 @@ use alloc::vec;
 use optee_utee::{
     ta_close_session, ta_create, ta_destroy, ta_invoke_command, 
ta_open_session, trace_println,
 };
-use optee_utee::{DataFlag, ObjectStorageConstants, PersistentObject};
+use optee_utee::{DataFlag, GenericObject, ObjectStorageConstants, 
PersistentObject};
 use optee_utee::{Error, ErrorKind, Parameters, Result};
-use proto::{Command};
+use proto::Command;
 
 #[ta_create]
 fn create() -> Result<()> {
@@ -84,9 +84,8 @@ pub fn delete_object(params: &mut Parameters) -> Result<()> {
             return Err(e);
         }
 
-        Ok(mut object) => {
+        Ok(object) => {
             object.close_and_delete()?;
-            mem::forget(object);
             return Ok(());
         }
     }
@@ -125,7 +124,6 @@ pub fn create_raw_object(params: &mut Parameters) -> 
Result<()> {
             }
             Err(e_write) => {
                 object.close_and_delete()?;
-                mem::forget(object);
                 return Err(e_write);
             }
         },
diff --git a/examples/signature_verification-rs/ta/src/main.rs 
b/examples/signature_verification-rs/ta/src/main.rs
index d2bd115..0f89766 100644
--- a/examples/signature_verification-rs/ta/src/main.rs
+++ b/examples/signature_verification-rs/ta/src/main.rs
@@ -26,7 +26,7 @@ use optee_utee::{
 };
 use optee_utee::{AlgorithmId, AttributeId, AttributeMemref, Digest, 
Asymmetric, OperationMode};
 use optee_utee::{Error, ErrorKind, Parameters, Result};
-use optee_utee::{TransientObject, TransientObjectType};
+use optee_utee::{GenericObject, TransientObject, TransientObjectType};
 use proto::Command;
 
 pub struct RsaSign {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to