OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/net/crl_set_fetcher.h" | 5 #include "ios/chrome/browser/net/crl_set_fetcher.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
9 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
10 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
11 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
12 #include "base/time/time.h" | 14 #include "base/time/time.h" |
13 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
14 #include "components/component_updater/component_updater_service.h" | 16 #include "components/component_updater/component_updater_service.h" |
15 #include "components/update_client/update_client.h" | 17 #include "components/update_client/update_client.h" |
16 #include "ios/chrome/browser/chrome_constants.h" | 18 #include "ios/chrome/browser/chrome_constants.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) { | 59 base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) { |
58 NOTREACHED(); | 60 NOTREACHED(); |
59 } | 61 } |
60 } | 62 } |
61 | 63 |
62 void CRLSetFetcher::DoInitialLoadFromDisk() { | 64 void CRLSetFetcher::DoInitialLoadFromDisk() { |
63 DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::FILE); | 65 DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::FILE); |
64 | 66 |
65 LoadFromDisk(GetCRLSetFilePath(), &crl_set_); | 67 LoadFromDisk(GetCRLSetFilePath(), &crl_set_); |
66 | 68 |
67 uint32 sequence_of_loaded_crl = 0; | 69 uint32_t sequence_of_loaded_crl = 0; |
68 if (crl_set_.get()) | 70 if (crl_set_.get()) |
69 sequence_of_loaded_crl = crl_set_->sequence(); | 71 sequence_of_loaded_crl = crl_set_->sequence(); |
70 | 72 |
71 // Get updates, advertising the sequence number of the CRL set that we just | 73 // Get updates, advertising the sequence number of the CRL set that we just |
72 // loaded, if any. | 74 // loaded, if any. |
73 if (!web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, | 75 if (!web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, |
74 base::Bind(&CRLSetFetcher::RegisterComponent, | 76 base::Bind(&CRLSetFetcher::RegisterComponent, |
75 this, sequence_of_loaded_crl))) { | 77 this, sequence_of_loaded_crl))) { |
76 NOTREACHED(); | 78 NOTREACHED(); |
77 } | 79 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 LOG(WARNING) << "Refusing to downgrade CRL set from #" | 114 LOG(WARNING) << "Refusing to downgrade CRL set from #" |
113 << old_crl_set->sequence() << "to #" << crl_set->sequence(); | 115 << old_crl_set->sequence() << "to #" << crl_set->sequence(); |
114 } else { | 116 } else { |
115 net::SSLConfigService::SetCRLSet(crl_set); | 117 net::SSLConfigService::SetCRLSet(crl_set); |
116 VLOG(1) << "Installed CRL set #" << crl_set->sequence(); | 118 VLOG(1) << "Installed CRL set #" << crl_set->sequence(); |
117 } | 119 } |
118 } | 120 } |
119 | 121 |
120 // kPublicKeySHA256 is the SHA256 hash of the SubjectPublicKeyInfo of the key | 122 // kPublicKeySHA256 is the SHA256 hash of the SubjectPublicKeyInfo of the key |
121 // that's used to sign generated CRL sets. | 123 // that's used to sign generated CRL sets. |
122 static const uint8 kPublicKeySHA256[32] = { | 124 static const uint8_t kPublicKeySHA256[32] = { |
123 0x75, 0xda, 0xf8, 0xcb, 0x77, 0x68, 0x40, 0x33, 0x65, 0x4c, 0x97, | 125 0x75, 0xda, 0xf8, 0xcb, 0x77, 0x68, 0x40, 0x33, 0x65, 0x4c, 0x97, |
124 0xe5, 0xc5, 0x1b, 0xcd, 0x81, 0x7b, 0x1e, 0xeb, 0x11, 0x2c, 0xe1, | 126 0xe5, 0xc5, 0x1b, 0xcd, 0x81, 0x7b, 0x1e, 0xeb, 0x11, 0x2c, 0xe1, |
125 0xa4, 0x33, 0x8c, 0xf5, 0x72, 0x5e, 0xed, 0xb8, 0x43, 0x97, | 127 0xa4, 0x33, 0x8c, 0xf5, 0x72, 0x5e, 0xed, 0xb8, 0x43, 0x97, |
126 }; | 128 }; |
127 | 129 |
128 void CRLSetFetcher::RegisterComponent(uint32 sequence_of_loaded_crl) { | 130 void CRLSetFetcher::RegisterComponent(uint32_t sequence_of_loaded_crl) { |
129 DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); | 131 DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); |
130 | 132 |
131 update_client::CrxComponent component; | 133 update_client::CrxComponent component; |
132 component.pk_hash.assign(kPublicKeySHA256, | 134 component.pk_hash.assign(kPublicKeySHA256, |
133 kPublicKeySHA256 + sizeof(kPublicKeySHA256)); | 135 kPublicKeySHA256 + sizeof(kPublicKeySHA256)); |
134 component.installer = this; | 136 component.installer = this; |
135 component.name = "CRLSet"; | 137 component.name = "CRLSet"; |
136 component.version = Version(base::UintToString(sequence_of_loaded_crl)); | 138 component.version = Version(base::UintToString(sequence_of_loaded_crl)); |
137 component.allow_background_download = false; | 139 component.allow_background_download = false; |
138 if (!component.version.IsValid()) { | 140 if (!component.version.IsValid()) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 bool CRLSetFetcher::GetInstalledFile(const std::string& file, | 227 bool CRLSetFetcher::GetInstalledFile(const std::string& file, |
226 base::FilePath* installed_file) { | 228 base::FilePath* installed_file) { |
227 return false; | 229 return false; |
228 } | 230 } |
229 | 231 |
230 bool CRLSetFetcher::Uninstall() { | 232 bool CRLSetFetcher::Uninstall() { |
231 return false; | 233 return false; |
232 } | 234 } |
233 | 235 |
234 CRLSetFetcher::~CRLSetFetcher() {} | 236 CRLSetFetcher::~CRLSetFetcher() {} |
OLD | NEW |