| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // provided to ensure that sensitive data wouldn't be exposed in plain text in | 142 // provided to ensure that sensitive data wouldn't be exposed in plain text in |
| 143 // case when an attacker would somehow gain access to all content within | 143 // case when an attacker would somehow gain access to all content within |
| 144 // cryptohome. | 144 // cryptohome. |
| 145 CRYPTO_EXPORT SymmetricKey* GetSupplementalUserKey(); | 145 CRYPTO_EXPORT SymmetricKey* GetSupplementalUserKey(); |
| 146 #endif | 146 #endif |
| 147 | 147 |
| 148 // Convert a NSS PRTime value into a base::Time object. | 148 // Convert a NSS PRTime value into a base::Time object. |
| 149 // We use a int64 instead of PRTime here to avoid depending on NSPR headers. | 149 // We use a int64 instead of PRTime here to avoid depending on NSPR headers. |
| 150 CRYPTO_EXPORT base::Time PRTimeToBaseTime(int64 prtime); | 150 CRYPTO_EXPORT base::Time PRTimeToBaseTime(int64 prtime); |
| 151 | 151 |
| 152 // Convert a base::Time object into a PRTime value. |
| 153 // We use a int64 instead of PRTime here to avoid depending on NSPR headers. |
| 154 CRYPTO_EXPORT int64 BaseTimeToPRTime(base::Time time); |
| 155 |
| 152 #if defined(USE_NSS) | 156 #if defined(USE_NSS) |
| 153 // Exposed for unittests only. |path| should be an existing directory under | 157 // Exposed for unittests only. |path| should be an existing directory under |
| 154 // which the DB files will be placed. |description| is a user-visible name for | 158 // which the DB files will be placed. |description| is a user-visible name for |
| 155 // the DB, as a utf8 string, which will be truncated at 32 bytes. | 159 // the DB, as a utf8 string, which will be truncated at 32 bytes. |
| 156 CRYPTO_EXPORT bool OpenTestNSSDB(const FilePath& path, const char* description); | 160 CRYPTO_EXPORT bool OpenTestNSSDB(const FilePath& path, const char* description); |
| 157 CRYPTO_EXPORT void CloseTestNSSDB(); | 161 CRYPTO_EXPORT void CloseTestNSSDB(); |
| 158 | 162 |
| 159 // NSS has a bug which can cause a deadlock or stall in some cases when writing | 163 // NSS has a bug which can cause a deadlock or stall in some cases when writing |
| 160 // to the certDB and keyDB. It also has a bug which causes concurrent key pair | 164 // to the certDB and keyDB. It also has a bug which causes concurrent key pair |
| 161 // generations to scribble over each other. To work around this, we synchronize | 165 // generations to scribble over each other. To work around this, we synchronize |
| (...skipping 13 matching lines...) Expand all Loading... |
| 175 private: | 179 private: |
| 176 base::Lock *lock_; | 180 base::Lock *lock_; |
| 177 DISALLOW_COPY_AND_ASSIGN(AutoNSSWriteLock); | 181 DISALLOW_COPY_AND_ASSIGN(AutoNSSWriteLock); |
| 178 }; | 182 }; |
| 179 | 183 |
| 180 #endif // defined(USE_NSS) | 184 #endif // defined(USE_NSS) |
| 181 | 185 |
| 182 } // namespace crypto | 186 } // namespace crypto |
| 183 | 187 |
| 184 #endif // CRYPTO_NSS_UTIL_H_ | 188 #endif // CRYPTO_NSS_UTIL_H_ |
| OLD | NEW |