-
Notifications
You must be signed in to change notification settings - Fork 208
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
Expose ProjectivePoint
value
#937
Comments
Are you expecting these strings to compare equal if their corresponding One thing to keep in mind is that projective points use a homogenous coordinate system, where many projective points (e.g. when the coordinates are multiplied by the same value) can map to the same affine point. |
That's a good point, but for our purposes, it does not matter. All we care about is to have a mapping between projective points and byte arrays. I'm fine with multiple projective points that map into the same affine point to be mapped to different byte arrays, so long as the That being said, your comment makes it clear that this might not be for all use-cases, and so maybe implementing the standard Let me know how to proceed, and I'll make the PR. Thanks |
Really exposing anything about the internals I guess the right place for this is probably zkcrypto/group#30 though that has generally been about exposing affine coordinates, not projective ones. Perhaps you could leave a comment about your use case there? |
Depending on the implementation, exposing the projective point can leak information about the discrete logarithm (https://www.iacr.org/archive/eurocrypt2004/30270258/projective.pdf) It sounds to me like a batched projective->affine conversion would solve your problem without introducing a footgun. Typically a batch conversion of any size is basically as efficient as a single, since you only have to do a single field inversion for the whole batch. |
Thanks for that save. That does sound efficient. Can we do that instead @tarcieri ? |
@ycscaly that sounds like the way to go, yes |
@tarcieri you've raised concerns here regarding the safety of exposing and using the projective coordinate of an elliptic curve, which is the representation used for group operations, and suggested that we only use the affine representation, which is the canonic representation of the group element value. A similar issue happens in groups like Paillier, which I implemented using A cryptographer colleague of mine looked at Montgomery form and suggested we can do that, since the representation is canonical. However, I thought it would be good to have your opinion here as well. The alternative is a similar batch conversion routine, which I'm not certain whether it exists for Montgomery reductions. Thanks |
@ycscaly I similarly consider the use of Montgomery form as the internal representation of field elements something of an implementation detail which I haven't previously considered exposing Likewise there are field implementations where we don't use Montgomery form, like P-521, where we use an unsaturated representation which is able to leverage unique properties of Mersenne/Solinas primes. |
However, the Montgomery form is exposed in |
We don't actually use |
Maybe the confusion stems from me putting this comment in the elliptic curve crate. I just wanted to continue the discussion as it is related. But this is a pure If it helps I can move the question to |
Aah, I mean, if you want to use Montgomery form as the wire format for your custom protocol, I don't see any problem with that |
Great,thats what I wanted to know - that it doesn't open up a new attack vector vs. the alternative of sending the reduced Uint |
The value of the
x
,y
, andz
coordinates of theProjectivePoint
struct is private, and it is intended that one should use.to_affine()
to get a canonical representation of the point. That function, however, is extremely computationally costly in comparison to accessing the fields directly, clocking at 5.4642 µs.I am now developing an aggregatable, batched Schnorr proof, and for e.g. the knowledge of the discrete log language
.to_affine()
becomes the bottleneck as we need to call itbatch_size
times as each statement should be put into the transcript.I don't actually need to access the members of this struct (the coordinates) but I do need a unique representation in bytes that is computationally inexpensive (it should be a few nano seconds and not micro seconds.)
@tarcieri your thoughts on this?
The text was updated successfully, but these errors were encountered: