[gnutls-devel] gnutls_record_recv/gnutls_record_send and record length?

Nikos Mavrogiannopoulos nmav at gnutls.org
Wed Feb 10 09:54:28 CET 2016


On Wed, Feb 10, 2016 at 12:15 AM, Jaak Ristioja <jaak.ristioja at cyber.ee> wrote:
> Hi!
> TLS 1.2 specifies a maximum record payload of 2^14 bytes. The GnuTLS
> documentation for gnutls_record_send states that the maximum number of
> bytes gnutls_record_send can send in a single call is determined by the
> negotiated maximum record size (<= 2^14 bytes). Does gnutls_record_recv
> have similar limitations? I'm thinking of implementing buffers for both
> send and receive and I wonder whether 2^14-byte read and write buffers
> will suffice to minimize the number of gnutls calls.

The answer is yes, you can rely gnutls_record_recv() to return data <=
2^14 per call.

However to minimize the number of calls to gnutls you may consider to
use gnutls_record_recv_packet(). That in addition will eliminate any
need for copying buffers.

regards,
Nikos



More information about the Gnutls-devel mailing list