OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/crypto/quic_crypto_client_config.h" | 5 #include "net/quic/crypto/quic_crypto_client_config.h" |
6 | 6 |
| 7 #include "base/metrics/sparse_histogram.h" |
7 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
8 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
9 #include "net/quic/crypto/cert_compressor.h" | 10 #include "net/quic/crypto/cert_compressor.h" |
10 #include "net/quic/crypto/chacha20_poly1305_encrypter.h" | 11 #include "net/quic/crypto/chacha20_poly1305_encrypter.h" |
11 #include "net/quic/crypto/channel_id.h" | 12 #include "net/quic/crypto/channel_id.h" |
12 #include "net/quic/crypto/common_cert_set.h" | 13 #include "net/quic/crypto/common_cert_set.h" |
13 #include "net/quic/crypto/crypto_framer.h" | 14 #include "net/quic/crypto/crypto_framer.h" |
14 #include "net/quic/crypto/crypto_utils.h" | 15 #include "net/quic/crypto/crypto_utils.h" |
15 #include "net/quic/crypto/curve25519_key_exchange.h" | 16 #include "net/quic/crypto/curve25519_key_exchange.h" |
16 #include "net/quic/crypto/key_exchange.h" | 17 #include "net/quic/crypto/key_exchange.h" |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 *error_details = "Proof missing"; | 586 *error_details = "Proof missing"; |
586 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; | 587 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER; |
587 } | 588 } |
588 } | 589 } |
589 | 590 |
590 const uint32* reject_reasons; | 591 const uint32* reject_reasons; |
591 size_t num_reject_reasons; | 592 size_t num_reject_reasons; |
592 COMPILE_ASSERT(sizeof(QuicTag) == sizeof(uint32), header_out_of_sync); | 593 COMPILE_ASSERT(sizeof(QuicTag) == sizeof(uint32), header_out_of_sync); |
593 if (rej.GetTaglist(kRREJ, &reject_reasons, | 594 if (rej.GetTaglist(kRREJ, &reject_reasons, |
594 &num_reject_reasons) == QUIC_NO_ERROR) { | 595 &num_reject_reasons) == QUIC_NO_ERROR) { |
595 #if defined(DEBUG) | |
596 uint32 packed_error = 0; | 596 uint32 packed_error = 0; |
597 for (size_t i = 0; i < num_reject_reasons; ++i) { | 597 for (size_t i = 0; i < num_reject_reasons; ++i) { |
598 // HANDSHAKE_OK is 0 and don't report that as error. | 598 // HANDSHAKE_OK is 0 and don't report that as error. |
599 if (reject_reasons[i] == HANDSHAKE_OK || reject_reasons[i] >= 32) { | 599 if (reject_reasons[i] == HANDSHAKE_OK || reject_reasons[i] >= 32) { |
600 continue; | 600 continue; |
601 } | 601 } |
602 HandshakeFailureReason reason = | 602 HandshakeFailureReason reason = |
603 static_cast<HandshakeFailureReason>(reject_reasons[i]); | 603 static_cast<HandshakeFailureReason>(reject_reasons[i]); |
604 packed_error |= 1 << (reason - 1); | 604 packed_error |= 1 << (reason - 1); |
605 } | 605 } |
606 DVLOG(1) << "Reasons for rejection: " << packed_error; | 606 DVLOG(1) << "Reasons for rejection: " << packed_error; |
607 #endif | 607 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicClientHelloRejectReasons", |
| 608 packed_error); |
608 } | 609 } |
609 | 610 |
610 return QUIC_NO_ERROR; | 611 return QUIC_NO_ERROR; |
611 } | 612 } |
612 | 613 |
613 QuicErrorCode QuicCryptoClientConfig::ProcessServerHello( | 614 QuicErrorCode QuicCryptoClientConfig::ProcessServerHello( |
614 const CryptoHandshakeMessage& server_hello, | 615 const CryptoHandshakeMessage& server_hello, |
615 QuicConnectionId connection_id, | 616 QuicConnectionId connection_id, |
616 const QuicVersionVector& negotiated_versions, | 617 const QuicVersionVector& negotiated_versions, |
617 CachedState* cached, | 618 CachedState* cached, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 return; | 765 return; |
765 } | 766 } |
766 | 767 |
767 // Update canonical version to point at the "most recent" entry. | 768 // Update canonical version to point at the "most recent" entry. |
768 canonical_server_map_[suffix_server_id] = server_id; | 769 canonical_server_map_[suffix_server_id] = server_id; |
769 | 770 |
770 server_state->InitializeFrom(*canonical_state); | 771 server_state->InitializeFrom(*canonical_state); |
771 } | 772 } |
772 | 773 |
773 } // namespace net | 774 } // namespace net |
OLD | NEW |