Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/nss_util.h" | 5 #include "base/nss_util.h" |
| 6 #include "base/nss_util_internal.h" | 6 #include "base/nss_util_internal.h" |
| 7 | 7 |
| 8 #include <nss.h> | 8 #include <nss.h> |
| 9 #include <plarena.h> | 9 #include <plarena.h> |
| 10 #include <prerror.h> | 10 #include <prerror.h> |
| 11 #include <prinit.h> | 11 #include <prinit.h> |
| 12 #include <prtime.h> | 12 #include <prtime.h> |
| 13 #include <pk11pub.h> | 13 #include <pk11pub.h> |
| 14 #include <secmod.h> | 14 #include <secmod.h> |
| 15 | 15 |
| 16 #if defined(OS_LINUX) | 16 #if defined(OS_LINUX) |
| 17 #include <linux/magic.h> | 17 #include <linux/magic.h> |
| 18 #include <sys/vfs.h> | 18 #include <sys/vfs.h> |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 #include "base/file_util.h" | 21 #include "base/file_util.h" |
| 22 #include "base/logging.h" | 22 #include "base/logging.h" |
| 23 #include "base/singleton.h" | 23 #include "base/singleton.h" |
| 24 #include "base/stringprintf.h" | 24 #include "base/stringprintf.h" |
| 25 #include "base/thread_restrictions.h" | |
| 25 | 26 |
| 26 // USE_NSS means we use NSS for everything crypto-related. If USE_NSS is not | 27 // USE_NSS means we use NSS for everything crypto-related. If USE_NSS is not |
| 27 // defined, such as on Mac and Windows, we use NSS for SSL only -- we don't | 28 // defined, such as on Mac and Windows, we use NSS for SSL only -- we don't |
| 28 // use NSS for crypto or certificate verification, and we don't use the NSS | 29 // use NSS for crypto or certificate verification, and we don't use the NSS |
| 29 // certificate and key databases. | 30 // certificate and key databases. |
| 30 #if defined(USE_NSS) | 31 #if defined(USE_NSS) |
| 31 #include "base/environment.h" | 32 #include "base/environment.h" |
| 32 #include "base/lock.h" | 33 #include "base/lock.h" |
| 33 #include "base/scoped_ptr.h" | 34 #include "base/scoped_ptr.h" |
| 34 #endif // defined(USE_NSS) | 35 #endif // defined(USE_NSS) |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 #endif // defined(USE_NSS) | 304 #endif // defined(USE_NSS) |
| 304 }; | 305 }; |
| 305 | 306 |
| 306 } // namespace | 307 } // namespace |
| 307 | 308 |
| 308 void EnsureNSPRInit() { | 309 void EnsureNSPRInit() { |
| 309 Singleton<NSPRInitSingleton>::get(); | 310 Singleton<NSPRInitSingleton>::get(); |
| 310 } | 311 } |
| 311 | 312 |
| 312 void EnsureNSSInit() { | 313 void EnsureNSSInit() { |
| 314 // Initializing SSL causes us to do blocking IO. | |
| 315 // Temporarily allow it until we fix | |
| 316 // http://code.google.com/p/chromium/issues/detail?id=59847 | |
|
willchan no longer on Chromium
2010/10/27 00:06:18
The referenced bug is for this happening on the IO
| |
| 317 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
| 313 Singleton<NSSInitSingleton>::get(); | 318 Singleton<NSSInitSingleton>::get(); |
| 314 } | 319 } |
| 315 | 320 |
| 316 #if defined(USE_NSS) | 321 #if defined(USE_NSS) |
| 317 bool OpenTestNSSDB(const FilePath& path, const char* description) { | 322 bool OpenTestNSSDB(const FilePath& path, const char* description) { |
| 318 return Singleton<NSSInitSingleton>::get()->OpenTestNSSDB(path, description); | 323 return Singleton<NSSInitSingleton>::get()->OpenTestNSSDB(path, description); |
| 319 } | 324 } |
| 320 | 325 |
| 321 void CloseTestNSSDB() { | 326 void CloseTestNSSDB() { |
| 322 Singleton<NSSInitSingleton>::get()->CloseTestNSSDB(); | 327 Singleton<NSSInitSingleton>::get()->CloseTestNSSDB(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 exploded.millisecond = prxtime.tm_usec / 1000; | 368 exploded.millisecond = prxtime.tm_usec / 1000; |
| 364 | 369 |
| 365 return Time::FromUTCExploded(exploded); | 370 return Time::FromUTCExploded(exploded); |
| 366 } | 371 } |
| 367 | 372 |
| 368 PK11SlotInfo* GetDefaultNSSKeySlot() { | 373 PK11SlotInfo* GetDefaultNSSKeySlot() { |
| 369 return Singleton<NSSInitSingleton>::get()->GetDefaultKeySlot(); | 374 return Singleton<NSSInitSingleton>::get()->GetDefaultKeySlot(); |
| 370 } | 375 } |
| 371 | 376 |
| 372 } // namespace base | 377 } // namespace base |
| OLD | NEW |