diff options
Diffstat (limited to 'lib/record.c')
-rw-r--r-- | lib/record.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/lib/record.c b/lib/record.c index 6b9ed8c9e3..5a733d5915 100644 --- a/lib/record.c +++ b/lib/record.c @@ -538,20 +538,27 @@ _gnutls_send_tlen_int(gnutls_session_t session, content_type_t type, return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); headers = _mbuffer_get_uhead_ptr(bufel); - if (vers->tls13_sem && record_params->cipher->id != GNUTLS_CIPHER_NULL) - headers[0] = GNUTLS_APPLICATION_DATA; - else - headers[0] = type; - - /* Use the default record version, if it is - * set. */ - ret = copy_record_version(session, htype, &headers[1]); - if (ret < 0) - return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); + if (vers->id == GNUTLS_DTLS1_3 && record_params->cipher->id != GNUTLS_CIPHER_NULL) { + /* Currently constant will change for dynamic length and CID */ + headers[0] = 0x2c | (record_params->epoch & 0x0003); + _gnutls_write_uint16(record_state->sequence_number, &headers[1]); + //size is determined in encrypt_packet_tls13() + } else { + if (vers->tls13_sem && record_params->cipher->id != GNUTLS_CIPHER_NULL) + headers[0] = GNUTLS_APPLICATION_DATA; + else + headers[0] = type; + + /* Use the default record version, if it is + * set. */ + ret = copy_record_version(session, htype, &headers[1]); + if (ret < 0) + return gnutls_assert_val(GNUTLS_E_INTERNAL_ERROR); - /* Adjust header length and add sequence for DTLS */ - if (IS_DTLS(session)) - _gnutls_write_uint64(record_state->sequence_number, &headers[3]); + /* Adjust header length and add sequence for DTLS */ + if (IS_DTLS(session)) + _gnutls_write_uint64(record_state->sequence_number, &headers[3]); + } _gnutls_record_log ("REC[%p]: Preparing Packet %s(%d) with length: %d and min pad: %d\n", |