| OLD | NEW |
| 1 // Copyright (c) 2010 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 BASE_NSS_UTIL_H_ | 5 #ifndef BASE_NSS_UTIL_H_ |
| 6 #define BASE_NSS_UTIL_H_ | 6 #define BASE_NSS_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> |
| 9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 10 | 11 |
| 11 #if defined(USE_NSS) | 12 #if defined(USE_NSS) |
| 12 class FilePath; | 13 class FilePath; |
| 13 #endif // defined(USE_NSS) | 14 #endif // defined(USE_NSS) |
| 14 | 15 |
| 15 // This file specifically doesn't depend on any NSS or NSPR headers because it | 16 // This file specifically doesn't depend on any NSS or NSPR headers because it |
| 16 // is included by various (non-crypto) parts of chrome to call the | 17 // is included by various (non-crypto) parts of chrome to call the |
| 17 // initialization functions. | 18 // initialization functions. |
| 18 namespace base { | 19 namespace base { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // | 73 // |
| 73 // Note that this does not load libnssckbi.so which contains the root | 74 // Note that this does not load libnssckbi.so which contains the root |
| 74 // certificates. | 75 // certificates. |
| 75 void LoadNSSLibraries(); | 76 void LoadNSSLibraries(); |
| 76 | 77 |
| 77 // Check if the current NSS version is greater than or equals to |version|. | 78 // Check if the current NSS version is greater than or equals to |version|. |
| 78 // A sample version string is "3.12.3". | 79 // A sample version string is "3.12.3". |
| 79 bool CheckNSSVersion(const char* version); | 80 bool CheckNSSVersion(const char* version); |
| 80 | 81 |
| 81 #if defined(OS_CHROMEOS) | 82 #if defined(OS_CHROMEOS) |
| 82 // Open the r/w nssdb that's stored inside the user's encrypted home directory. | 83 // Open the r/w nssdb that's stored inside the user's encrypted home |
| 84 // directory. This is the default slot returned by |
| 85 // GetPublicNSSKeySlot(). |
| 83 void OpenPersistentNSSDB(); | 86 void OpenPersistentNSSDB(); |
| 87 |
| 88 // Load the opencryptoki library into NSS so that we can access the |
| 89 // TPM through NSS. Once this is called, GetPrivateNSSKeySlot() will |
| 90 // return the TPM slot if one was found. Returns false if it was |
| 91 // unable to load opencryptoki or open the TPM slot. |
| 92 bool EnableTPMForNSS(); |
| 93 |
| 94 // Get name for the built-in TPM token on ChromeOS. |
| 95 std::string GetTPMTokenName(); |
| 84 #endif | 96 #endif |
| 85 | 97 |
| 86 // Convert a NSS PRTime value into a base::Time object. | 98 // Convert a NSS PRTime value into a base::Time object. |
| 87 // We use a int64 instead of PRTime here to avoid depending on NSPR headers. | 99 // We use a int64 instead of PRTime here to avoid depending on NSPR headers. |
| 88 Time PRTimeToBaseTime(int64 prtime); | 100 Time PRTimeToBaseTime(int64 prtime); |
| 89 | 101 |
| 90 #if defined(USE_NSS) | 102 #if defined(USE_NSS) |
| 91 // Exposed for unittests only. |path| should be an existing directory under | 103 // Exposed for unittests only. |path| should be an existing directory under |
| 92 // which the DB files will be placed. |description| is a user-visible name for | 104 // which the DB files will be placed. |description| is a user-visible name for |
| 93 // the DB, as a utf8 string, which will be truncated at 32 bytes. | 105 // the DB, as a utf8 string, which will be truncated at 32 bytes. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 113 private: | 125 private: |
| 114 Lock *lock_; | 126 Lock *lock_; |
| 115 DISALLOW_COPY_AND_ASSIGN(AutoNSSWriteLock); | 127 DISALLOW_COPY_AND_ASSIGN(AutoNSSWriteLock); |
| 116 }; | 128 }; |
| 117 | 129 |
| 118 #endif // defined(USE_NSS) | 130 #endif // defined(USE_NSS) |
| 119 | 131 |
| 120 } // namespace base | 132 } // namespace base |
| 121 | 133 |
| 122 #endif // BASE_NSS_UTIL_H_ | 134 #endif // BASE_NSS_UTIL_H_ |
| OLD | NEW |