Fix curve mulgen iterate/derive
This commit is contained in:
parent
8dec368878
commit
f47fb628f0
|
@ -58,7 +58,9 @@ proc mul*(_: type[Curve25519], dst: var Curve25519Key, scalar: Curve25519Key, po
|
||||||
assert res == 1
|
assert res == 1
|
||||||
|
|
||||||
proc mulgen*(_: type[Curve25519], dst: var Curve25519Key, scalar: Curve25519Key) =
|
proc mulgen*(_: type[Curve25519], dst: var Curve25519Key, scalar: Curve25519Key) =
|
||||||
|
block iterate:
|
||||||
while true:
|
while true:
|
||||||
|
block derive:
|
||||||
let
|
let
|
||||||
size = defaultBrEc.mulgen(
|
size = defaultBrEc.mulgen(
|
||||||
cast[pcuchar](addr dst[0]),
|
cast[pcuchar](addr dst[0]),
|
||||||
|
@ -68,8 +70,8 @@ proc mulgen*(_: type[Curve25519], dst: var Curve25519Key, scalar: Curve25519Key)
|
||||||
assert size == Curve25519KeySize
|
assert size == Curve25519KeySize
|
||||||
for forbid in ForbiddenCurveValues:
|
for forbid in ForbiddenCurveValues:
|
||||||
if dst == forbid:
|
if dst == forbid:
|
||||||
continue
|
break derive
|
||||||
break
|
break iterate
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
var
|
var
|
||||||
|
|
Loading…
Reference in New Issue