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 "chrome/browser/net/crl_set_fetcher.h" | 5 #include "chrome/browser/net/crl_set_fetcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) { | 60 base::Bind(&CRLSetFetcher::DoDeleteFromDisk, this))) { |
61 NOTREACHED(); | 61 NOTREACHED(); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 void CRLSetFetcher::DoInitialLoadFromDisk() { | 65 void CRLSetFetcher::DoInitialLoadFromDisk() { |
66 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 66 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
67 | 67 |
68 LoadFromDisk(GetCRLSetFilePath(), &crl_set_); | 68 LoadFromDisk(GetCRLSetFilePath(), &crl_set_); |
69 | 69 |
70 uint32 sequence_of_loaded_crl = 0; | 70 uint32_t sequence_of_loaded_crl = 0; |
71 if (crl_set_.get()) | 71 if (crl_set_.get()) |
72 sequence_of_loaded_crl = crl_set_->sequence(); | 72 sequence_of_loaded_crl = crl_set_->sequence(); |
73 | 73 |
74 // Get updates, advertising the sequence number of the CRL set that we just | 74 // Get updates, advertising the sequence number of the CRL set that we just |
75 // loaded, if any. | 75 // loaded, if any. |
76 if (!BrowserThread::PostTask( | 76 if (!BrowserThread::PostTask( |
77 BrowserThread::UI, FROM_HERE, | 77 BrowserThread::UI, FROM_HERE, |
78 base::Bind( | 78 base::Bind( |
79 &CRLSetFetcher::RegisterComponent, | 79 &CRLSetFetcher::RegisterComponent, |
80 this, | 80 this, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 << "to #" | 122 << "to #" |
123 << crl_set->sequence(); | 123 << crl_set->sequence(); |
124 } else { | 124 } else { |
125 net::SSLConfigService::SetCRLSet(crl_set); | 125 net::SSLConfigService::SetCRLSet(crl_set); |
126 VLOG(1) << "Installed CRL set #" << crl_set->sequence(); | 126 VLOG(1) << "Installed CRL set #" << crl_set->sequence(); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 // kPublicKeySHA256 is the SHA256 hash of the SubjectPublicKeyInfo of the key | 130 // kPublicKeySHA256 is the SHA256 hash of the SubjectPublicKeyInfo of the key |
131 // that's used to sign generated CRL sets. | 131 // that's used to sign generated CRL sets. |
132 static const uint8 kPublicKeySHA256[32] = { | 132 static const uint8_t kPublicKeySHA256[32] = { |
133 0x75, 0xda, 0xf8, 0xcb, 0x77, 0x68, 0x40, 0x33, | 133 0x75, 0xda, 0xf8, 0xcb, 0x77, 0x68, 0x40, 0x33, 0x65, 0x4c, 0x97, |
134 0x65, 0x4c, 0x97, 0xe5, 0xc5, 0x1b, 0xcd, 0x81, | 134 0xe5, 0xc5, 0x1b, 0xcd, 0x81, 0x7b, 0x1e, 0xeb, 0x11, 0x2c, 0xe1, |
135 0x7b, 0x1e, 0xeb, 0x11, 0x2c, 0xe1, 0xa4, 0x33, | 135 0xa4, 0x33, 0x8c, 0xf5, 0x72, 0x5e, 0xed, 0xb8, 0x43, 0x97, |
136 0x8c, 0xf5, 0x72, 0x5e, 0xed, 0xb8, 0x43, 0x97, | |
137 }; | 136 }; |
138 | 137 |
139 void CRLSetFetcher::RegisterComponent(uint32 sequence_of_loaded_crl) { | 138 void CRLSetFetcher::RegisterComponent(uint32_t sequence_of_loaded_crl) { |
140 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 139 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
141 | 140 |
142 update_client::CrxComponent component; | 141 update_client::CrxComponent component; |
143 component.pk_hash.assign(kPublicKeySHA256, | 142 component.pk_hash.assign(kPublicKeySHA256, |
144 kPublicKeySHA256 + sizeof(kPublicKeySHA256)); | 143 kPublicKeySHA256 + sizeof(kPublicKeySHA256)); |
145 component.installer = this; | 144 component.installer = this; |
146 component.name = "CRLSet"; | 145 component.name = "CRLSet"; |
147 component.version = Version(base::UintToString(sequence_of_loaded_crl)); | 146 component.version = Version(base::UintToString(sequence_of_loaded_crl)); |
148 component.allow_background_download = false; | 147 component.allow_background_download = false; |
149 if (!component.version.IsValid()) { | 148 if (!component.version.IsValid()) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 bool CRLSetFetcher::GetInstalledFile( | 236 bool CRLSetFetcher::GetInstalledFile( |
238 const std::string& file, base::FilePath* installed_file) { | 237 const std::string& file, base::FilePath* installed_file) { |
239 return false; | 238 return false; |
240 } | 239 } |
241 | 240 |
242 bool CRLSetFetcher::Uninstall() { | 241 bool CRLSetFetcher::Uninstall() { |
243 return false; | 242 return false; |
244 } | 243 } |
245 | 244 |
246 CRLSetFetcher::~CRLSetFetcher() {} | 245 CRLSetFetcher::~CRLSetFetcher() {} |
OLD | NEW |