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_H_ | 5 #ifndef CRYPTO_NSS_UTIL_H_ |
6 #define CRYPTO_NSS_UTIL_H_ | 6 #define CRYPTO_NSS_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback_forward.h" | |
11 #include "base/compiler_specific.h" | |
10 #include "crypto/crypto_export.h" | 12 #include "crypto/crypto_export.h" |
11 | 13 |
12 namespace base { | 14 namespace base { |
13 class FilePath; | 15 class FilePath; |
14 class Lock; | 16 class Lock; |
15 class Time; | 17 class Time; |
16 } // namespace base | 18 } // namespace base |
17 | 19 |
18 // This file specifically doesn't depend on any NSS or NSPR headers because it | 20 // This file specifically doesn't depend on any NSS or NSPR headers because it |
19 // is included by various (non-crypto) parts of chrome to call the | 21 // is included by various (non-crypto) parts of chrome to call the |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 // Open the r/w nssdb that's stored inside the user's encrypted home | 97 // Open the r/w nssdb that's stored inside the user's encrypted home |
96 // directory. This is the default slot returned by | 98 // directory. This is the default slot returned by |
97 // GetPublicNSSKeySlot(). | 99 // GetPublicNSSKeySlot(). |
98 CRYPTO_EXPORT void OpenPersistentNSSDB(); | 100 CRYPTO_EXPORT void OpenPersistentNSSDB(); |
99 | 101 |
100 // Indicates that NSS should load the Chaps library so that we | 102 // Indicates that NSS should load the Chaps library so that we |
101 // can access the TPM through NSS. Once this is called, | 103 // can access the TPM through NSS. Once this is called, |
102 // GetPrivateNSSKeySlot() will return the TPM slot if one was found. | 104 // GetPrivateNSSKeySlot() will return the TPM slot if one was found. |
103 CRYPTO_EXPORT void EnableTPMTokenForNSS(); | 105 CRYPTO_EXPORT void EnableTPMTokenForNSS(); |
104 | 106 |
107 // Returns true if EnableTPMTokenForNSS has been called. | |
108 CRYPTO_EXPORT bool IsTPMTokenEnabledForNSS() WARN_UNUSED_RESULT; | |
Ryan Sleevi
2013/12/04 20:59:55
same comments: Why W_U_R?
mattm
2013/12/04 22:09:28
Done.
| |
109 | |
105 // Returns true if the TPM is owned and PKCS#11 initialized with the | 110 // Returns true if the TPM is owned and PKCS#11 initialized with the |
106 // user and security officer PINs, and has been enabled in NSS by | 111 // user and security officer PINs, and has been enabled in NSS by |
107 // calling EnableTPMForNSS, and Chaps has been successfully | 112 // calling EnableTPMForNSS, and Chaps has been successfully |
108 // loaded into NSS. | 113 // loaded into NSS. |
109 CRYPTO_EXPORT bool IsTPMTokenReady(); | 114 // If |callback| is non-null and the function returns false, the |callback| will |
115 // be run once the TPM is ready. |callback| will never be run if the function | |
116 // returns true. | |
117 CRYPTO_EXPORT bool IsTPMTokenReady(const base::Closure& callback) | |
118 WARN_UNUSED_RESULT; | |
110 | 119 |
111 // Initialize the TPM token. Does nothing if it is already initialized. | 120 // Initialize the TPM token. Does nothing if it is already initialized. |
112 CRYPTO_EXPORT bool InitializeTPMToken(int token_slot_id); | 121 CRYPTO_EXPORT bool InitializeTPMToken(int token_slot_id); |
113 #endif | 122 #endif |
114 | 123 |
115 // Convert a NSS PRTime value into a base::Time object. | 124 // Convert a NSS PRTime value into a base::Time object. |
116 // We use a int64 instead of PRTime here to avoid depending on NSPR headers. | 125 // We use a int64 instead of PRTime here to avoid depending on NSPR headers. |
117 CRYPTO_EXPORT base::Time PRTimeToBaseTime(int64 prtime); | 126 CRYPTO_EXPORT base::Time PRTimeToBaseTime(int64 prtime); |
118 | 127 |
119 // Convert a base::Time object into a PRTime value. | 128 // Convert a base::Time object into a PRTime value. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 private: | 166 private: |
158 base::Lock *lock_; | 167 base::Lock *lock_; |
159 DISALLOW_COPY_AND_ASSIGN(AutoNSSWriteLock); | 168 DISALLOW_COPY_AND_ASSIGN(AutoNSSWriteLock); |
160 }; | 169 }; |
161 | 170 |
162 #endif // defined(USE_NSS) | 171 #endif // defined(USE_NSS) |
163 | 172 |
164 } // namespace crypto | 173 } // namespace crypto |
165 | 174 |
166 #endif // CRYPTO_NSS_UTIL_H_ | 175 #endif // CRYPTO_NSS_UTIL_H_ |
OLD | NEW |