pub struct Cryp<'d, T: Instance, DmaIn = NoDma, DmaOut = NoDma> { /* private fields */ }
Expand description
Crypto Accelerator Driver
Implementations§
Source§impl<'d, T: Instance, DmaIn, DmaOut> Cryp<'d, T, DmaIn, DmaOut>
impl<'d, T: Instance, DmaIn, DmaOut> Cryp<'d, T, DmaIn, DmaOut>
Sourcepub fn new(
peri: impl Peripheral<P = T> + 'd,
indma: impl Peripheral<P = DmaIn> + 'd,
outdma: impl Peripheral<P = DmaOut> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
pub fn new( peri: impl Peripheral<P = T> + 'd, indma: impl Peripheral<P = DmaIn> + 'd, outdma: impl Peripheral<P = DmaOut> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Create a new CRYP driver.
Sourcepub fn start_blocking<'c, C: Cipher<'c> + CipherSized + IVSized>(
&self,
cipher: &'c C,
dir: Direction,
) -> Context<'c, C>
pub fn start_blocking<'c, C: Cipher<'c> + CipherSized + IVSized>( &self, cipher: &'c C, dir: Direction, ) -> Context<'c, C>
Start a new encrypt or decrypt operation for the given cipher.
Sourcepub async fn start<'c, C: Cipher<'c> + CipherSized + IVSized>(
&mut self,
cipher: &'c C,
dir: Direction,
) -> Context<'c, C>
pub async fn start<'c, C: Cipher<'c> + CipherSized + IVSized>( &mut self, cipher: &'c C, dir: Direction, ) -> Context<'c, C>
Start a new encrypt or decrypt operation for the given cipher.
Sourcepub fn payload_blocking<'c, C: Cipher<'c> + CipherSized + IVSized>(
&self,
ctx: &mut Context<'c, C>,
input: &[u8],
output: &mut [u8],
last_block: bool,
)
pub fn payload_blocking<'c, C: Cipher<'c> + CipherSized + IVSized>( &self, ctx: &mut Context<'c, C>, input: &[u8], output: &mut [u8], last_block: bool, )
Performs encryption/decryption on the provided context.
The context determines algorithm, mode, and state of the crypto accelerator.
When the last piece of data is supplied, last_block
should be true
.
This function panics under various mismatches of parameters.
Output buffer must be at least as long as the input buffer.
Data must be a multiple of block size (128-bits for AES, 64-bits for DES) for CBC and ECB modes.
Padding or ciphertext stealing must be managed by the application for these modes.
Data must also be a multiple of block size unless last_block
is true
.
Sourcepub async fn payload<'c, C: Cipher<'c> + CipherSized + IVSized>(
&mut self,
ctx: &mut Context<'c, C>,
input: &[u8],
output: &mut [u8],
last_block: bool,
)
pub async fn payload<'c, C: Cipher<'c> + CipherSized + IVSized>( &mut self, ctx: &mut Context<'c, C>, input: &[u8], output: &mut [u8], last_block: bool, )
Performs encryption/decryption on the provided context.
The context determines algorithm, mode, and state of the crypto accelerator.
When the last piece of data is supplied, last_block
should be true
.
This function panics under various mismatches of parameters.
Output buffer must be at least as long as the input buffer.
Data must be a multiple of block size (128-bits for AES, 64-bits for DES) for CBC and ECB modes.
Padding or ciphertext stealing must be managed by the application for these modes.
Data must also be a multiple of block size unless last_block
is true
.