mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-14 17:04:53 +00:00
deploy: ea62e2b7cea936ed364f0026fb4283f94a129303
This commit is contained in:
parent
f16fce554b
commit
6b7ba5986b
@ -2,7 +2,7 @@
|
||||
|
||||
# libtool - Provide generalized library-building support services.
|
||||
# Generated automatically by config.status (libbacktrace) version-unused
|
||||
# Libtool was configured on host fv-az308-858:
|
||||
# Libtool was configured on host fv-az335-655:
|
||||
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
||||
#
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
|
||||
|
@ -355,7 +355,7 @@ proc processMessagePatternTokens(rng: var BrHmacDrbgContext, hs: var HandshakeSt
|
||||
trace "noise write s"
|
||||
|
||||
# If the local static key is not set (the handshake state was not properly initialized), we raise an error
|
||||
if hs.s == default(KeyPair):
|
||||
if isDefault(hs.s):
|
||||
raise newException(NoisePublicKeyError, "Static key not set")
|
||||
|
||||
# We encrypt the public part of the static key in case a key is set in the Cipher State
|
||||
@ -386,7 +386,7 @@ proc processMessagePatternTokens(rng: var BrHmacDrbgContext, hs: var HandshakeSt
|
||||
trace "noise dh ee"
|
||||
|
||||
# If local and/or remote ephemeral keys are not set, we raise an error
|
||||
if hs.e == default(KeyPair) or hs.re == default(Curve25519Key):
|
||||
if isDefault(hs.e) or isDefault(hs.re):
|
||||
raise newException(NoisePublicKeyError, "Local or remote ephemeral key not set")
|
||||
|
||||
# Calls MixKey(DH(e, re)).
|
||||
@ -401,11 +401,11 @@ proc processMessagePatternTokens(rng: var BrHmacDrbgContext, hs: var HandshakeSt
|
||||
# We check if keys are correctly set.
|
||||
# If both present, we call MixKey(DH(e, rs)) if initiator, MixKey(DH(s, re)) if responder.
|
||||
if hs.initiator:
|
||||
if hs.e == default(KeyPair) or hs.rs == default(Curve25519Key):
|
||||
if isDefault(hs.e) or isDefault(hs.rs):
|
||||
raise newException(NoisePublicKeyError, "Local or remote ephemeral/static key not set")
|
||||
hs.ss.mixKey(dh(hs.e.privateKey, hs.rs))
|
||||
else:
|
||||
if hs.re == default(Curve25519Key) or hs.s == default(KeyPair):
|
||||
if isDefault(hs.re) or isDefault(hs.s):
|
||||
raise newException(NoisePublicKeyError, "Local or remote ephemeral/static key not set")
|
||||
hs.ss.mixKey(dh(hs.s.privateKey, hs.re))
|
||||
|
||||
@ -418,11 +418,11 @@ proc processMessagePatternTokens(rng: var BrHmacDrbgContext, hs: var HandshakeSt
|
||||
# We check if keys are correctly set.
|
||||
# If both present, call MixKey(DH(s, re)) if initiator, MixKey(DH(e, rs)) if responder.
|
||||
if hs.initiator:
|
||||
if hs.s == default(KeyPair) or hs.re == default(Curve25519Key):
|
||||
if isDefault(hs.s) or isDefault(hs.re):
|
||||
raise newException(NoiseMalformedHandshake, "Local or remote ephemeral/static key not set")
|
||||
hs.ss.mixKey(dh(hs.s.privateKey, hs.re))
|
||||
else:
|
||||
if hs.rs == default(Curve25519Key) or hs.e == default(KeyPair):
|
||||
if isDefault(hs.rs) or isDefault(hs.e):
|
||||
raise newException(NoiseMalformedHandshake, "Local or remote ephemeral/static key not set")
|
||||
hs.ss.mixKey(dh(hs.e.privateKey, hs.rs))
|
||||
|
||||
@ -433,7 +433,7 @@ proc processMessagePatternTokens(rng: var BrHmacDrbgContext, hs: var HandshakeSt
|
||||
trace "noise dh ss"
|
||||
|
||||
# If local and/or remote static keys are not set, we raise an error
|
||||
if hs.s == default(KeyPair) or hs.rs == default(Curve25519Key):
|
||||
if isDefault(hs.s) or isDefault(hs.rs):
|
||||
raise newException(NoiseMalformedHandshake, "Local or remote static key not set")
|
||||
|
||||
# Calls MixKey(DH(s, rs)).
|
||||
|
@ -57,6 +57,11 @@ proc pkcs7_unpad*(payload: seq[byte], paddingSize: int): seq[byte] =
|
||||
let unpadded = payload[0..payload.high-k.int]
|
||||
return unpadded
|
||||
|
||||
# Simple utility that checks if the given variable is "default",
|
||||
# Therefore, it has not been initialized
|
||||
proc isDefault*[T](value: T): bool =
|
||||
value == static(default(T))
|
||||
|
||||
#################################################################
|
||||
|
||||
#################################
|
||||
@ -406,4 +411,4 @@ proc deserializePayloadV2*(payload: seq[byte]): Result[PayloadV2, cstring]
|
||||
payload2.transportMessage = payload[i..i+transportMessageLen-1]
|
||||
i += transportMessageLen
|
||||
|
||||
return ok(payload2)
|
||||
return ok(payload2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user