~mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
791af0b
)
math/scaf.c: Fix conditional subtractions in `scaf_reduce'.
author
Mark Wooding
<mdw@distorted.org.uk>
Wed, 10 May 2017 20:19:32 +0000
(21:19 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sun, 14 May 2017 13:58:40 +0000
(14:58 +0100)
So that they actually subtract the right thing. Obvious blunder. The
big surprise is that none of the literally thousands of
Ed25519
tests
which have hammered on that code caught it. (Found during development
of Ed448, coming later.)
math/scaf.c
patch
|
blob
|
blame
|
history
diff --git
a/math/scaf.c
b/math/scaf.c
index
778e5e3
..
84ef3de
100644
(file)
--- a/
math/scaf.c
+++ b/
math/scaf.c
@@
-269,7
+269,7
@@
void scaf_reduce(scaf_piece *z, const scaf_dblpiece *x,
u += z[j] + (l[j] ^ m);
t[j] = u&m; u >>= piecewd;
}
- for (j = 0, u = -u; j < npiece; j++) z[
i] = (t[i]&u) | (z[i
]&~u);
+ for (j = 0, u = -u; j < npiece; j++) z[
j] = (t[j]&u) | (z[j
]&~u);
}
}