• Home
  • Raw
  • Download

Lines Matching refs:ssl

85 static void get_current_time(const SSL *ssl, struct timeval *out_clock);
87 int dtls1_new(SSL *ssl) { in dtls1_new() argument
90 if (!ssl3_new(ssl)) { in dtls1_new()
95 ssl3_free(ssl); in dtls1_new()
107 ssl3_free(ssl); in dtls1_new()
111 ssl->d1 = d1; in dtls1_new()
118 ssl->version = DTLS1_2_VERSION; in dtls1_new()
122 static void dtls1_clear_queues(SSL *ssl) { in dtls1_clear_queues() argument
126 while ((item = pqueue_pop(ssl->d1->buffered_messages)) != NULL) { in dtls1_clear_queues()
132 while ((item = pqueue_pop(ssl->d1->sent_messages)) != NULL) { in dtls1_clear_queues()
139 void dtls1_free(SSL *ssl) { in dtls1_free() argument
140 ssl3_free(ssl); in dtls1_free()
142 if (ssl == NULL || ssl->d1 == NULL) { in dtls1_free()
146 dtls1_clear_queues(ssl); in dtls1_free()
148 pqueue_free(ssl->d1->buffered_messages); in dtls1_free()
149 pqueue_free(ssl->d1->sent_messages); in dtls1_free()
151 OPENSSL_free(ssl->d1); in dtls1_free()
152 ssl->d1 = NULL; in dtls1_free()
161 void dtls1_start_timer(SSL *ssl) { in dtls1_start_timer() argument
163 if (ssl->d1->next_timeout.tv_sec == 0 && ssl->d1->next_timeout.tv_usec == 0) { in dtls1_start_timer()
164 ssl->d1->timeout_duration = 1; in dtls1_start_timer()
168 get_current_time(ssl, &ssl->d1->next_timeout); in dtls1_start_timer()
171 ssl->d1->next_timeout.tv_sec += ssl->d1->timeout_duration; in dtls1_start_timer()
172 BIO_ctrl(SSL_get_rbio(ssl), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, in dtls1_start_timer()
173 &ssl->d1->next_timeout); in dtls1_start_timer()
176 int DTLSv1_get_timeout(const SSL *ssl, struct timeval *out) { in DTLSv1_get_timeout() argument
177 if (!SSL_IS_DTLS(ssl)) { in DTLSv1_get_timeout()
182 if (ssl->d1->next_timeout.tv_sec == 0 && ssl->d1->next_timeout.tv_usec == 0) { in DTLSv1_get_timeout()
188 get_current_time(ssl, &timenow); in DTLSv1_get_timeout()
191 if (ssl->d1->next_timeout.tv_sec < timenow.tv_sec || in DTLSv1_get_timeout()
192 (ssl->d1->next_timeout.tv_sec == timenow.tv_sec && in DTLSv1_get_timeout()
193 ssl->d1->next_timeout.tv_usec <= timenow.tv_usec)) { in DTLSv1_get_timeout()
199 memcpy(out, &ssl->d1->next_timeout, sizeof(struct timeval)); in DTLSv1_get_timeout()
216 int dtls1_is_timer_expired(SSL *ssl) { in dtls1_is_timer_expired() argument
220 if (!DTLSv1_get_timeout(ssl, &timeleft)) { in dtls1_is_timer_expired()
233 void dtls1_double_timeout(SSL *ssl) { in dtls1_double_timeout() argument
234 ssl->d1->timeout_duration *= 2; in dtls1_double_timeout()
235 if (ssl->d1->timeout_duration > 60) { in dtls1_double_timeout()
236 ssl->d1->timeout_duration = 60; in dtls1_double_timeout()
238 dtls1_start_timer(ssl); in dtls1_double_timeout()
241 void dtls1_stop_timer(SSL *ssl) { in dtls1_stop_timer() argument
243 ssl->d1->num_timeouts = 0; in dtls1_stop_timer()
244 memset(&ssl->d1->next_timeout, 0, sizeof(struct timeval)); in dtls1_stop_timer()
245 ssl->d1->timeout_duration = 1; in dtls1_stop_timer()
246 BIO_ctrl(SSL_get_rbio(ssl), BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT, 0, in dtls1_stop_timer()
247 &ssl->d1->next_timeout); in dtls1_stop_timer()
249 dtls1_clear_record_buffer(ssl); in dtls1_stop_timer()
252 int dtls1_check_timeout_num(SSL *ssl) { in dtls1_check_timeout_num() argument
253 ssl->d1->num_timeouts++; in dtls1_check_timeout_num()
256 if (ssl->d1->num_timeouts > DTLS1_MTU_TIMEOUTS && in dtls1_check_timeout_num()
257 !(SSL_get_options(ssl) & SSL_OP_NO_QUERY_MTU)) { in dtls1_check_timeout_num()
258 long mtu = BIO_ctrl(SSL_get_wbio(ssl), BIO_CTRL_DGRAM_GET_FALLBACK_MTU, 0, in dtls1_check_timeout_num()
261 ssl->d1->mtu = (unsigned)mtu; in dtls1_check_timeout_num()
265 if (ssl->d1->num_timeouts > DTLS1_MAX_TIMEOUTS) { in dtls1_check_timeout_num()
274 int DTLSv1_handle_timeout(SSL *ssl) { in DTLSv1_handle_timeout() argument
275 if (!SSL_IS_DTLS(ssl)) { in DTLSv1_handle_timeout()
280 if (!dtls1_is_timer_expired(ssl)) { in DTLSv1_handle_timeout()
284 dtls1_double_timeout(ssl); in DTLSv1_handle_timeout()
286 if (dtls1_check_timeout_num(ssl) < 0) { in DTLSv1_handle_timeout()
290 dtls1_start_timer(ssl); in DTLSv1_handle_timeout()
291 return dtls1_retransmit_buffered_messages(ssl); in DTLSv1_handle_timeout()
294 static void get_current_time(const SSL *ssl, struct timeval *out_clock) { in get_current_time() argument
295 if (ssl->ctx->current_time_cb != NULL) { in get_current_time()
296 ssl->ctx->current_time_cb(ssl, out_clock); in get_current_time()
310 int dtls1_set_handshake_header(SSL *ssl, int htype, unsigned long len) { in dtls1_set_handshake_header() argument
311 uint8_t *message = (uint8_t *)ssl->init_buf->data; in dtls1_set_handshake_header()
312 const struct hm_header_st *msg_hdr = &ssl->d1->w_msg_hdr; in dtls1_set_handshake_header()
316 ssl->d1->handshake_write_seq = ssl->d1->next_handshake_write_seq; in dtls1_set_handshake_header()
317 ssl->d1->next_handshake_write_seq++; in dtls1_set_handshake_header()
319 dtls1_set_message_header(ssl, htype, len, ssl->d1->handshake_write_seq, 0, in dtls1_set_handshake_header()
321 ssl->init_num = (int)len + DTLS1_HM_HEADER_LENGTH; in dtls1_set_handshake_header()
322 ssl->init_off = 0; in dtls1_set_handshake_header()
325 dtls1_buffer_message(ssl); in dtls1_set_handshake_header()
334 return ssl3_update_handshake_hash(ssl, serialised_header, in dtls1_set_handshake_header()
336 ssl3_update_handshake_hash(ssl, message + DTLS1_HM_HEADER_LENGTH, len); in dtls1_set_handshake_header()
339 int dtls1_handshake_write(SSL *ssl) { in dtls1_handshake_write() argument
340 return dtls1_do_handshake_write(ssl, dtls1_use_current_epoch); in dtls1_handshake_write()