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: add inout support #1793

Merged
merged 2 commits into from
Mar 12, 2025
Merged

aead: add inout support #1793

merged 2 commits into from
Mar 12, 2025

Conversation

tarcieri
Copy link
Member

Renames AeadInPlaceDetached to AeadInOut, and changes the type signature so the provided buffer is now an InOutBuf

@tarcieri tarcieri requested a review from newpavlov March 12, 2025 16:28
Renames `AeadInPlaceDetached` to `AeadInOut`, and changes the type
signature so the provided `buffer` is now an `InOutBuf`
Copy link
Member

@newpavlov newpavlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's worth to gate inout and have the split between AeadInPlace and AeadInOut. If your intent is to use the traits for hardware-based encryptors which can not support buf-to-buf mode of operation, then I think they should implement the inout API by simply copying data from input to output buffer in the case the buffers are separate.

But I guess we can discuss it in separate PRs/issues.

@tarcieri
Copy link
Member Author

If your intent is to use the traits for hardware-based encryptors which can not support buf-to-buf mode of operation, then I think they should implement the inout API by simply copying data from input to output buffer in the case the buffers are separate.

It's for wrapping any API which can't use the inout pattern, whether it's a hardware accelerator, a C implementation of an AEAD, or a TPM/SEP/KMS/etc (which would probably benefit from async traits, but I digress).

I think we can potentially combine AeadCore, Aead, and AeadInPlace into a single trait at this point, but I think it makes sense to keep inout separate.

@tarcieri tarcieri merged commit 204a4e0 into master Mar 12, 2025
84 of 85 checks passed
@tarcieri tarcieri deleted the aead/inout branch March 12, 2025 17:45
tarcieri added a commit to RustCrypto/AEADs that referenced this pull request Mar 13, 2025
Replaces the previous `AeadInPlaceDetached` impls with `AeadInOut`,
which was introduced in RustCrypto/traits#1793
@baloo
Copy link
Member

baloo commented Mar 14, 2025

About gating the inout feature, I don't think there is a single crate that can work without it here: RustCrypto/AEADs#664

@tarcieri
Copy link
Member Author

@baloo as mentioned above, it's gated to ensure the traits are still useful/usable for use cases beyond our own crates

@baloo
Copy link
Member

baloo commented Mar 14, 2025

fair enough.

baloo pushed a commit to baloo/AEADs that referenced this pull request Mar 17, 2025
Replaces the previous `AeadInPlaceDetached` impls with `AeadInOut`,
which was introduced in RustCrypto/traits#1793
baloo pushed a commit to baloo/AEADs that referenced this pull request Mar 17, 2025
Replaces the previous `AeadInPlaceDetached` impls with `AeadInOut`,
which was introduced in RustCrypto/traits#1793
baloo pushed a commit to baloo/AEADs that referenced this pull request Mar 17, 2025
Replaces the previous `AeadInPlaceDetached` impls with `AeadInOut`,
which was introduced in RustCrypto/traits#1793
baloo pushed a commit to baloo/AEADs that referenced this pull request Mar 17, 2025
Replaces the previous `AeadInPlaceDetached` impls with `AeadInOut`,
which was introduced in RustCrypto/traits#1793
baloo pushed a commit to baloo/AEADs that referenced this pull request Mar 17, 2025
Replaces the previous `AeadInPlaceDetached` impls with `AeadInOut`,
which was introduced in RustCrypto/traits#1793
baloo pushed a commit to baloo/AEADs that referenced this pull request Mar 21, 2025
Replaces the previous `AeadInPlaceDetached` impls with `AeadInOut`,
which was introduced in RustCrypto/traits#1793
newpavlov pushed a commit to RustCrypto/AEADs that referenced this pull request Mar 24, 2025
This is to prepare the migration to `AeadInOut`, following
RustCrypto/traits#1793

Note: there is a strong chance this could actually use the
StreamCipherCore api, but I couldn't not make it fit.
baloo pushed a commit to baloo/AEADs that referenced this pull request Mar 24, 2025
Replaces the previous `AeadInPlaceDetached` impls with `AeadInOut`,
which was introduced in RustCrypto/traits#1793
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.

3 participants