Skip to content

aead: API with separate buffers for input and output #1311

Open
@ia0

Description

@ia0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    aeadAuthenticated Encryption with Associated Data (AEAD) crate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions