Blame doc/man3/SSL_CTX_set_mode.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
SSL_CTX_set_mode, SSL_CTX_clear_mode, SSL_set_mode, SSL_clear_mode, SSL_CTX_get_mode, SSL_get_mode - manipulate SSL engine mode
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/ssl.h>
Packit c4476c
Packit c4476c
 long SSL_CTX_set_mode(SSL_CTX *ctx, long mode);
Packit c4476c
 long SSL_CTX_clear_mode(SSL_CTX *ctx, long mode);
Packit c4476c
 long SSL_set_mode(SSL *ssl, long mode);
Packit c4476c
 long SSL_clear_mode(SSL *ssl, long mode);
Packit c4476c
Packit c4476c
 long SSL_CTX_get_mode(SSL_CTX *ctx);
Packit c4476c
 long SSL_get_mode(SSL *ssl);
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
SSL_CTX_set_mode() adds the mode set via bitmask in B<mode> to B<ctx>.
Packit c4476c
Options already set before are not cleared.
Packit c4476c
SSL_CTX_clear_mode() removes the mode set via bitmask in B<mode> from B<ctx>.
Packit c4476c
Packit c4476c
SSL_set_mode() adds the mode set via bitmask in B<mode> to B<ssl>.
Packit c4476c
Options already set before are not cleared.
Packit c4476c
SSL_clear_mode() removes the mode set via bitmask in B<mode> from B<ssl>.
Packit c4476c
Packit c4476c
SSL_CTX_get_mode() returns the mode set for B<ctx>.
Packit c4476c
Packit c4476c
SSL_get_mode() returns the mode set for B<ssl>.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
The following mode changes are available:
Packit c4476c
Packit c4476c
=over 4
Packit c4476c
Packit c4476c
=item SSL_MODE_ENABLE_PARTIAL_WRITE
Packit c4476c
Packit c4476c
Allow SSL_write_ex(..., n, &r) to return with 0 < r < n (i.e. report success
Packit c4476c
when just a single record has been written). This works in a similar way for
Packit c4476c
SSL_write(). When not set (the default), SSL_write_ex() or SSL_write() will only
Packit c4476c
report success once the complete chunk was written. Once SSL_write_ex() or
Packit c4476c
SSL_write() returns successful, B<r> bytes have been written and the next call
Packit c4476c
to SSL_write_ex() or SSL_write() must only send the n-r bytes left, imitating
Packit c4476c
the behaviour of write().
Packit c4476c
Packit c4476c
=item SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
Packit c4476c
Packit c4476c
Make it possible to retry SSL_write_ex() or SSL_write() with changed buffer
Packit c4476c
location (the buffer contents must stay the same). This is not the default to
Packit c4476c
avoid the misconception that non-blocking SSL_write() behaves like
Packit c4476c
non-blocking write().
Packit c4476c
Packit c4476c
=item SSL_MODE_AUTO_RETRY
Packit c4476c
Packit c4476c
During normal operations, non-application data records might need to be sent or
Packit c4476c
received that the application is not aware of.
Packit c4476c
If a non-application data record was processed,
Packit c4476c
L<SSL_read_ex(3)> and L<SSL_read(3)> can return with a failure and indicate the
Packit c4476c
need to retry with B<SSL_ERROR_WANT_READ>.
Packit c4476c
If such a non-application data record was processed, the flag
Packit c4476c
B<SSL_MODE_AUTO_RETRY> causes it to try to process the next record instead of
Packit c4476c
returning.
Packit c4476c
Packit c4476c
In a non-blocking environment applications must be prepared to handle
Packit c4476c
incomplete read/write operations.
Packit c4476c
Setting B<SSL_MODE_AUTO_RETRY> for a non-blocking B<BIO> will process
Packit c4476c
non-application data records until either no more data is available or
Packit c4476c
an application data record has been processed.
Packit c4476c
Packit c4476c
In a blocking environment, applications are not always prepared to
Packit c4476c
deal with the functions returning intermediate reports such as retry
Packit c4476c
requests, and setting the B<SSL_MODE_AUTO_RETRY> flag will cause the functions
Packit c4476c
to only return after successfully processing an application data record or a
Packit c4476c
failure.
Packit c4476c
Packit c4476c
Turning off B<SSL_MODE_AUTO_RETRY> can be useful with blocking B<BIO>s in case
Packit c4476c
they are used in combination with something like select() or poll().
Packit c4476c
Otherwise the call to SSL_read() or SSL_read_ex() might hang when a
Packit c4476c
non-application record was sent and no application data was sent.
Packit c4476c
Packit c4476c
=item SSL_MODE_RELEASE_BUFFERS
Packit c4476c
Packit c4476c
When we no longer need a read buffer or a write buffer for a given SSL,
Packit c4476c
then release the memory we were using to hold it.
Packit c4476c
Using this flag can
Packit c4476c
save around 34k per idle SSL connection.
Packit c4476c
This flag has no effect on SSL v2 connections, or on DTLS connections.
Packit c4476c
Packit c4476c
=item SSL_MODE_SEND_FALLBACK_SCSV
Packit c4476c
Packit c4476c
Send TLS_FALLBACK_SCSV in the ClientHello.
Packit c4476c
To be set only by applications that reconnect with a downgraded protocol
Packit c4476c
version; see draft-ietf-tls-downgrade-scsv-00 for details.
Packit c4476c
Packit c4476c
DO NOT ENABLE THIS if your application attempts a normal handshake.
Packit c4476c
Only use this in explicit fallback retries, following the guidance
Packit c4476c
in draft-ietf-tls-downgrade-scsv-00.
Packit c4476c
Packit c4476c
=item SSL_MODE_ASYNC
Packit c4476c
Packit c4476c
Enable asynchronous processing. TLS I/O operations may indicate a retry with
Packit c4476c
SSL_ERROR_WANT_ASYNC with this mode set if an asynchronous capable engine is
Packit c4476c
used to perform cryptographic operations. See L<SSL_get_error(3)>.
Packit c4476c
Packit c4476c
=item SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG
Packit c4476c
Packit c4476c
Older versions of OpenSSL had a bug in the computation of the label length
Packit c4476c
used for computing the endpoint-pair shared secret. The bug was that the
Packit c4476c
terminating zero was included in the length of the label. Setting this option
Packit c4476c
enables this behaviour to allow interoperability with such broken
Packit c4476c
implementations. Please note that setting this option breaks interoperability
Packit c4476c
with correct implementations. This option only applies to DTLS over SCTP.
Packit c4476c
Packit c4476c
=back
Packit c4476c
Packit c4476c
All modes are off by default except for SSL_MODE_AUTO_RETRY which is on by
Packit c4476c
default since 1.1.1.
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
SSL_CTX_set_mode() and SSL_set_mode() return the new mode bitmask
Packit c4476c
after adding B<mode>.
Packit c4476c
Packit c4476c
SSL_CTX_get_mode() and SSL_get_mode() return the current bitmask.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<ssl(7)>, L<SSL_read_ex(3)>, L<SSL_read(3)>, L<SSL_write_ex(3)> or
Packit c4476c
L<SSL_write(3)>, L<SSL_get_error(3)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
SSL_MODE_ASYNC was added in OpenSSL 1.1.0.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut