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: split Aead(Mut) from Aead(Mut)InPlace (fixes #70) #120

Merged
merged 1 commit into from
May 23, 2020

Conversation

tarcieri
Copy link
Member

Splits the Aead and AeadMut trait into the following:

  • Aead and AeadMut:gated on the alloc feature
  • AeadInPlace and AeadMutInPlace: object-safe, always available

This further has the benefit that implementors who don't want to provide or abstract over the in-place APIs no longer have to. See ursa as a real world example of where this split is useful.

To make the *InPlace traits object safe, the one generic parameter they previously used (impl Buffer) was switched to dyn Buffer. This adds some vtable dispatch overhead for manipulating the buffer, but hopefully it is still cheap compared to the overhead of cryptographic operations on the underlying data. That said, no benchmarks have been performed (yet) on the costs of this change.

This was referenced May 23, 2020
Splits the `Aead` and `AeadMut` trait into the following:

- `Aead` and `AeadMut`:gated on the `alloc` feature
- `AeadInPlace` and `AeadMutInPlace`: object-safe, always available

This further has the benefit that implementors who don't want to provide
or abstract over the in-place APIs no longer have to.

To make the `*InPlace` traits object safe, the one generic parameter
they previously used (`impl Buffer`) was switched to `dyn Buffer`.
This adds some vtable dispatch overhead for manipulating the buffer, but
hopefully it is still cheap compared to the overhead of cryptographic
operations on the underlying data. That said, no benchmarks have been
performed (yet) on the costs of this change.
@tarcieri
Copy link
Member Author

Going to go ahead and merge this, but if anyone has any feedback on it, I'd certainly be interested in hearing it and am happy to do some follow-up passes to revise.

/cc @newpavlov @jcape @burdges @WildCryptoFox

@tarcieri tarcieri merged commit e5148f4 into master May 23, 2020
@tarcieri tarcieri deleted the aead/split-in-place-api branch May 23, 2020 23:30
@burdges
Copy link

burdges commented May 24, 2020

I suppose rust-lang/rfcs#2930 could influence the direction this takes in future. Also maybe rust-lang/rfcs#2895

@tarcieri tarcieri mentioned this pull request Jun 5, 2020
dns2utf8 pushed a commit to dns2utf8/traits that referenced this pull request Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants