Trait kernel::hil::public_key_crypto::rsa_math::RsaCryptoBaseMut
source · pub trait RsaCryptoBaseMut<'a> {
// Required methods
fn set_client(&'a self, client: &'a dyn ClientMut<'a>);
fn clear_data(&self);
fn mod_exponent(
&self,
message: &'static mut [u8],
modulus: &'static mut [u8],
exponent: &'static mut [u8],
result: &'static mut [u8],
) -> Result<(), (ErrorCode, &'static mut [u8], &'static mut [u8], &'static mut [u8], &'static mut [u8])>;
}
Required Methods§
sourcefn set_client(&'a self, client: &'a dyn ClientMut<'a>)
fn set_client(&'a self, client: &'a dyn ClientMut<'a>)
Set the ClientMut
client to be called on completion.
sourcefn clear_data(&self)
fn clear_data(&self)
Clear any confidential data.
sourcefn mod_exponent(
&self,
message: &'static mut [u8],
modulus: &'static mut [u8],
exponent: &'static mut [u8],
result: &'static mut [u8],
) -> Result<(), (ErrorCode, &'static mut [u8], &'static mut [u8], &'static mut [u8], &'static mut [u8])>
fn mod_exponent( &self, message: &'static mut [u8], modulus: &'static mut [u8], exponent: &'static mut [u8], result: &'static mut [u8], ) -> Result<(), (ErrorCode, &'static mut [u8], &'static mut [u8], &'static mut [u8], &'static mut [u8])>
Calculate (message
^ exponent
) % modulus
and store it in the
result
buffer.
On completion the mod_exponent_done()
upcall will be scheduled.
The length of modulus
must be a power of 2 and determines the length
of the operation.
The message
and exponent
buffers can be any length. All of the data
in the buffer up to the length of the modulus
will be used. This
allows callers to allocate larger buffers to support multiple
RSA lengths, but only the operation length (defined by the modulus)
will be used.
The result
buffer must be at least as large as the modulus
buffer,
otherwise Err(SIZE) will be returned.
If result
is longer then modulus
the data will be stored in the
result
buffer from 0 to modulue.len()
.
The possible ErrorCodes are:
- BUSY: The system is busy
- ALREADY: An operation is already on going
- INVAL: An invalid parameter was supplied
- SIZE: The size of the
result
buffer is invalid - NOSUPPORT: The operation is not supported