ping doesn't attach forward header redundantly anymore
This commit is contained in:
@@ -35,7 +35,7 @@ var (
|
||||
// for each crypt, and a header which a relay uses to determine what cipher to
|
||||
// use. Everything in a message after this message is encrypted as specified.
|
||||
type Layer struct {
|
||||
Seq int
|
||||
Depth int
|
||||
ToHeaderPub, ToPayloadPub *pub.Key
|
||||
From *prv.Key
|
||||
// The remainder here are for Decode.
|
||||
@@ -81,10 +81,10 @@ func (x *Layer) Encode(b slice.Bytes, c *slice.Cursor) {
|
||||
panic(e)
|
||||
}
|
||||
end := len(b)
|
||||
switch x.Seq {
|
||||
switch x.Depth {
|
||||
case 0:
|
||||
case 3, 2, 1:
|
||||
end = start + (x.Seq-1)*ReverseLayerLen
|
||||
end = start + (x.Depth-1)*ReverseLayerLen
|
||||
default:
|
||||
panic("incorrect value for crypt sequence")
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ func Ping(id nonce.ID, client *traffic.Session, s traffic.Circuit,
|
||||
|
||||
n := GenPingNonces()
|
||||
return Skins{}.
|
||||
ForwardCrypt(s[0], ks.Next(), n[0]).
|
||||
Crypt(s[0].HeaderPub, nil, ks.Next(), n[0], 0).
|
||||
ForwardCrypt(s[1], ks.Next(), n[1]).
|
||||
ForwardCrypt(s[2], ks.Next(), n[2]).
|
||||
ForwardCrypt(s[3], ks.Next(), n[3]).
|
||||
|
||||
@@ -36,7 +36,8 @@ func (o Skins) ForwardCrypt(s *traffic.Session, k *prv.Key,
|
||||
return o.Forward(s.AddrPort).Crypt(s.HeaderPub, s.PayloadPub, k, n, 0)
|
||||
}
|
||||
|
||||
func (o Skins) ReverseCrypt(s *traffic.Session, k *prv.Key, n nonce.IV, seq int) Skins {
|
||||
func (o Skins) ReverseCrypt(s *traffic.Session, k *prv.Key, n nonce.IV,
|
||||
seq int) Skins {
|
||||
|
||||
return o.Reverse(s.AddrPort).Crypt(s.HeaderPub, s.PayloadPub, k, n, seq)
|
||||
}
|
||||
@@ -111,10 +112,10 @@ func (o Skins) GetBalance(id, confID nonce.ID, prvs [3]*prv.Key,
|
||||
}
|
||||
|
||||
func (o Skins) Crypt(toHdr, toPld *pub.Key, from *prv.Key, n nonce.IV,
|
||||
seq int) Skins {
|
||||
depth int) Skins {
|
||||
|
||||
return append(o, &crypt.Layer{
|
||||
Seq: seq,
|
||||
Depth: depth,
|
||||
ToHeaderPub: toHdr,
|
||||
ToPayloadPub: toPld,
|
||||
From: from,
|
||||
|
||||
@@ -22,7 +22,7 @@ func (eng *Engine) SendExit(port uint16, message slice.Bytes, id nonce.ID,
|
||||
o := onion.SendExit(port, message, id, se[len(se)-1], c, eng.KeySet)
|
||||
log.D.Ln("sending out exit onion")
|
||||
res := eng.PostAcctOnion(o)
|
||||
eng.SendWithOneHook(c[0].AddrPort, res, 0, hook)
|
||||
eng.SendWithOneHook(c[0].AddrPort, res, timeout, hook)
|
||||
}
|
||||
|
||||
func (eng *Engine) MakeExit(port uint16, message slice.Bytes, id nonce.ID,
|
||||
|
||||
Reference in New Issue
Block a user