pub trait BlockModeDecrypt: BlockSizeUser + Sized {
// Required method
fn decrypt_with_backend(
&mut self,
f: impl BlockModeDecClosure<BlockSize = Self::BlockSize>,
);
// Provided methods
fn decrypt_block_inout(&mut self, block: InOut<'_, '_, Block<Self>>) { ... }
fn decrypt_blocks_inout(&mut self, blocks: InOutBuf<'_, '_, Block<Self>>) { ... }
fn decrypt_block(&mut self, block: &mut Block<Self>) { ... }
fn decrypt_block_b2b(
&mut self,
in_block: &Block<Self>,
out_block: &mut Block<Self>,
) { ... }
fn decrypt_blocks(&mut self, blocks: &mut [Block<Self>]) { ... }
fn decrypt_blocks_b2b(
&mut self,
in_blocks: &[Block<Self>],
out_blocks: &mut [Block<Self>],
) -> Result<(), NotEqualError> { ... }
fn decrypt_padded_inout<'out, P: Padding>(
self,
data: InOutBuf<'_, 'out, u8>,
) -> Result<&'out [u8], Error> { ... }
fn decrypt_padded<P: Padding>(self, buf: &mut [u8]) -> Result<&[u8], Error> { ... }
fn decrypt_padded_b2b<'a, P: Padding>(
self,
in_buf: &[u8],
out_buf: &'a mut [u8],
) -> Result<&'a [u8], Error> { ... }
}Expand description
Decrypt-only functionality for block ciphers and modes with mutable access to self.
The main use case for this trait is blocks modes, but it also can be used
for hardware cryptographic engines which require &mut self access to an
underlying hardware peripheral.
Required Methods§
Sourcefn decrypt_with_backend(
&mut self,
f: impl BlockModeDecClosure<BlockSize = Self::BlockSize>,
)
fn decrypt_with_backend( &mut self, f: impl BlockModeDecClosure<BlockSize = Self::BlockSize>, )
Decrypt data using backend provided to the rank-2 closure.
Provided Methods§
Sourcefn decrypt_block_inout(&mut self, block: InOut<'_, '_, Block<Self>>)
fn decrypt_block_inout(&mut self, block: InOut<'_, '_, Block<Self>>)
Decrypt single inout block.
Sourcefn decrypt_blocks_inout(&mut self, blocks: InOutBuf<'_, '_, Block<Self>>)
fn decrypt_blocks_inout(&mut self, blocks: InOutBuf<'_, '_, Block<Self>>)
Decrypt inout blocks.
Sourcefn decrypt_block(&mut self, block: &mut Block<Self>)
fn decrypt_block(&mut self, block: &mut Block<Self>)
Decrypt single block in-place.
Sourcefn decrypt_block_b2b(
&mut self,
in_block: &Block<Self>,
out_block: &mut Block<Self>,
)
fn decrypt_block_b2b( &mut self, in_block: &Block<Self>, out_block: &mut Block<Self>, )
Decrypt in_block and write result to out_block.
Sourcefn decrypt_blocks(&mut self, blocks: &mut [Block<Self>])
fn decrypt_blocks(&mut self, blocks: &mut [Block<Self>])
Decrypt blocks in-place.
Sourcefn decrypt_blocks_b2b(
&mut self,
in_blocks: &[Block<Self>],
out_blocks: &mut [Block<Self>],
) -> Result<(), NotEqualError>
fn decrypt_blocks_b2b( &mut self, in_blocks: &[Block<Self>], out_blocks: &mut [Block<Self>], ) -> Result<(), NotEqualError>
Decrypt blocks buffer-to-buffer.
§Errors
Returns NotEqualError if provided in_blocks and out_blocks
have different lengths.
Sourcefn decrypt_padded_inout<'out, P: Padding>(
self,
data: InOutBuf<'_, 'out, u8>,
) -> Result<&'out [u8], Error>
fn decrypt_padded_inout<'out, P: Padding>( self, data: InOutBuf<'_, 'out, u8>, ) -> Result<&'out [u8], Error>
Decrypt input and unpad it. Returns resulting plaintext slice.
§Errors
Returns block_padding::Error if padding is malformed or if input length is
not multiple of Self::BlockSize.
Sourcefn decrypt_padded<P: Padding>(self, buf: &mut [u8]) -> Result<&[u8], Error>
fn decrypt_padded<P: Padding>(self, buf: &mut [u8]) -> Result<&[u8], Error>
Decrypt input and unpad it in-place. Returns resulting plaintext slice.
§Errors
Returns block_padding::Error if padding is malformed or if input length is
not multiple of Self::BlockSize.
Sourcefn decrypt_padded_b2b<'a, P: Padding>(
self,
in_buf: &[u8],
out_buf: &'a mut [u8],
) -> Result<&'a [u8], Error>
fn decrypt_padded_b2b<'a, P: Padding>( self, in_buf: &[u8], out_buf: &'a mut [u8], ) -> Result<&'a [u8], Error>
Decrypt input and unpad it buffer-to-buffer. Returns resulting plaintext slice.
§Errors
Returns block_padding::Error if padding is malformed or if input length is
not multiple of Self::BlockSize.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.