Skip to content

Commit 426dc7b

Browse files
authored
Merge pull request #10236 from Roy-Carter/feature/enhance_conf_and_max_size
Enhance extra user data value and external cookie length max size
2 parents 2192140 + 16fd8d4 commit 426dc7b

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

configure.ac

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11025,9 +11025,10 @@ case "$ENABLED_EX_DATA" in
1102511025
no) ;;
1102611026
yes) AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA"
1102711027
;;
11028-
[[1-9]]|[[1-9]][[0-9]]) AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DMAX_EX_DATA=$ENABLED_EX_DATA"
11028+
[[1-9]]|[[1-9]][[0-9]]|[[1-9]][[0-9]][[0-9]]|[[1-9]][[0-9]][[0-9]][[0-9]])
11029+
AM_CFLAGS="$AM_CFLAGS -DHAVE_EX_DATA -DMAX_EX_DATA=$ENABLED_EX_DATA"
1102911030
;;
11030-
*) AC_MSG_ERROR([Invalid argument to --enable-context-extra-user-data -- must be yes, no, or a number from 1 to 99])
11031+
*) AC_MSG_ERROR([Invalid argument to --enable-context-extra-user-data -- must be yes, no, or a number from 1 to 9999 (note: each index reserves one pointer per object, so large values increase memory use)])
1103111032
;;
1103211033
esac
1103311034

wolfssl/internal.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,15 @@ enum {
14421442
*/
14431443
#define AEAD_SM4_CCM_LIMIT w64From32(0, (1 << 10) - 1)
14441444

1445+
#ifndef WOLFSSL_COOKIE_LEN
1446+
/* Maximum size for a DTLS cookie */
1447+
#define WOLFSSL_COOKIE_LEN 32
1448+
#endif
1449+
1450+
#if WOLFSSL_COOKIE_LEN > 255
1451+
#error "WOLFSSL_COOKIE_LEN must be <= 255 per RFC 6347 (opaque<0..2^8-1>)"
1452+
#endif
1453+
14451454
#if defined(WOLFSSL_TLS13) || !defined(NO_PSK)
14461455

14471456
#define TLS13_TICKET_NONCE_MAX_SZ 255
@@ -1569,7 +1578,7 @@ enum Misc {
15691578
SEED_LEN = RAN_LEN * 2, /* tls prf seed length */
15701579
ID_LEN = 32, /* session id length */
15711580
COOKIE_SECRET_SZ = 14, /* dtls cookie secret size */
1572-
MAX_COOKIE_LEN = 32, /* max dtls cookie size */
1581+
MAX_COOKIE_LEN = WOLFSSL_COOKIE_LEN, /* max dtls cookie size */
15731582
COOKIE_SZ = 20, /* use a 20 byte cookie */
15741583
SUITE_LEN = 2, /* cipher suite sz length */
15751584
ENUM_LEN = 1, /* always a byte */

0 commit comments

Comments
 (0)