Home | History | Annotate | Download | only in ssl

Lines Matching refs:sid

195  * If the unreferenced sid is not in the cache, Free sid and its contents.
198 ssl_DestroySID(sslSessionID *sid)
200 SSL_TRC(8, ("SSL: destroy sid: sid=0x%x cached=%d", sid, sid->cached));
201 PORT_Assert((sid->references == 0));
203 if (sid->cached == in_client_cache)
206 if (sid->version < SSL_LIBRARY_VERSION_3_0) {
207 SECITEM_ZfreeItem(&sid->u.ssl2.masterKey, PR_FALSE);
208 SECITEM_ZfreeItem(&sid->u.ssl2.cipherArg, PR_FALSE);
210 if (sid->peerID != NULL)
211 PORT_Free((void *)sid->peerID); /* CONST */
213 if (sid->urlSvrName != NULL)
214 PORT_Free((void *)sid->urlSvrName); /* CONST */
216 if ( sid->peerCert ) {
217 CERT_DestroyCertificate(sid->peerCert);
219 if ( sid->localCert ) {
220 CERT_DestroyCertificate(sid->localCert);
222 if (sid->u.ssl3.sessionTicket.ticket.data) {
223 SECITEM_FreeItem(&sid->u.ssl3.sessionTicket.ticket, PR_FALSE);
226 PORT_ZFree(sid, sizeof(sslSessionID));
231 * free sid if ref count is zero, and sid is not in the cache.
233 * If the sid is still in the cache, it is left there until next time
237 ssl_FreeLockedSID(sslSessionID *sid)
239 PORT_Assert(sid->references >= 1);
240 if (--sid->references == 0) {
241 ssl_DestroySID(sid);
247 * free sid if ref count is zero, and sid is not in the cache.
249 * These locks are necessary because the sid _might_ be in the cache list.
252 ssl_FreeSID(sslSessionID *sid)
255 ssl_FreeLockedSID(sid);
262 ** Lookup sid entry in cache by Address, port, and peerID string.
272 sslSessionID * sid;
280 while ((sid = *sidp) != 0) {
281 PORT_Assert(sid->cached == in_client_cache);
282 PORT_Assert(sid->references >= 1);
284 SSL_TRC(8, ("SSL: Lookup1: sid=0x%x", sid));
286 if (sid->expirationTime < now || !sid->references) {
291 SSL_TRC(7, ("SSL: lookup1, throwing sid out, age=%d refs=%d",
292 now - sid->creationTime, sid->references));
294 *sidp = sid->next; /* delink it from the list. */
295 sid->cached = invalid_cache; /* mark not on list. */
296 if (!sid->references)
297 ssl_DestroySID(sid);
299 ssl_FreeLockedSID(sid); /* drop ref count, free. */
301 } else if (!memcmp(&sid->addr, addr, sizeof(PRIPv6Addr)) && /* server IP addr matches */
302 (sid->port == port) && /* server port matches */
304 (((peerID == NULL) && (sid->peerID == NULL)) ||
305 ((peerID != NULL) && (sid->peerID != NULL) &&
306 PORT_Strcmp(sid->peerID, peerID) == 0)) &&
308 (sid->version < SSL_LIBRARY_VERSION_3_0 ||
309 sid->u.ssl3.keys.resumable) &&
311 (sid->urlSvrName != NULL) &&
312 ((0 == PORT_Strcmp(urlSvrName, sid->urlSvrName)) ||
313 ((sid->peerCert != NULL) && (SECSuccess ==
314 CERT_VerifyCertName(sid->peerCert, urlSvrName))) )
317 sid->lastAccessTime = now;
318 sid->references++;
321 sidp = &sid->next;
325 return sid;
329 ** Add an sid to the cache or return a previously cached entry to the cache.
333 CacheSID(sslSessionID *sid)
336 SSL_TRC(8, ("SSL: Cache: sid=0x%x cached=%d addr=0x%08x%08x%08x%08x port=0x%04x "
338 sid, sid->cached, sid->addr.pr_s6_addr32[0],
339 sid->addr.pr_s6_addr32[1], sid->addr.pr_s6_addr32[2],
340 sid->addr.pr_s6_addr32[3], sid->port, sid->creationTime,
341 sid->cached));
343 if (sid->cached == in_client_cache)
346 if (!sid->urlSvrName) {
347 /* don't cache this SID because it can never be matched */
352 if (sid->version < SSL_LIBRARY_VERSION_3_0) {
355 sid->u.ssl2.sessionID, sizeof(sid->u.ssl2.sessionID)));
357 sid->u.ssl2.masterKey.data, sid->u.ssl2.masterKey.len));
359 sid->u.ssl2.cipherArg.data, sid->u.ssl2.cipherArg.len));
361 if (sid->u.ssl3.sessionIDLength == 0 &&
362 sid->u.ssl3.sessionTicket.ticket.data == NULL)
365 if (sid->u.ssl3.sessionIDLength == 0) {
367 rv = PK11_GenerateRandom(sid->u.ssl3.sessionID,
371 sid->u.ssl3.sessionIDLength = SSL3_SESSIONID_BYTES;
375 sid->u.ssl3.sessionID, sid->u.ssl3.sessionIDLength));
377 PORT_Assert(sid->creationTime != 0 && sid->expirationTime != 0);
378 if (!sid->creationTime)
379 sid->lastAccessTime = sid->creationTime = ssl_Time();
380 if (!sid->expirationTime)
381 sid->expirationTime = sid->creationTime + expirationPeriod;
384 * Put sid into the cache. Bump reference count to indicate that
389 sid->references++;
390 sid->cached = in_client_cache;
391 sid->next = cache;
392 cache = sid;
397 * If sid "zap" is in the cache,
398 * removes sid from cache, and decrements reference count.
405 sslSessionID *sid;
427 while ((sid = *sidp) != 0) {
428 if (sid == zap) {
431 ** everyone is done with the sid we can free it up.
438 sidp = &sid->next;
442 /* If sid "zap" is in the cache,
443 * removes sid from cache, and decrements reference count.
500 ssl3_SetSIDSessionTicket(sslSessionID *sid, NewSessionTicket *session_ticket)
504 /* We need to lock the cache, as this sid might already be in the cache. */
510 if (sid->u.ssl3.sessionTicket.ticket.data)
511 SECITEM_FreeItem(&sid->u.ssl3.sessionTicket.ticket, PR_FALSE);
513 rv = SECITEM_CopyItem(NULL, &sid->u.ssl3.sessionTicket.ticket,
520 sid->u.ssl3.sessionTicket.ticket.data = NULL;
521 sid->u.ssl3.sessionTicket.ticket.len = 0;
523 sid->u.ssl3.sessionTicket.received_timestamp =
525 sid->u.ssl3.sessionTicket.ticket_lifetime_hint =