You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@teaclave.apache.org by GitBox <gi...@apache.org> on 2023/01/18 18:52:04 UTC

[GitHub] [incubator-teaclave-trustzone-sdk] syedelec opened a new issue, #103: Create a persistent object from an initialized transient object

syedelec opened a new issue, #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103

   Hello
   
   I want to create a persistent object from an initialized transient object however it did not seem to work and unfortunately there are no examples, the only examples concern creating a persistent object with initial data.
   
   According to code documentation, this should be possible. Refer to [code](https://github.com/apache/incubator-teaclave-trustzone-sdk/blob/master/optee-utee/src/object.rs#L937-L938).
   
   Here is a sample code:
   
   ```
   let mut obj_id = [1u8; 1];
   let obj_data_flag = DataFlag::ACCESS_READ | DataFlag::ACCESS_WRITE | DataFlag::ACCESS_WRITE_META;
   
   let mut ec_key = TransientObject::allocate(TransientObjectType::EcdsaKeypair, 256).unwrap();
   let attr_curve = AttributeValue::from_value(AttributeId::EccCurve, ElementId::EccCurveNistP256 as u32, 0);
   ec_key.generate_key(256, &[attr_curve.into()])?;
   
   match PersistentObject::create(
       ObjectStorageConstants::Private,
       &mut obj_id,
       obj_data_flag,
       Some(ec_key), // Do not work. What to put here?
       b"",
   ) {
       Err(e) => {
           return Err(e);
       }
   
       Ok(mut object) => {
           trace_println!("success");
       },
   }
   ```
   
   Thanks for your help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] syedelec commented on issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
syedelec commented on issue #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103#issuecomment-1398165574

   Unfortunately I have another error even with the workaround
   
   ```
   error[E0509]: cannot move out of type `TransientObject`, which implements the `Drop` trait
     --> src/ecdsa.rs:32:14
      |
   32 |         Some(ec_key.0),
      |              ^^^^^^^^
      |              |
      |              cannot move out of here
      |              move occurs because `ec_key.0` has type `ObjectHandle`, which does not implement the `Copy` trait
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] DemesneGH commented on issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
DemesneGH commented on issue #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103#issuecomment-1398248840

   Add a new line `#[derive(Copy, Clone)]` above this line of code:
   
   https://github.com/apache/incubator-teaclave-trustzone-sdk/blob/972760f5bd9777104e653fc31a32da096f1955bd/optee-utee/src/object.rs#L213-L216
   
   ```
   /// An opaque handle on an object.
   #[derive(Copy, Clone)]
   pub struct ObjectHandle {
       raw: *mut raw::TEE_ObjectHandle,
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] DemesneGH commented on issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
DemesneGH commented on issue #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103#issuecomment-1398158377

   As a workaround, change this line of code:
   https://github.com/apache/incubator-teaclave-trustzone-sdk/blob/972760f5bd9777104e653fc31a32da096f1955bd/optee-utee/src/object.rs#L485
   to 
   ```
   pub struct TransientObject(pub ObjectHandle);
   ```
   I will consider which is the best way to add this feature later.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] DemesneGH commented on issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
DemesneGH commented on issue #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103#issuecomment-1398130348

   > I have this error:
   > 
   > ```
   > error[E0308]: mismatched types
   >   --> src/ecdsa.rs:32:14
   >    |
   > 32 |         Some(ec_key),
   >    |              ^^^^^^ expected struct `ObjectHandle`, found struct `TransientObject`
   > ```
   
   Try `Some(ec_key.0)`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] syedelec commented on issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
syedelec commented on issue #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103#issuecomment-1398140219

   I have another error:
   
   ```
   error[E0616]: field `0` of struct `TransientObject` is private
     --> src/ecdsa.rs:32:21
      |
   32 |         Some(ec_key.0),
      |                     ^ private field
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] syedelec commented on issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
syedelec commented on issue #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103#issuecomment-1398498977

   Thanks it's working now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] syedelec commented on issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
syedelec commented on issue #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103#issuecomment-1397162176

   I have this error:
   
   ```
   error[E0308]: mismatched types
     --> src/ecdsa.rs:32:14
      |
   32 |         Some(ec_key),
      |              ^^^^^^ expected struct `ObjectHandle`, found struct `TransientObject`
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] DemesneGH commented on issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
DemesneGH commented on issue #103:
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103#issuecomment-1396499550

   Hi @syedelec 
   
   > I want to create a persistent object from an initialized transient object however it did not seem to work
   
   Could you please paste the error message here? thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org


[GitHub] [incubator-teaclave-trustzone-sdk] syedelec closed issue #103: Create a persistent object from an initialized transient object

Posted by GitBox <gi...@apache.org>.
syedelec closed issue #103: Create a persistent object from an initialized transient object
URL: https://github.com/apache/incubator-teaclave-trustzone-sdk/issues/103


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@teaclave.apache.org
For additional commands, e-mail: dev-help@teaclave.apache.org