diff options
Diffstat (limited to 'lib/gnutls_int.h')
-rw-r--r-- | lib/gnutls_int.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 93ffd7cee9..2352299cd8 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -325,8 +325,7 @@ typedef enum recv_state_t { /* IDs are allocated in a way that all values fit in 64-bit integer as (1<<val) */ typedef enum extensions_t { GNUTLS_EXTENSION_INVALID = 0xffff, - GNUTLS_EXTENSION_MAX_RECORD_SIZE = 0, - GNUTLS_EXTENSION_STATUS_REQUEST, + GNUTLS_EXTENSION_STATUS_REQUEST = 0, GNUTLS_EXTENSION_CERT_TYPE, GNUTLS_EXTENSION_CLIENT_CERT_TYPE, GNUTLS_EXTENSION_SERVER_CERT_TYPE, @@ -349,6 +348,7 @@ typedef enum extensions_t { GNUTLS_EXTENSION_EARLY_DATA, GNUTLS_EXTENSION_PSK_KE_MODES, GNUTLS_EXTENSION_RECORD_SIZE_LIMIT, + GNUTLS_EXTENSION_MAX_RECORD_SIZE, /* * pre_shared_key and dumbfw must always be the last extensions, * in that order */ @@ -1357,6 +1357,8 @@ typedef struct { * server: intend to process early data */ #define HSK_RECORD_SIZE_LIMIT_NEGOTIATED (1<<24) +#define HSK_RECORD_SIZE_LIMIT_SENT (1<<25) /* record_size_limit extension was sent */ +#define HSK_RECORD_SIZE_LIMIT_RECEIVED (1<<26) /* server: record_size_limit extension was seen but not accepted yet */ /* The hsk_flags are for use within the ongoing handshake; * they are reset to zero prior to handshake start by gnutls_handshake. */ @@ -1546,17 +1548,20 @@ inline static int _gnutls_set_current_version(gnutls_session_t s, unsigned v) return 0; } +/* Returns the maximum size of the plaintext to be sent, considering + * both user-specified/negotiated maximum values. + */ inline static size_t max_user_send_size(gnutls_session_t session, record_parameters_st * record_params) { size_t max; - if (IS_DTLS(session)) { - max = MIN(gnutls_dtls_get_data_mtu(session), session->security_parameters.max_record_send_size); - } else { - max = session->security_parameters.max_record_send_size; - } + max = MIN(session->security_parameters.max_record_send_size, + session->security_parameters.max_record_recv_size); + + if (IS_DTLS(session)) + max = MIN(gnutls_dtls_get_data_mtu(session), max); return max; } |