OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 /* | 4 /* |
5 * This file implements PKCS 11 on top of our existing security modules | 5 * This file implements PKCS 11 on top of our existing security modules |
6 * | 6 * |
7 * For more information about PKCS 11 See PKCS 11 Token Inteface Standard. | 7 * For more information about PKCS 11 See PKCS 11 Token Inteface Standard. |
8 * This implementation has two slots: | 8 * This implementation has two slots: |
9 * slot 1 is our generic crypto support. It does not require login. | 9 * slot 1 is our generic crypto support. It does not require login. |
10 * It supports Public Key ops, and all they bulk ciphers and hashes. | 10 * It supports Public Key ops, and all they bulk ciphers and hashes. |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 sqlite_lock = PR_NewLock(); | 2005 sqlite_lock = PR_NewLock(); |
2006 if (sqlite_lock == NULL) { | 2006 if (sqlite_lock == NULL) { |
2007 error = CKR_HOST_MEMORY; | 2007 error = CKR_HOST_MEMORY; |
2008 goto loser; | 2008 goto loser; |
2009 } | 2009 } |
2010 } | 2010 } |
2011 #endif | 2011 #endif |
2012 | 2012 |
2013 /* how long does it take to test for a non-existant file in our working | 2013 /* how long does it take to test for a non-existant file in our working |
2014 * directory? Allows us to test if we may be on a network file system */ | 2014 * directory? Allows us to test if we may be on a network file system */ |
2015 accessOps = sdb_measureAccess(directory); | 2015 accessOps = 1; |
| 2016 { |
| 2017 char *env; |
| 2018 env = PR_GetEnv("NSS_SDB_USE_CACHE"); |
| 2019 /* If the environment variable is set to yes or no, sdb_init() will |
| 2020 * ignore the value of accessOps, and we can skip the measuring.*/ |
| 2021 if (!env || ((PORT_Strcasecmp(env, "no") != 0) && |
| 2022 (PORT_Strcasecmp(env, "yes") != 0))){ |
| 2023 accessOps = sdb_measureAccess(directory); |
| 2024 } |
| 2025 } |
2016 | 2026 |
2017 /* | 2027 /* |
2018 * open the cert data base | 2028 * open the cert data base |
2019 */ | 2029 */ |
2020 if (certdb) { | 2030 if (certdb) { |
2021 /* initialize Certificate database */ | 2031 /* initialize Certificate database */ |
2022 error = sdb_init(cert, "nssPublic", SDB_CERT, &inUpdate, | 2032 error = sdb_init(cert, "nssPublic", SDB_CERT, &inUpdate, |
2023 newInit, flags, accessOps, certdb); | 2033 newInit, flags, accessOps, certdb); |
2024 if (error != CKR_OK) { | 2034 if (error != CKR_OK) { |
2025 goto loser; | 2035 goto loser; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 s_shutdown() | 2080 s_shutdown() |
2071 { | 2081 { |
2072 #ifdef SQLITE_UNSAFE_THREADS | 2082 #ifdef SQLITE_UNSAFE_THREADS |
2073 if (sqlite_lock) { | 2083 if (sqlite_lock) { |
2074 PR_DestroyLock(sqlite_lock); | 2084 PR_DestroyLock(sqlite_lock); |
2075 sqlite_lock = NULL; | 2085 sqlite_lock = NULL; |
2076 } | 2086 } |
2077 #endif | 2087 #endif |
2078 return CKR_OK; | 2088 return CKR_OK; |
2079 } | 2089 } |
OLD | NEW |