mirror of
https://github.com/golang/go
synced 2024-11-21 23:24:41 -07:00
internal/edwards25519: skip zero coef in VarTimeDoubleScalarBaseMult
The comment says "Find the first nonzero coefficient.", but actually this code does nothing. I fixed it to work correctly. ``` name old time/op new time/op delta VarTimeDoubleScalarBaseMult-10 37.5µs ± 0% 36.9µs ± 0% -1.48% (p=0.000 n=19+16) ```
This commit is contained in:
parent
537c4354cb
commit
a5fa9169d0
@ -167,8 +167,8 @@ func (v *Point) VarTimeDoubleScalarBaseMult(a *Scalar, A *Point, b *Scalar) *Poi
|
||||
|
||||
// Find the first nonzero coefficient.
|
||||
i := 255
|
||||
for j := i; j >= 0; j-- {
|
||||
if aNaf[j] != 0 || bNaf[j] != 0 {
|
||||
for ; i >= 0; i-- {
|
||||
if aNaf[i] != 0 || bNaf[i] != 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user