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

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

Issue 2547863002: Move base32 into base so that it can be used within base.
Patch Set: sync to position 437832 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
« no previous file with comments | « components/certificate_transparency/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base32.h"
7 #include "base/bind.h" 8 #include "base/bind.h"
8 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
9 #include "base/format_macros.h" 10 #include "base/format_macros.h"
10 #include "base/location.h" 11 #include "base/location.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "components/base32/base32.h"
19 #include "crypto/sha2.h" 19 #include "crypto/sha2.h"
20 #include "net/cert/merkle_audit_proof.h" 20 #include "net/cert/merkle_audit_proof.h"
21 #include "net/dns/dns_client.h" 21 #include "net/dns/dns_client.h"
22 #include "net/dns/dns_config_service.h" 22 #include "net/dns/dns_config_service.h"
23 #include "net/dns/dns_protocol.h" 23 #include "net/dns/dns_protocol.h"
24 #include "net/dns/dns_response.h" 24 #include "net/dns/dns_response.h"
25 #include "net/dns/dns_transaction.h" 25 #include "net/dns/dns_transaction.h"
26 #include "net/dns/record_parsed.h" 26 #include "net/dns/record_parsed.h"
27 #include "net/dns/record_rdata.h" 27 #include "net/dns/record_rdata.h"
28 28
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // is complete, and can invoke the completion callback then if appropriate. 268 // is complete, and can invoke the completion callback then if appropriate.
269 if (result != net::ERR_IO_PENDING) { 269 if (result != net::ERR_IO_PENDING) {
270 // The callback will delete this query (now that it has finished), so copy 270 // The callback will delete this query (now that it has finished), so copy
271 // |callback_| before running it so that it is not deleted along with the 271 // |callback_| before running it so that it is not deleted along with the
272 // query, mid-callback-execution (which would result in a crash). 272 // query, mid-callback-execution (which would result in a crash).
273 base::ResetAndReturn(&callback_).Run(result); 273 base::ResetAndReturn(&callback_).Run(result);
274 } 274 }
275 } 275 }
276 276
277 net::Error LogDnsClient::AuditProofQuery::RequestLeafIndex() { 277 net::Error LogDnsClient::AuditProofQuery::RequestLeafIndex() {
278 std::string encoded_leaf_hash = base32::Base32Encode( 278 std::string encoded_leaf_hash =
279 leaf_hash_, base32::Base32EncodePolicy::OMIT_PADDING); 279 base::Base32Encode(leaf_hash_, base::Base32EncodePolicy::OMIT_PADDING);
280 DCHECK_EQ(encoded_leaf_hash.size(), 52u); 280 DCHECK_EQ(encoded_leaf_hash.size(), 52u);
281 281
282 std::string qname = base::StringPrintf( 282 std::string qname = base::StringPrintf(
283 "%s.hash.%s.", encoded_leaf_hash.c_str(), domain_for_log_.c_str()); 283 "%s.hash.%s.", encoded_leaf_hash.c_str(), domain_for_log_.c_str());
284 284
285 if (!StartDnsTransaction(qname)) { 285 if (!StartDnsTransaction(qname)) {
286 return net::ERR_NAME_RESOLUTION_FAILED; 286 return net::ERR_NAME_RESOLUTION_FAILED;
287 } 287 }
288 288
289 next_state_ = State::REQUEST_LEAF_INDEX_COMPLETE; 289 next_state_ = State::REQUEST_LEAF_INDEX_COMPLETE;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 } 470 }
471 471
472 void LogDnsClient::UpdateDnsConfig() { 472 void LogDnsClient::UpdateDnsConfig() {
473 net::DnsConfig config; 473 net::DnsConfig config;
474 net::NetworkChangeNotifier::GetDnsConfig(&config); 474 net::NetworkChangeNotifier::GetDnsConfig(&config);
475 if (config.IsValid()) 475 if (config.IsValid())
476 dns_client_->SetConfig(config); 476 dns_client_->SetConfig(config);
477 } 477 }
478 478
479 } // namespace certificate_transparency 479 } // namespace certificate_transparency
OLDNEW
« no previous file with comments | « components/certificate_transparency/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698