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 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. |
| 57 // InitializeTPMTokenAndSystemSlot and no system token is provided by the Chaps | 57 // If |skip_tpm_initialization| is true, the TPM initialization that is usually |
| 58 // triggered by InitializeTPMTokenAndSystemSlot is skipped and instead the | |
| 59 // |slot| is directly exposed through |GetSystemNSSKeySlot| and | |
| 60 // |IsTPMTokenReady| will return true. | |
| 61 // If |skip_tpm_initialization| is false, InitializeTPMTokenAndSystemSlot must | |
| 62 // be called afterwards. If then no system token is provided by the Chaps | |
| 58 // module, then this test slot will be used and the initialization continues as | 63 // module, then this test slot will be used and the initialization continues as |
|
Ryan Sleevi
2014/07/29 00:23:16
English-wise, this reads a little weird (namely "I
pneubeck (no reviews)
2014/07/29 16:00:15
Yes, the 'then' was a typo.
| |
| 59 // if Chaps had provided this test slot. In particular, |slot| will be exposed | 64 // if Chaps had provided this test slot. Again, |slot| will be exposed |
| 60 // by |GetSystemNSSKeySlot| and |IsTPMTokenReady| will return true. | 65 // by |GetSystemNSSKeySlot| and |IsTPMTokenReady| will return true. |
| 61 // This must must not be called consecutively with a |slot| != NULL. If |slot| | 66 // This must must not be called consecutively with a |slot| != NULL. If |slot| |
| 62 // is NULL, the test system slot is unset. | 67 // is NULL, the test system slot is unset. |
| 63 CRYPTO_EXPORT_PRIVATE void SetSystemKeySlotForTesting(ScopedPK11Slot slot); | 68 CRYPTO_EXPORT_PRIVATE void SetSystemKeySlotForTesting( |
| 69 bool skip_tpm_initialization, | |
| 70 ScopedPK11Slot slot); | |
| 64 | 71 |
| 65 // Prepare per-user NSS slot mapping. It is safe to call this function multiple | 72 // 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. | 73 // times. Returns true if the user was added, or false if it already existed. |
| 67 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( | 74 CRYPTO_EXPORT bool InitializeNSSForChromeOSUser( |
| 68 const std::string& email, | 75 const std::string& email, |
| 69 const std::string& username_hash, | 76 const std::string& username_hash, |
| 70 const base::FilePath& path); | 77 const base::FilePath& path); |
| 71 | 78 |
| 72 // Returns whether TPM for ChromeOS user still needs initialization. If | 79 // Returns whether TPM for ChromeOS user still needs initialization. If |
| 73 // true is returned, the caller can proceed to initialize TPM slot for the | 80 // true is returned, the caller can proceed to initialize TPM slot for the |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 | 113 |
| 107 // Closes the NSS DB for |username_hash| that was previously opened by the | 114 // Closes the NSS DB for |username_hash| that was previously opened by the |
| 108 // *Initialize*ForChromeOSUser functions. | 115 // *Initialize*ForChromeOSUser functions. |
| 109 CRYPTO_EXPORT_PRIVATE void CloseChromeOSUserForTesting( | 116 CRYPTO_EXPORT_PRIVATE void CloseChromeOSUserForTesting( |
| 110 const std::string& username_hash); | 117 const std::string& username_hash); |
| 111 #endif // defined(OS_CHROMEOS) | 118 #endif // defined(OS_CHROMEOS) |
| 112 | 119 |
| 113 } // namespace crypto | 120 } // namespace crypto |
| 114 | 121 |
| 115 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ | 122 #endif // CRYPTO_NSS_UTIL_INTERNAL_H_ |
| OLD | NEW |