From 2f90b3e318395f37d0f6e713f22b9938581bcb31 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 18 Feb 2018 14:32:27 +0300 Subject: [PATCH] Updated upstream dependencies --- src/chacha20 | 2 +- src/cypherpunks.ru/nncp/node.go | 5 ++++- src/cypherpunks.ru/nncp/sp.go | 25 ++++++++++++++++++++----- src/github.com/flynn/noise | 2 +- src/golang.org/x/crypto | 2 +- src/golang.org/x/net | 2 +- src/golang.org/x/sys | 2 +- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/chacha20 b/src/chacha20 index 95f85aa..883eae7 120000 --- a/src/chacha20 +++ b/src/chacha20 @@ -1 +1 @@ -golang.org/x/crypto/chacha20poly1305/internal/chacha20 \ No newline at end of file +golang.org/x/crypto/internal/chacha20 \ No newline at end of file diff --git a/src/cypherpunks.ru/nncp/node.go b/src/cypherpunks.ru/nncp/node.go index 9cd4605..f1fb79f 100644 --- a/src/cypherpunks.ru/nncp/node.go +++ b/src/cypherpunks.ru/nncp/node.go @@ -85,7 +85,10 @@ func NewNodeGenerate() (*NodeOur, error) { if err != nil { return nil, err } - noiseKey := noise.DH25519.GenerateKeypair(rand.Reader) + noiseKey, err := noise.DH25519.GenerateKeypair(rand.Reader) + if err != nil { + return nil, err + } noisePub := new([32]byte) noisePrv := new([32]byte) copy(noisePrv[:], noiseKey.Private) diff --git a/src/cypherpunks.ru/nncp/sp.go b/src/cypherpunks.ru/nncp/sp.go index ee54f74..5bffe28 100644 --- a/src/cypherpunks.ru/nncp/sp.go +++ b/src/cypherpunks.ru/nncp/sp.go @@ -297,9 +297,13 @@ func (ctx *Ctx) StartI(conn net.Conn, nodeId *NodeId, nice uint8, xxOnly TRxTx, }, PeerStatic: node.NoisePub[:], } + hs, err := noise.NewHandshakeState(conf) + if err != nil { + return nil, err + } state := SPState{ ctx: ctx, - hs: noise.NewHandshakeState(conf), + hs: hs, Node: node, onlineDeadline: onlineDeadline, maxOnlineTime: maxOnlineTime, @@ -328,7 +332,11 @@ func (ctx *Ctx) StartI(conn net.Conn, nodeId *NodeId, nice uint8, xxOnly TRxTx, var buf []byte var payload []byte - buf, _, _ = state.hs.WriteMessage(nil, firstPayload) + buf, _, _, err = state.hs.WriteMessage(nil, firstPayload) + if err != nil { + state.dirUnlock() + return nil, err + } sds := SDS{"node": nodeId, "nice": strconv.Itoa(int(nice))} ctx.LogD("sp-start", sds, "sending first message") conn.SetWriteDeadline(time.Now().Add(DefaultDeadline * time.Second)) @@ -371,9 +379,13 @@ func (ctx *Ctx) StartR(conn net.Conn, nice uint8, xxOnly TRxTx) (*SPState, error Public: ctx.Self.NoisePub[:], }, } + hs, err := noise.NewHandshakeState(conf) + if err != nil { + return nil, err + } state := SPState{ ctx: ctx, - hs: noise.NewHandshakeState(conf), + hs: hs, nice: nice, payloads: make(chan []byte), infosOurSeen: make(map[[32]byte]struct{}), @@ -383,7 +395,6 @@ func (ctx *Ctx) StartR(conn net.Conn, nice uint8, xxOnly TRxTx) (*SPState, error } var buf []byte var payload []byte - var err error ctx.LogD( "sp-start", SDS{"nice": strconv.Itoa(int(nice))}, @@ -449,7 +460,11 @@ func (ctx *Ctx) StartR(conn net.Conn, nice uint8, xxOnly TRxTx) (*SPState, error } ctx.LogD("sp-start", sds, "sending first message") - buf, state.csTheir, state.csOur = state.hs.WriteMessage(nil, firstPayload) + buf, state.csTheir, state.csOur, err = state.hs.WriteMessage(nil, firstPayload) + if err != nil { + state.dirUnlock() + return nil, err + } conn.SetWriteDeadline(time.Now().Add(DefaultDeadline * time.Second)) if err = state.WriteSP(conn, buf); err != nil { ctx.LogE("sp-start", SdsAdd(sds, SDS{"err": err}), "") diff --git a/src/github.com/flynn/noise b/src/github.com/flynn/noise index fc3a9f3..01638cb 160000 --- a/src/github.com/flynn/noise +++ b/src/github.com/flynn/noise @@ -1 +1 @@ -Subproject commit fc3a9f3b3c4fba0af38ac409e8867672499d26e4 +Subproject commit 01638cb52dafe42224b938fb517721f984c03100 diff --git a/src/golang.org/x/crypto b/src/golang.org/x/crypto index d585fd2..650f4a3 160000 --- a/src/golang.org/x/crypto +++ b/src/golang.org/x/crypto @@ -1 +1 @@ -Subproject commit d585fd2cc9195196078f516b69daff6744ef5e84 +Subproject commit 650f4a345ab4e5b245a3034b110ebc7299e68186 diff --git a/src/golang.org/x/net b/src/golang.org/x/net index d866cfc..136a25c 160000 --- a/src/golang.org/x/net +++ b/src/golang.org/x/net @@ -1 +1 @@ -Subproject commit d866cfc389cec985d6fda2859936a575a55a3ab6 +Subproject commit 136a25c244d3019482a795d728110278d6ba09a4 diff --git a/src/golang.org/x/sys b/src/golang.org/x/sys index 8380141..37707fd 160000 --- a/src/golang.org/x/sys +++ b/src/golang.org/x/sys @@ -1 +1 @@ -Subproject commit 83801418e1b59fb1880e363299581ee543af32ca +Subproject commit 37707fdb30a5b38865cfb95e5aab41707daec7fd -- 2.44.0