Commit ac71020
group: Save a normalize_to_zero in gej_add_ge
The code currently switches to the alternative formula for lambda only if (R,M)
= (0,0) but the alternative formula works whenever M = 0: Specifically, M = 0
implies y1 = -y2. If x1 = x2, then a = -b this is the r = infinity case that we
handle separately. If x1 != x2, then the denominator in the alternative formula
is non-zero, so this formula is well-defined.
One needs to carefully check that the infinity assignment is still correct
because now the definition of m_alt at this point in the code has changed. But
this is true:
Case y1 = -y2:
Then degenerate = true and infinity = ((x1 - x2)Z == 0) & ~a->infinity .
a->infinity is handled separately.
And if ~a->infinity, then Z = Z1 != 0,
so infinity = (x1 - x2 == 0) = (a == -b) by case condition.
Case y1 != -y2:
Then degenerate = false and infinity = ((y1 + y2)Z == 0) & ~a->infinity .
a->infinity is handled separately.
And if ~a->infinity, then Z = Z1 != 0,
so infinity = (y1 + y2 == 0) = false by case condition.
Co-Authored-By: Pieter Wuille <[email protected]>1 parent 1253a27 commit ac71020
2 files changed
+12
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
| 179 | + | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | 184 | | |
189 | 185 | | |
190 | 186 | | |
| |||
200 | 196 | | |
201 | 197 | | |
202 | 198 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
207 | 202 | | |
208 | | - | |
| 203 | + | |
209 | 204 | | |
210 | 205 | | |
211 | 206 | | |
| |||
289 | 284 | | |
290 | 285 | | |
291 | 286 | | |
292 | | - | |
| 287 | + | |
293 | 288 | | |
294 | 289 | | |
295 | 290 | | |
296 | 291 | | |
297 | 292 | | |
298 | 293 | | |
299 | | - | |
| 294 | + | |
300 | 295 | | |
301 | 296 | | |
302 | 297 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
561 | | - | |
| 561 | + | |
562 | 562 | | |
563 | | - | |
564 | | - | |
| 563 | + | |
565 | 564 | | |
566 | 565 | | |
567 | 566 | | |
| |||
573 | 572 | | |
574 | 573 | | |
575 | 574 | | |
576 | | - | |
| 575 | + | |
577 | 576 | | |
578 | 577 | | |
579 | 578 | | |
| |||
0 commit comments