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

Side by Side Diff: net/quic/quic_crypto_server_stream.cc

Issue 2188663003: Add plumbing for passing stats from calls to ProofSource::GetProof through QUIC. These stats are n… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@128459519
Patch Set: Rebase Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_crypto_server_stream.h" 5 #include "net/quic/quic_crypto_server_stream.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "crypto/secure_hash.h" 10 #include "crypto/secure_hash.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 validate_client_hello_cb_ = new ValidateCallback(this); 150 validate_client_hello_cb_ = new ValidateCallback(this);
151 crypto_config_->ValidateClientHello( 151 crypto_config_->ValidateClientHello(
152 message, session()->connection()->peer_address().address(), 152 message, session()->connection()->peer_address().address(),
153 session()->connection()->self_address().address(), version(), 153 session()->connection()->self_address().address(), version(),
154 session()->connection()->clock(), &crypto_proof_, 154 session()->connection()->clock(), &crypto_proof_,
155 validate_client_hello_cb_); 155 validate_client_hello_cb_);
156 } 156 }
157 157
158 void QuicCryptoServerStream::FinishProcessingHandshakeMessage( 158 void QuicCryptoServerStream::FinishProcessingHandshakeMessage(
159 const CryptoHandshakeMessage& message, 159 const CryptoHandshakeMessage& message,
160 const ValidateClientHelloResultCallback::Result& result) { 160 const ValidateClientHelloResultCallback::Result& result,
161 std::unique_ptr<ProofSource::Details> details) {
161 // Clear the callback that got us here. 162 // Clear the callback that got us here.
162 DCHECK(validate_client_hello_cb_ != nullptr); 163 DCHECK(validate_client_hello_cb_ != nullptr);
163 validate_client_hello_cb_ = nullptr; 164 validate_client_hello_cb_ = nullptr;
164 165
165 if (use_stateless_rejects_if_peer_supported_) { 166 if (use_stateless_rejects_if_peer_supported_) {
166 peer_supports_stateless_rejects_ = DoesPeerSupportStatelessRejects(message); 167 peer_supports_stateless_rejects_ = DoesPeerSupportStatelessRejects(message);
167 } 168 }
168 169
169 CryptoHandshakeMessage reply; 170 CryptoHandshakeMessage reply;
170 DiversificationNonce diversification_nonce; 171 DiversificationNonce diversification_nonce;
171 string error_details; 172 string error_details;
172 QuicErrorCode error = ProcessClientHello( 173 QuicErrorCode error =
173 message, result, &reply, &diversification_nonce, &error_details); 174 ProcessClientHello(message, result, std::move(details), &reply,
175 &diversification_nonce, &error_details);
174 176
175 if (error != QUIC_NO_ERROR) { 177 if (error != QUIC_NO_ERROR) {
176 CloseConnectionWithDetails(error, error_details); 178 CloseConnectionWithDetails(error, error_details);
177 return; 179 return;
178 } 180 }
179 181
180 if (reply.tag() != kSHLO) { 182 if (reply.tag() != kSHLO) {
181 if (reply.tag() == kSREJ) { 183 if (reply.tag() == kSREJ) {
182 DCHECK(use_stateless_rejects_if_peer_supported_); 184 DCHECK(use_stateless_rejects_if_peer_supported_);
183 DCHECK(peer_supports_stateless_rejects_); 185 DCHECK(peer_supports_stateless_rejects_);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } 412 }
411 output->resize(len); 413 output->resize(len);
412 } 414 }
413 } 415 }
414 return true; 416 return true;
415 } 417 }
416 418
417 QuicErrorCode QuicCryptoServerStream::ProcessClientHello( 419 QuicErrorCode QuicCryptoServerStream::ProcessClientHello(
418 const CryptoHandshakeMessage& message, 420 const CryptoHandshakeMessage& message,
419 const ValidateClientHelloResultCallback::Result& result, 421 const ValidateClientHelloResultCallback::Result& result,
422 std::unique_ptr<ProofSource::Details> proof_source_details,
420 CryptoHandshakeMessage* reply, 423 CryptoHandshakeMessage* reply,
421 DiversificationNonce* out_diversification_nonce, 424 DiversificationNonce* out_diversification_nonce,
422 string* error_details) { 425 string* error_details) {
423 QuicServerSessionBase* session_base = 426 QuicServerSessionBase* session_base =
424 static_cast<QuicServerSessionBase*>(session()); 427 static_cast<QuicServerSessionBase*>(session());
425 if (!session_base->CanAcceptClientHello(message, error_details)) { 428 if (!session_base->CanAcceptClientHello(message, error_details)) {
426 return QUIC_HANDSHAKE_FAILED; 429 return QUIC_HANDSHAKE_FAILED;
427 } 430 }
428 431
429 if (!result.info.server_nonce.empty()) { 432 if (!result.info.server_nonce.empty()) {
(...skipping 29 matching lines...) Expand all
459 QuicCryptoServerStream::ValidateCallback::ValidateCallback( 462 QuicCryptoServerStream::ValidateCallback::ValidateCallback(
460 QuicCryptoServerStream* parent) 463 QuicCryptoServerStream* parent)
461 : parent_(parent) {} 464 : parent_(parent) {}
462 465
463 void QuicCryptoServerStream::ValidateCallback::Cancel() { 466 void QuicCryptoServerStream::ValidateCallback::Cancel() {
464 parent_ = nullptr; 467 parent_ = nullptr;
465 } 468 }
466 469
467 void QuicCryptoServerStream::ValidateCallback::RunImpl( 470 void QuicCryptoServerStream::ValidateCallback::RunImpl(
468 const CryptoHandshakeMessage& client_hello, 471 const CryptoHandshakeMessage& client_hello,
469 const Result& result) { 472 const Result& result,
473 std::unique_ptr<ProofSource::Details> details) {
470 if (parent_ != nullptr) { 474 if (parent_ != nullptr) {
471 parent_->FinishProcessingHandshakeMessage(client_hello, result); 475 parent_->FinishProcessingHandshakeMessage(client_hello, result,
476 std::move(details));
472 } 477 }
473 } 478 }
474 479
475 QuicConnectionId QuicCryptoServerStream::GenerateConnectionIdForReject( 480 QuicConnectionId QuicCryptoServerStream::GenerateConnectionIdForReject(
476 QuicConnectionId connection_id) { 481 QuicConnectionId connection_id) {
477 // TODO(rch): Remove this method when 482 // TODO(rch): Remove this method when
478 // reloadable_flag_quic_dispatcher_creates_id2 is removed. 483 // reloadable_flag_quic_dispatcher_creates_id2 is removed.
479 QuicServerSessionBase* session_base = 484 QuicServerSessionBase* session_base =
480 static_cast<QuicServerSessionBase*>(session()); 485 static_cast<QuicServerSessionBase*>(session());
481 return session_base->GenerateConnectionIdForReject(connection_id); 486 return session_base->GenerateConnectionIdForReject(connection_id);
482 } 487 }
483 488
484 } // namespace net 489 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698