pub(crate) fn decrypt_in_place_detached(
        mut self,
        associated_data: &[u8],
        buffer: &mut [u8],
        tag: &Tag,
    ) -> Result<(), Error> {
        if !associated_data.is_empty() {
            return Err(Error);
        }


        use subtle::ConstantTimeEq;
        let expected_tag = self.mac.compute_unpadded(buffer).into_bytes();

        // This performs a constant-time comparison using the `subtle` crate
        if expected_tag.ct_eq(&tag).unwrap_u8() == 1 {
            // TODO(tarcieri): interleave decryption with Poly1305
            // See: <https://github.com/RustCrypto/AEADs/issues/74>
            self.cipher.apply_keystream(buffer);
            Ok(())
        } else {
            Err(Error)
        }
    }
/// Decrypt the given message, first authenticating ciphertext integrity
/// and returning an error if it's been tampered with.
Decrypt the given message, first authenticating ciphertext integrity
and returning an error if it's been tampered with.
Decrypt the given message first authenticating ciphertext integrity and returning an error if it ' s been tampered with .
pub(crate) fn decrypt_in_place_detached(
        mut self,
        associated_data: &[u8],
        buffer: &mut [u8],
        tag: &Tag,
    ) -> Result<(), Error> {
        if !associated_data.is_empty() {
            return Err(Error);
        }
        use subtle::ConstantTimeEq;
        let expected_tag = self.mac.compute_unpadded(buffer).into_bytes();
        // This performs a constant-time comparison using the `subtle` crate
        if expected_tag.ct_eq(&tag).unwrap_u8() == 1 {
            // TODO(tarcieri): interleave decryption with Poly1305
            // See: <https://github.com/RustCrypto/AEADs/issues/74>
            self.cipher.apply_keystream(buffer);
            Ok(())
        } else {
            Err(Error)
        }
    }
pub ( crate ) fn decrypt_in_place_detached ( mut self , associated_data : & [ u8 ] , buffer : & mut [ u8 ] , tag : & Tag , ) -> Result < ( ) , Error > { if ! associated_data . is_empty ( ) { return Err ( Error ) ; } use subtle :: ConstantTimeEq ; let expected_tag = self . mac . compute_unpadded ( buffer ) . into_bytes ( ) ; // This performs a constant-time comparison using the `subtle` crate if expected_tag . ct_eq ( & tag ) . unwrap_u8 ( ) == 1 { // TODO(tarcieri): interleave decryption with Poly1305 // See: <https://github.com/RustCrypto/AEADs/issues/74> self . cipher . apply_keystream ( buffer ) ; Ok ( ( ) ) } else { Err ( Error ) } }
Decrypt the given message, first authenticating ciphertext integrity
and returning an error if it's been tampered with.
Decrypt the given message first authenticating ciphertext integrity and returning an error if it ' s been tampered with .
mut self
associated_data
&[u8]
buffer
&mut [u8]
tag
&Tag
mut self
associated_data
&[u8]
buffer
&mut [u8]
tag
&Tag