-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Rescale initial point before every ecmult_gen #881
Comments
This is where we secp256k1/src/ecmult_gen_impl.h Lines 191 to 192 in 98dac87
This is only called when contexts are created (or at build time for static precomp) and secp256k1_context_randomize .
So this is blinding but the blinding value is fixed across all multiplications. In particular, the z-coordinate will always be the same for the first step of the scalar multiplication, which processes the MSBs of the scalar. (The more steps we do, the more z-coord of the accumulator point will randomized, even though this is not easy to reason about due to our addition formula.) The proposal is to call |
If it's derived from the seckey and/or message (and not from a counter or other mutable data), there is no need to modify the actual in-context |
In fact that's what I have in mind. (I admit it's not what I wrote when I wrote Ok, I think I could open a PR then. |
Perhaps after #693? The ecmult_gen code gets changed a lot. |
Oh yes. That's again what I had in mind yesterday. But apparently I can't even remember things for 24h anymore when I don't write them down. |
Good point. And I think that's fine. From looking at the code, it seems we don't have any invariant that imposes requirements on the coordinates when the infinity flag is set. (But then I wonder why we clear the coordinates here:) Lines 184 to 189 in 98dac87
|
So that they don't end up floating around uninitialized and mixing uninitialized stuff in places (harmlessly and even without causing valgrind to complain, but it's a pita to reason about). |
[...] right now the ecmult_gen uses a random projection for the initial point (secp256k1_gej_rescale). ([...] the rescale currently only happens on randomize-- but that is already something that should get fixed independent of anything being done with the inversion).
Originally posted by @gmaxwell in #767 (comment)
The text was updated successfully, but these errors were encountered: