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

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

Issue 1680243005: Make QUIC tests use certs which are valid for the hosts they connect to. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
Index: net/quic/test_tools/mock_crypto_client_stream.cc
diff --git a/net/quic/test_tools/mock_crypto_client_stream.cc b/net/quic/test_tools/mock_crypto_client_stream.cc
index 580beb61a9d87fa91684e1bfe301b0142d65ae3c..aba39e9e5f0e9216ebe1bb5841a363e371db79e5 100644
--- a/net/quic/test_tools/mock_crypto_client_stream.cc
+++ b/net/quic/test_tools/mock_crypto_client_stream.cc
@@ -20,13 +20,14 @@ MockCryptoClientStream::MockCryptoClientStream(
ProofVerifyContext* verify_context,
QuicCryptoClientConfig* crypto_config,
HandshakeMode handshake_mode,
- const ProofVerifyDetails* proof_verify_details)
+ const ProofVerifyDetailsChromium* proof_verify_details)
: QuicCryptoClientStream(server_id,
session,
verify_context,
crypto_config,
session),
handshake_mode_(handshake_mode),
+ server_id_(server_id),
proof_verify_details_(proof_verify_details) {}
MockCryptoClientStream::~MockCryptoClientStream() {}
@@ -38,6 +39,17 @@ void MockCryptoClientStream::OnHandshakeMessage(
}
void MockCryptoClientStream::CryptoConnect() {
+ if (proof_verify_details_) {
+ bool unused = false;
+ if (!proof_verify_details_->cert_verify_result.verified_cert
+ ->VerifyNameMatch(server_id_.host(), &unused)) {
+ handshake_confirmed_ = false;
+ encryption_established_ = false;
+ session()->connection()->CloseConnection(QUIC_PROOF_INVALID, false);
+ return;
+ }
+ }
+
switch (handshake_mode_) {
case ZERO_RTT: {
encryption_established_ = true;
« no previous file with comments | « net/quic/test_tools/mock_crypto_client_stream.h ('k') | net/quic/test_tools/mock_crypto_client_stream_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698