pub struct RsaModularMultiplication<'a, 'd, T>where
    T: RsaMode,{ /* private fields */ }
Expand description

Support for RSA peripheral’s modular multiplication feature that could be used to find the (operand a * operand b) mod modulus.

Each operand is a little endian byte array of the same size

Implementations§

source§

impl<'a, 'd, T, const N: usize> RsaModularMultiplication<'a, 'd, T>where T: RsaMode<InputType = [u8; N]> + RsaMode,

source

pub fn new( rsa: &'a mut Rsa<'d>, operand_a: &<T as RsaMode>::InputType, operand_b: &<T as RsaMode>::InputType, modulus: &<T as RsaMode>::InputType, m_prime: u32 ) -> RsaModularMultiplication<'a, 'd, T>

Creates an Instance of RsaModularMultiplication.
m_prime could be calculated using -(modular multiplicative inverse of modulus) mod 2^32, for more information check 19.3.1 in the https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf

source

pub fn start_modular_multiplication(&mut self, r: &<T as RsaMode>::InputType)

Starts the modular multiplication operation. r could be calculated using 2 ^ ( bitlength * 2 ) mod modulus, for more information check 19.3.1 in the https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf

source§

impl<'a, 'd, T, const N: usize> RsaModularMultiplication<'a, 'd, T>where T: RsaMode<InputType = [u8; N]> + RsaMode,

source

pub fn read_results( &mut self, outbuf: &mut <T as RsaMode>::InputType ) -> Result<(), Error<Infallible>>

Reads the result to the given buffer. This is a non blocking function that returns without an error if operation is completed successfully.

Auto Trait Implementations§

§

impl<'a, 'd, T> RefUnwindSafe for RsaModularMultiplication<'a, 'd, T>where T: RefUnwindSafe,

§

impl<'a, 'd, T> Send for RsaModularMultiplication<'a, 'd, T>where T: Send,

§

impl<'a, 'd, T> Sync for RsaModularMultiplication<'a, 'd, T>where T: Sync,

§

impl<'a, 'd, T> Unpin for RsaModularMultiplication<'a, 'd, T>where T: Unpin,

§

impl<'a, 'd, T> !UnwindSafe for RsaModularMultiplication<'a, 'd, T>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.