pub struct RsaModularExponentiation<'a, 'd, T: RsaMode, Dm: DriverMode> { /* private fields */ }Expand description
Support for RSA peripheral’s modular exponentiation feature that could be
used to find the (base ^ exponent) mod modulus.
Each operand is a little endian byte array of the same size
Implementations§
Source§impl<'a, 'd, T, Dm: DriverMode, const N: usize> RsaModularExponentiation<'a, 'd, T, Dm>
 
impl<'a, 'd, T, Dm: DriverMode, const N: usize> RsaModularExponentiation<'a, 'd, T, Dm>
Sourcepub fn new(
    rsa: &'a mut Rsa<'d, Dm>,
    exponent: &T::InputType,
    modulus: &T::InputType,
    m_prime: u32,
) -> Self
 
pub fn new( rsa: &'a mut Rsa<'d, Dm>, exponent: &T::InputType, modulus: &T::InputType, m_prime: u32, ) -> Self
Creates an instance of RsaModularExponentiation.
m_prime could be calculated using -(modular multiplicative inverse of modulus) mod 2^32.
For more information refer to the Technical Reference Manual
Sourcepub fn start_exponentiation(&mut self, base: &T::InputType, r: &T::InputType)
 
pub fn start_exponentiation(&mut self, base: &T::InputType, r: &T::InputType)
Starts the modular exponentiation operation.
r can be calculated using 2 ^ ( bitlength * 2 ) mod modulus.
For more information refer to the Technical Reference Manual
Sourcepub fn read_results(&mut self, outbuf: &mut T::InputType)
 
pub fn read_results(&mut self, outbuf: &mut T::InputType)
Reads the result to the given buffer.
This is a blocking function: it waits for the RSA operation to complete,
then reads the results into the provided buffer. start_exponentiation must be
called before calling this function.