Lines Matching refs:sc
206 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s); in dtls1_read_bytes() local
208 if (sc == NULL) in dtls1_read_bytes()
214 SSLfatal(sc, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR); in dtls1_read_bytes()
218 if (!ossl_statem_get_in_handshake(sc) && SSL_in_init(s)) { in dtls1_read_bytes()
220 i = sc->handshake_func(s); in dtls1_read_bytes()
229 sc->rwstate = SSL_NOTHING; in dtls1_read_bytes()
236 dtls_unbuffer_record(sc); in dtls1_read_bytes()
239 if (dtls1_handle_timeout(sc) > 0) { in dtls1_read_bytes()
241 } else if (ossl_statem_in_error(sc)) { in dtls1_read_bytes()
247 if (sc->rlayer.curr_rec >= sc->rlayer.num_recs) { in dtls1_read_bytes()
248 sc->rlayer.curr_rec = sc->rlayer.num_recs = 0; in dtls1_read_bytes()
250 rr = &sc->rlayer.tlsrecs[sc->rlayer.num_recs]; in dtls1_read_bytes()
252 ret = HANDLE_RLAYER_READ_RETURN(sc, in dtls1_read_bytes()
253 sc->rlayer.rrlmethod->read_record(sc->rlayer.rrl, in dtls1_read_bytes()
259 ret = dtls1_read_failed(sc, ret); in dtls1_read_bytes()
270 sc->rlayer.num_recs++; in dtls1_read_bytes()
271 } while (sc->rlayer.rrlmethod->processed_read_pending(sc->rlayer.rrl) in dtls1_read_bytes()
272 && sc->rlayer.num_recs < SSL_MAX_PIPELINES); in dtls1_read_bytes()
274 rr = &sc->rlayer.tlsrecs[sc->rlayer.curr_rec]; in dtls1_read_bytes()
281 sc->rlayer.alert_count = 0; in dtls1_read_bytes()
285 if (sc->s3.change_cipher_spec /* set when we receive ChangeCipherSpec, in dtls1_read_bytes()
293 if (dtls_buffer_record(sc, rr) < 0) { in dtls1_read_bytes()
297 if (!ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
306 if (sc->shutdown & SSL_RECEIVED_SHUTDOWN) { in dtls1_read_bytes()
307 if (!ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
309 sc->rwstate = SSL_NOTHING; in dtls1_read_bytes()
326 && (SSL_IS_FIRST_HANDSHAKE(sc))) { in dtls1_read_bytes()
327 SSLfatal(sc, SSL_AD_UNEXPECTED_MESSAGE, in dtls1_read_bytes()
341 if (rr->length == 0 && !ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
353 if (rr->length == 0 && !ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
356 if (!ssl_release_record(sc, rr, n)) in dtls1_read_bytes()
366 sc->d1->shutdown_received in dtls1_read_bytes()
368 sc->shutdown |= SSL_RECEIVED_SHUTDOWN; in dtls1_read_bytes()
390 SSLfatal(sc, SSL_AD_UNEXPECTED_MESSAGE, SSL_R_INVALID_ALERT); in dtls1_read_bytes()
394 if (sc->msg_callback) in dtls1_read_bytes()
395 sc->msg_callback(0, sc->version, SSL3_RT_ALERT, alert_bytes, 2, s, in dtls1_read_bytes()
396 sc->msg_callback_arg); in dtls1_read_bytes()
398 if (sc->info_callback != NULL) in dtls1_read_bytes()
399 cb = sc->info_callback; in dtls1_read_bytes()
409 sc->s3.warn_alert = alert_descr; in dtls1_read_bytes()
410 if (!ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
413 sc->rlayer.alert_count++; in dtls1_read_bytes()
414 if (sc->rlayer.alert_count == MAX_WARN_ALERT_COUNT) { in dtls1_read_bytes()
415 SSLfatal(sc, SSL_AD_UNEXPECTED_MESSAGE, in dtls1_read_bytes()
429 sc->d1->shutdown_received = 1; in dtls1_read_bytes()
430 sc->rwstate = SSL_READING; in dtls1_read_bytes()
436 sc->shutdown |= SSL_RECEIVED_SHUTDOWN; in dtls1_read_bytes()
440 sc->rwstate = SSL_NOTHING; in dtls1_read_bytes()
441 sc->s3.fatal_alert = alert_descr; in dtls1_read_bytes()
442 SSLfatal_data(sc, SSL_AD_NO_ALERT, in dtls1_read_bytes()
445 sc->shutdown |= SSL_RECEIVED_SHUTDOWN; in dtls1_read_bytes()
446 if (!ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
448 SSL_CTX_remove_session(sc->session_ctx, sc->session); in dtls1_read_bytes()
451 SSLfatal(sc, SSL_AD_ILLEGAL_PARAMETER, SSL_R_UNKNOWN_ALERT_TYPE); in dtls1_read_bytes()
458 if (sc->shutdown & SSL_SENT_SHUTDOWN) { /* but we have not received a in dtls1_read_bytes()
460 sc->rwstate = SSL_NOTHING; in dtls1_read_bytes()
461 if (!ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
471 if (!ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
479 if (rr->type == SSL3_RT_HANDSHAKE && !ossl_statem_get_in_handshake(sc)) { in dtls1_read_bytes()
486 if (rr->epoch != sc->rlayer.d->r_epoch in dtls1_read_bytes()
488 if (!ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
500 if (dtls1_check_timeout_num(sc) < 0) { in dtls1_read_bytes()
505 if (dtls1_retransmit_buffered_messages(sc) <= 0) { in dtls1_read_bytes()
507 if (ossl_statem_in_error(sc)) in dtls1_read_bytes()
510 if (!ssl_release_record(sc, rr, 0)) in dtls1_read_bytes()
512 if (!(sc->mode & SSL_MODE_AUTO_RETRY)) { in dtls1_read_bytes()
513 if (!sc->rlayer.rrlmethod->unprocessed_read_pending(sc->rlayer.rrl)) { in dtls1_read_bytes()
517 sc->rwstate = SSL_READING; in dtls1_read_bytes()
534 SSLfatal(sc, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR); in dtls1_read_bytes()
539 ossl_statem_set_in_init(sc, 1); in dtls1_read_bytes()
541 i = sc->handshake_func(s); in dtls1_read_bytes()
548 if (!(sc->mode & SSL_MODE_AUTO_RETRY)) { in dtls1_read_bytes()
549 if (!sc->rlayer.rrlmethod->unprocessed_read_pending(sc->rlayer.rrl)) { in dtls1_read_bytes()
558 sc->rwstate = SSL_READING; in dtls1_read_bytes()
570 SSLfatal(sc, SSL_AD_UNEXPECTED_MESSAGE, SSL_R_UNEXPECTED_RECORD); in dtls1_read_bytes()
580 SSLfatal(sc, SSL_AD_UNEXPECTED_MESSAGE, ERR_R_INTERNAL_ERROR); in dtls1_read_bytes()
590 if (sc->s3.in_read_app_data && in dtls1_read_bytes()
591 (sc->s3.total_renegotiations != 0) && in dtls1_read_bytes()
592 ossl_statem_app_data_allowed(sc)) { in dtls1_read_bytes()
593 sc->s3.in_read_app_data = 2; in dtls1_read_bytes()
596 SSLfatal(sc, SSL_AD_UNEXPECTED_MESSAGE, SSL_R_UNEXPECTED_RECORD); in dtls1_read_bytes()
621 int do_dtls1_write(SSL_CONNECTION *sc, uint8_t type, const unsigned char *buf, in do_dtls1_write() argument
626 SSL *s = SSL_CONNECTION_GET_SSL(sc); in do_dtls1_write()
630 if (sc->s3.alert_dispatch > 0) { in do_dtls1_write()
640 if (len > ssl_get_max_send_fragment(sc)) { in do_dtls1_write()
641 SSLfatal(sc, SSL_AD_INTERNAL_ERROR, SSL_R_EXCEEDS_MAX_FRAGMENT_SIZE); in do_dtls1_write()
652 && sc->max_proto_version != DTLS1_BAD_VER) in do_dtls1_write()
655 tmpl.version = sc->version; in do_dtls1_write()
659 ret = HANDLE_RLAYER_WRITE_RETURN(sc, in do_dtls1_write()
660 sc->rlayer.wrlmethod->write_records(sc->rlayer.wrl, &tmpl, 1)); in do_dtls1_write()