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

cipher: rework backend traits #1636

Merged
merged 12 commits into from
Aug 14, 2024
Merged

cipher: rework backend traits #1636

merged 12 commits into from
Aug 14, 2024

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Jul 31, 2024

This PR splits BlockBackend traits into 4 specific traits: BlockCipherEncBackend, BlockCipherDecBackend, BlockModeEncBackend, and BlockModeDecBackend. Same for BlockClosure. This allows for cipher backends to remove awkard &mut &backend juggling (see RustCrypto/block-ciphers#442), makes code a bit easier to read (i.e. encrypt_blocks instead of proc_blocks), and allows for one backend type to be used for both encryption and decryption.

The impl_simple_block_encdec macro is removed since we now can implement the backend traits directly on cipher types, which should make implementation crates slightly easier to understand.

Additionally, it moves traits to the block and cipher modules to reduce clutter in the crate root. Later we can add docs to each module to describe the traits in detail.

@newpavlov newpavlov requested a review from tarcieri July 31, 2024 19:53
@newpavlov newpavlov merged commit 3ebd677 into master Aug 14, 2024
84 checks passed
@newpavlov newpavlov deleted the block_backends branch August 14, 2024 13:40
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.

1 participant