| OLD | NEW |
| 1 diff -pu a/nss/lib/ssl/ssl3con.c b/nss/lib/ssl/ssl3con.c | 1 diff --git a/ssl/ssl3con.c b/ssl/ssl3con.c |
| 2 --- a/nss/lib/ssl/ssl3con.c» 2014-01-17 18:10:16.783281701 -0800 | 2 index adaa9a4..708a4c7 100644 |
| 3 +++ b/nss/lib/ssl/ssl3con.c» 2014-01-17 18:11:03.734060469 -0800 | 3 --- a/ssl/ssl3con.c |
| 4 @@ -5678,7 +5678,6 @@ SSL3_ShutdownServerCache(void) | 4 +++ b/ssl/ssl3con.c |
| 5 @@ -5733,7 +5733,6 @@ SSL3_ShutdownServerCache(void) |
| 5 } | 6 } |
| 6 | 7 |
| 7 PZ_Unlock(symWrapKeysLock); | 8 PZ_Unlock(symWrapKeysLock); |
| 8 - ssl_FreeSessionCacheLocks(); | 9 - ssl_FreeSessionCacheLocks(); |
| 9 return SECSuccess; | 10 return SECSuccess; |
| 10 } | 11 } |
| 11 | 12 |
| 12 @@ -5730,7 +5729,7 @@ getWrappingKey( sslSocket * ss, | 13 @@ -5785,7 +5784,7 @@ getWrappingKey( sslSocket * ss, |
| 13 | 14 |
| 14 pSymWrapKey = &symWrapKeys[symWrapMechIndex].symWrapKey[exchKeyType]; | 15 pSymWrapKey = &symWrapKeys[symWrapMechIndex].symWrapKey[exchKeyType]; |
| 15 | 16 |
| 16 - ssl_InitSessionCacheLocks(PR_TRUE); | 17 - ssl_InitSessionCacheLocks(PR_TRUE); |
| 17 + ssl_InitSessionCacheLocks(); | 18 + ssl_InitSessionCacheLocks(); |
| 18 | 19 |
| 19 PZ_Lock(symWrapKeysLock); | 20 PZ_Lock(symWrapKeysLock); |
| 20 | 21 |
| 21 diff -pu a/nss/lib/ssl/sslimpl.h b/nss/lib/ssl/sslimpl.h | 22 diff --git a/ssl/sslimpl.h b/ssl/sslimpl.h |
| 22 --- a/nss/lib/ssl/sslimpl.h» 2014-01-17 18:10:16.793281867 -0800 | 23 index 643570f..62f822a 100644 |
| 23 +++ b/nss/lib/ssl/sslimpl.h» 2014-01-17 18:11:03.734060469 -0800 | 24 --- a/ssl/sslimpl.h |
| 24 @@ -1913,9 +1913,7 @@ extern SECStatus ssl_InitSymWrapKeysLock | 25 +++ b/ssl/sslimpl.h |
| 26 @@ -1917,9 +1917,7 @@ extern SECStatus ssl_InitSymWrapKeysLock(void); |
| 25 | 27 |
| 26 extern SECStatus ssl_FreeSymWrapKeysLock(void); | 28 extern SECStatus ssl_FreeSymWrapKeysLock(void); |
| 27 | 29 |
| 28 -extern SECStatus ssl_InitSessionCacheLocks(PRBool lazyInit); | 30 -extern SECStatus ssl_InitSessionCacheLocks(PRBool lazyInit); |
| 29 - | 31 - |
| 30 -extern SECStatus ssl_FreeSessionCacheLocks(void); | 32 -extern SECStatus ssl_FreeSessionCacheLocks(void); |
| 31 +extern SECStatus ssl_InitSessionCacheLocks(void); | 33 +extern SECStatus ssl_InitSessionCacheLocks(void); |
| 32 | 34 |
| 33 /***************** platform client auth ****************/ | 35 /***************** platform client auth ****************/ |
| 34 | 36 |
| 35 diff -pu a/nss/lib/ssl/sslnonce.c b/nss/lib/ssl/sslnonce.c | 37 diff --git a/ssl/sslnonce.c b/ssl/sslnonce.c |
| 36 --- a/nss/lib/ssl/sslnonce.c» 2014-01-17 17:59:03.242109996 -0800 | 38 index 1326a8b..c45849d 100644 |
| 37 +++ b/nss/lib/ssl/sslnonce.c» 2014-01-17 18:11:03.754060801 -0800 | 39 --- a/ssl/sslnonce.c |
| 40 +++ b/ssl/sslnonce.c |
| 38 @@ -35,91 +35,55 @@ static PZLock * cacheLock = NULL; | 41 @@ -35,91 +35,55 @@ static PZLock * cacheLock = NULL; |
| 39 #define LOCK_CACHE lock_cache() | 42 #define LOCK_CACHE lock_cache() |
| 40 #define UNLOCK_CACHE PZ_Unlock(cacheLock) | 43 #define UNLOCK_CACHE PZ_Unlock(cacheLock) |
| 41 | 44 |
| 42 -static SECStatus | 45 -static SECStatus |
| 43 -ssl_InitClientSessionCacheLock(void) | 46 -ssl_InitClientSessionCacheLock(void) |
| 44 -{ | 47 -{ |
| 45 - cacheLock = PZ_NewLock(nssILockCache); | 48 - cacheLock = PZ_NewLock(nssILockCache); |
| 46 - return cacheLock ? SECSuccess : SECFailure; | 49 - return cacheLock ? SECSuccess : SECFailure; |
| 47 -} | 50 -} |
| 48 - | 51 - |
| 49 -static SECStatus | 52 -static SECStatus |
| 50 -ssl_FreeClientSessionCacheLock(void) | 53 -ssl_FreeClientSessionCacheLock(void) |
| 51 -{ | 54 -{ |
| 52 - if (cacheLock) { | 55 - if (cacheLock) { |
| 53 - PZ_DestroyLock(cacheLock); | 56 - PZ_DestroyLock(cacheLock); |
| 54 - cacheLock = NULL; | 57 - cacheLock = NULL; |
| 55 - return SECSuccess; | 58 - return SECSuccess; |
| 56 - } | 59 - } |
| 57 - PORT_SetError(SEC_ERROR_NOT_INITIALIZED); | 60 - PORT_SetError(SEC_ERROR_NOT_INITIALIZED); |
| 58 - return SECFailure; | 61 - return SECFailure; |
| 59 -} | 62 -} |
| 60 - | 63 - |
| 61 -static PRBool LocksInitializedEarly = PR_FALSE; | 64 -static PRBool LocksInitializedEarly = PR_FALSE; |
| 62 - | 65 +static PRCallOnceType lockOnce; |
| 63 -static SECStatus | 66 |
| 67 +/* FreeSessionCacheLocks is a callback from NSS_RegisterShutdown which destroys |
| 68 + * the session cache locks on shutdown and resets them to their initial |
| 69 + * state. */ |
| 70 static SECStatus |
| 64 -FreeSessionCacheLocks() | 71 -FreeSessionCacheLocks() |
| 65 -{ | 72 +FreeSessionCacheLocks(void* appData, void* nssData) |
| 73 { |
| 66 - SECStatus rv1, rv2; | 74 - SECStatus rv1, rv2; |
| 67 - rv1 = ssl_FreeSymWrapKeysLock(); | 75 - rv1 = ssl_FreeSymWrapKeysLock(); |
| 68 - rv2 = ssl_FreeClientSessionCacheLock(); | 76 - rv2 = ssl_FreeClientSessionCacheLock(); |
| 69 - if ( (SECSuccess == rv1) && (SECSuccess == rv2) ) { | 77 - if ( (SECSuccess == rv1) && (SECSuccess == rv2) ) { |
| 70 - return SECSuccess; | 78 - return SECSuccess; |
| 71 - } | 79 - } |
| 72 - return SECFailure; | 80 - return SECFailure; |
| 73 -} | 81 -} |
| 74 +static PRCallOnceType lockOnce; | 82 + static const PRCallOnceType pristineCallOnce; |
| 83 + SECStatus rv; |
| 75 | 84 |
| 76 +/* FreeSessionCacheLocks is a callback from NSS_RegisterShutdown which destroys | 85 -static SECStatus |
| 77 + * the session cache locks on shutdown and resets them to their initial | |
| 78 + * state. */ | |
| 79 static SECStatus | |
| 80 -InitSessionCacheLocks(void) | 86 -InitSessionCacheLocks(void) |
| 81 +FreeSessionCacheLocks(void* appData, void* nssData) | 87 -{ |
| 82 { | |
| 83 - SECStatus rv1, rv2; | 88 - SECStatus rv1, rv2; |
| 84 - PRErrorCode rc; | 89 - PRErrorCode rc; |
| 85 - rv1 = ssl_InitSymWrapKeysLock(); | 90 - rv1 = ssl_InitSymWrapKeysLock(); |
| 86 - rv2 = ssl_InitClientSessionCacheLock(); | 91 - rv2 = ssl_InitClientSessionCacheLock(); |
| 87 - if ( (SECSuccess == rv1) && (SECSuccess == rv2) ) { | 92 - if ( (SECSuccess == rv1) && (SECSuccess == rv2) ) { |
| 88 - return SECSuccess; | 93 - return SECSuccess; |
| 89 - } | 94 - } |
| 90 - rc = PORT_GetError(); | 95 - rc = PORT_GetError(); |
| 91 - FreeSessionCacheLocks(); | 96 - FreeSessionCacheLocks(); |
| 92 - PORT_SetError(rc); | 97 - PORT_SetError(rc); |
| 93 - return SECFailure; | 98 - return SECFailure; |
| 94 -} | 99 -} |
| 95 + static const PRCallOnceType pristineCallOnce; | 100 - |
| 96 + SECStatus rv; | |
| 97 | |
| 98 -/* free the session cache locks if they were initialized early */ | 101 -/* free the session cache locks if they were initialized early */ |
| 99 -SECStatus | 102 -SECStatus |
| 100 -ssl_FreeSessionCacheLocks() | 103 -ssl_FreeSessionCacheLocks() |
| 101 -{ | 104 -{ |
| 102 - PORT_Assert(PR_TRUE == LocksInitializedEarly); | 105 - PORT_Assert(PR_TRUE == LocksInitializedEarly); |
| 103 - if (!LocksInitializedEarly) { | 106 - if (!LocksInitializedEarly) { |
| 104 + if (!cacheLock) { | 107 + if (!cacheLock) { |
| 105 PORT_SetError(SEC_ERROR_NOT_INITIALIZED); | 108 PORT_SetError(SEC_ERROR_NOT_INITIALIZED); |
| 106 return SECFailure; | 109 return SECFailure; |
| 107 } | 110 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 + PZ_DestroyLock(cacheLock); | 156 + PZ_DestroyLock(cacheLock); |
| 154 + cacheLock = NULL; | 157 + cacheLock = NULL; |
| 155 + PORT_SetError(error); | 158 + PORT_SetError(error); |
| 156 + return PR_FAILURE; | 159 + return PR_FAILURE; |
| 157 + } | 160 + } |
| 158 + | 161 + |
| 159 + rv = NSS_RegisterShutdown(FreeSessionCacheLocks, NULL); | 162 + rv = NSS_RegisterShutdown(FreeSessionCacheLocks, NULL); |
| 160 PORT_Assert(SECSuccess == rv); | 163 PORT_Assert(SECSuccess == rv); |
| 161 if (SECSuccess != rv) { | 164 if (SECSuccess != rv) { |
| 162 return PR_FAILURE; | 165 return PR_FAILURE; |
| 163 @@ -127,34 +91,18 @@ static PRStatus initSessionCacheLocksLaz | 166 @@ -127,34 +91,18 @@ static PRStatus initSessionCacheLocksLazily(void) |
| 164 return PR_SUCCESS; | 167 return PR_SUCCESS; |
| 165 } | 168 } |
| 166 | 169 |
| 167 -/* lazyInit means that the call is not happening during a 1-time | 170 -/* lazyInit means that the call is not happening during a 1-time |
| 168 - * initialization function, but rather during dynamic, lazy initialization | 171 - * initialization function, but rather during dynamic, lazy initialization |
| 169 - */ | 172 - */ |
| 170 SECStatus | 173 SECStatus |
| 171 -ssl_InitSessionCacheLocks(PRBool lazyInit) | 174 -ssl_InitSessionCacheLocks(PRBool lazyInit) |
| 172 +ssl_InitSessionCacheLocks(void) | 175 +ssl_InitSessionCacheLocks(void) |
| 173 { | 176 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 194 | 197 |
| 195 -static void | 198 -static void |
| 196 +static void | 199 +static void |
| 197 lock_cache(void) | 200 lock_cache(void) |
| 198 { | 201 { |
| 199 - ssl_InitSessionCacheLocks(PR_TRUE); | 202 - ssl_InitSessionCacheLocks(PR_TRUE); |
| 200 + ssl_InitSessionCacheLocks(); | 203 + ssl_InitSessionCacheLocks(); |
| 201 PZ_Lock(cacheLock); | 204 PZ_Lock(cacheLock); |
| 202 } | 205 } |
| 203 | 206 |
| 204 diff -pu a/nss/lib/ssl/sslsnce.c b/nss/lib/ssl/sslsnce.c | 207 diff --git a/ssl/sslsnce.c b/ssl/sslsnce.c |
| 205 --- a/nss/lib/ssl/sslsnce.c» 2014-01-17 17:49:26.072517368 -0800 | 208 index 4d9ef38..3279200 100644 |
| 206 +++ b/nss/lib/ssl/sslsnce.c» 2014-01-17 18:11:03.774061133 -0800 | 209 --- a/ssl/sslsnce.c |
| 207 @@ -1353,7 +1353,7 @@ SSL_ConfigServerSessionIDCache(» int | 210 +++ b/ssl/sslsnce.c |
| 211 @@ -1352,7 +1352,7 @@ SSL_ConfigServerSessionIDCache(» int maxCacheEntries
, |
| 208 PRUint32 ssl3_timeout, | 212 PRUint32 ssl3_timeout, |
| 209 const char * directory) | 213 const char * directory) |
| 210 { | 214 { |
| 211 - ssl_InitSessionCacheLocks(PR_FALSE); | 215 - ssl_InitSessionCacheLocks(PR_FALSE); |
| 212 + ssl_InitSessionCacheLocks(); | 216 + ssl_InitSessionCacheLocks(); |
| 213 return SSL_ConfigServerSessionIDCacheInstance(&globalCache, | 217 return SSL_ConfigServerSessionIDCacheInstance(&globalCache, |
| 214 maxCacheEntries, ssl2_timeout, ssl3_timeout, directory, PR_FALSE
); | 218 maxCacheEntries, ssl2_timeout, ssl3_timeout, directory, PR_FALSE
); |
| 215 } | 219 } |
| 216 @@ -1467,7 +1467,7 @@ SSL_ConfigServerSessionIDCacheWithOpt( | 220 @@ -1466,7 +1466,7 @@ SSL_ConfigServerSessionIDCacheWithOpt( |
| 217 PRBool enableMPCache) | 221 PRBool enableMPCache) |
| 218 { | 222 { |
| 219 if (!enableMPCache) { | 223 if (!enableMPCache) { |
| 220 - ssl_InitSessionCacheLocks(PR_FALSE); | 224 - ssl_InitSessionCacheLocks(PR_FALSE); |
| 221 + ssl_InitSessionCacheLocks(); | 225 + ssl_InitSessionCacheLocks(); |
| 222 return ssl_ConfigServerSessionIDCacheInstanceWithOpt(&globalCache, | 226 return ssl_ConfigServerSessionIDCacheInstanceWithOpt(&globalCache, |
| 223 ssl2_timeout, ssl3_timeout, directory, PR_FALSE, | 227 ssl2_timeout, ssl3_timeout, directory, PR_FALSE, |
| 224 maxCacheEntries, maxCertCacheEntries, maxSrvNameCacheEntries); | 228 maxCacheEntries, maxCertCacheEntries, maxSrvNameCacheEntries); |
| 225 @@ -1512,7 +1512,7 @@ SSL_InheritMPServerSIDCacheInstance(cach | 229 @@ -1511,7 +1511,7 @@ SSL_InheritMPServerSIDCacheInstance(cacheDesc *cache, cons
t char * envString) |
| 226 return SECSuccess; /* already done. */ | 230 return SECSuccess; /* already done. */ |
| 227 } | 231 } |
| 228 | 232 |
| 229 - ssl_InitSessionCacheLocks(PR_FALSE); | 233 - ssl_InitSessionCacheLocks(PR_FALSE); |
| 230 + ssl_InitSessionCacheLocks(); | 234 + ssl_InitSessionCacheLocks(); |
| 231 | 235 |
| 232 ssl_sid_lookup = ServerSessionIDLookup; | 236 ssl_sid_lookup = ServerSessionIDLookup; |
| 233 ssl_sid_cache = ServerSessionIDCache; | 237 ssl_sid_cache = ServerSessionIDCache; |
| OLD | NEW |