Struct esp_hal::rsa::RsaModularExponentiation
source · pub struct RsaModularExponentiation<'a, 'd, T: RsaMode> { /* 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, const N: usize> RsaModularExponentiation<'a, 'd, T>
impl<'a, 'd, T, const N: usize> RsaModularExponentiation<'a, 'd, T>
sourcepub fn new(
rsa: &'a mut Rsa<'d>,
exponent: &T::InputType,
modulus: &T::InputType,
m_prime: u32
) -> Self
pub fn new( rsa: &'a mut Rsa<'d>, 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 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> RsaModularExponentiation<'a, 'd, T>
impl<'a, 'd, T, const N: usize> RsaModularExponentiation<'a, 'd, T>
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 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 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.