| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file implements the CLIENT Session ID cache. | 2 * This file implements the CLIENT Session ID cache. |
| 3 * | 3 * |
| 4 * This Source Code Form is subject to the terms of the Mozilla Public | 4 * This Source Code Form is subject to the terms of the Mozilla Public |
| 5 * License, v. 2.0. If a copy of the MPL was not distributed with this | 5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 7 | 7 |
| 8 #include "cert.h" | 8 #include "cert.h" |
| 9 #include "pk11pub.h" | 9 #include "pk11pub.h" |
| 10 #include "secitem.h" | 10 #include "secitem.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 SECITEM_FreeItem(&sid->u.ssl3.srvName, PR_FALSE); | 131 SECITEM_FreeItem(&sid->u.ssl3.srvName, PR_FALSE); |
| 132 } | 132 } |
| 133 if (sid->u.ssl3.originalHandshakeHash.data) { | 133 if (sid->u.ssl3.originalHandshakeHash.data) { |
| 134 SECITEM_FreeItem(&sid->u.ssl3.originalHandshakeHash, PR_FALSE); | 134 SECITEM_FreeItem(&sid->u.ssl3.originalHandshakeHash, PR_FALSE); |
| 135 } | 135 } |
| 136 if (sid->u.ssl3.signedCertTimestamps.data) { | 136 if (sid->u.ssl3.signedCertTimestamps.data) { |
| 137 SECITEM_FreeItem(&sid->u.ssl3.signedCertTimestamps, PR_FALSE); | 137 SECITEM_FreeItem(&sid->u.ssl3.signedCertTimestamps, PR_FALSE); |
| 138 } | 138 } |
| 139 | 139 |
| 140 if (sid->u.ssl3.lock) { | 140 if (sid->u.ssl3.lock) { |
| 141 PR_DestroyRWLock(sid->u.ssl3.lock); | 141 NSSRWLock_Destroy(sid->u.ssl3.lock); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 if (sid->peerID != NULL) | 145 if (sid->peerID != NULL) |
| 146 PORT_Free((void *)sid->peerID); /* CONST */ | 146 PORT_Free((void *)sid->peerID); /* CONST */ |
| 147 | 147 |
| 148 if (sid->urlSvrName != NULL) | 148 if (sid->urlSvrName != NULL) |
| 149 PORT_Free((void *)sid->urlSvrName); /* CONST */ | 149 PORT_Free((void *)sid->urlSvrName); /* CONST */ |
| 150 | 150 |
| 151 if ( sid->peerCert ) { | 151 if ( sid->peerCert ) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 rv = PK11_GenerateRandom(sid->u.ssl3.sessionID, | 307 rv = PK11_GenerateRandom(sid->u.ssl3.sessionID, |
| 308 SSL3_SESSIONID_BYTES); | 308 SSL3_SESSIONID_BYTES); |
| 309 if (rv != SECSuccess) | 309 if (rv != SECSuccess) |
| 310 return; | 310 return; |
| 311 sid->u.ssl3.sessionIDLength = SSL3_SESSIONID_BYTES; | 311 sid->u.ssl3.sessionIDLength = SSL3_SESSIONID_BYTES; |
| 312 } | 312 } |
| 313 expirationPeriod = ssl3_sid_timeout; | 313 expirationPeriod = ssl3_sid_timeout; |
| 314 PRINT_BUF(8, (0, "sessionID:", | 314 PRINT_BUF(8, (0, "sessionID:", |
| 315 sid->u.ssl3.sessionID, sid->u.ssl3.sessionIDLength)); | 315 sid->u.ssl3.sessionID, sid->u.ssl3.sessionIDLength)); |
| 316 | 316 |
| 317 » sid->u.ssl3.lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, NULL); | 317 » sid->u.ssl3.lock = NSSRWLock_New(NSS_RWLOCK_RANK_NONE, NULL); |
| 318 if (!sid->u.ssl3.lock) { | 318 if (!sid->u.ssl3.lock) { |
| 319 return; | 319 return; |
| 320 } | 320 } |
| 321 } | 321 } |
| 322 PORT_Assert(sid->creationTime != 0 && sid->expirationTime != 0); | 322 PORT_Assert(sid->creationTime != 0 && sid->expirationTime != 0); |
| 323 if (!sid->creationTime) | 323 if (!sid->creationTime) |
| 324 sid->lastAccessTime = sid->creationTime = ssl_Time(); | 324 sid->lastAccessTime = sid->creationTime = ssl_Time(); |
| 325 if (!sid->expirationTime) | 325 if (!sid->expirationTime) |
| 326 sid->expirationTime = sid->creationTime + expirationPeriod; | 326 sid->expirationTime = sid->creationTime + expirationPeriod; |
| 327 | 327 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 { | 447 { |
| 448 PORT_Assert(sid); | 448 PORT_Assert(sid); |
| 449 PORT_Assert(newSessionTicket); | 449 PORT_Assert(newSessionTicket); |
| 450 | 450 |
| 451 /* if sid->u.ssl3.lock, we are updating an existing entry that is already | 451 /* if sid->u.ssl3.lock, we are updating an existing entry that is already |
| 452 * cached or was once cached, so we need to acquire and release the write | 452 * cached or was once cached, so we need to acquire and release the write |
| 453 * lock. Otherwise, this is a new session that isn't shared with anything | 453 * lock. Otherwise, this is a new session that isn't shared with anything |
| 454 * yet, so no locking is needed. | 454 * yet, so no locking is needed. |
| 455 */ | 455 */ |
| 456 if (sid->u.ssl3.lock) { | 456 if (sid->u.ssl3.lock) { |
| 457 » PR_RWLock_Wlock(sid->u.ssl3.lock); | 457 » NSSRWLock_LockWrite(sid->u.ssl3.lock); |
| 458 | 458 |
| 459 /* A server might have sent us an empty ticket, which has the | 459 /* A server might have sent us an empty ticket, which has the |
| 460 * effect of clearing the previously known ticket. | 460 * effect of clearing the previously known ticket. |
| 461 */ | 461 */ |
| 462 if (sid->u.ssl3.locked.sessionTicket.ticket.data) { | 462 if (sid->u.ssl3.locked.sessionTicket.ticket.data) { |
| 463 SECITEM_FreeItem(&sid->u.ssl3.locked.sessionTicket.ticket, | 463 SECITEM_FreeItem(&sid->u.ssl3.locked.sessionTicket.ticket, |
| 464 PR_FALSE); | 464 PR_FALSE); |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 | 467 |
| 468 PORT_Assert(!sid->u.ssl3.locked.sessionTicket.ticket.data); | 468 PORT_Assert(!sid->u.ssl3.locked.sessionTicket.ticket.data); |
| 469 | 469 |
| 470 /* Do a shallow copy, moving the ticket data. */ | 470 /* Do a shallow copy, moving the ticket data. */ |
| 471 sid->u.ssl3.locked.sessionTicket = *newSessionTicket; | 471 sid->u.ssl3.locked.sessionTicket = *newSessionTicket; |
| 472 newSessionTicket->ticket.data = NULL; | 472 newSessionTicket->ticket.data = NULL; |
| 473 newSessionTicket->ticket.len = 0; | 473 newSessionTicket->ticket.len = 0; |
| 474 | 474 |
| 475 if (sid->u.ssl3.lock) { | 475 if (sid->u.ssl3.lock) { |
| 476 » PR_RWLock_Unlock(sid->u.ssl3.lock); | 476 » NSSRWLock_UnlockWrite(sid->u.ssl3.lock); |
| 477 } | 477 } |
| 478 } | 478 } |
| OLD | NEW |