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: add traits for tweakable block ciphers #1721

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

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Dec 4, 2024

The trait design generally follows the BlockCipherEnc/Dec traits. We currently do not have tweakable block cipher implementations which use the backend capability, but I think it's still worth to include it for API consistency and to future-proof the traits. Some of the helper methods (e.g. encrypt_blocks) are not translated since it's unclear how to organize passing of tweaks. Arguably, such methods should not be used with tweakable block ciphers either way.

As a bridge between tweakable and non-tweakable traits the ZeroTweak wrapper is introduced. It allows users to use tweakable block cipher implementations with the parts of the ecosystem which expects non-tweakble block ciphers while still being explicit in the code (e.g. ZeroTweak<Threefish256>).

Closes #177

@newpavlov newpavlov requested a review from tarcieri December 4, 2024 13:41
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.

Trait for tweakable block ciphers
1 participant