-
Notifications
You must be signed in to change notification settings - Fork 43
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
mirage-crypto-ec: move API to string (instead of cstruct) #210
Conversation
@@ -49,7 +49,7 @@ module type Dh = sig | |||
than the group order meaning the public key cannot be the point at | |||
inifinity. *) | |||
|
|||
val key_exchange : secret -> Cstruct.t -> (Cstruct.t, error) result | |||
val key_exchange : secret -> string -> (string, error) result |
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.
note it may be useful to be able to pass a ?off
in here (but that may as well be premature optimization) -- eventually you receive in some data stream the public you want to use in key_exchange
, and with the revised API you always need to copy it out and create a fresh string. I'm rather undecided about that.
Asking @reynir @Firobe @dinosaure @palainp about opinions? I get some (10% - 20%) speedup for EC operations on my laptop with this. |
Thank you @hannesm . I'm away from my computer for some days, but I'm in favor of that patch esp. as an improvement is observed :) |
On a Intel(R) Core(TM) i7-9700F CPU @ 3.00GHz I don't see any significant speedup (maybe <1% speedup). I'm unsure why not. Maybe it's the CPU architecture. On the other hand I don't observe a slowdown! I'm in favor of this PR at least for the new interface. |
it's not 10%, but here: main branch (61721c2):
this PR (ff2b4d4):
so, likely it is noise in the end. but I prefer the interface over the cstruct one ;) |
No description provided.