-
Notifications
You must be signed in to change notification settings - Fork 499
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
Misleading description for hash-to-Edwards point #400
Comments
I don't like that these function is here at all, actually.
I'd like to remove these functions entirely, unless someone can find a non-broken upstream use. If removal isn't possible, I'd like to feature-gate it behind Plan for removal: What I'd like to do is deprecate this in 4.0 and remove it in 4.1. But this technically breaks semver. So maybe a better route is to feature-gate it behind @tarcieri thoughts? |
We’ve done a decent amount of work in the @RustCrypto My best guess is |
Also you can feature gate them behind a feature which is explicitly called out as exempt from semver, perhaps complete with a deprecation warning. The same thing could be done with the |
|
Ugh you're right, the Ristretto version also does not appear to implement the Elligator standard (it only does half the map). I think this should also be deprecated. We could pretty easily re-introduce elligator2 methods in a future major release. The RFC has lots of test vectors |
There were good reasons to expose the original singleton elligator map for ed25519, no? It's not exposed for ristretto now anyways, likely because there are no ristretto protocols you wish to resemble. I simply meant the ristretto version does not depend upon the ed25519 version. In ristretto, the actual hash |
I'd like to release before fixing this issue though. We can deprecate these functions but you bring up an important question: do we need a new name for the functions that will replace these? Is that a question for later? |
Ignore my ed25519 question above.. Afaik, there are no problems with the Ristretto code, so afaik nothing there should be deprecated or changed now or in the future, just maybe adding the RFC test vectors eventually. |
I'm wrong. It appears to be doing the correct thing. I should add the real test vectors to make sure. |
Fixed my point above. A separate point is that these hashing functions do no domain separation, despite the RFC mandating it. Fixing it would be breaking, but leaving it would be Not Good. Hmmm |
You can remind people in comments, but clearly |
My issue here was specifically about As for deprecating: since |
I can get in touch with Trevor if you like, but if we did use (It'd be neat to get those upstreamed but I do not myself have a cryptographer background and can't say whether they're generally useful operations, or too specific to what Signal / zkgroup is doing.) |
That's good to know. Hopefully this means the deprecation won't be noticed. Thank you! |
Resolved in #438 |
The function
EdwardsPoint::hash_from_bytes()
is described as "performing hashing to the group" and explicitly references draft-irtf-cfrg-hash-to-curve:curve25519-dalek/src/edwards.rs
Lines 529 to 532 in 8abb22b
This is a rather misleading description because:
encode_to_curve
, nothash_to_curve
(the draft reserves the latter name for the construction that invokes the map twice, and adds together the two output points, to yield a quasi-uniform output distribution).The first point is mostly about interoperability; while the map is not the same as in the draft, it is still safe (in particular, this code just uses the first 255 bits of a hash output as a field element, while the draft would generate 129 extra bits and perform a modular reduction; but in Curve25519, the field modulus is very close to 2^255, so the bias from using just 255 input bits is negligible). The second point is, arguably, more important for security, because the current
hash_from_bytes()
produces points with a non-uniform distribution that is easy to distinguish from a uniform random generation. Most protocols (and in particular the Signal stuff that this implementation follows) don't mind, but some of them require a uniform distribution, and the lack of uniformity can have consequences ranging from invalid security proofs to actual information leaks.I recommend, at least, modifying the documentation to make it explicit that the implemented functionality is not compatible with draft-irtf-cfrg-hash-to-curve, and that it has a non-uniform output distribution, which may be troublesome for some (admittedly not many) protocols.
Looking at the existing pull requests, I see PR #377, which not only modifies the description of
hash_from_bytes()
, but also implements (in new, additional functions) the draft-irtf-hash-to-curve process. I have not looked in details at that PR, but the idea seems good.The text was updated successfully, but these errors were encountered: