-
Notifications
You must be signed in to change notification settings - Fork 14
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
polyval: Implement GHASH #9
Conversation
@@ -22,6 +22,7 @@ zeroize = { version = "0.10", optional = true, default-features = false } | |||
hex-literal = "0.1" | |||
|
|||
[features] | |||
ghash = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively we could use the ghash
crate for this. What do you think @newpavlov? I could go either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I think using ghash
crate would be better for visibility, but then it would be probably better to move field
module to a separate crate (and you will not see polyval
in a dependency tree for gmac
). But if you prefer the current way I am fine with it as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we leave them in the same crate for now, and I can investigate things getting VPCLMULQDQ working, and runtime CPU detection and fallback to the software implementation, and once all of that stuff is working we can investigate splitting them into separate crates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sounds good to me.
cf0a7d4
to
3aaaf75
Compare
polyval/src/ghash.rs
Outdated
|
||
/// Get POLYVAL result (i.e. computed `S` field element) | ||
fn result(self) -> Output<U16> { | ||
let mut output: Block = self.0.result().into_bytes().as_slice().try_into().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can replace it with a simple self.0.result().into()
. GenericArray<T; U16>
implements Into<[T; 16]>
since generic-array v0.12.3
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I guess I knew that but did things the silly way anyway.
I was able to eliminate all use of TryInto
via simple Into
conversions (at least in the ghash
module).
3aaaf75
to
a0ad868
Compare
Implements GHASH in terms of POLYVAL as described in RFC 8452 Appendix A: https://tools.ietf.org/html/rfc8452#appendix-A
a0ad868
to
2265955
Compare
Implements GHASH in terms of POLYVAL as described in RFC 8452 Appendix A:
https://tools.ietf.org/html/rfc8452#appendix-A