Lines Matching refs:handshake

485     if (ssl->handshake->retransmit_timeout >= ssl->conf->hs_timeout_max) {
495 if (ssl->handshake->retransmit_timeout != ssl->conf->hs_timeout_min) {
496 ssl->handshake->mtu = 508;
497 MBEDTLS_SSL_DEBUG_MSG(2, ("mtu autoreduction to %d bytes", ssl->handshake->mtu));
500 new_timeout = 2 * ssl->handshake->retransmit_timeout;
503 if (new_timeout < ssl->handshake->retransmit_timeout ||
508 ssl->handshake->retransmit_timeout = new_timeout;
510 (unsigned long) ssl->handshake->retransmit_timeout));
517 ssl->handshake->retransmit_timeout = ssl->conf->hs_timeout_min;
519 (unsigned long) ssl->handshake->retransmit_timeout));
2235 timeout = ssl->handshake->retransmit_timeout;
2262 MBEDTLS_SSL_DEBUG_MSG(1, ("handshake timeout"));
2411 * Append current handshake message to current outgoing flight
2435 /* Copy current handshake message with headers */
2442 if (ssl->handshake->flight == NULL) {
2443 ssl->handshake->flight = msg;
2445 mbedtls_ssl_flight_item *cur = ssl->handshake->flight;
2457 * Free the current flight of handshake messages
2483 if (ssl->transform_out == ssl->handshake->alt_transform_out) {
2492 ssl->transform_out = ssl->handshake->alt_transform_out;
2493 ssl->handshake->alt_transform_out = tmp_transform;
2497 memcpy(ssl->cur_out_ctr, ssl->handshake->alt_out_ctr,
2499 memcpy(ssl->handshake->alt_out_ctr, tmp_out_ctr,
2500 sizeof(ssl->handshake->alt_out_ctr));
2536 if (ssl->handshake->retransmit_state != MBEDTLS_SSL_RETRANS_SENDING) {
2539 ssl->handshake->cur_msg = ssl->handshake->flight;
2540 ssl->handshake->cur_msg_p = ssl->handshake->flight->p + 12;
2546 ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_SENDING;
2549 while (ssl->handshake->cur_msg != NULL) {
2551 const mbedtls_ssl_flight_item * const cur = ssl->handshake->cur_msg;
2563 if (is_finished && ssl->handshake->cur_msg_p == (cur->p + 12)) {
2592 ssl->handshake->cur_msg_p += cur->len;
2594 const unsigned char * const p = ssl->handshake->cur_msg_p;
2620 MBEDTLS_SSL_DEBUG_MSG(2, ("fragmenting handshake message (%u > %u)",
2625 /* Messages are stored with handshake headers as if not fragmented,
2638 MBEDTLS_SSL_DEBUG_BUF(3, "handshake header", ssl->out_msg, 12);
2640 /* Copy the handshake message content and set records fields */
2646 ssl->handshake->cur_msg_p += cur_hs_frag_len;
2650 if (ssl->handshake->cur_msg_p >= cur->p + cur->len) {
2652 ssl->handshake->cur_msg = cur->next;
2653 ssl->handshake->cur_msg_p = cur->next->p + 12;
2655 ssl->handshake->cur_msg = NULL;
2656 ssl->handshake->cur_msg_p = NULL;
2673 ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_FINISHED;
2675 ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_WAITING;
2676 mbedtls_ssl_set_timer(ssl, ssl->handshake->retransmit_timeout);
2690 mbedtls_ssl_flight_free(ssl->handshake->flight);
2691 ssl->handshake->flight = NULL;
2692 ssl->handshake->cur_msg = NULL;
2695 ssl->handshake->in_flight_start_seq = ssl->handshake->in_msg_seq;
2698 ssl->handshake->buffering.seen_ccs = 0;
2708 ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_FINISHED;
2710 ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_PREPARING;
2720 mbedtls_ssl_set_timer(ssl, ssl->handshake->retransmit_timeout);
2724 ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_FINISHED;
2726 ssl->handshake->retransmit_state = MBEDTLS_SSL_RETRANS_WAITING;
2738 * Reserve 4 bytes for handshake header. ( Section 4,RFC 8446 )
2754 * Write (DTLS: or queue) current handshake (including CCS) message.
2756 * - fill in handshake headers
2757 * - update handshake checksum
2765 * - ssl->out_msglen: 4 + actual handshake message len
2766 * (4 is the size of handshake headers for TLS)
2767 * - ssl->out_msg[0]: the handshake type (ClientHello, ServerHello, etc)
2768 * - ssl->out_msg + 4: the handshake message body
2772 * (including handshake headers but excluding record headers)
2773 * - ssl->out_msg: the record contents (handshake headers + content)
2783 MBEDTLS_SSL_DEBUG_MSG(2, ("=> write handshake message"));
2795 * HelloRequest we should be in a handshake - double check. */
2798 ssl->handshake == NULL) {
2805 ssl->handshake != NULL &&
2806 ssl->handshake->retransmit_state == MBEDTLS_SSL_RETRANS_SENDING) {
2830 * Fill handshake headers
2848 MBEDTLS_SSL_DEBUG_MSG(1, ("DTLS handshake message too large: "
2861 MBEDTLS_PUT_UINT16_BE(ssl->handshake->out_msg_seq, ssl->out_msg, 4);
2862 ++(ssl->handshake->out_msg_seq);
2875 /* Update running hashes of handshake messages seen */
2877 ret = ssl->handshake->update_checksum(ssl, ssl->out_msg,
2904 MBEDTLS_SSL_DEBUG_MSG(2, ("<= write handshake message"));
2916 /* Add reserved 4 bytes for handshake header */
3198 /* msg_len does not include the handshake header */
3224 MBEDTLS_SSL_DEBUG_MSG(1, ("handshake message too short: %" MBEDTLS_PRINTF_SIZET,
3231 MBEDTLS_SSL_DEBUG_MSG(3, ("handshake message: msglen ="
3242 MBEDTLS_SSL_DEBUG_MSG(1, ("invalid handshake header"));
3246 if (ssl->handshake != NULL &&
3248 recv_msg_seq != ssl->handshake->in_msg_seq) ||
3251 if (recv_msg_seq > ssl->handshake->in_msg_seq) {
3254 "received future handshake message of sequence number %u (next %u)",
3256 ssl->handshake->in_msg_seq));
3263 if (recv_msg_seq == ssl->handshake->in_flight_start_seq - 1 &&
3268 ssl->handshake->in_flight_start_seq));
3278 ssl->handshake->in_msg_seq));
3286 * messages; the commonality is that both handshake fragments and
3288 * handshake logic layer. */
3290 MBEDTLS_SSL_DEBUG_MSG(2, ("found fragmented DTLS handshake message"));
3297 MBEDTLS_SSL_DEBUG_MSG(1, ("TLS handshake fragmentation not supported"));
3307 mbedtls_ssl_handshake_params * const hs = ssl->handshake;
3310 ret = ssl->handshake->update_checksum(ssl, ssl->in_msg, ssl->in_hslen);
3320 ssl->handshake != NULL) {
3324 /* Increment handshake sequence number */
3328 * Clear up handshake buffering and reassembly structure.
3482 * Structure of ClientHello with record and handshake headers,
3487 * 0-0 ContentType type; copied, must be handshake
3936 * access the first byte of record content (handshake type), as we
3997 * received records using the handshake traffic key, discarding
4001 * server proceeds as with an ordinary 1-RTT handshake."
4280 mbedtls_ssl_handshake_params * const hs = ssl->handshake;
4329 * next handshake message. */
4342 MBEDTLS_SSL_DEBUG_MSG(2, ("Next handshake message has been buffered - load"));
4343 MBEDTLS_SSL_DEBUG_BUF(3, "Buffered handshake message (incl. header)",
4354 MBEDTLS_SSL_DEBUG_MSG(2, ("Next handshake message %u not or only partially bufffered",
4371 mbedtls_ssl_handshake_params * const hs = ssl->handshake;
4385 /* We don't have enough space to buffer the next expected handshake
4392 "Free buffering slot %d to make space for reassembly of next handshake message",
4412 mbedtls_ssl_handshake_params * const hs = ssl->handshake;
4434 /* We should never receive an old handshake
4436 if (recv_msg_seq < ssl->handshake->in_msg_seq) {
4441 recv_msg_seq_offset = recv_msg_seq - ssl->handshake->in_msg_seq;
4447 recv_msg_seq, ssl->handshake->in_msg_seq,
4448 ssl->handshake->in_msg_seq + MBEDTLS_SSL_MAX_BUFFERED_HS -
4617 * Remove last handshake message, move content
4649 * current handshake content: If DTLS handshake
4651 * size instead. Using the total handshake message
4657 * Again, it's wrong for DTLS handshake fragmentation.
4703 mbedtls_ssl_handshake_params * const hs = ssl->handshake;
4720 mbedtls_ssl_handshake_params * const hs = ssl->handshake;
4781 mbedtls_ssl_handshake_params * const hs = ssl->handshake;
4788 /* Only buffer handshake records (we are only interested
4956 * probably means something went wrong in the handshake
5057 if (ssl->handshake == NULL) {
5058 MBEDTLS_SSL_DEBUG_MSG(1, ("dropping ChangeCipherSpec outside handshake"));
5137 if (ssl->handshake != NULL &&
5417 * Case C: A handshake message is being processed.
5422 ("ssl_check_pending: more handshake messages within current record"));
5597 MBEDTLS_SSL_DEBUG_MSG(3, ("received post-handshake message"));
5614 /* This function is called from mbedtls_ssl_read() when a handshake message is
5615 * received after the initial handshake. In this context, handshake messages
5619 * of post-handshake handshake messages changes significantly in TLS 1.3,
5638 MBEDTLS_SSL_DEBUG_MSG(1, ("handshake received (not HelloRequest)"));
5640 /* With DTLS, drop the packet (probably from last handshake) */
5653 MBEDTLS_SSL_DEBUG_MSG(1, ("handshake received (not ClientHello)"));
5655 /* With DTLS, drop the packet (probably from last handshake) */
5790 if (ssl->handshake != NULL &&
5791 ssl->handshake->retransmit_state == MBEDTLS_SSL_RETRANS_SENDING) {
5800 * Check if renegotiation is necessary and/or handshake is
5807 * a handshake while waiting for the ClientHello
5870 * by the post-handshake message has been completed or not. The cases
5877 * a non-handshake, non-application data message while awaiting
5918 * except if handshake (renegotiation) is in progress */
5957 * Early Data handshake message.
6100 * If we are at the beginning of the handshake, the early data state being
6102 * MBEDTLS_SSL_EARLY_DATA_STATE_IND_SENT advance the handshake just
6104 * guarantee that when starting the handshake with this function we will
6132 * Otherwise, progress the handshake as much as possible to not delay
6249 mbedtls_ssl_handshake_params * const hs = ssl->handshake;
6265 mbedtls_ssl_handshake_params * const hs = ssl->handshake;