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" |
| 11 #include "crypto/crypto_api.h" |
11 | 12 |
12 #if defined(USE_NSS) | 13 #if defined(USE_NSS) |
13 class FilePath; | 14 class FilePath; |
14 #endif // defined(USE_NSS) | 15 #endif // defined(USE_NSS) |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class Lock; | 18 class Lock; |
18 class Time; | 19 class Time; |
19 } // namespace base | 20 } // namespace base |
20 | 21 |
21 // This file specifically doesn't depend on any NSS or NSPR headers because it | 22 // This file specifically doesn't depend on any NSS or NSPR headers because it |
22 // is included by various (non-crypto) parts of chrome to call the | 23 // is included by various (non-crypto) parts of chrome to call the |
23 // initialization functions. | 24 // initialization functions. |
24 namespace crypto { | 25 namespace crypto { |
25 | 26 |
26 #if defined(USE_NSS) | 27 #if defined(USE_NSS) |
27 // EarlySetupForNSSInit performs lightweight setup which must occur before the | 28 // EarlySetupForNSSInit performs lightweight setup which must occur before the |
28 // process goes multithreaded. This does not initialise NSS. For test, see | 29 // process goes multithreaded. This does not initialise NSS. For test, see |
29 // EnsureNSSInit. | 30 // EnsureNSSInit. |
30 void EarlySetupForNSSInit(); | 31 void EarlySetupForNSSInit(); |
31 #endif | 32 #endif |
32 | 33 |
33 // Initialize NRPR if it isn't already initialized. This function is | 34 // Initialize NRPR if it isn't already initialized. This function is |
34 // thread-safe, and NSPR will only ever be initialized once. | 35 // thread-safe, and NSPR will only ever be initialized once. |
35 void EnsureNSPRInit(); | 36 void CRYPTO_API EnsureNSPRInit(); |
36 | 37 |
37 // Initialize NSS if it isn't already initialized. This must be called before | 38 // Initialize NSS if it isn't already initialized. This must be called before |
38 // any other NSS functions. This function is thread-safe, and NSS will only | 39 // any other NSS functions. This function is thread-safe, and NSS will only |
39 // ever be initialized once. | 40 // ever be initialized once. |
40 void EnsureNSSInit(); | 41 void CRYPTO_API EnsureNSSInit(); |
41 | 42 |
42 // Call this before calling EnsureNSSInit() will force NSS to initialize | 43 // Call this before calling EnsureNSSInit() will force NSS to initialize |
43 // without a persistent DB. This is used for the special case where access of | 44 // without a persistent DB. This is used for the special case where access of |
44 // persistent DB is prohibited. | 45 // persistent DB is prohibited. |
45 // | 46 // |
46 // TODO(hclam): Isolate loading default root certs. | 47 // TODO(hclam): Isolate loading default root certs. |
47 // | 48 // |
48 // NSS will be initialized without loading any user security modules, including | 49 // NSS will be initialized without loading any user security modules, including |
49 // the built-in root certificates module. User security modules need to be | 50 // the built-in root certificates module. User security modules need to be |
50 // loaded manually after NSS initialization. | 51 // loaded manually after NSS initialization. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 private: | 147 private: |
147 base::Lock *lock_; | 148 base::Lock *lock_; |
148 DISALLOW_COPY_AND_ASSIGN(AutoNSSWriteLock); | 149 DISALLOW_COPY_AND_ASSIGN(AutoNSSWriteLock); |
149 }; | 150 }; |
150 | 151 |
151 #endif // defined(USE_NSS) | 152 #endif // defined(USE_NSS) |
152 | 153 |
153 } // namespace crypto | 154 } // namespace crypto |
154 | 155 |
155 #endif // CRYPTO_NSS_UTIL_H_ | 156 #endif // CRYPTO_NSS_UTIL_H_ |
OLD | NEW |