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§
sourcefn handle(&self) -> TEE_ObjectHandle
fn handle(&self) -> TEE_ObjectHandle
Return the handle of an object.
Provided Methods§
sourcefn info(&self) -> Result<ObjectInfo>
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 thegpd.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.
sourcefn restrict_usage(&mut self, obj_usage: UsageFlag) -> Result<()>
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 thegpd.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.
sourcefn ref_attribute(&self, id: AttributeId, buffer: &mut [u8]) -> Result<usize>
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 thegpd.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.
sourcefn value_attribute(&self, id: u32) -> Result<(u32, u32)>
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 thegpd.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.