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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 DISALLOW_COPY_AND_ASSIGN(AutoSECMODListReadLock); | 46 DISALLOW_COPY_AND_ASSIGN(AutoSECMODListReadLock); |
47 }; | 47 }; |
48 | 48 |
49 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
50 // Returns a reference to the system-wide TPM slot if is loaded. If it is not | 50 // Returns a reference to the system-wide TPM slot if is loaded. If it is not |
51 // laoded and |callback| is non-null, the |callback| will be run once the slot | 51 // laoded and |callback| is non-null, the |callback| will be run once the slot |
52 // is loaded. | 52 // is loaded. |
53 CRYPTO_EXPORT ScopedPK11Slot GetSystemNSSKeySlot( | 53 CRYPTO_EXPORT ScopedPK11Slot GetSystemNSSKeySlot( |
54 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; | 54 const base::Callback<void(ScopedPK11Slot)>& callback) WARN_UNUSED_RESULT; |
55 | 55 |
56 // Sets the test system slot. If this was called before | 56 // Sets the test system slot. |slot| is exposed through |GetSystemNSSKeySlot| |
57 // InitializeTPMTokenAndSystemSlot and no system token is provided by the Chaps | 57 // and |IsTPMTokenReady| will return true. |
58 // module, then this test slot will be used and the initialization continues as | 58 // |InitializeTPMTokenAndSystemSlot|, which triggers the TPM initialization, |
59 // if Chaps had provided this test slot. In particular, |slot| will be exposed | 59 // does not have to be called if the test slot is set. |
Ryan Sleevi
2014/07/29 23:53:15
Kind of a weird API contract, in that I'd think to
pneubeck (no reviews)
2014/07/30 06:27:39
No idea what 'two' slots you're meaning, only the
| |
60 // by |GetSystemNSSKeySlot| and |IsTPMTokenReady| will return true. | |
61 // This must must not be called consecutively with a |slot| != NULL. If |slot| | 60 // This must must not be called consecutively with a |slot| != NULL. If |slot| |
62 // is NULL, the test system slot is unset. | 61 // is NULL, the test system slot is unset. |
63 CRYPTO_EXPORT_PRIVATE void SetSystemKeySlotForTesting(ScopedPK11Slot slot); | 62 CRYPTO_EXPORT_PRIVATE void SetSystemKeySlotForTesting(ScopedPK11Slot slot); |
64 | 63 |
65 // Prepare per-user NSS slot mapping. It is safe to call this function multiple | 64 // Prepare per-user NSS slot mapping. It is safe to call this function multiple |
66 // times. Returns true if the user was added, or false if it already existed. | 65 // times. Returns true if the user was added, or false if it already existed. |
67 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( | 66 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( |
68 const std::string& email, | 67 const std::string& email, |
69 const std::string& username_hash, | 68 const std::string& username_hash, |
70 const base::FilePath& path); | 69 const base::FilePath& path); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 | 105 |
107 // Closes the NSS DB for |username_hash| that was previously opened by the | 106 // Closes the NSS DB for |username_hash| that was previously opened by the |
108 // *Initialize*ForChromeOSUser functions. | 107 // *Initialize*ForChromeOSUser functions. |
109 CRYPTO_EXPORT_PRIVATE void CloseChromeOSUserForTesting( | 108 CRYPTO_EXPORT_PRIVATE void CloseChromeOSUserForTesting( |
110 const std::string& username_hash); | 109 const std::string& username_hash); |
111 #endif // defined(OS_CHROMEOS) | 110 #endif // defined(OS_CHROMEOS) |
112 | 111 |
113 } // namespace crypto | 112 } // namespace crypto |
114 | 113 |
115 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ | 114 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ |
OLD | NEW |