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

Poly1305 refactor #48

Merged
merged 6 commits into from
Mar 29, 2020
Merged

Poly1305 refactor #48

merged 6 commits into from
Mar 29, 2020

Conversation

str4d
Copy link
Contributor

@str4d str4d commented Mar 28, 2020

Makes the implementation more readable, sets the ground for #46, and also improves performance a bit!

@str4d
Copy link
Contributor Author

str4d commented Mar 28, 2020

See str4d/rage#57 (comment) for an indication of the effect of this PR on ChaCha20Poly1305 performance.

This path will be taken if the caller is exclusively using the
UniversalHash trait. The original path might be taken if they are mixing
in calls to Poly1305::update, which might result in partial blocks.
When zeroize is enabled, Poly1305 implements Drop, and because
soft::Poly1305State does not implement Copy, we cannot move it out of
Poly1305.
use crate::{Tag, BLOCK_SIZE};

#[derive(Clone)]
pub(crate) struct Poly1305State {
Copy link
Member

Choose a reason for hiding this comment

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

I think I'd prefer State to Poly1305State in the spirit of RFC#356 (although that deals specifically with modules, and not necessarily the name of the parent crate)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good; I'll make this change in the next PR.

@tarcieri
Copy link
Member

Will go ahead and merge this. If you agree with Poly1305State => State feel free to do it in the followup PR you want to submit.

@tarcieri tarcieri merged commit 2b1231b into RustCrypto:master Mar 29, 2020
@str4d str4d deleted the poly1305-refactor branch March 29, 2020 23:04
@tarcieri tarcieri mentioned this pull request Jun 6, 2020
str4d added a commit to str4d/rage that referenced this pull request Nov 3, 2020
Improves throughput benchmarks by ~20%, due to a refactor included in
poly1305 0.6:
    RustCrypto/universal-hashes#48
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