summaryrefslogtreecommitdiff
path: root/lib/gnutls_int.h
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2015-12-24 11:44:00 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2015-12-24 11:44:17 +0200
commiteeb514a5b6b3be578ee779d6bfdaf4bf9521062f (patch)
treea35dc3f948c4834cf6fc3f8842352db1575e9399 /lib/gnutls_int.h
parent32f6aad0b09a4984f44b4219594fac0fa08e3197 (diff)
downloadgnutls-eeb514a5b6b3be578ee779d6bfdaf4bf9521062f.tar.gz
respect the max-record extension under DTLS
This resolves issue with max-record being negotiated but ignored. Resolves #61
Diffstat (limited to 'lib/gnutls_int.h')
-rw-r--r--lib/gnutls_int.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 4469603dfd..faad0d46a1 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -168,7 +168,7 @@ typedef enum record_flush_t {
*/
#define MAX_RECORD_SEND_OVERHEAD(session) (MAX_CIPHER_BLOCK_SIZE/*iv*/+MAX_PAD_SIZE+((gnutls_compression_get(session)!=GNUTLS_COMP_NULL)?(EXTRA_COMP_SIZE):(0))+MAX_HASH_SIZE/*MAC*/)
#define MAX_RECORD_SEND_SIZE(session) (IS_DTLS(session)? \
- ((size_t)gnutls_dtls_get_mtu(session)): \
+ (MIN((size_t)gnutls_dtls_get_mtu(session), (size_t)session->security_parameters.max_record_send_size+MAX_RECORD_SEND_OVERHEAD(session))): \
((size_t)session->security_parameters.max_record_send_size+MAX_RECORD_SEND_OVERHEAD(session)))
#define MAX_PAD_SIZE 255
#define EXTRA_COMP_SIZE 2048
@@ -1087,9 +1087,9 @@ inline static size_t max_user_send_size(gnutls_session_t session,
{
size_t max;
- if (IS_DTLS(session))
- max = gnutls_dtls_get_data_mtu(session);
- else {
+ 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;
}