xref: /openssl/doc/man3/SSL_alloc_buffers.pod (revision da1c088f)
1=pod
2
3=head1 NAME
4
5SSL_free_buffers, SSL_alloc_buffers - manage SSL structure buffers
6
7=head1 SYNOPSIS
8
9 #include <openssl/ssl.h>
10
11 int SSL_free_buffers(SSL *ssl);
12 int SSL_alloc_buffers(SSL *ssl);
13
14=head1 DESCRIPTION
15
16SSL_free_buffers() frees the read and write buffers of the given B<ssl>.
17SSL_alloc_buffers() allocates the read and write buffers of the given B<ssl>.
18
19The B<SSL_MODE_RELEASE_BUFFERS> mode releases read or write buffers whenever
20the buffers have been drained. These functions allow applications to manually
21control when buffers are freed and allocated.
22
23After freeing the buffers, the buffers are automatically reallocated upon a
24new read or write. The SSL_alloc_buffers() does not need to be called, but
25can be used to make sure the buffers are preallocated. This can be used to
26avoid allocation during data processing or with CRYPTO_set_mem_functions()
27to control where and how buffers are allocated.
28
29These functions are no-ops when used with QUIC SSL objects. For QUIC,
30SSL_free_buffers() always fails, and SSL_alloc_buffers() always succeeds.
31
32=head1 RETURN VALUES
33
34The following return values can occur:
35
36=over 4
37
38=item 0 (Failure)
39
40The SSL_free_buffers() function returns 0 when there is pending data to be
41read or written. The SSL_alloc_buffers() function returns 0 when there is
42an allocation failure.
43
44=item 1 (Success)
45
46The SSL_free_buffers() function returns 1 if the buffers have been freed. This
47value is also returned if the buffers had been freed before calling
48SSL_free_buffers().
49The SSL_alloc_buffers() function returns 1 if the buffers have been allocated.
50This value is also returned if the buffers had been allocated before calling
51SSL_alloc_buffers().
52
53=back
54
55=head1 SEE ALSO
56
57L<ssl(7)>,
58L<SSL_free(3)>, L<SSL_clear(3)>,
59L<SSL_new(3)>, L<SSL_CTX_set_mode(3)>,
60L<CRYPTO_set_mem_functions(3)>
61
62=head1 COPYRIGHT
63
64Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.
65
66Licensed under the Apache License 2.0 (the "License").  You may not use
67this file except in compliance with the License.  You can obtain a copy
68in the file LICENSE in the source distribution or at
69L<https://www.openssl.org/source/license.html>.
70
71=cut
72