Commit a796d2f1 authored by Jeromy's avatar Jeromy

gx publish 1.1.7

parent d0b299c8
1.1.6: QmZmbJapJZPcXtS7cwX9fnbVLwc26tN9CsY9NSfCEujPZG
1.1.7: QmV2e7FjHs7N27D4gRoe2wqRMhMCtfiMmm2teeKqvk7K4Y
......@@ -13,12 +13,6 @@
"name": "go-msgio",
"version": "0.0.0"
},
{
"author": "whyrusleeping",
"hash": "QmVBCw9KC9Z7prCbFf7YFcnfSUUnAMiUXNr91e9qLnRBdA",
"name": "go-ipfs-util",
"version": "1.2.1"
},
{
"author": "whyrusleeping",
"hash": "QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52",
......@@ -33,15 +27,15 @@
},
{
"author": "whyrusleeping",
"hash": "QmPb2njwxSV3JK3tFHqMjyTxp3wnMoKemyJJD19TB1wmW1",
"hash": "QmP1DfoUjiWH2ZBo1PBH6FupdBucbDepx3HpWmEY6JMUpY",
"name": "go-libp2p-crypto",
"version": "1.3.3"
"version": "1.4.2"
},
{
"author": "whyrusleeping",
"hash": "QmfDnbDVGXZMg1MffZd4dSFKNq8cQC6zSFKMyBZ6PNun26",
"hash": "QmdS9KpbDyPrieswibZhkod1oXqRwZJrUPzxCofAMWpFGq",
"name": "go-libp2p-peer",
"version": "2.1.1"
"version": "2.1.7"
}
],
"gxVersion": "0.4.0",
......@@ -49,6 +43,6 @@
"license": "MIT",
"name": "go-libp2p-secio",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "1.1.6"
"version": "1.1.7"
}
......@@ -10,12 +10,12 @@ import (
"sync"
"time"
u "github.com/ipfs/go-ipfs-util"
logging "github.com/ipfs/go-log"
msgio "github.com/jbenet/go-msgio"
ci "github.com/libp2p/go-libp2p-crypto"
peer "github.com/libp2p/go-libp2p-peer"
pb "github.com/libp2p/go-libp2p-secio/pb"
mh "github.com/multiformats/go-multihash"
)
var log = logging.Logger("secio")
......@@ -104,6 +104,17 @@ func (s *secureSession) Handshake() error {
return s.handshakeErr
}
func hashSha256(data []byte) mh.Multihash {
h, err := mh.Sum(data, mh.SHA2_256, -1)
if err != nil {
// this error can be safely ignored (panic) because multihash only fails
// from the selection of hash function. If the fn + length are valid, it
// won't error.
panic("multihash failed to hash using SHA2_256.")
}
return h
}
// runHandshake performs initial communication over insecure channel to share
// keys, IDs, and initiate communication, assigning all necessary params.
// requires the duplex channel to be a msgio.ReadWriter (for framed messaging)
......@@ -178,8 +189,8 @@ func (s *secureSession) runHandshake() error {
// step 1.2 Selection -- select/agree on best encryption parameters
// to determine order, use cmp(H(remote_pubkey||local_rand), H(local_pubkey||remote_rand)).
oh1 := u.Hash(append(proposeIn.GetPubkey(), nonceOut...))
oh2 := u.Hash(append(myPubKeyBytes, proposeIn.GetRand()...))
oh1 := hashSha256(append(proposeIn.GetPubkey(), nonceOut...))
oh2 := hashSha256(append(myPubKeyBytes, proposeIn.GetRand()...))
order := bytes.Compare(oh1, oh2)
if order == 0 {
return ErrEcho // talking to self (same socket. must be reuseport + dialing self)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment