| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/dnssec_chain_verifier.h" | 5 #include "net/base/dnssec_chain_verifier.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 std::string temp; | 430 std::string temp; |
| 431 uint8 temp2[crypto::kSHA256Length]; | 431 uint8 temp2[crypto::kSHA256Length]; |
| 432 const uint8* digest; | 432 const uint8* digest; |
| 433 unsigned digest_len; | 433 unsigned digest_len; |
| 434 | 434 |
| 435 std::string input = name.as_string() + dnskey.as_string(); | 435 std::string input = name.as_string() + dnskey.as_string(); |
| 436 | 436 |
| 437 if (digest_type == kDNSSEC_SHA1) { | 437 if (digest_type == kDNSSEC_SHA1) { |
| 438 temp = base::SHA1HashString(input); | 438 temp = base::SHA1HashString(input); |
| 439 digest = reinterpret_cast<const uint8*>(temp.data()); | 439 digest = reinterpret_cast<const uint8*>(temp.data()); |
| 440 digest_len = base::SHA1_LENGTH; | 440 digest_len = base::kSHA1Length; |
| 441 } else if (digest_type == kDNSSEC_SHA256) { | 441 } else if (digest_type == kDNSSEC_SHA256) { |
| 442 crypto::SHA256HashString(input, temp2, sizeof(temp2)); | 442 crypto::SHA256HashString(input, temp2, sizeof(temp2)); |
| 443 digest = temp2; | 443 digest = temp2; |
| 444 digest_len = sizeof(temp2); | 444 digest_len = sizeof(temp2); |
| 445 } else { | 445 } else { |
| 446 return false; | 446 return false; |
| 447 } | 447 } |
| 448 | 448 |
| 449 uint8* output = static_cast<uint8*>(malloc(4 + digest_len)); | 449 uint8* output = static_cast<uint8*>(malloc(4 + digest_len)); |
| 450 scratch_pool_.push_back(output); | 450 scratch_pool_.push_back(output); |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 } | 910 } |
| 911 } | 911 } |
| 912 | 912 |
| 913 if (output->authorized_hashes.empty()) | 913 if (output->authorized_hashes.empty()) |
| 914 return DISCARD; | 914 return DISCARD; |
| 915 | 915 |
| 916 return SUCCESS; | 916 return SUCCESS; |
| 917 } | 917 } |
| 918 | 918 |
| 919 } // namespace net | 919 } // namespace net |
| OLD | NEW |