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 "crypto/nss_util.h" | 5 #include "crypto/nss_util.h" |
6 #include "crypto/nss_util_internal.h" | 6 #include "crypto/nss_util_internal.h" |
7 | 7 |
8 #include <nss.h> | 8 #include <nss.h> |
9 #include <plarena.h> | 9 #include <plarena.h> |
10 #include <prerror.h> | 10 #include <prerror.h> |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 // provider, which are still read-only (because we initialized | 227 // provider, which are still read-only (because we initialized |
228 // NSS before we had a cryptohome mounted). | 228 // NSS before we had a cryptohome mounted). |
229 software_slot_ = OpenUserDB(GetDefaultConfigDirectory(), | 229 software_slot_ = OpenUserDB(GetDefaultConfigDirectory(), |
230 kNSSDatabaseName); | 230 kNSSDatabaseName); |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 void EnableTPMTokenForNSS(TPMTokenInfoDelegate* info_delegate) { | 234 void EnableTPMTokenForNSS(TPMTokenInfoDelegate* info_delegate) { |
235 CHECK(info_delegate); | 235 CHECK(info_delegate); |
236 tpm_token_info_delegate_.reset(info_delegate); | 236 tpm_token_info_delegate_.reset(info_delegate); |
237 // Try to load once to avoid jank later. Ignore the return value, | |
238 // because if it fails we will try again later. | |
239 EnsureTPMTokenReady(); | |
stevenjb
2011/10/10 17:18:13
Why remove this? If the new logic gets changed, or
gauravsh
2011/10/10 20:55:49
Is it used anywhere else? I couldn't find it.
The
| |
240 } | 237 } |
241 | 238 |
242 // This is called whenever we want to make sure opencryptoki is | 239 // This is called whenever we want to make sure opencryptoki is |
243 // properly loaded, because it can fail shortly after the initial | 240 // properly loaded, because it can fail shortly after the initial |
244 // login while the PINs are being initialized, and we want to retry | 241 // login while the PINs are being initialized, and we want to retry |
245 // if this happens. | 242 // if this happens. |
246 bool EnsureTPMTokenReady() { | 243 bool EnsureTPMTokenReady() { |
247 // If EnableTPMTokenForNSS hasn't been called, return false. | 244 // If EnableTPMTokenForNSS hasn't been called, return false. |
248 if (tpm_token_info_delegate_.get() == NULL) | 245 if (tpm_token_info_delegate_.get() == NULL) |
249 return false; | 246 return false; |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
775 | 772 |
776 PK11SlotInfo* GetPublicNSSKeySlot() { | 773 PK11SlotInfo* GetPublicNSSKeySlot() { |
777 return g_nss_singleton.Get().GetPublicNSSKeySlot(); | 774 return g_nss_singleton.Get().GetPublicNSSKeySlot(); |
778 } | 775 } |
779 | 776 |
780 PK11SlotInfo* GetPrivateNSSKeySlot() { | 777 PK11SlotInfo* GetPrivateNSSKeySlot() { |
781 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); | 778 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); |
782 } | 779 } |
783 | 780 |
784 } // namespace crypto | 781 } // namespace crypto |
OLD | NEW |