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 must proceed to initialize TPM slot for the | |
58 // user. All subsequent calls will return false. | |
59 // |InitializeNSSForChromeOSUser| must have been called first. | |
60 CRYPTO_EXPORT bool GetAndSetStartedInitializeTPMForChromeOSUser( | |
Ryan Sleevi
2014/07/09 19:05:40
Naming still confused the hell out of me.
ShouldI
tbarzic
2014/07/09 20:45:34
Yeah, we had the same expectation with old API, bu
| |
61 const std::string& username_hash) WARN_UNUSED_RESULT; | |
56 | 62 |
57 // Use TPM slot |slot_id| for user. InitializeNSSForChromeOSUser must have been | 63 // Use TPM slot |slot_id| for user. InitializeNSSForChromeOSUser must have been |
58 // called first. | 64 // called first. |
59 CRYPTO_EXPORT void InitializeTPMForChromeOSUser( | 65 CRYPTO_EXPORT void InitializeTPMForChromeOSUser( |
60 const std::string& username_hash, | 66 const std::string& username_hash, |
61 CK_SLOT_ID slot_id); | 67 CK_SLOT_ID slot_id); |
62 | 68 |
63 // Use the software slot as the private slot for user. | 69 // Use the software slot as the private slot for user. |
64 // InitializeNSSForChromeOSUser must have been called first. | 70 // InitializeNSSForChromeOSUser must have been called first. |
65 CRYPTO_EXPORT void InitializePrivateSoftwareSlotForChromeOSUser( | 71 CRYPTO_EXPORT void InitializePrivateSoftwareSlotForChromeOSUser( |
66 const std::string& username_hash); | 72 const std::string& username_hash); |
67 | 73 |
68 // Returns a reference to the public slot for user. | 74 // Returns a reference to the public slot for user. |
69 CRYPTO_EXPORT ScopedPK11Slot GetPublicSlotForChromeOSUser( | 75 CRYPTO_EXPORT ScopedPK11Slot GetPublicSlotForChromeOSUser( |
70 const std::string& username_hash) WARN_UNUSED_RESULT; | 76 const std::string& username_hash) WARN_UNUSED_RESULT; |
71 | 77 |
72 // Returns the private slot for |username_hash| if it is loaded. If it is not | 78 // 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 | 79 // loaded and |callback| is non-null, the |callback| will be run once the slot |
74 // is loaded. | 80 // is loaded. |
75 CRYPTO_EXPORT ScopedPK11Slot GetPrivateSlotForChromeOSUser( | 81 CRYPTO_EXPORT ScopedPK11Slot GetPrivateSlotForChromeOSUser( |
76 const std::string& username_hash, | 82 const std::string& username_hash, |
77 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; | 83 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; |
78 #endif // defined(OS_CHROMEOS) | 84 #endif // defined(OS_CHROMEOS) |
79 | 85 |
80 } // namespace crypto | 86 } // namespace crypto |
81 | 87 |
82 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ | 88 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ |
OLD | NEW |