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

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

Issue 2132623002: Landing Recent QUIC changes until 2016-07-02 02:45 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing comment about RPCs Created 4 years, 5 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
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config_test.cc ('k') | net/quic/quic_alarm.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 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_server_config.h" 5 #include "net/quic/crypto/quic_crypto_server_config.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 if (validate_chlo_result.error_code != QUIC_NO_ERROR) { 597 if (validate_chlo_result.error_code != QUIC_NO_ERROR) {
598 *error_details = validate_chlo_result.error_details; 598 *error_details = validate_chlo_result.error_details;
599 return validate_chlo_result.error_code; 599 return validate_chlo_result.error_code;
600 } 600 }
601 601
602 out->Clear(); 602 out->Clear();
603 603
604 bool x509_supported = false; 604 bool x509_supported = false;
605 bool x509_ecdsa_supported = false; 605 bool x509_ecdsa_supported = false;
606 ParseProofDemand(client_hello, &x509_supported, &x509_ecdsa_supported); 606 ParseProofDemand(client_hello, &x509_supported, &x509_ecdsa_supported);
607 if (!x509_supported && FLAGS_quic_require_x509) {
608 *error_details = "Missing or invalid PDMD";
609 return QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER;
610 }
607 DCHECK(proof_source_.get()); 611 DCHECK(proof_source_.get());
608 string chlo_hash; 612 string chlo_hash;
609 CryptoUtils::HashHandshakeMessage(client_hello, &chlo_hash); 613 CryptoUtils::HashHandshakeMessage(client_hello, &chlo_hash);
610 if (!crypto_proof->chain && 614 if (!crypto_proof->chain &&
611 !proof_source_->GetProof( 615 !proof_source_->GetProof(
612 server_ip, info.sni.as_string(), primary_config->serialized, version, 616 server_ip, info.sni.as_string(), primary_config->serialized, version,
613 chlo_hash, x509_ecdsa_supported, &crypto_proof->chain, 617 chlo_hash, x509_ecdsa_supported, &crypto_proof->chain,
614 &crypto_proof->signature, &crypto_proof->cert_sct)) { 618 &crypto_proof->signature, &crypto_proof->cert_sct)) {
615 return QUIC_HANDSHAKE_FAILED; 619 return QUIC_HANDSHAKE_FAILED;
616 } 620 }
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 StringPiece chlo_hash, 1160 StringPiece chlo_hash,
1157 const SourceAddressTokens& previous_source_address_tokens, 1161 const SourceAddressTokens& previous_source_address_tokens,
1158 const IPAddress& server_ip, 1162 const IPAddress& server_ip,
1159 const IPAddress& client_ip, 1163 const IPAddress& client_ip,
1160 const QuicClock* clock, 1164 const QuicClock* clock,
1161 QuicRandom* rand, 1165 QuicRandom* rand,
1162 QuicCompressedCertsCache* compressed_certs_cache, 1166 QuicCompressedCertsCache* compressed_certs_cache,
1163 const QuicCryptoNegotiatedParameters& params, 1167 const QuicCryptoNegotiatedParameters& params,
1164 const CachedNetworkParameters* cached_network_params, 1168 const CachedNetworkParameters* cached_network_params,
1165 CryptoHandshakeMessage* out) const { 1169 CryptoHandshakeMessage* out) const {
1166 base::AutoLock locked(configs_lock_); 1170 string serialized;
1171 string source_address_token;
1172 const CommonCertSets* common_cert_sets;
1173 {
1174 base::AutoLock locked(configs_lock_);
1175 serialized = primary_config_->serialized;
1176 common_cert_sets = primary_config_->common_cert_sets;
1177 source_address_token = NewSourceAddressToken(
1178 *primary_config_, previous_source_address_tokens, client_ip, rand,
1179 clock->WallNow(), cached_network_params);
1180 }
1181
1167 out->set_tag(kSCUP); 1182 out->set_tag(kSCUP);
1168 out->SetStringPiece(kSCFG, primary_config_->serialized); 1183 out->SetStringPiece(kSCFG, serialized);
1169 out->SetStringPiece( 1184 out->SetStringPiece(kSourceAddressTokenTag, source_address_token);
1170 kSourceAddressTokenTag,
1171 NewSourceAddressToken(*primary_config_.get(),
1172 previous_source_address_tokens, client_ip, rand,
1173 clock->WallNow(), cached_network_params));
1174 1185
1175 scoped_refptr<ProofSource::Chain> chain; 1186 scoped_refptr<ProofSource::Chain> chain;
1176 string signature; 1187 string signature;
1177 string cert_sct; 1188 string cert_sct;
1178 if (FLAGS_quic_use_hash_in_scup) { 1189 if (FLAGS_quic_use_hash_in_scup) {
1179 if (!proof_source_->GetProof(server_ip, params.sni, 1190 if (!proof_source_->GetProof(server_ip, params.sni, serialized, version,
1180 primary_config_->serialized, version,
1181 chlo_hash, params.x509_ecdsa_supported, &chain, 1191 chlo_hash, params.x509_ecdsa_supported, &chain,
1182 &signature, &cert_sct)) { 1192 &signature, &cert_sct)) {
1183 DVLOG(1) << "Server: failed to get proof."; 1193 DVLOG(1) << "Server: failed to get proof.";
1184 return false; 1194 return false;
1185 } 1195 }
1186 } else { 1196 } else {
1187 if (!proof_source_->GetProof( 1197 if (!proof_source_->GetProof(
1188 server_ip, params.sni, primary_config_->serialized, version, 1198 server_ip, params.sni, serialized, version, params.client_nonce,
1189 params.client_nonce, params.x509_ecdsa_supported, &chain, 1199 params.x509_ecdsa_supported, &chain, &signature, &cert_sct)) {
1190 &signature, &cert_sct)) {
1191 DVLOG(1) << "Server: failed to get proof."; 1200 DVLOG(1) << "Server: failed to get proof.";
1192 return false; 1201 return false;
1193 } 1202 }
1194 } 1203 }
1195 1204
1196 const string compressed = CompressChain( 1205 const string compressed = CompressChain(
1197 compressed_certs_cache, chain, params.client_common_set_hashes, 1206 compressed_certs_cache, chain, params.client_common_set_hashes,
1198 params.client_cached_cert_hashes, primary_config_->common_cert_sets); 1207 params.client_cached_cert_hashes, common_cert_sets);
1199 1208
1200 out->SetStringPiece(kCertificateTag, compressed); 1209 out->SetStringPiece(kCertificateTag, compressed);
1201 out->SetStringPiece(kPROF, signature); 1210 out->SetStringPiece(kPROF, signature);
1202 if (params.sct_supported_by_client && version > QUIC_VERSION_29 && 1211 if (params.sct_supported_by_client && version > QUIC_VERSION_29 &&
1203 enable_serving_sct_) { 1212 enable_serving_sct_) {
1204 if (cert_sct.empty()) { 1213 if (cert_sct.empty()) {
1205 DLOG(WARNING) << "SCT is expected but it is empty."; 1214 DLOG(WARNING) << "SCT is expected but it is empty.";
1206 } else { 1215 } else {
1207 out->SetStringPiece(kCertificateSCTTag, cert_sct); 1216 out->SetStringPiece(kCertificateSCTTag, cert_sct);
1208 } 1217 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 } 1251 }
1243 1252
1244 // Send client the reject reason for debugging purposes. 1253 // Send client the reject reason for debugging purposes.
1245 DCHECK_LT(0u, info.reject_reasons.size()); 1254 DCHECK_LT(0u, info.reject_reasons.size());
1246 out->SetVector(kRREJ, info.reject_reasons); 1255 out->SetVector(kRREJ, info.reject_reasons);
1247 1256
1248 // The client may have requested a certificate chain. 1257 // The client may have requested a certificate chain.
1249 bool x509_supported = false; 1258 bool x509_supported = false;
1250 ParseProofDemand(client_hello, &x509_supported, 1259 ParseProofDemand(client_hello, &x509_supported,
1251 &params->x509_ecdsa_supported); 1260 &params->x509_ecdsa_supported);
1252 if (!x509_supported) { 1261 if (!x509_supported && FLAGS_quic_require_x509) {
1262 QUIC_BUG << "x509 certificates not supported in proof demand";
1253 return; 1263 return;
1254 } 1264 }
1255 1265
1256 StringPiece client_common_set_hashes; 1266 StringPiece client_common_set_hashes;
1257 if (client_hello.GetStringPiece(kCCS, &client_common_set_hashes)) { 1267 if (client_hello.GetStringPiece(kCCS, &client_common_set_hashes)) {
1258 params->client_common_set_hashes = client_common_set_hashes.as_string(); 1268 params->client_common_set_hashes = client_common_set_hashes.as_string();
1259 } 1269 }
1260 1270
1261 StringPiece client_cached_cert_hashes; 1271 StringPiece client_cached_cert_hashes;
1262 if (client_hello.GetStringPiece(kCCRT, &client_cached_cert_hashes)) { 1272 if (client_hello.GetStringPiece(kCCRT, &client_cached_cert_hashes)) {
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 priority(0), 1836 priority(0),
1827 source_address_token_boxer(nullptr) {} 1837 source_address_token_boxer(nullptr) {}
1828 1838
1829 QuicCryptoServerConfig::Config::~Config() { 1839 QuicCryptoServerConfig::Config::~Config() {
1830 STLDeleteElements(&key_exchanges); 1840 STLDeleteElements(&key_exchanges);
1831 } 1841 }
1832 1842
1833 QuicCryptoProof::QuicCryptoProof() {} 1843 QuicCryptoProof::QuicCryptoProof() {}
1834 QuicCryptoProof::~QuicCryptoProof() {} 1844 QuicCryptoProof::~QuicCryptoProof() {}
1835 } // namespace net 1845 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_crypto_client_config_test.cc ('k') | net/quic/quic_alarm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698