pub struct RsaModularExponentiation<'a, 'd, T: RsaMode, Dm: DriverMode> { /* private fields */ }
unstable
only.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<T, const N: usize> RsaModularExponentiation<'_, '_, T, Async>
impl<T, const N: usize> RsaModularExponentiation<'_, '_, T, Async>
Sourcepub async fn exponentiation(
&mut self,
base: &T::InputType,
r: &T::InputType,
outbuf: &mut T::InputType,
)
pub async fn exponentiation( &mut self, base: &T::InputType, r: &T::InputType, outbuf: &mut T::InputType, )
Asynchronously performs an RSA modular exponentiation operation.
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 24.3.2 of https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf.
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 24.3.2 of https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf.
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 non blocking function that returns without an error if
operation is completed successfully. start_exponentiation
must be
called before calling this function.