Skip to content

ocb3: migrate internals to use inout #667

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

baloo
Copy link
Member

@baloo baloo commented Mar 17, 2025

This is to prepare the migration to AeadInOut, following RustCrypto/traits#1793

Depends:

@baloo baloo force-pushed the baloo/ocb3/inout branch from f4fdb5c to d5ce931 Compare March 17, 2025 05:27
@baloo baloo marked this pull request as draft March 17, 2025 05:27
@baloo baloo force-pushed the baloo/ocb3/inout branch from d5ce931 to e6191ae Compare March 17, 2025 05:49
@baloo
Copy link
Member Author

baloo commented Mar 17, 2025

I couldn't figure out a way to test inout here with two separate buffers, but this gets tested in #665 when it's plugged with AeadInOut (tested by aead::new_test)

ocb3/src/lib.rs Outdated
pub(crate) type Block = Array<u8, U16>;
type BlockSize = U16;
pub(crate) type Block = Array<u8, BlockSize>;
type DoubleBlock = Array<u8, <BlockSize as Mul<U2>>::Output>;
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively you can use Add instead of Mul<U2> (where Add implicitly takes Self as a default) e.g. https://github.com/RustCrypto/AEADs/blob/a09f3d2/aes-siv/src/siv.rs#L101

Copy link
Member Author

Choose a reason for hiding this comment

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

It's an internal type, I think it's better to be explicit about the intent?
Relying on the implicit value of Add makes it harder to read imho.

Copy link
Member Author

Choose a reason for hiding this comment

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

went with typenum::Prod

@baloo baloo force-pushed the baloo/ocb3/inout branch 2 times, most recently from 0aeac3f to 42e4e95 Compare March 25, 2025 23:13
@baloo baloo marked this pull request as ready for review March 25, 2025 23:14
@baloo baloo force-pushed the baloo/ocb3/inout branch 3 times, most recently from e5ff157 to 54a2f61 Compare March 31, 2025 16:30
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.

2 participants