Struct optee_teec::Context

source ·
pub struct Context { /* private fields */ }
Expand description

An abstraction of the logical connection between a client application and a TEE.

Implementations§

source§

impl Context

source

pub fn new() -> Result<Context>

Creates a TEE client context object.

§Examples
let mut ctx = Context::new()?;
source

pub fn open_session(&mut self, uuid: Uuid) -> Result<Session>

Opens a new session with the specified trusted application.

The target trusted application is specified by uuid.

§Examples
use optee_teec::{Context, ErrorKind, Uuid};

fn main() -> optee_teec::Result<()> {
    let mut ctx = Context::new()?;
    let uuid = Uuid::parse_str("8abcf200-2450-11e4-abe2-0002a5d5c51b").map_err(|err| {
        println!("bad uuid: {:?}", err);
        ErrorKind::BadParameters
    })?;
    let session = ctx.open_session(uuid)?;
    Ok(())
}
source

pub fn open_session_with_login( &mut self, uuid: Uuid, login: ConnectionMethods ) -> Result<Session>

source

pub fn open_session_with_operation<A: Param, B: Param, C: Param, D: Param>( &mut self, uuid: Uuid, operation: &mut Operation<A, B, C, D> ) -> Result<Session>

Opens a new session with the specified trusted application, pass some parameters to TA by an operation.

The target trusted application is specified by uuid.

§Examples
use optee_teec::{Context, ErrorKind, Operation, ParamNone, ParamType, ParamValue, Uuid};

fn main() -> optee_teec::Result<()> {
    let mut ctx = Context::new()?;
    let uuid = Uuid::parse_str("8abcf200-2450-11e4-abe2-0002a5d5c51b").map_err(|err| {
        println!("bad uuid: {:?}", err);
        ErrorKind::BadParameters
    })?;
    let p0 = ParamValue::new(42, 0, ParamType::ValueInout);
    let mut operation = Operation::new(0, p0, ParamNone, ParamNone, ParamNone);
    let session = ctx.open_session_with_operation(uuid, &mut operation)?;
    Ok(())
}

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.