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

Side by Side Diff: components/certificate_transparency/log_dns_client.cc

Issue 2017563002: Add Certificate Transparency logs auditing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/certificate_transparency/log_dns_client.h" 5 #include "components/certificate_transparency/log_dns_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 next_state_ = State::REQUEST_AUDIT_PROOF_NODES; 316 next_state_ = State::REQUEST_AUDIT_PROOF_NODES;
317 return net::OK; 317 return net::OK;
318 } 318 }
319 319
320 net::Error LogDnsClient::AuditProofQuery::RequestAuditProofNodes() { 320 net::Error LogDnsClient::AuditProofQuery::RequestAuditProofNodes() {
321 // Test pre-conditions (should be guaranteed by DNS response validation). 321 // Test pre-conditions (should be guaranteed by DNS response validation).
322 if (proof_->leaf_index >= proof_->tree_size || 322 if (proof_->leaf_index >= proof_->tree_size ||
323 proof_->nodes.size() >= net::ct::CalculateAuditPathLength( 323 proof_->nodes.size() >= net::ct::CalculateAuditPathLength(
324 proof_->leaf_index, proof_->tree_size)) { 324 proof_->leaf_index, proof_->tree_size)) {
325 return net::ERR_UNEXPECTED; 325 return net::ERR_UNEXPECTED;
326 // The performance of this could be improved by sending all of the expected
327 // queries up front. Each response can contain a maximum of 7 audit path
328 // nodes,
329 // so for an audit proof of size 20, it could send 3 queries (for nodes 0-6,
330 // 7-13 and 14-19) immediately. Currently, it sends only the first and then,
331 // based on the number of nodes received, sends the next query. The
332 // complexity
333 // of the code would increase though, as it would need to detect gaps in the
334 // audit proof caused by the server not responding with the anticipated
335 // number
336 // of nodes. Ownership of the proof would need to change, as it would be
337 // shared
338 // between simultaneous DNS transactions.
339 /*
340 void LogDnsClient::QueryAuditProof(base::StringPiece domain_for_log,
341 uint64_t leaf_index,
342 uint64_t tree_size,
343 const AuditProofCallback& callback) {
344 if (domain_for_log.empty() || leaf_index >= tree_size) {
345 base::ThreadTaskRunnerHandle::Get()->PostTask(
346 FROM_HERE,
347 base::Bind(callback, net::Error::ERR_INVALID_ARGUMENT, nullptr));
348 return;
349 */
Ryan Sleevi 2016/12/22 21:33:20 Accidental paste?
Eran Messeri 2017/01/03 23:07:41 Fixed - bad merge.
326 } 350 }
327 351
328 std::string qname = base::StringPrintf( 352 std::string qname = base::StringPrintf(
329 "%zu.%" PRIu64 ".%" PRIu64 ".tree.%s.", proof_->nodes.size(), 353 "%zu.%" PRIu64 ".%" PRIu64 ".tree.%s.", proof_->nodes.size(),
330 proof_->leaf_index, proof_->tree_size, domain_for_log_.c_str()); 354 proof_->leaf_index, proof_->tree_size, domain_for_log_.c_str());
331 355
332 if (!StartDnsTransaction(qname)) { 356 if (!StartDnsTransaction(qname)) {
333 return net::ERR_NAME_RESOLUTION_FAILED; 357 return net::ERR_NAME_RESOLUTION_FAILED;
334 } 358 }
335 359
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 494 }
471 495
472 void LogDnsClient::UpdateDnsConfig() { 496 void LogDnsClient::UpdateDnsConfig() {
473 net::DnsConfig config; 497 net::DnsConfig config;
474 net::NetworkChangeNotifier::GetDnsConfig(&config); 498 net::NetworkChangeNotifier::GetDnsConfig(&config);
475 if (config.IsValid()) 499 if (config.IsValid())
476 dns_client_->SetConfig(config); 500 dns_client_->SetConfig(config);
477 } 501 }
478 502
479 } // namespace certificate_transparency 503 } // namespace certificate_transparency
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698