pub struct Aes<'d, T: Instance> { /* private fields */ }Expand description
AES driver.
Implementations§
Source§impl<'d, T: Instance> Aes<'d, T>
impl<'d, T: Instance> Aes<'d, T>
Sourcepub fn new_blocking(peripheral: Peri<'d, T>) -> Self
pub fn new_blocking(peripheral: Peri<'d, T>) -> Self
Instantiates, resets, and enables the AES peripheral.
Unlike the aes_v3b driver, no interrupt binding is required: on
aes_v2 parts the engine has no dedicated interrupt, so the driver
polls the completion flag.
Sourcepub fn start<'c, C>(&mut self, cipher: &'c C, dir: Direction) -> Context<'c, C>
pub fn start<'c, C>(&mut self, cipher: &'c C, dir: Direction) -> Context<'c, C>
Starts a new cipher operation and returns the context.
Sourcepub fn aad_blocking<'c, C>(
&mut self,
ctx: &mut Context<'c, C>,
aad: &[u8],
last: bool,
) -> Result<(), Error>where
C: Cipher<'c> + CipherAuthenticated<16>,
pub fn aad_blocking<'c, C>(
&mut self,
ctx: &mut Context<'c, C>,
aad: &[u8],
last: bool,
) -> Result<(), Error>where
C: Cipher<'c> + CipherAuthenticated<16>,
Process authenticated additional data (AAD) for GCM/CCM modes.
Must be called after start and before payload_blocking.
Set last to true for the final AAD block.
Sourcepub fn payload_blocking<'c, C>(
&mut self,
ctx: &mut Context<'c, C>,
input: &[u8],
output: &mut [u8],
last: bool,
) -> Result<(), Error>where
C: Cipher<'c>,
pub fn payload_blocking<'c, C>(
&mut self,
ctx: &mut Context<'c, C>,
input: &[u8],
output: &mut [u8],
last: bool,
) -> Result<(), Error>where
C: Cipher<'c>,
Process payload data in blocking mode.
Set last to true for the final block. Intermediate chunks (last=false)
must be block-aligned (16 bytes); only the final chunk can be partial.
Source§impl<'d, T: InterruptableInstance> Aes<'d, T>
impl<'d, T: InterruptableInstance> Aes<'d, T>
Sourcepub fn new(
peripheral: Peri<'d, T>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
) -> Self
pub fn new( peripheral: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, ) -> Self
Instantiates, resets, and enables the AES peripheral for interrupt-driven async operation.
This is only available on parts whose AES engine has a dedicated
interrupt vector (e.g. STM32L5 and WL). On parts where the engine shares
its vector with another peripheral or has none (U0, G0, G4), use
new_blocking instead.
Sourcepub async fn start_async<'c, C>(
&mut self,
cipher: &'c C,
dir: Direction,
) -> Context<'c, C>
pub async fn start_async<'c, C>( &mut self, cipher: &'c C, dir: Direction, ) -> Context<'c, C>
Starts a new cipher operation and returns the context.
The GCM/CCM init phase (hash-key computation) completes asynchronously. Key derivation for ECB/CBC decryption is a one-shot step and is polled.
Sourcepub async fn aad_async<'c, C>(
&mut self,
ctx: &mut Context<'c, C>,
aad: &[u8],
last: bool,
) -> Result<(), Error>where
C: Cipher<'c> + CipherAuthenticated<16>,
pub async fn aad_async<'c, C>(
&mut self,
ctx: &mut Context<'c, C>,
aad: &[u8],
last: bool,
) -> Result<(), Error>where
C: Cipher<'c> + CipherAuthenticated<16>,
Processes authenticated additional data (AAD) for GCM/CCM modes.
Must be called after start_async and before
payload_async. Set last to true for the final block.
Sourcepub async fn payload_async<'c, C>(
&mut self,
ctx: &mut Context<'c, C>,
input: &[u8],
output: &mut [u8],
last: bool,
) -> Result<(), Error>where
C: Cipher<'c>,
pub async fn payload_async<'c, C>(
&mut self,
ctx: &mut Context<'c, C>,
input: &[u8],
output: &mut [u8],
last: bool,
) -> Result<(), Error>where
C: Cipher<'c>,
Processes payload data.
Set last to true for the final block. Intermediate chunks (last=false)
must be block-aligned (16 bytes); only the final chunk can be partial.