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 "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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 if (software_slot_) | 375 if (software_slot_) |
376 return PK11_ReferenceSlot(software_slot_); | 376 return PK11_ReferenceSlot(software_slot_); |
377 return PK11_GetInternalKeySlot(); | 377 return PK11_GetInternalKeySlot(); |
378 } | 378 } |
379 | 379 |
380 PK11SlotInfo* GetPrivateNSSKeySlot() { | 380 PK11SlotInfo* GetPrivateNSSKeySlot() { |
381 if (test_slot_) | 381 if (test_slot_) |
382 return PK11_ReferenceSlot(test_slot_); | 382 return PK11_ReferenceSlot(test_slot_); |
383 | 383 |
384 #if defined(OS_CHROMEOS) | 384 #if defined(OS_CHROMEOS) |
385 // Make sure that if EnableTPMTokenForNSS has been called that we | |
386 // have successfully loaded Chaps. | |
387 if (tpm_token_info_delegate_.get() != NULL) { | 385 if (tpm_token_info_delegate_.get() != NULL) { |
388 if (EnsureTPMTokenReady()) { | 386 if (IsTPMTokenReady()) { |
389 return PK11_ReferenceSlot(tpm_slot_); | 387 return PK11_ReferenceSlot(tpm_slot_); |
390 } else { | 388 } else { |
391 // If we were supposed to get the hardware token, but were | 389 // If we were supposed to get the hardware token, but were |
392 // unable to, return NULL rather than fall back to sofware. | 390 // unable to, return NULL rather than fall back to sofware. |
393 return NULL; | 391 return NULL; |
394 } | 392 } |
395 } | 393 } |
396 #endif | 394 #endif |
397 // If we weren't supposed to enable the TPM for NSS, then return | 395 // If we weren't supposed to enable the TPM for NSS, then return |
398 // the software slot. | 396 // the software slot. |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 783 |
786 PK11SlotInfo* GetPublicNSSKeySlot() { | 784 PK11SlotInfo* GetPublicNSSKeySlot() { |
787 return g_nss_singleton.Get().GetPublicNSSKeySlot(); | 785 return g_nss_singleton.Get().GetPublicNSSKeySlot(); |
788 } | 786 } |
789 | 787 |
790 PK11SlotInfo* GetPrivateNSSKeySlot() { | 788 PK11SlotInfo* GetPrivateNSSKeySlot() { |
791 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); | 789 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); |
792 } | 790 } |
793 | 791 |
794 } // namespace crypto | 792 } // namespace crypto |
OLD | NEW |