OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/cert/crl_set.h" | 5 #include "net/cert/crl_set.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 26 matching lines...) Expand all Loading... |
37 if (!serial.empty() && (serial[0] & 0x80) != 0) { | 37 if (!serial.empty() && (serial[0] & 0x80) != 0) { |
38 // This serial number is negative but the process which generates CRL sets | 38 // This serial number is negative but the process which generates CRL sets |
39 // will reject any certificates with negative serial numbers as invalid. | 39 // will reject any certificates with negative serial numbers as invalid. |
40 return UNKNOWN; | 40 return UNKNOWN; |
41 } | 41 } |
42 | 42 |
43 // Remove any leading zero bytes. | 43 // Remove any leading zero bytes. |
44 while (serial.size() > 1 && serial[0] == 0x00) | 44 while (serial.size() > 1 && serial[0] == 0x00) |
45 serial.remove_prefix(1); | 45 serial.remove_prefix(1); |
46 | 46 |
47 base::hash_map<std::string, size_t>::const_iterator i = | 47 base::hash_map<std::string, size_t>::const_iterator crl_index = |
48 crls_index_by_issuer_.find(issuer_spki_hash.as_string()); | 48 crls_index_by_issuer_.find(issuer_spki_hash.as_string()); |
49 if (i == crls_index_by_issuer_.end()) | 49 if (crl_index == crls_index_by_issuer_.end()) |
50 return UNKNOWN; | 50 return UNKNOWN; |
51 const std::vector<std::string>& serials = crls_[i->second].second; | 51 const std::vector<std::string>& serials = crls_[crl_index->second].second; |
52 | 52 |
53 for (std::vector<std::string>::const_iterator i = serials.begin(); | 53 for (std::vector<std::string>::const_iterator i = serials.begin(); |
54 i != serials.end(); ++i) { | 54 i != serials.end(); ++i) { |
55 if (base::StringPiece(*i) == serial) | 55 if (base::StringPiece(*i) == serial) |
56 return REVOKED; | 56 return REVOKED; |
57 } | 57 } |
58 | 58 |
59 return GOOD; | 59 return GOOD; |
60 } | 60 } |
61 | 61 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 crl_set->crls_index_by_issuer_[spki] = 0; | 98 crl_set->crls_index_by_issuer_[spki] = 0; |
99 } | 99 } |
100 | 100 |
101 if (!serial_number.empty()) | 101 if (!serial_number.empty()) |
102 crl_set->crls_[0].second.push_back(serial_number); | 102 crl_set->crls_[0].second.push_back(serial_number); |
103 | 103 |
104 return crl_set; | 104 return crl_set; |
105 } | 105 } |
106 | 106 |
107 } // namespace net | 107 } // namespace net |
OLD | NEW |