pub struct Otbn<'a> { /* private fields */ }
Implementations§
Source§impl<'a> Otbn<'a>
impl<'a> Otbn<'a>
pub fn new(base: StaticRef<OtbnRegisters>) -> Self
pub fn handle_interrupt(&self)
Sourcepub fn set_client(&'a self, client: &'a dyn Client<'a>)
pub fn set_client(&'a self, client: &'a dyn Client<'a>)
Set the client instance which will receive
Sourcepub fn load_binary(&self, input: &[u8]) -> Result<(), ErrorCode>
pub fn load_binary(&self, input: &[u8]) -> Result<(), ErrorCode>
Load the acceleration binary data into the accelerator. This data will be accelerator specific and could be an elf file which will be run or could be binary settings used to configure the accelerator. This function can be called multiple times if multiple binary blobs are required. On error the return value will contain a return code and the original data
Sourcepub fn load_data(&self, address: usize, data: &[u8]) -> Result<(), ErrorCode>
pub fn load_data(&self, address: usize, data: &[u8]) -> Result<(), ErrorCode>
Load the data into the accelerator
This function can be called multiple times if multiple loads
are required.
On error the return value will contain a return code and the original data
The data
buffer should be in little endian
Sourcepub fn run(
&self,
address: usize,
output: &'static mut [u8],
) -> Result<(), (ErrorCode, &'static mut [u8])>
pub fn run( &self, address: usize, output: &'static mut [u8], ) -> Result<(), (ErrorCode, &'static mut [u8])>
Run the acceleration operation.
This doesn’t return any data, instead the client needs to have
set a op_done
handler to determine when this is complete.
The data returned via op_done()
will be starting at address
and of
the full length of output
.
On error the return value will contain a return code and the original data
If there is data from the load_binary()
command asyncrously waiting to
be written it will be written before the operation starts.
Sourcepub fn clear_data(&self)
pub fn clear_data(&self)
Clear the keys and any other sensitive data. This won’t clear the buffers provided to this API, that is up to the user to clear those.