From 1d3240965139d0f5f56134167d5f7abfba098e17 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 25 Apr 2017 16:26:29 -0700 Subject: [PATCH] DTLS Multicast 1. Allow the MTU size to be changed at compile time for memory contrained environments using static memory. 2. Add compile time option to disable the check for DTLS messages in the current epoch with an outside-the-window sequence number. --- src/internal.c | 2 ++ wolfssl/internal.h | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/internal.c b/src/internal.c index 93b9e0882..3e7a7410c 100755 --- a/src/internal.c +++ b/src/internal.c @@ -9684,10 +9684,12 @@ static INLINE int DtlsCheckWindow(WOLFSSL* ssl) WOLFSSL_MSG("Current record sequence number from the past."); return 0; } +#ifndef WOLFSSL_DTLS_ALLOW_FUTURE else if (!curLT && (diff > DTLS_SEQ_BITS)) { WOLFSSL_MSG("Rejecting message too far into the future."); return 0; } +#endif else if (curLT) { word32 idx = diff / DTLS_WORD_BITS; word32 newDiff = diff % DTLS_WORD_BITS; diff --git a/wolfssl/internal.h b/wolfssl/internal.h index d1911b259..7bac49e00 100755 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -924,6 +924,10 @@ enum { #define WOLFSSL_DTLS_PEERSEQ_SZ WOLFSSL_MULTICAST_PEERS #endif /* WOLFSSL_MULTICAST */ +#ifndef WOLFSSL_MAX_MTU + #define WOLFSSL_MAX_MTU 1500 +#endif /* WOLFSSL_MAX_MTU */ + enum Misc { @@ -970,7 +974,7 @@ enum Misc { /* RECORD_HEADER_SZ + BLOCK_SZ (pad) + Max digest sz + BLOC_SZ (iv) + pad byte (1) */ MAX_COMP_EXTRA = 1024, /* max compression extra */ - MAX_MTU = 1500, /* max expected MTU */ + MAX_MTU = WOLFSSL_MAX_MTU, /* max expected MTU */ MAX_UDP_SIZE = 8192 - 100, /* was MAX_MTU - 100 */ MAX_DH_SZ = 1036, /* 4096 p, pub, g + 2 byte size for each */ MAX_STR_VERSION = 8, /* string rep of protocol version */