Răsfoiți Sursa

add equality check for nonce and remote nonce

zelig 10 ani în urmă
părinte
comite
923504ce3d
1 a modificat fișierele cu 6 adăugiri și 0 ștergeri
  1. 6 0
      p2p/crypto_test.go

+ 6 - 0
p2p/crypto_test.go

@@ -38,6 +38,12 @@ func TestCryptoHandshake(t *testing.T) {
 
 	fmt.Printf("%x\n%x\n%x\n%x\n%x\n%x\n%x\n%x\n%x\n%x\n", auth, initNonce, response, remoteRecNonce, remoteInitNonce, remoteRandomPubKey, recNonce, &randomPrivKey.PublicKey, initSessionToken, initSecretRW)
 
+	if !bytes.Equal(initNonce, remoteInitNonce) {
+		t.Errorf("nonces do not match")
+	}
+	if !bytes.Equal(recNonce, remoteRecNonce) {
+		t.Errorf("receiver nonces do not match")
+	}
 	if !bytes.Equal(initSessionToken, recSessionToken) {
 		t.Errorf("session tokens do not match")
 	}