Trait UnalignedBytesDecryptMut

Source
pub trait UnalignedBytesDecryptMut: BlockDecryptMut + BlockSizeUser {
    // Required method
    fn proc_tail(
        &self,
        blocks: &mut InOutBuf<'_, '_, Block<Self>>,
        tail: &mut InOutBuf<'_, '_, u8>,
    ) -> Result<(), TailError>;

    // Provided methods
    fn decrypt_bytes_inout_mut<'inp, 'out>(
        &mut self,
        data: InOutBuf<'inp, 'out, u8>,
    ) -> Result<&'out [u8], TailError> { ... }
    fn decrypt_bytes_mut<'a>(
        &mut self,
        buf: &'a mut [u8],
    ) -> Result<&'a [u8], TailError> { ... }
    fn decrypt_bytes_b2b_mut<'a>(
        &mut self,
        msg: &[u8],
        out_buf: &'a mut [u8],
    ) -> Result<&'a [u8], TailError> { ... }
}
Expand description

In many cases, plaintext and ciphertext input is not divisible by the block size, and padding is often used. In practical use, however, this is not always done, and user-specified processing to an unaligned part like, for example, XOR, is often applied. This trait enables to apply additional processing to an unaligned [tail].

Required Methods§

Source

fn proc_tail( &self, blocks: &mut InOutBuf<'_, '_, Block<Self>>, tail: &mut InOutBuf<'_, '_, u8>, ) -> Result<(), TailError>

In many cases, plaintext and ciphertext input is not divisible by the block size, and padding is often used. In practical use, however, this is not always done, and the termination may be handled by, for example, XOR. This trait and fn [proc_tail] divides the input into aligned blocks and an unaligned part([tail]), and then applies appropriate user-specified processing to the [tail].

Provided Methods§

Source

fn decrypt_bytes_inout_mut<'inp, 'out>( &mut self, data: InOutBuf<'inp, 'out, u8>, ) -> Result<&'out [u8], TailError>

Decrypt inout bytes slice.

Source

fn decrypt_bytes_mut<'a>( &mut self, buf: &'a mut [u8], ) -> Result<&'a [u8], TailError>

Unaligned bytes input and decrypt in-place. Returns resulting plaintext slice.

Returns TailError if length of output buffer is not sufficient.

Source

fn decrypt_bytes_b2b_mut<'a>( &mut self, msg: &[u8], out_buf: &'a mut [u8], ) -> Result<&'a [u8], TailError>

Unaligned bytes input and decrypt buffer-to-buffer. Returns resulting plaintext slice.

Returns TailError if length of output buffer is not sufficient.

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.

Implementors§