| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // provider, which are still read-only (because we initialized | 228 // provider, which are still read-only (because we initialized |
| 229 // NSS before we had a cryptohome mounted). | 229 // NSS before we had a cryptohome mounted). |
| 230 software_slot_ = OpenUserDB(GetDefaultConfigDirectory(), | 230 software_slot_ = OpenUserDB(GetDefaultConfigDirectory(), |
| 231 kNSSDatabaseName); | 231 kNSSDatabaseName); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 void EnableTPMTokenForNSS(TPMTokenInfoDelegate* info_delegate) { | 235 void EnableTPMTokenForNSS(TPMTokenInfoDelegate* info_delegate) { |
| 236 CHECK(info_delegate); | 236 CHECK(info_delegate); |
| 237 tpm_token_info_delegate_.reset(info_delegate); | 237 tpm_token_info_delegate_.reset(info_delegate); |
| 238 // Try to load once to avoid jank later. Ignore the return value, | |
| 239 // because if it fails we will try again later. | |
| 240 EnsureTPMTokenReady(); | |
| 241 } | 238 } |
| 242 | 239 |
| 243 // This is called whenever we want to make sure opencryptoki is | 240 // This is called whenever we want to make sure opencryptoki is |
| 244 // properly loaded, because it can fail shortly after the initial | 241 // properly loaded, because it can fail shortly after the initial |
| 245 // login while the PINs are being initialized, and we want to retry | 242 // login while the PINs are being initialized, and we want to retry |
| 246 // if this happens. | 243 // if this happens. |
| 247 bool EnsureTPMTokenReady() { | 244 bool EnsureTPMTokenReady() { |
| 248 // If EnableTPMTokenForNSS hasn't been called, return false. | 245 // If EnableTPMTokenForNSS hasn't been called, return false. |
| 249 if (tpm_token_info_delegate_.get() == NULL) | 246 if (tpm_token_info_delegate_.get() == NULL) |
| 250 return false; | 247 return false; |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 782 |
| 786 PK11SlotInfo* GetPublicNSSKeySlot() { | 783 PK11SlotInfo* GetPublicNSSKeySlot() { |
| 787 return g_nss_singleton.Get().GetPublicNSSKeySlot(); | 784 return g_nss_singleton.Get().GetPublicNSSKeySlot(); |
| 788 } | 785 } |
| 789 | 786 |
| 790 PK11SlotInfo* GetPrivateNSSKeySlot() { | 787 PK11SlotInfo* GetPrivateNSSKeySlot() { |
| 791 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); | 788 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); |
| 792 } | 789 } |
| 793 | 790 |
| 794 } // namespace crypto | 791 } // namespace crypto |
| OLD | NEW |