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

Side by Side Diff: net/quic/crypto/crypto_utils.cc

Issue 255333003: Renamed namespaces in src/net. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tue 04/29/2014 19:22:06.75 Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_resolver_v8.cc ('k') | net/socket_stream/socket_stream_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/crypto_utils.h" 5 #include "net/quic/crypto/crypto_utils.h"
6 6
7 #include "crypto/hkdf.h" 7 #include "crypto/hkdf.h"
8 #include "net/base/net_util.h" 8 #include "net/base/net_util.h"
9 #include "net/quic/crypto/crypto_handshake.h" 9 #include "net/quic/crypto/crypto_handshake.h"
10 #include "net/quic/crypto/crypto_protocol.h" 10 #include "net/quic/crypto/crypto_protocol.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 kNonceSize - bytes_written); 44 kNonceSize - bytes_written);
45 } 45 }
46 46
47 // static 47 // static
48 bool CryptoUtils::IsValidSNI(StringPiece sni) { 48 bool CryptoUtils::IsValidSNI(StringPiece sni) {
49 // TODO(rtenneti): Support RFC2396 hostname. 49 // TODO(rtenneti): Support RFC2396 hostname.
50 // NOTE: Microsoft does NOT enforce this spec, so if we throw away hostnames 50 // NOTE: Microsoft does NOT enforce this spec, so if we throw away hostnames
51 // based on the above spec, we may be losing some hostnames that windows 51 // based on the above spec, we may be losing some hostnames that windows
52 // would consider valid. By far the most common hostname character NOT 52 // would consider valid. By far the most common hostname character NOT
53 // accepted by the above spec is '_'. 53 // accepted by the above spec is '_'.
54 url_canon::CanonHostInfo host_info; 54 url::CanonHostInfo host_info;
55 string canonicalized_host(CanonicalizeHost(sni.as_string(), &host_info)); 55 string canonicalized_host(CanonicalizeHost(sni.as_string(), &host_info));
56 return !host_info.IsIPAddress() && 56 return !host_info.IsIPAddress() &&
57 IsCanonicalizedHostCompliant(canonicalized_host, std::string()) && 57 IsCanonicalizedHostCompliant(canonicalized_host, std::string()) &&
58 sni.find_last_of('.') != string::npos; 58 sni.find_last_of('.') != string::npos;
59 } 59 }
60 60
61 // static 61 // static
62 string CryptoUtils::NormalizeHostname(const char* hostname) { 62 string CryptoUtils::NormalizeHostname(const char* hostname) {
63 url_canon::CanonHostInfo host_info; 63 url::CanonHostInfo host_info;
64 string host(CanonicalizeHost(hostname, &host_info)); 64 string host(CanonicalizeHost(hostname, &host_info));
65 65
66 // Walk backwards over the string, stopping at the first trailing dot. 66 // Walk backwards over the string, stopping at the first trailing dot.
67 size_t host_end = host.length(); 67 size_t host_end = host.length();
68 while (host_end != 0 && host[host_end - 1] == '.') { 68 while (host_end != 0 && host[host_end - 1] == '.') {
69 host_end--; 69 host_end--;
70 } 70 }
71 71
72 // Erase the trailing dots. 72 // Erase the trailing dots.
73 if (host_end != host.length()) { 73 if (host_end != host.length()) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 !out->decrypter->SetKey(hkdf.server_write_key()) || 111 !out->decrypter->SetKey(hkdf.server_write_key()) ||
112 !out->decrypter->SetNoncePrefix(hkdf.server_write_iv())) { 112 !out->decrypter->SetNoncePrefix(hkdf.server_write_iv())) {
113 return false; 113 return false;
114 } 114 }
115 } 115 }
116 116
117 return true; 117 return true;
118 } 118 }
119 119
120 } // namespace net 120 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_v8.cc ('k') | net/socket_stream/socket_stream_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698