traits
traits copied to clipboard
aead: API with separate buffers for input and output
Would it make sense to add the following methods to AeadInPlace (similarly for AeadMutInPlace) with default implementations based on the existing methods?
fn encrypt_mut(&self, nonce: &Nonce, aad: &[u8], plain: &[u8], cipher_tag: &mut [u8]) -> Result<()> { ... }
fn encrypt_mut_detached(&self, nonce: &Nonce, aad: &[u8], plain: &[u8], cipher: &mut [u8]) -> Result<Tag> { ... }
fn decrypt_mut(&self, nonce: &Nonce, aad: &[u8], cipher_tag: &[u8], plain: &mut [u8]) -> Result<()> { ... }
fn decrypt_mut_detached(&self, nonce: &Nonce, aad: &[u8], cipher: &[u8], tag: &Tag, plain: &mut [u8]) -> Result<()> { ... }
This would add support (without extra copies or allocation) for implementations that don't support aliasing input and output. They would implement the _mut version and use a copy to implement the _in_place version using the _mut version.