Fix curve mulgen iterate/derive

This commit is contained in:
Giovanni Petrantoni 2020-02-14 12:16:21 +09:00 committed by Dmitriy Ryajov
parent 8dec368878
commit f47fb628f0
1 changed files with 14 additions and 12 deletions

View File

@ -58,7 +58,9 @@ proc mul*(_: type[Curve25519], dst: var Curve25519Key, scalar: Curve25519Key, po
assert res == 1
proc mulgen*(_: type[Curve25519], dst: var Curve25519Key, scalar: Curve25519Key) =
block iterate:
while true:
block derive:
let
size = defaultBrEc.mulgen(
cast[pcuchar](addr dst[0]),
@ -68,8 +70,8 @@ proc mulgen*(_: type[Curve25519], dst: var Curve25519Key, scalar: Curve25519Key)
assert size == Curve25519KeySize
for forbid in ForbiddenCurveValues:
if dst == forbid:
continue
break
break derive
break iterate
when isMainModule:
var