ssl_sess.c (59191) | ssl_sess.c (68651) |
---|---|
1/* ssl/ssl_sess.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 97 unchanged lines hidden (view full) --- 106 { 107 return(CRYPTO_get_ex_data(&s->ex_data,idx)); 108 } 109 110SSL_SESSION *SSL_SESSION_new(void) 111 { 112 SSL_SESSION *ss; 113 | 1/* ssl/ssl_sess.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 97 unchanged lines hidden (view full) --- 106 { 107 return(CRYPTO_get_ex_data(&s->ex_data,idx)); 108 } 109 110SSL_SESSION *SSL_SESSION_new(void) 111 { 112 SSL_SESSION *ss; 113 |
114 ss=(SSL_SESSION *)Malloc(sizeof(SSL_SESSION)); | 114 ss=(SSL_SESSION *)OPENSSL_malloc(sizeof(SSL_SESSION)); |
115 if (ss == NULL) 116 { 117 SSLerr(SSL_F_SSL_SESSION_NEW,ERR_R_MALLOC_FAILURE); 118 return(0); 119 } 120 memset(ss,0,sizeof(SSL_SESSION)); 121 122 ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */ --- 182 unchanged lines hidden (view full) --- 305 if (ret->cipher == NULL) 306 goto err; 307 } 308 309 310#if 0 /* This is way too late. */ 311 312 /* If a thread got the session, then 'swaped', and another got | 115 if (ss == NULL) 116 { 117 SSLerr(SSL_F_SSL_SESSION_NEW,ERR_R_MALLOC_FAILURE); 118 return(0); 119 } 120 memset(ss,0,sizeof(SSL_SESSION)); 121 122 ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */ --- 182 unchanged lines hidden (view full) --- 305 if (ret->cipher == NULL) 306 goto err; 307 } 308 309 310#if 0 /* This is way too late. */ 311 312 /* If a thread got the session, then 'swaped', and another got |
313 * it and then due to a time-out decided to 'Free' it we could | 313 * it and then due to a time-out decided to 'OPENSSL_free' it we could |
314 * be in trouble. So I'll increment it now, then double decrement 315 * later - am I speaking rubbish?. */ 316 CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION); 317#endif 318 319 if ((long)(ret->time+ret->timeout) < (long)time(NULL)) /* timeout */ 320 { 321 s->ctx->stats.sess_timeout++; --- 147 unchanged lines hidden (view full) --- 469 470 memset(ss->key_arg,0,SSL_MAX_KEY_ARG_LENGTH); 471 memset(ss->master_key,0,SSL_MAX_MASTER_KEY_LENGTH); 472 memset(ss->session_id,0,SSL_MAX_SSL_SESSION_ID_LENGTH); 473 if (ss->sess_cert != NULL) ssl_sess_cert_free(ss->sess_cert); 474 if (ss->peer != NULL) X509_free(ss->peer); 475 if (ss->ciphers != NULL) sk_SSL_CIPHER_free(ss->ciphers); 476 memset(ss,0,sizeof(*ss)); | 314 * be in trouble. So I'll increment it now, then double decrement 315 * later - am I speaking rubbish?. */ 316 CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION); 317#endif 318 319 if ((long)(ret->time+ret->timeout) < (long)time(NULL)) /* timeout */ 320 { 321 s->ctx->stats.sess_timeout++; --- 147 unchanged lines hidden (view full) --- 469 470 memset(ss->key_arg,0,SSL_MAX_KEY_ARG_LENGTH); 471 memset(ss->master_key,0,SSL_MAX_MASTER_KEY_LENGTH); 472 memset(ss->session_id,0,SSL_MAX_SSL_SESSION_ID_LENGTH); 473 if (ss->sess_cert != NULL) ssl_sess_cert_free(ss->sess_cert); 474 if (ss->peer != NULL) X509_free(ss->peer); 475 if (ss->ciphers != NULL) sk_SSL_CIPHER_free(ss->ciphers); 476 memset(ss,0,sizeof(*ss)); |
477 Free(ss); | 477 OPENSSL_free(ss); |
478 } 479 480int SSL_set_session(SSL *s, SSL_SESSION *session) 481 { 482 int ret=0; 483 SSL_METHOD *meth; 484 485 if (session != NULL) --- 195 unchanged lines hidden --- | 478 } 479 480int SSL_set_session(SSL *s, SSL_SESSION *session) 481 { 482 int ret=0; 483 SSL_METHOD *meth; 484 485 if (session != NULL) --- 195 unchanged lines hidden --- |