Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aead: support variable-length nonces #65

Closed
oberien opened this issue Dec 23, 2019 · 2 comments
Closed

aead: support variable-length nonces #65

oberien opened this issue Dec 23, 2019 · 2 comments
Labels
aead Authenticated Encryption with Associated Data (AEAD) crate

Comments

@oberien
Copy link

oberien commented Dec 23, 2019

Currently, the AEAD-trait only supports fixed-length nonces. However, there are some AEAD algorithms, which allow variable length nonces to be used. I think this is important not only for interoperability with other implementations, but also to not restrict the input of AEAD algorithms arbitrarily. Some cases have already been discussed in RustCrypto/AEADs#62 and https://github.com/RustCrypto/traits/pull/40/files/a5db8f2d8e07593883e7e6aba27eb4e9d54b9460#r307931303.

I could imagine, for type-safety, adding a new trait like AeadVarlenNonce, which is only implemented for algorithms supporting it, or adding a method to the existing Aead trait, which takes a &[u8] as nonce, but may return an Err (or None or panic) if the algorithm doesn't support varlen nonces.

/cc @tarcieri

@tarcieri
Copy link
Member

tarcieri commented Dec 23, 2019

Variable-length nonces would be nice for AES-SIV. Miscreant supported them.

@newpavlov newpavlov mentioned this issue Jan 9, 2020
13 tasks
@tarcieri tarcieri added the aead Authenticated Encryption with Associated Data (AEAD) crate label Feb 29, 2020
@tarcieri tarcieri changed the title Support variable length AEAD Nonces aead: support variable-length nonces Feb 29, 2020
@tarcieri
Copy link
Member

Per RustCrypto/AEADs#126 it seems like the best solution to this is to make implementations of algorithms which support multiple different nonce sizes generic over Aead::NonceSize, which requires no changes to the trait.

dns2utf8 pushed a commit to dns2utf8/traits that referenced this issue Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aead Authenticated Encryption with Associated Data (AEAD) crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants