Chromium Code Reviews| Index: net/base/cert_verify_proc.cc |
| =================================================================== |
| --- net/base/cert_verify_proc.cc (revision 151057) |
| +++ net/base/cert_verify_proc.cc (working copy) |
| @@ -217,8 +217,9 @@ |
| } |
| // static |
| +// NOTE: This implementation assumes and enforces that the hashes are SHA1. |
| bool CertVerifyProc::IsPublicKeyBlacklisted( |
| - const std::vector<SHA1Fingerprint>& public_key_hashes) { |
| + const std::vector<HashValueVector>& public_key_hashes) { |
| static const unsigned kNumHashes = 9; |
| static const uint8 kHashes[kNumHashes][base::kSHA1Length] = { |
| // Subject: CN=DigiNotar Root CA |
| @@ -263,11 +264,14 @@ |
| 0xd1, 0x72, 0xbd, 0x53, 0xe0, 0xd3, 0x07, 0x83, 0x4b, 0xd1}, |
| }; |
| + const HashValueVector& sha1_hashes = public_key_hashes[HASH_VALUE_SHA1]; |
|
Ryan Sleevi
2012/08/11 01:39:55
BUG: Accessing HASH_VALUE_SHA1 without checking th
palmer
2012/08/14 19:40:42
Well, the constructor guarantees that public_key_h
Ryan Sleevi
2012/08/14 20:02:51
What constructor?
public_key_hashes is an input a
|
| for (unsigned i = 0; i < kNumHashes; i++) { |
| - for (std::vector<SHA1Fingerprint>::const_iterator |
| - j = public_key_hashes.begin(); j != public_key_hashes.end(); ++j) { |
| - if (memcmp(j->data, kHashes[i], base::kSHA1Length) == 0) |
| + for (HashValueVector::const_iterator j = sha1_hashes.begin(); |
| + j != sha1_hashes.end(); ++j) { |
| + if (j->tag == HASH_VALUE_SHA1 && |
| + memcmp(j->data(), kHashes[i], base::kSHA1Length) == 0) { |
| return true; |
| + } |
| } |
| } |