RsaBackend

Struct RsaBackend 

Source
pub struct RsaBackend<'d> { /* private fields */ }
Expand description

RSA processing backend.

The backend processes work items placed in the RSA work queue. The backend needs to be created and started for operations to be processed. This allows you to perform operations on the RSA accelerator without carrying around the peripheral singleton, or the driver.

The RsaContext struct can enqueue work items that this backend will process.

§Example

use esp_hal::rsa::{RsaBackend, RsaContext, operand_sizes::Op512};
let mut rsa_backend = RsaBackend::new(peripherals.RSA);
let _driver = rsa_backend.start();

async fn perform_512bit_big_number_multiplication(
    operand_a: &[u32; 16],
    operand_b: &[u32; 16],
    result: &mut [u32; 32],
) {
    let mut rsa = RsaContext::new();

    let mut handle = rsa.multiply::<Op512>(operand_a, operand_b, result);
    handle.wait().await;
}

Implementations§

Source§

impl<'d> RsaBackend<'d>

Source

pub fn new(rsa: RSA<'d>) -> Self

Creates a new RSA backend.

§Example
use esp_hal::rsa::RsaBackend;
let mut rsa = RsaBackend::new(peripherals.RSA);
Source

pub fn start(&mut self) -> RsaWorkQueueDriver<'_, 'd>

Registers the RSA driver to process RSA operations.

The driver stops operating when the returned object is dropped.

§Example
use esp_hal::rsa::RsaBackend;
let mut rsa = RsaBackend::new(peripherals.RSA);
// Start the backend, which allows processing RSA operations.
let _backend = rsa.start();

Auto Trait Implementations§

§

impl<'d> Freeze for RsaBackend<'d>

§

impl<'d> RefUnwindSafe for RsaBackend<'d>

§

impl<'d> Send for RsaBackend<'d>

§

impl<'d> Sync for RsaBackend<'d>

§

impl<'d> Unpin for RsaBackend<'d>

§

impl<'d> !UnwindSafe for RsaBackend<'d>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.