Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 AutoSECMODListReadLock(); | 40 AutoSECMODListReadLock(); |
| 41 ~AutoSECMODListReadLock(); | 41 ~AutoSECMODListReadLock(); |
| 42 | 42 |
| 43 private: | 43 private: |
| 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. If |provisional| is set, the user's mapping and public NSS slot will |
| 51 // get initialized, but another |InitializeNSSForChromeOSUser| call will be | |
| 52 // required before the mapping becomes usable. | |
| 53 // Returns true if the user was added or confimed, false if it already | |
|
Ryan Sleevi
2014/07/01 18:51:33
typo: confirmed?
| |
| 54 // existed and was not provisional. | |
| 51 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( | 55 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( |
| 52 const std::string& email, | 56 const std::string& email, |
| 53 const std::string& username_hash, | 57 const std::string& username_hash, |
| 54 bool is_primary_user, | 58 const base::FilePath& path, |
| 55 const base::FilePath& path) WARN_UNUSED_RESULT; | 59 bool provisional) WARN_UNUSED_RESULT; |
| 56 | 60 |
| 57 // Use TPM slot |slot_id| for user. InitializeNSSForChromeOSUser must have been | 61 // Use TPM slot |slot_id| for user. InitializeNSSForChromeOSUser must have been |
| 58 // called first. | 62 // called first. |
| 59 CRYPTO_EXPORT void InitializeTPMForChromeOSUser( | 63 CRYPTO_EXPORT void InitializeTPMForChromeOSUser( |
| 60 const std::string& username_hash, | 64 const std::string& username_hash, |
| 61 CK_SLOT_ID slot_id); | 65 CK_SLOT_ID slot_id); |
| 62 | 66 |
| 63 // Use the software slot as the private slot for user. | 67 // Use the software slot as the private slot for user. |
| 64 // InitializeNSSForChromeOSUser must have been called first. | 68 // InitializeNSSForChromeOSUser must have been called first. |
| 65 CRYPTO_EXPORT void InitializePrivateSoftwareSlotForChromeOSUser( | 69 CRYPTO_EXPORT void InitializePrivateSoftwareSlotForChromeOSUser( |
| 66 const std::string& username_hash); | 70 const std::string& username_hash); |
| 67 | 71 |
| 68 // Returns a reference to the public slot for user. | 72 // Returns a reference to the public slot for user. |
| 69 CRYPTO_EXPORT ScopedPK11Slot GetPublicSlotForChromeOSUser( | 73 CRYPTO_EXPORT ScopedPK11Slot GetPublicSlotForChromeOSUser( |
| 70 const std::string& username_hash) WARN_UNUSED_RESULT; | 74 const std::string& username_hash) WARN_UNUSED_RESULT; |
| 71 | 75 |
| 72 // Returns the private slot for |username_hash| if it is loaded. If it is not | 76 // 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 | 77 // loaded and |callback| is non-null, the |callback| will be run once the slot |
| 74 // is loaded. | 78 // is loaded. |
| 75 CRYPTO_EXPORT ScopedPK11Slot GetPrivateSlotForChromeOSUser( | 79 CRYPTO_EXPORT ScopedPK11Slot GetPrivateSlotForChromeOSUser( |
| 76 const std::string& username_hash, | 80 const std::string& username_hash, |
| 77 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; | 81 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; |
| 78 #endif // defined(OS_CHROMEOS) | 82 #endif // defined(OS_CHROMEOS) |
| 79 | 83 |
| 80 } // namespace crypto | 84 } // namespace crypto |
| 81 | 85 |
| 82 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ | 86 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ |
| OLD | NEW |