Function ring::aead::open_in_place [] [src]

pub fn open_in_place(key: &OpeningKey, nonce: &[u8], in_prefix_len: usize, in_out: &mut [u8], ad: &[u8]) -> Result<usizeUnspecified>

Authenticates and decrypts (“opens”) data in place.

The input is in_out[in_prefix_len..]; i.e. the input is the part of in_out after the prefix. When open returns Ok(out_len), the decrypted output is in_out[..out_len]; i.e. the output has been written over the top of the prefix and the input. To put it a different way, the output overwrites the input, shifted by in_prefix_len bytes. To have the output overwrite the input without shifting, pass 0 as in_prefix_len. (The input/output buffer is expressed this way because Rust's type system does not allow us to have two slices, one mutable and one immutable, that reference overlapping memory at the same time.)

C analog: EVP_AEAD_CTX_open

Go analog: AEAD.Open