]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
ext/max_record: add function to get max send size
authorWilfred Mallawa <wilfred.mallawa@wdc.com>
Mon, 7 Jul 2025 03:21:58 +0000 (13:21 +1000)
committerDaiki Ueno <ueno@gnu.org>
Tue, 5 Aug 2025 08:35:39 +0000 (17:35 +0900)
Adds a new function to max_record library to extract
the endpoints maximum record send size. Which may have been negotiated
through the record_size_limit or the max_fragment_length extensions.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
NEWS
devel/symbols.last
doc/Makefile.am
doc/manpages/Makefile.am
lib/ext/max_record.c
lib/includes/gnutls/gnutls.h.in
lib/libgnutls.map

diff --git a/NEWS b/NEWS
index 545a81d1722e694fd12da2b56da3609d1f9a2082..178d15aa03294a2fe4f8bbd54409378442eecfca 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,9 +13,14 @@ See the end for copying conditions.
    and gnutls_psk_allocate_server_credentials2() functions, the
    application can use other MAC algorithms such as HMAC-SHA384.
 
+** libgnutls: Expose a new function to provide the maximum record send size
+   A new function gnutls_record_get_max_send_size() has been added to
+   determine the maximum size of a TLS record to be sent to the peer.
+
 ** API and ABI modifications:
 gnutls_psk_allocate_client_credentials2: New function
 gnutls_psk_allocate_server_credentials2: New function
+gnutls_record_get_max_send_size: New function
 
 * Version 3.8.10 (released 2025-07-08)
 
index 5e5ccfc48bebcc88871183a345a091e95f52e219..7cdfc8c3e7149efcb9ff45b06c000c761d6338c9 100644 (file)
@@ -783,6 +783,7 @@ gnutls_record_send_range@GNUTLS_3_4
 gnutls_record_set_max_early_data_size@GNUTLS_3_6_4
 gnutls_record_set_max_recv_size@GNUTLS_3_6_8
 gnutls_record_set_max_size@GNUTLS_3_4
+gnutls_record_get_max_send_size@GNUTLS_3_8_11
 gnutls_record_set_state@GNUTLS_3_4
 gnutls_record_set_timeout@GNUTLS_3_4
 gnutls_record_uncork@GNUTLS_3_4
index b1cd4f10470210ef0ee5861e0ac6cf162e1833a7..d697e66bdcfe53478a1dea6c490b2289f5b6220b 100644 (file)
@@ -1967,6 +1967,8 @@ FUNCS += functions/gnutls_record_set_max_recv_size
 FUNCS += functions/gnutls_record_set_max_recv_size.short
 FUNCS += functions/gnutls_record_set_max_size
 FUNCS += functions/gnutls_record_set_max_size.short
+FUNCS += functions/gnutls_record_get_max_send_size
+FUNCS += functions/gnutls_record_get_max_send_size.short
 FUNCS += functions/gnutls_record_set_state
 FUNCS += functions/gnutls_record_set_state.short
 FUNCS += functions/gnutls_record_set_timeout
index 598724a90b545831d9d6d879ae37fe8e40d6f6d0..eeca130abd6e716c643f827246a4f1c6b0f4e873 100644 (file)
@@ -829,6 +829,7 @@ APIMANS += gnutls_record_send_range.3
 APIMANS += gnutls_record_set_max_early_data_size.3
 APIMANS += gnutls_record_set_max_recv_size.3
 APIMANS += gnutls_record_set_max_size.3
+APIMANS += gnutls_record_get_max_send_size.3
 APIMANS += gnutls_record_set_state.3
 APIMANS += gnutls_record_set_timeout.3
 APIMANS += gnutls_record_uncork.3
index ec3062253d79cfa393095ff85b0eb055865aa5a6..4b24af420c128d19550a92d4723759d162015e15 100644 (file)
@@ -307,3 +307,18 @@ ssize_t gnutls_record_set_max_recv_size(gnutls_session_t session, size_t size)
 
        return 0;
 }
+
+/**
+ * gnutls_record_get_max_send_size:
+ * @session: is a #gnutls_session_t type.
+ *
+ * Get the maximum plaintext send size. This maybe negotiated, or user specified.
+ *
+ * Returns: The maximum plaintext send size.
+ *
+ * Since: 3.8.11
+ **/
+size_t gnutls_record_get_max_send_size(gnutls_session_t session)
+{
+       return max_record_send_size(session);
+}
index cd7dceaaa428f19d3913e2064812f7b2d4e08b3a..d14cd4bf43dda443a186727fccfaa039c3fe9245 100644 (file)
@@ -1599,6 +1599,8 @@ ssize_t gnutls_record_send_early_data(gnutls_session_t session,
 ssize_t gnutls_record_recv_early_data(gnutls_session_t session, void *data,
                                      size_t data_size);
 
+size_t gnutls_record_get_max_send_size(gnutls_session_t session);
+
 void gnutls_session_force_valid(gnutls_session_t session);
 
 int gnutls_prf(gnutls_session_t session, size_t label_size, const char *label,
index c74c8569ddc20b71c9a941970b9ed3bdc7b15e10..2d86a1e14ac6b5837404281bbe566f2dbbfe2c71 100644 (file)
@@ -1455,6 +1455,7 @@ GNUTLS_3_8_11
  global:
        gnutls_psk_allocate_client_credentials2;
        gnutls_psk_allocate_server_credentials2;
+       gnutls_record_get_max_send_size;
  local:
        *;
 } GNUTLS_3_8_6;