Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: net/quic/test_tools/crypto_test_utils.cc

Issue 14718011: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_utils.cc ('k') | net/quic/test_tools/mock_crypto_client_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/crypto_test_utils.cc
diff --git a/net/quic/test_tools/crypto_test_utils.cc b/net/quic/test_tools/crypto_test_utils.cc
index 9504949257292502ecc752720ee3b7c9a8eeb359..4fec83d5dab22c7468c55517c98c68d2675eaabb 100644
--- a/net/quic/test_tools/crypto_test_utils.cc
+++ b/net/quic/test_tools/crypto_test_utils.cc
@@ -110,7 +110,7 @@ void CryptoTestUtils::CommunicateHandshakeMessages(
PacketSavingConnection* b_conn,
QuicCryptoStream* b) {
size_t a_i = 0, b_i = 0;
- while (!a->handshake_complete()) {
+ while (!a->handshake_confirmed()) {
ASSERT_GT(a_conn->packets_.size(), a_i);
LOG(INFO) << "Processing " << a_conn->packets_.size() - a_i
<< " packets a->b";
@@ -218,22 +218,29 @@ string CryptoTestUtils::GetValueForTag(const CryptoHandshakeMessage& message,
void CryptoTestUtils::CompareClientAndServerKeys(
QuicCryptoClientStream* client,
QuicCryptoServerStream* server) {
- StringPiece client_encrypter_key =
- client->session()->connection()->encrypter()->GetKey();
- StringPiece client_encrypter_iv =
- client->session()->connection()->encrypter()->GetNoncePrefix();
- StringPiece client_decrypter_key =
- client->session()->connection()->decrypter()->GetKey();
- StringPiece client_decrypter_iv =
- client->session()->connection()->decrypter()->GetNoncePrefix();
- StringPiece server_encrypter_key =
- server->session()->connection()->encrypter()->GetKey();
- StringPiece server_encrypter_iv =
- server->session()->connection()->encrypter()->GetNoncePrefix();
- StringPiece server_decrypter_key =
- server->session()->connection()->decrypter()->GetKey();
- StringPiece server_decrypter_iv =
- server->session()->connection()->decrypter()->GetNoncePrefix();
+ const QuicEncrypter* client_encrypter(
+ client->session()->connection()->encrypter(ENCRYPTION_INITIAL));
+ // Normally we would expect the client's INITIAL decrypter to have latched
+ // from the receipt of the server hello. However, when using a
+ // PacketSavingConnection (at the tests do) we don't actually encrypt with
+ // the correct encrypter.
+ // TODO(agl): make the tests more realistic.
+ const QuicDecrypter* client_decrypter(
+ client->session()->connection()->alternative_decrypter());
+ const QuicEncrypter* server_encrypter(
+ server->session()->connection()->encrypter(ENCRYPTION_INITIAL));
+ const QuicDecrypter* server_decrypter(
+ server->session()->connection()->decrypter());
+
+ StringPiece client_encrypter_key = client_encrypter->GetKey();
+ StringPiece client_encrypter_iv = client_encrypter->GetNoncePrefix();
+ StringPiece client_decrypter_key = client_decrypter->GetKey();
+ StringPiece client_decrypter_iv = client_decrypter->GetNoncePrefix();
+ StringPiece server_encrypter_key = server_encrypter->GetKey();
+ StringPiece server_encrypter_iv = server_encrypter->GetNoncePrefix();
+ StringPiece server_decrypter_key = server_decrypter->GetKey();
+ StringPiece server_decrypter_iv = server_decrypter->GetNoncePrefix();
+
CompareCharArraysWithHexError("client write key",
client_encrypter_key.data(),
client_encrypter_key.length(),
« no previous file with comments | « net/quic/quic_utils.cc ('k') | net/quic/test_tools/mock_crypto_client_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698