1.\" $OpenBSD: SSL_renegotiate.3,v 1.9 2019/06/12 09:36:30 schwarze Exp $ 2.\" OpenSSL SSL_key_update.pod 4fbfe86a Feb 16 17:04:40 2017 +0000 3.\" 4.\" This file is a derived work. 5.\" Some parts are covered by the following Copyright and license: 6.\" 7.\" Copyright (c) 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> 8.\" 9.\" Permission to use, copy, modify, and distribute this software for any 10.\" purpose with or without fee is hereby granted, provided that the above 11.\" copyright notice and this permission notice appear in all copies. 12.\" 13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20.\" 21.\" Other parts were written by Matt Caswell <matt@openssl.org>. 22.\" Copyright (c) 2017 The OpenSSL Project. All rights reserved. 23.\" 24.\" Redistribution and use in source and binary forms, with or without 25.\" modification, are permitted provided that the following conditions 26.\" are met: 27.\" 28.\" 1. Redistributions of source code must retain the above copyright 29.\" notice, this list of conditions and the following disclaimer. 30.\" 31.\" 2. Redistributions in binary form must reproduce the above copyright 32.\" notice, this list of conditions and the following disclaimer in 33.\" the documentation and/or other materials provided with the 34.\" distribution. 35.\" 36.\" 3. All advertising materials mentioning features or use of this 37.\" software must display the following acknowledgment: 38.\" "This product includes software developed by the OpenSSL Project 39.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 40.\" 41.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 42.\" endorse or promote products derived from this software without 43.\" prior written permission. For written permission, please contact 44.\" openssl-core@openssl.org. 45.\" 46.\" 5. Products derived from this software may not be called "OpenSSL" 47.\" nor may "OpenSSL" appear in their names without prior written 48.\" permission of the OpenSSL Project. 49.\" 50.\" 6. Redistributions of any form whatsoever must retain the following 51.\" acknowledgment: 52.\" "This product includes software developed by the OpenSSL Project 53.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 54.\" 55.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 56.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 57.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 58.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 59.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 60.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 61.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 62.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 63.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 64.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" 68.Dd $Mdocdate: June 12 2019 $ 69.Dt SSL_RENEGOTIATE 3 70.Os 71.Sh NAME 72.Nm SSL_renegotiate , 73.Nm SSL_renegotiate_abbreviated , 74.Nm SSL_renegotiate_pending 75.Nd initiate a new TLS handshake 76.Sh SYNOPSIS 77.In openssl/ssl.h 78.Ft int 79.Fo SSL_renegotiate 80.Fa "SSL *ssl" 81.Fc 82.Ft int 83.Fo SSL_renegotiate_abbreviated 84.Fa "SSL *ssl" 85.Fc 86.Ft int 87.Fo SSL_renegotiate_pending 88.Fa "SSL *ssl" 89.Fc 90.Sh DESCRIPTION 91When called from the client side, 92.Fn SSL_renegotiate 93schedules a completely new handshake over an existing TLS connection. 94The next time an I/O operation such as 95.Fn SSL_read 96or 97.Fn SSL_write 98takes place on the connection, a check is performed to confirm 99that it is a suitable time to start a renegotiation. 100If so, a new handshake is initiated immediately. 101An existing session associated with the connection is not resumed. 102.Pp 103This function is automatically called by 104.Xr SSL_read 3 105and 106.Xr SSL_write 3 107whenever the renegotiation byte count set by 108.Xr BIO_set_ssl_renegotiate_bytes 3 109or the timeout set by 110.Xr BIO_set_ssl_renegotiate_timeout 3 111are exceeded. 112.Pp 113When called from the client side, 114.Fn SSL_renegotiate_abbreviated 115is similar to 116.Fn SSL_renegotiate 117except that resuming the session associated with the current 118connection is attempted in the new handshake. 119.Pp 120When called from the server side, 121.Fn SSL_renegotiate 122and 123.Fn SSL_renegotiate_abbreviated 124behave identically. 125They both schedule a request for a new handshake to be sent to the client. 126The next time an I/O operation is performed, the same checks as on 127the client side are performed and then, if appropriate, the request 128is sent. 129The client may or may not respond with a new handshake and it may 130or may not attempt to resume an existing session. 131If a new handshake is started, it is handled transparently during 132any I/O function. 133.Pp 134If a LibreSSL client receives a renegotiation request from a server, 135it is also handled transparently during any I/O function. 136The client attempts to resume the current session in the new 137handshake. 138For historical reasons, DTLS clients do not attempt to resume 139the session in the new handshake. 140.Sh RETURN VALUES 141.Fn SSL_renegotiate 142and 143.Fn SSL_renegotiate_abbreviated 144return 1 on success or 0 on error. 145.Pp 146.Fn SSL_renegotiate_pending 147returns 1 if a renegotiation or renegotiation request has been 148scheduled but not yet acted on, or 0 otherwise. 149.Sh SEE ALSO 150.Xr ssl 3 , 151.Xr SSL_do_handshake 3 , 152.Xr SSL_num_renegotiations 3 , 153.Xr SSL_read 3 , 154.Xr SSL_write 3 155.Sh HISTORY 156.Fn SSL_renegotiate 157first appeared in SSLeay 0.8.0 and has been available since 158.Ox 2.4 . 159.Pp 160.Fn SSL_renegotiate_pending 161first appeared in OpenSSL 0.9.7 and has been available since 162.Ox 3.2 . 163.Pp 164.Fn SSL_renegotiate_abbreviated 165first appeared in OpenSSL 1.0.1 and has been available since 166.Ox 5.3 . 167