summaryrefslogtreecommitdiffstats
path: root/net/quic/crypto/crypto_handshake.cc
diff options
context:
space:
mode:
authorrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-22 14:47:50 +0000
committerrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-22 14:47:50 +0000
commitaf806e6d9e18cdd223c76db4af45af3559e75245 (patch)
tree21c7badd804adacb46558fc73d0f953f49614c54 /net/quic/crypto/crypto_handshake.cc
parentc85a2af7a310db435ddb5fd849a7de56b1b49c79 (diff)
downloadchromium_src-af806e6d9e18cdd223c76db4af45af3559e75245.zip
chromium_src-af806e6d9e18cdd223c76db4af45af3559e75245.tar.gz
chromium_src-af806e6d9e18cdd223c76db4af45af3559e75245.tar.bz2
Revert 201501 "Land Recent QUIC changes."
Broke chromium.chrome build: ../../net/quic/test_tools/crypto_test_utils.cc:400:error: 'v' may be used uninitialized in this function > Land Recent QUIC changes. > > Use example.com as test hostname. > > Merge internal change: 46048925 > > Only updating the time of last packet once we've done our best to verify packet validity. > > Merge internal change: 46044184 > > Improve logging behavior in quic_connection.h. > > Merge internal change: 46033559 > > Moving the public flags to the beginning of the header in preparation for variable length guids. > > Merge internal change: 45980153 > > QUIC: change the GCM tag size to 12 bytes. > > Merge internal change: 45973625 > > QUIC: add some crypto tests. > > The client code tries to be correct, which can hamper some tests that wish to > send invalid requests. > > This CL contains some utilities for constructing arbitrary handshake messages > and some tests that exercise the server crypto code. > > Merge internal change: 45972782 > > Not allowing retransmissions to affect client timeouts. Fixes a serious > bug where if client vanishes and we have unacked packets, the connection > could live on forever. > > Merge internal change: 45935953 > > Address wtc's comments on cl/44272981. > > Merge internal change: 45917323 > > QUIC: don't CHECK when QUIC is enabled without any certificates loaded. > > Without certificates we don't have any key material for the source-address > token nor server config and so QUIC isn't setup at server load time. However, > if QUIC is enabled anyway then it'll crash. > > This change removes the CHECK and has every crypto handshake fail instead. > > (I have tests for the recent SNI change pending, into which a test for this > will fall nicely, hopefully this afternoon. But I'm prioritising this change > for now rather than waiting for the test CL to land.) > > Merge internal change: 45914344 > > Merging cleanup changes from chromium > > Merge internal change: 45797529 > > QUIC: pad client hello messages and require padding on the server. > > This reduces any amplification factor that an attacker might get from us. I've > picked a minimum size of 512 bytes out of thin air. > > Satyam has a change pending that bumps the version to 2 so I've omitted that here. > > Merge internal change: 45779287 > > QUIC: small fixes > > * Don't send invalid SNIs as a client. > * Don't require an SNI as a server. > * Don't ignore client hello processing errors. > > Merge internal change: 45774287 > > QUIC - set QUIC max stream per connections based on SNI. > > Merge internal change: 45656436 > > - Enabled EndToEnd's Timeout unittest. > - Ported IsValidSNI and NormalizeHostname from internal code. > > R=rch@chromium.org > > Review URL: https://chromiumcodereview.appspot.com/15385004 TBR=rtenneti@chromium.org Review URL: https://codereview.chromium.org/15737008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201516 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/crypto/crypto_handshake.cc')
-rw-r--r--net/quic/crypto/crypto_handshake.cc48
1 files changed, 7 insertions, 41 deletions
diff --git a/net/quic/crypto/crypto_handshake.cc b/net/quic/crypto/crypto_handshake.cc
index db66f4b..3585eb5 100644
--- a/net/quic/crypto/crypto_handshake.cc
+++ b/net/quic/crypto/crypto_handshake.cc
@@ -8,7 +8,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
-#include "base/stringprintf.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "crypto/secure_hash.h"
@@ -28,22 +27,18 @@
#include "net/quic/quic_utils.h"
using base::StringPiece;
-using base::StringPrintf;
using std::map;
using std::string;
using std::vector;
namespace net {
-CryptoHandshakeMessage::CryptoHandshakeMessage()
- : tag_(0),
- minimum_size_(0) {}
+CryptoHandshakeMessage::CryptoHandshakeMessage() : tag_(0) {}
CryptoHandshakeMessage::CryptoHandshakeMessage(
const CryptoHandshakeMessage& other)
: tag_(other.tag_),
- tag_value_map_(other.tag_value_map_),
- minimum_size_(other.minimum_size_) {
+ tag_value_map_(other.tag_value_map_) {
// Don't copy serialized_. scoped_ptr doesn't have a copy constructor.
// The new object can reconstruct serialized_ lazily.
}
@@ -57,14 +52,12 @@ CryptoHandshakeMessage& CryptoHandshakeMessage::operator=(
// Don't copy serialized_. scoped_ptr doesn't have an assignment operator.
// However, invalidate serialized_.
serialized_.reset();
- minimum_size_ = other.minimum_size_;
return *this;
}
void CryptoHandshakeMessage::Clear() {
tag_ = 0;
tag_value_map_.clear();
- minimum_size_ = 0;
serialized_.reset();
}
@@ -203,29 +196,6 @@ QuicErrorCode CryptoHandshakeMessage::GetUint64(QuicTag tag,
return GetPOD(tag, out, sizeof(uint64));
}
-size_t CryptoHandshakeMessage::size() const {
- size_t ret = sizeof(QuicTag) +
- sizeof(uint16) /* number of entries */ +
- sizeof(uint16) /* padding */;
- ret += (sizeof(QuicTag) + sizeof(uint32) /* end offset */) *
- tag_value_map_.size();
- for (QuicTagValueMap::const_iterator i = tag_value_map_.begin();
- i != tag_value_map_.end(); ++i) {
- ret += i->second.size();
- }
-
- return ret;
-}
-
-void CryptoHandshakeMessage::set_minimum_size(size_t min_bytes) {
- serialized_.reset();
- minimum_size_ = min_bytes;
-}
-
-size_t CryptoHandshakeMessage::minimum_size() const {
- return minimum_size_;
-}
-
string CryptoHandshakeMessage::DebugString() const {
return DebugStringInternal(0);
}
@@ -299,11 +269,6 @@ string CryptoHandshakeMessage::DebugStringInternal(size_t indent) const {
}
}
break;
- case kPAD:
- ret += StringPrintf("(%d bytes of padding)",
- static_cast<int>(it->second.size()));
- done = true;
- break;
}
if (!done) {
@@ -468,11 +433,12 @@ void QuicCryptoClientConfig::FillInchoateClientHello(
QuicCryptoNegotiatedParameters* out_params,
CryptoHandshakeMessage* out) const {
out->set_tag(kCHLO);
- out->set_minimum_size(kClientHelloMinimumSize);
- // Server name indication. We only send SNI if it's a valid domain name, as
- // per the spec.
- if (CryptoUtils::IsValidSNI(server_hostname)) {
+ // Server name indication.
+ // If server_hostname is not an IP address literal, it is a DNS hostname.
+ IPAddressNumber ip;
+ if (!server_hostname.empty() &&
+ !ParseIPLiteralToNumber(server_hostname, &ip)) {
out->SetStringPiece(kSNI, server_hostname);
}
out->SetValue(kVERS, version);