make comments describe what code actually does.
Dominic Tarr committed
May 6, 2015 at 15:33 UTC
e89e83f49e0f764504958872c38040dc09f5658e
1 file changed
+3
-3
p2p/crypto/secio/protocol.go
+3
-3
@@ -144,7 +144,7 @@ func (s *secureSession) handshake(ctx context.Context, insecure io.ReadWriter) e
144
// =============================================================================
145
// step 1.2 Selection -- select/agree on best encryption parameters
146
147
- // to determine order, use cmp(H(lr||rpk), H(rr||lpk)).
147
+ // to determine order, use cmp(H(remote_pubkey||local_rand), H(local_pubkey||remote_rand)).
148
oh1 := u.Hash(append(proposeIn.GetPubkey(), nonceOut...))
149
oh2 := u.Hash(append(myPubKeyBytes, proposeIn.GetRand()...))
150
order := bytes.Compare(oh1, oh2)
@@ -203,7 +203,7 @@ func (s *secureSession) handshake(ctx context.Context, insecure io.ReadWriter) e
203
return err
204
}
205
206
- // Receive + Parse their Propose packet and generate an Exchange packet.
206
+ // Receive + Parse their Exchange packet.
207
exchangeIn := new(pb.Exchange)
208
if _, err := readMsgCtx(ctx, s.insecureM, exchangeIn); err != nil {
209
return err
@@ -278,7 +278,7 @@ func (s *secureSession) handshake(ctx context.Context, insecure io.ReadWriter) e
278
// log.Debug("2.3 mac + cipher.")
279
280
// =============================================================================
281
- // step 3. Finish -- send expected message (the nonces), verify encryption works
281
+ // step 3. Finish -- send expected message to verify encryption works (send local nonce)
282
283
// setup ETM ReadWriter
284
w := NewETMWriter(s.insecure, s.local.cipher, s.local.mac)