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 #ifndef CRYPTO_NSS_UTIL_INTERNAL_H_ | 5 #ifndef CRYPTO_NSS_UTIL_INTERNAL_H_ |
6 #define CRYPTO_NSS_UTIL_INTERNAL_H_ | 6 #define CRYPTO_NSS_UTIL_INTERNAL_H_ |
7 | 7 |
8 #include <secmodt.h> | 8 #include <secmodt.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 SECMODListLock* lock_; | 44 SECMODListLock* lock_; |
45 DISALLOW_COPY_AND_ASSIGN(AutoSECMODListReadLock); | 45 DISALLOW_COPY_AND_ASSIGN(AutoSECMODListReadLock); |
46 }; | 46 }; |
47 | 47 |
48 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
49 // Prepare per-user NSS slot mapping. It is safe to call this function multiple | 49 // Prepare per-user NSS slot mapping. It is safe to call this function multiple |
50 // times. Returns true if the user was added, or false if it already existed. | 50 // times. Returns true if the user was added, or false if it already existed. |
51 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( | 51 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( |
52 const std::string& email, | 52 const std::string& email, |
53 const std::string& username_hash, | 53 const std::string& username_hash, |
54 bool is_primary_user, | 54 const base::FilePath& path); |
55 const base::FilePath& path) WARN_UNUSED_RESULT; | 55 |
| 56 // Returns whether TPM for ChromeOS user still needs initialization. If |
| 57 // true is returned, the caller can proceed to initialize TPM slot for the |
| 58 // user, but should call |WillInitializeTPMForChromeOSUser| first. |
| 59 // |InitializeNSSForChromeOSUser| must have been called first. |
| 60 CRYPTO_EXPORT bool ShouldInitializeTPMForChromeOSUser( |
| 61 const std::string& username_hash) WARN_UNUSED_RESULT; |
| 62 |
| 63 // Makes |ShouldInitializeTPMForChromeOSUser| start returning false. |
| 64 // Should be called before starting TPM initialization for the user. |
| 65 // Assumes |InitializeNSSForChromeOSUser| had already been called. |
| 66 CRYPTO_EXPORT void WillInitializeTPMForChromeOSUser( |
| 67 const std::string& username_hash); |
56 | 68 |
57 // Use TPM slot |slot_id| for user. InitializeNSSForChromeOSUser must have been | 69 // Use TPM slot |slot_id| for user. InitializeNSSForChromeOSUser must have been |
58 // called first. | 70 // called first. |
59 CRYPTO_EXPORT void InitializeTPMForChromeOSUser( | 71 CRYPTO_EXPORT void InitializeTPMForChromeOSUser( |
60 const std::string& username_hash, | 72 const std::string& username_hash, |
61 CK_SLOT_ID slot_id); | 73 CK_SLOT_ID slot_id); |
62 | 74 |
63 // Use the software slot as the private slot for user. | 75 // Use the software slot as the private slot for user. |
64 // InitializeNSSForChromeOSUser must have been called first. | 76 // InitializeNSSForChromeOSUser must have been called first. |
65 CRYPTO_EXPORT void InitializePrivateSoftwareSlotForChromeOSUser( | 77 CRYPTO_EXPORT void InitializePrivateSoftwareSlotForChromeOSUser( |
66 const std::string& username_hash); | 78 const std::string& username_hash); |
67 | 79 |
68 // Returns a reference to the public slot for user. | 80 // Returns a reference to the public slot for user. |
69 CRYPTO_EXPORT ScopedPK11Slot GetPublicSlotForChromeOSUser( | 81 CRYPTO_EXPORT ScopedPK11Slot GetPublicSlotForChromeOSUser( |
70 const std::string& username_hash) WARN_UNUSED_RESULT; | 82 const std::string& username_hash) WARN_UNUSED_RESULT; |
71 | 83 |
72 // Returns the private slot for |username_hash| if it is loaded. If it is not | 84 // Returns the private slot for |username_hash| if it is loaded. If it is not |
73 // loaded and |callback| is non-null, the |callback| will be run once the slot | 85 // loaded and |callback| is non-null, the |callback| will be run once the slot |
74 // is loaded. | 86 // is loaded. |
75 CRYPTO_EXPORT ScopedPK11Slot GetPrivateSlotForChromeOSUser( | 87 CRYPTO_EXPORT ScopedPK11Slot GetPrivateSlotForChromeOSUser( |
76 const std::string& username_hash, | 88 const std::string& username_hash, |
77 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; | 89 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; |
78 #endif // defined(OS_CHROMEOS) | 90 #endif // defined(OS_CHROMEOS) |
79 | 91 |
80 } // namespace crypto | 92 } // namespace crypto |
81 | 93 |
82 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ | 94 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ |
OLD | NEW |