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

Refactor 2PC GHASH #171

Merged
merged 2 commits into from
Jan 26, 2023
Merged

Refactor 2PC GHASH #171

merged 2 commits into from
Jan 26, 2023

Conversation

sinui0
Copy link
Member

@sinui0 sinui0 commented Jan 24, 2023

This PR moves the ghash impl into the universal-hash crate. The core logic should be untouched.

Changes

  1. Updated interface to support initialization prior to knowing the key share
  2. Introduced the UniversalHash trait which is a common interface between GHASH and Poly1305
  3. Renamed a couple variables such as max_message_length -> max_block_count as the message vs block naming was a bit confusing.
  4. Automatically pad the message if it isn't a multiple of the block size
  5. Automatically compute new shares if the block count increases.

Copy link
Member

@th4s th4s left a comment

Choose a reason for hiding this comment

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

Nice 🚀, ACK with some small changes

universal-hash/src/ghash/ghash/mod.rs Show resolved Hide resolved
universal-hash/src/ghash/ghash/mod.rs Outdated Show resolved Hide resolved
universal-hash/src/ghash/ghash/mod.rs Show resolved Hide resolved
Copy link
Member

@themighty1 themighty1 left a comment

Choose a reason for hiding this comment

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

ack

#[derive(Debug, Clone, Builder)]
pub struct GhashConfig {
/// Initial number of block shares to provision
#[builder(default = "1024")]
Copy link
Member

Choose a reason for hiding this comment

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

Don't we want 1026 here and below ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I like powers of 2 🙃 but if we do find ourselves hitting against this limit we can adjust the default

@sinui0 sinui0 merged commit cd9faec into dev Jan 26, 2023
@sinui0 sinui0 deleted the refactor/ghash-interface branch January 26, 2023 17:31
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.

3 participants