Struct esp32_hal::rsa::RsaModularMultiplication
source · 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>
impl<'a, 'd, T, const N: usize> RsaModularMultiplication<'a, 'd, T>
sourcepub fn new(
rsa: &'a mut Rsa<'d>,
modulus: &<T as RsaMode>::InputType,
m_prime: u32
) -> RsaModularMultiplication<'a, 'd, T>
pub fn new( rsa: &'a mut Rsa<'d>, modulus: &<T as RsaMode>::InputType, m_prime: u32 ) -> RsaModularMultiplication<'a, 'd, T>
Creates an Instance of RsaMultiplication
.
m_prime
could be calculated using -(modular multiplicative inverse of modulus) mod 2^32
, for more information check 24.3.2 in the
https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
sourcepub fn start_step1(
&mut self,
operand_a: &<T as RsaMode>::InputType,
r: &<T as RsaMode>::InputType
)
pub fn start_step1( &mut self, operand_a: &<T as RsaMode>::InputType, r: &<T as RsaMode>::InputType )
Starts the first step of modular multiplication operation. r
could be
calculated using 2 ^ ( bitlength * 2 ) mod modulus
,
for more information check 24.3.2 in the
https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
sourcepub fn start_step2(&mut self, operand_b: &<T as RsaMode>::InputType)
pub fn start_step2(&mut self, operand_b: &<T as RsaMode>::InputType)
Starts the second step of modular multiplication operation.
This is a non blocking function that returns without an error if
operation is completed successfully. start_step1
must be called
before calling this function.
source§impl<'a, 'd, T, const N: usize> RsaModularMultiplication<'a, 'd, T>
impl<'a, 'd, T, const N: usize> RsaModularMultiplication<'a, 'd, T>
sourcepub fn read_results(&mut self, outbuf: &mut <T as RsaMode>::InputType)
pub fn read_results(&mut self, outbuf: &mut <T as RsaMode>::InputType)
Reads the result to the given buffer. This is a non blocking function that returns without an error if operation is completed successfully.