mirror of
https://github.com/codex-storage/nim-libp2p.git
synced 2025-01-11 11:34:24 +00:00
Fix curve mulgen iterate/derive
This commit is contained in:
parent
8dec368878
commit
f47fb628f0
@ -58,18 +58,20 @@ 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) =
|
||||||
while true:
|
block iterate:
|
||||||
let
|
while true:
|
||||||
size = defaultBrEc.mulgen(
|
block derive:
|
||||||
cast[pcuchar](addr dst[0]),
|
let
|
||||||
cast[pcuchar](unsafeAddr scalar[0]),
|
size = defaultBrEc.mulgen(
|
||||||
Curve25519KeySize,
|
cast[pcuchar](addr dst[0]),
|
||||||
EC_curve25519.cint)
|
cast[pcuchar](unsafeAddr scalar[0]),
|
||||||
assert size == Curve25519KeySize
|
Curve25519KeySize,
|
||||||
for forbid in ForbiddenCurveValues:
|
EC_curve25519.cint)
|
||||||
if dst == forbid:
|
assert size == Curve25519KeySize
|
||||||
continue
|
for forbid in ForbiddenCurveValues:
|
||||||
break
|
if dst == forbid:
|
||||||
|
break derive
|
||||||
|
break iterate
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
var
|
var
|
||||||
|
Loading…
x
Reference in New Issue
Block a user