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 block mode traits and wrappers #567

Merged
merged 1 commit into from
Mar 12, 2021
Merged

cipher: add block mode traits and wrappers #567

merged 1 commit into from
Mar 12, 2021

Conversation

newpavlov
Copy link
Member

@newpavlov newpavlov commented Feb 26, 2021

Closes #564

@newpavlov newpavlov requested a review from tarcieri March 3, 2021 09:38
@newpavlov
Copy link
Member Author

Unfortunately, the block mode wrappers are a bit sub-optimal. They first copy data to an output buffer and only then encrypt/decrypt it, i.e. they effectively implement a two-pass approach. But to solve this issue we would have to expose block mode parallelism capabilities... Also ideally we would need a solution for #31. So I think it's worth to postpone it until later versions.

Another interesting observation is that mutable block cipher traits are quite symmetric with the block mode traits. I think it could be worth to explore merging them, e.g. we could say that hardware blocks implement not a block cipher, but ECB mode, on top of which we can implement other block cipher modes.

@tarcieri
Copy link
Member

tarcieri commented Mar 3, 2021

Another interesting observation is that mutable block cipher traits are quite symmetric with the block mode traits. I think it could be worth to explore merging them, e.g. we could say that hardware blocks implement not a block cipher, but ECB mode, on top of which we can implement other block cipher modes.

Interesting idea

aead/src/stream.rs Outdated Show resolved Hide resolved
@newpavlov newpavlov changed the title cipher: add BlockMode and BlockModeWrapper cipher: add block mode traits and wrappers Mar 4, 2021
@newpavlov
Copy link
Member Author

The experimental changes which I currently explore have become too big, so I will merge this PR and open a new one instead.

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.

New block-modes API design
2 participants