diff options
-rw-r--r-- | bootstrap.conf | 2 | ||||
-rw-r--r-- | lib/gnutls_int.h | 28 | ||||
-rw-r--r-- | lib/hello_ext.c | 2 | ||||
-rw-r--r-- | lib/hello_ext.h | 4 |
4 files changed, 19 insertions, 17 deletions
diff --git a/bootstrap.conf b/bootstrap.conf index f47b81aa68..8421fb995f 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -28,7 +28,7 @@ required_submodules="tests/suite/tls-fuzzer/python-ecdsa tests/suite/tls-fuzzer/ # Reproduce by: gnulib-tool --import --local-dir=gl/override --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=gl/tests --aux-dir=build-aux --with-tests --avoid=alignof-tests --avoid=lock-tests --avoid=lseek-tests --lgpl=2 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files alloca byteswap c-ctype extensions func gendocs getline gettext-h gettimeofday hash-pjw-bare havelib intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file secure_getenv snprintf stdint strcase strndup strtok_r strverscmp sys_socket sys_stat time_r unistd vasprintf vsnprintf warnings gnulib_modules=" -alloca byteswap c-ctype c-strcase extensions func gendocs getline gettext-h gettimeofday hash hash-pjw-bare havelib arpa_inet inet_ntop inet_pton intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file secure_getenv setsockopt snprintf stdint strcase strdup-posix strndup strtok_r strverscmp sys_socket sys_stat sys_types time_r unistd valgrind-tests vasprintf vsnprintf warnings +alloca byteswap c-ctype c-strcase extensions func gendocs getline gettext-h gettimeofday hash hash-pjw-bare havelib arpa_inet inet_ntop inet_pton intprops lib-msvc-compat lib-symbol-versions maintainer-makefile manywarnings memmem-simple minmax netdb netinet_in pmccabe2html read-file secure_getenv setsockopt snprintf stdint strcase strdup-posix strndup strtok_r strverscmp sys_socket sys_stat sys_types time_r unistd valgrind-tests vasprintf verify vsnprintf warnings " unistring_modules=" diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index d9d851be62..4ea8159979 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -146,7 +146,7 @@ typedef int ssize_t; /* TLS Extensions */ /* we can receive up to MAX_EXT_TYPES extensions. */ -#define MAX_EXT_TYPES 32 +#define MAX_EXT_TYPES 64 /* TLS-internal extension (will be parsed after a ciphersuite is selected). * This amends the gnutls_ext_parse_type_t. Not exported yet to allow more refining @@ -358,22 +358,24 @@ typedef enum extensions_t { GNUTLS_EXTENSION_MAX /* not real extension - used for iterators */ } extensions_t; -#define GNUTLS_EXTENSION_MAX_VALUE 31 -#define ext_track_t uint32_t +#define GNUTLS_EXTENSION_MAX_VALUE 63 +#define ext_track_t uint64_t -#if GNUTLS_EXTENSION_MAX >= GNUTLS_EXTENSION_MAX_VALUE -# error over limit -#endif +#include <verify.h> -#if GNUTLS_EXTENSION_MAX >= MAX_EXT_TYPES -# error over limit -#endif +verify(GNUTLS_EXTENSION_MAX < GNUTLS_EXTENSION_MAX_VALUE); +verify(GNUTLS_EXTENSION_MAX < MAX_EXT_TYPES); -/* we must provide at least 16 extensions for users to register */ -#if GNUTLS_EXTENSION_MAX_VALUE - GNUTLS_EXTENSION_MAX < 16 -# error not enough extension types; increase GNUTLS_EXTENSION_MAX_VALUE, MAX_EXT_TYPES and used_exts type -#endif +/* we must provide at least 16 extensions for users to register; + * increase GNUTLS_EXTENSION_MAX_VALUE, MAX_EXT_TYPES and used_exts + * type if this fails + */ +verify(GNUTLS_EXTENSION_MAX_VALUE - GNUTLS_EXTENSION_MAX >= 16); +/* The 'verify' symbol from <verify.h> is used extensively in the + * code; undef it to avoid clash + */ +#undef verify typedef enum { CIPHER_STREAM, CIPHER_BLOCK, CIPHER_AEAD } cipher_type_t; diff --git a/lib/hello_ext.c b/lib/hello_ext.c index 0c6c0dca01..1df1506e0b 100644 --- a/lib/hello_ext.c +++ b/lib/hello_ext.c @@ -520,7 +520,7 @@ int _gnutls_hello_ext_pack(gnutls_session_t session, gnutls_buffer_st *packed) BUFFER_APPEND_NUM(packed, 0); for (i = 0; i <= GNUTLS_EXTENSION_MAX_VALUE; i++) { - if (session->internals.used_exts & (1U << i)) { + if (session->internals.used_exts & ((ext_track_t)1 << i)) { ext = gid_to_ext_entry(session, i); if (ext == NULL) diff --git a/lib/hello_ext.h b/lib/hello_ext.h index 38b28ae069..a7b921875d 100644 --- a/lib/hello_ext.h +++ b/lib/hello_ext.h @@ -160,7 +160,7 @@ typedef struct hello_ext_entry_st { inline static unsigned _gnutls_hello_ext_is_present(gnutls_session_t session, extensions_t id) { - if (session->internals.used_exts & (1U << id)) + if (session->internals.used_exts & ((ext_track_t)1 << id)) return 1; return 0; @@ -184,7 +184,7 @@ unsigned _gnutls_hello_ext_save(gnutls_session_t session, return 0; } - session->internals.used_exts |= (1U << id); + session->internals.used_exts |= ((ext_track_t)1 << id); return 1; } |