| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 // digest_type: see http://tools.ietf.org/html/rfc4034#appendix-A.2 | 421 // digest_type: see http://tools.ietf.org/html/rfc4034#appendix-A.2 |
| 422 // keyid: the key's id | 422 // keyid: the key's id |
| 423 // algorithm: see http://tools.ietf.org/html/rfc4034#appendix-A.1 | 423 // algorithm: see http://tools.ietf.org/html/rfc4034#appendix-A.1 |
| 424 bool DNSSECChainVerifier::DigestKey(base::StringPiece* out, | 424 bool DNSSECChainVerifier::DigestKey(base::StringPiece* out, |
| 425 const base::StringPiece& name, | 425 const base::StringPiece& name, |
| 426 const base::StringPiece& dnskey, | 426 const base::StringPiece& dnskey, |
| 427 uint8 digest_type, | 427 uint8 digest_type, |
| 428 uint16 keyid, | 428 uint16 keyid, |
| 429 uint8 algorithm) { | 429 uint8 algorithm) { |
| 430 std::string temp; | 430 std::string temp; |
| 431 uint8 temp2[crypto::SHA256_LENGTH]; | 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::SHA1_LENGTH; |
| 441 } else if (digest_type == kDNSSEC_SHA256) { | 441 } else if (digest_type == kDNSSEC_SHA256) { |
| (...skipping 468 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 |