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

Jaak Ristioja jaak.ristioja at cyber.ee
Wed Feb 10 10:41:53 CET 2016

On 10.02.2016 10:54, Nikos Mavrogiannopoulos wrote:
> 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.

This might be worth documenting.

> 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.

I didn't know that but it might help me a lot! Thanks!

Best regards,

More information about the Gnutls-devel mailing list