Lines Matching refs:ss
29 __owur static int sess_timedout(time_t t, SSL_SESSION *ss) in DEFINE_STACK_OF()
32 if (ss->timeout_ovf) in DEFINE_STACK_OF()
34 return t > ss->calc_timeout; in DEFINE_STACK_OF()
78 void ssl_session_calculate_timeout(SSL_SESSION *ss) in ssl_session_calculate_timeout() argument
82 CALCULATE_TIMEOUT(ss, uint64_t); in ssl_session_calculate_timeout()
84 CALCULATE_TIMEOUT(ss, uint32_t); in ssl_session_calculate_timeout()
139 SSL_SESSION *ss; in SSL_SESSION_new() local
144 ss = OPENSSL_zalloc(sizeof(*ss)); in SSL_SESSION_new()
145 if (ss == NULL) { in SSL_SESSION_new()
150 ss->ext.max_fragment_len_mode = TLSEXT_max_fragment_length_UNSPECIFIED; in SSL_SESSION_new()
151 ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */ in SSL_SESSION_new()
152 ss->references = 1; in SSL_SESSION_new()
153 ss->timeout = 60 * 5 + 4; /* 5 minute timeout by default */ in SSL_SESSION_new()
154 ss->time = time(NULL); in SSL_SESSION_new()
155 ssl_session_calculate_timeout(ss); in SSL_SESSION_new()
156 ss->lock = CRYPTO_THREAD_lock_new(); in SSL_SESSION_new()
157 if (ss->lock == NULL) { in SSL_SESSION_new()
159 OPENSSL_free(ss); in SSL_SESSION_new()
163 if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data)) { in SSL_SESSION_new()
164 CRYPTO_THREAD_lock_free(ss->lock); in SSL_SESSION_new()
165 OPENSSL_free(ss); in SSL_SESSION_new()
168 return ss; in SSL_SESSION_new()
374 int ssl_generate_session_id(SSL *s, SSL_SESSION *ss) in ssl_generate_session_id() argument
388 ss->session_id_length = SSL3_SSL_SESSION_ID_LENGTH; in ssl_generate_session_id()
411 ss->session_id_length = 0; in ssl_generate_session_id()
431 memset(ss->session_id, 0, ss->session_id_length); in ssl_generate_session_id()
432 tmp = (int)ss->session_id_length; in ssl_generate_session_id()
433 if (!cb(s, ss->session_id, &tmp)) { in ssl_generate_session_id()
443 if (tmp == 0 || tmp > ss->session_id_length) { in ssl_generate_session_id()
449 ss->session_id_length = tmp; in ssl_generate_session_id()
451 if (SSL_has_matching_session_id(s, ss->session_id, in ssl_generate_session_id()
452 (unsigned int)ss->session_id_length)) { in ssl_generate_session_id()
464 SSL_SESSION *ss = NULL; in ssl_get_new_session() local
466 if ((ss = SSL_SESSION_new()) == NULL) { in ssl_get_new_session()
473 ss->timeout = SSL_get_default_timeout(s); in ssl_get_new_session()
475 ss->timeout = s->session_ctx->session_timeout; in ssl_get_new_session()
476 ssl_session_calculate_timeout(ss); in ssl_get_new_session()
487 ss->session_id_length = 0; in ssl_get_new_session()
488 } else if (!ssl_generate_session_id(s, ss)) { in ssl_get_new_session()
490 SSL_SESSION_free(ss); in ssl_get_new_session()
495 ss->session_id_length = 0; in ssl_get_new_session()
498 if (s->sid_ctx_length > sizeof(ss->sid_ctx)) { in ssl_get_new_session()
500 SSL_SESSION_free(ss); in ssl_get_new_session()
503 memcpy(ss->sid_ctx, s->sid_ctx, s->sid_ctx_length); in ssl_get_new_session()
504 ss->sid_ctx_length = s->sid_ctx_length; in ssl_get_new_session()
505 s->session = ss; in ssl_get_new_session()
506 ss->ssl_version = s->version; in ssl_get_new_session()
507 ss->verify_result = X509_V_OK; in ssl_get_new_session()
511 ss->flags |= SSL_SESS_FLAG_EXTMS; in ssl_get_new_session()
861 void SSL_SESSION_free(SSL_SESSION *ss) in SSL_SESSION_free() argument
865 if (ss == NULL) in SSL_SESSION_free()
867 CRYPTO_DOWN_REF(&ss->references, &i, ss->lock); in SSL_SESSION_free()
868 REF_PRINT_COUNT("SSL_SESSION", ss); in SSL_SESSION_free()
873 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data); in SSL_SESSION_free()
875 OPENSSL_cleanse(ss->master_key, sizeof(ss->master_key)); in SSL_SESSION_free()
876 OPENSSL_cleanse(ss->session_id, sizeof(ss->session_id)); in SSL_SESSION_free()
877 X509_free(ss->peer); in SSL_SESSION_free()
878 sk_X509_pop_free(ss->peer_chain, X509_free); in SSL_SESSION_free()
879 OPENSSL_free(ss->ext.hostname); in SSL_SESSION_free()
880 OPENSSL_free(ss->ext.tick); in SSL_SESSION_free()
882 OPENSSL_free(ss->psk_identity_hint); in SSL_SESSION_free()
883 OPENSSL_free(ss->psk_identity); in SSL_SESSION_free()
886 OPENSSL_free(ss->srp_username); in SSL_SESSION_free()
888 OPENSSL_free(ss->ext.alpn_selected); in SSL_SESSION_free()
889 OPENSSL_free(ss->ticket_appdata); in SSL_SESSION_free()
890 CRYPTO_THREAD_lock_free(ss->lock); in SSL_SESSION_free()
891 OPENSSL_clear_free(ss, sizeof(*ss)); in SSL_SESSION_free()
894 int SSL_SESSION_up_ref(SSL_SESSION *ss) in SSL_SESSION_up_ref() argument
898 if (CRYPTO_UP_REF(&ss->references, &i, ss->lock) <= 0) in SSL_SESSION_up_ref()
901 REF_PRINT_COUNT("SSL_SESSION", ss); in SSL_SESSION_up_ref()
1395 int SSL_SESSION_set1_ticket_appdata(SSL_SESSION *ss, const void *data, size_t len) in SSL_SESSION_set1_ticket_appdata() argument
1397 OPENSSL_free(ss->ticket_appdata); in SSL_SESSION_set1_ticket_appdata()
1398 ss->ticket_appdata_len = 0; in SSL_SESSION_set1_ticket_appdata()
1400 ss->ticket_appdata = NULL; in SSL_SESSION_set1_ticket_appdata()
1403 ss->ticket_appdata = OPENSSL_memdup(data, len); in SSL_SESSION_set1_ticket_appdata()
1404 if (ss->ticket_appdata != NULL) { in SSL_SESSION_set1_ticket_appdata()
1405 ss->ticket_appdata_len = len; in SSL_SESSION_set1_ticket_appdata()
1411 int SSL_SESSION_get0_ticket_appdata(SSL_SESSION *ss, void **data, size_t *len) in SSL_SESSION_get0_ticket_appdata() argument
1413 *data = ss->ticket_appdata; in SSL_SESSION_get0_ticket_appdata()
1414 *len = ss->ticket_appdata_len; in SSL_SESSION_get0_ticket_appdata()