1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-01 19:24:14 +08:00

Reenable secure channel code

This commit is contained in:
Jeromy
2014-10-27 21:34:48 +00:00
parent f89cfc1108
commit 32417724a6

View File

@ -184,41 +184,43 @@ func (s *SecurePipe) handshake() error {
}
cmp := bytes.Compare(myPubKey, proposeResp.GetPubkey())
//mIV, tIV, mCKey, tCKey, mMKey, tMKey := ci.KeyStretcher(cmp, cipherType, hashType, secret)
ci.KeyStretcher(cmp, cipherType, hashType, secret)
mIV, tIV, mCKey, tCKey, mMKey, tMKey := ci.KeyStretcher(cmp, cipherType, hashType, secret)
//ci.KeyStretcher(cmp, cipherType, hashType, secret)
//go s.handleSecureIn(hashType, cipherType, tIV, tCKey, tMKey)
//go s.handleSecureOut(hashType, cipherType, mIV, mCKey, mMKey)
go s.handleSecureIn(hashType, cipherType, tIV, tCKey, tMKey)
go s.handleSecureOut(hashType, cipherType, mIV, mCKey, mMKey)
// Disable Secure Channel
go func(sp *SecurePipe) {
for {
select {
case <-sp.ctx.Done():
return
case m, ok := <-sp.insecure.In:
if !ok {
sp.cancel()
/*
// Disable Secure Channel
go func(sp *SecurePipe) {
for {
select {
case <-sp.ctx.Done():
return
case m, ok := <-sp.insecure.In:
if !ok {
sp.cancel()
return
}
sp.In <- m
}
sp.In <- m
}
}
}(s)
go func(sp *SecurePipe) {
for {
select {
case <-sp.ctx.Done():
return
case m, ok := <-sp.Out:
if !ok {
sp.cancel()
}(s)
go func(sp *SecurePipe) {
for {
select {
case <-sp.ctx.Done():
return
case m, ok := <-sp.Out:
if !ok {
sp.cancel()
return
}
sp.insecure.Out <- m
}
sp.insecure.Out <- m
}
}
}(s)
}(s)
*/
finished := []byte("Finished")