Trait optee_utee::object::GenericObject

source ·
pub trait GenericObject {
    // Required method
    fn handle(&self) -> TEE_ObjectHandle;

    // Provided methods
    fn info(&self) -> Result<ObjectInfo> { ... }
    fn restrict_usage(&mut self, obj_usage: UsageFlag) -> Result<()> { ... }
    fn ref_attribute(&self, id: AttributeId, buffer: &mut [u8]) -> Result<usize> { ... }
    fn value_attribute(&self, id: u32) -> Result<(u32, u32)> { ... }
}
Expand description

A generic trait for an object (transient or persistent).

Required Methods§

source

fn handle(&self) -> TEE_ObjectHandle

Return the handle of an object.

Provided Methods§

source

fn info(&self) -> Result<ObjectInfo>

Return the characteristics of an object.

§Errors

For PersistentObject:

  • CorruptObject: If the persistent object is corrupt. The object handle SHALL behave based on the gpd.ta.doesNotCloseHandleOnCorruptObject property.
  • StorageNotAvailable: If the persistent object is stored in a storage area which is currently inaccessible.
§Panics
  • If object is not a valid opened object handle.
  • If the implementation detects any other error associated with this function that is not explicitly associated with a defined return code for this function.
source

fn restrict_usage(&mut self, obj_usage: UsageFlag) -> Result<()>

Restrict the object usage flags of an object handle to contain at most the flags passed in the obj_usage parameter.

§Errors

For PersistentObject:

  • CorruptObject: If the persistent object is corrupt. The object handle SHALL behave based on the gpd.ta.doesNotCloseHandleOnCorruptObject property.
  • StorageNotAvailable: If the persistent object is stored in a storage area which is currently inaccessible.
§Panics
  • If object is not a valid opened object handle.
  • If the implementation detects any other error associated with this function that is not explicitly associated with a defined return code for this function.
source

fn ref_attribute(&self, id: AttributeId, buffer: &mut [u8]) -> Result<usize>

Extract one buffer attribute from an object. The attribute is identified by the argument id.

§Errors

For all:

  • ItemNotFound: If the attribute is not found on this object.
  • SHORT_BUFFER: If buffer is NULL or too small to contain the key part.

For PersistentObject:

  • CorruptObject: If the persistent object is corrupt. The object handle SHALL behave based on the gpd.ta.doesNotCloseHandleOnCorruptObject property.
  • StorageNotAvailable: If the persistent object is stored in a storage area which is currently inaccessible.
§Panics
  • If object is not a valid opened object handle.
  • If the object is not initialized.
  • If Bit [29] of attributeID is not set to 0, so the attribute is not a buffer attribute.
  • If Bit [28] of attributeID is set to 0, denoting a protected attribute, and the object usage does not contain the TEE_USAGE_EXTRACTABLE flag.
  • If the implementation detects any other error associated with this function that is not explicitly associated with a defined return code for this function.
source

fn value_attribute(&self, id: u32) -> Result<(u32, u32)>

Extract one value attribute from an object. The attribute is identified by the argument id.

§Errors

For all:

  • ItemNotFound: If the attribute is not found on this object.
  • SHORT_BUFFER: If buffer is NULL or too small to contain the key part.

For PersistentObject:

  • CorruptObject: If the persistent object is corrupt. The object handle SHALL behave based on the gpd.ta.doesNotCloseHandleOnCorruptObject property.
  • StorageNotAvailable: If the persistent object is stored in a storage area which is currently inaccessible.
§Panics
  • If object is not a valid opened object handle.
  • If the object is not initialized.
  • If Bit [29] of attributeID is not set to 0, so the attribute is not a buffer attribute.
  • If Bit [28] of attributeID is set to 0, denoting a protected attribute, and the object usage does not contain the TEE_USAGE_EXTRACTABLE flag.
  • If the implementation detects any other error associated with this function that is not explicitly associated with a defined return code for this function.

Implementors§