1e71b7053SJung-uk Kim=pod 2e71b7053SJung-uk Kim 3e71b7053SJung-uk Kim=head1 NAME 4e71b7053SJung-uk Kim 5e71b7053SJung-uk KimSSL_key_update, 6e71b7053SJung-uk KimSSL_get_key_update_type, 7e71b7053SJung-uk KimSSL_renegotiate, 8e71b7053SJung-uk KimSSL_renegotiate_abbreviated, 9e71b7053SJung-uk KimSSL_renegotiate_pending 10e71b7053SJung-uk Kim- initiate and obtain information about updating connection keys 11e71b7053SJung-uk Kim 12e71b7053SJung-uk Kim=head1 SYNOPSIS 13e71b7053SJung-uk Kim 14e71b7053SJung-uk Kim #include <openssl/ssl.h> 15e71b7053SJung-uk Kim 16e71b7053SJung-uk Kim int SSL_key_update(SSL *s, int updatetype); 17*6935a639SJung-uk Kim int SSL_get_key_update_type(const SSL *s); 18e71b7053SJung-uk Kim 19e71b7053SJung-uk Kim int SSL_renegotiate(SSL *s); 20e71b7053SJung-uk Kim int SSL_renegotiate_abbreviated(SSL *s); 21*6935a639SJung-uk Kim int SSL_renegotiate_pending(const SSL *s); 22e71b7053SJung-uk Kim 23e71b7053SJung-uk Kim=head1 DESCRIPTION 24e71b7053SJung-uk Kim 25e71b7053SJung-uk KimSSL_key_update() schedules an update of the keys for the current TLS connection. 26e71b7053SJung-uk KimIf the B<updatetype> parameter is set to B<SSL_KEY_UPDATE_NOT_REQUESTED> then 27e71b7053SJung-uk Kimthe sending keys for this connection will be updated and the peer will be 28e71b7053SJung-uk Kiminformed of the change. If the B<updatetype> parameter is set to 29e71b7053SJung-uk KimB<SSL_KEY_UPDATE_REQUESTED> then the sending keys for this connection will be 30e71b7053SJung-uk Kimupdated and the peer will be informed of the change along with a request for the 31e71b7053SJung-uk Kimpeer to additionally update its sending keys. It is an error if B<updatetype> is 32e71b7053SJung-uk Kimset to B<SSL_KEY_UPDATE_NONE>. 33e71b7053SJung-uk Kim 34e71b7053SJung-uk KimSSL_key_update() must only be called after the initial handshake has been 35e71b7053SJung-uk Kimcompleted and TLSv1.3 has been negotiated. The key update will not take place 36e71b7053SJung-uk Kimuntil the next time an IO operation such as SSL_read_ex() or SSL_write_ex() 37e71b7053SJung-uk Kimtakes place on the connection. Alternatively SSL_do_handshake() can be called to 38e71b7053SJung-uk Kimforce the update to take place immediately. 39e71b7053SJung-uk Kim 40e71b7053SJung-uk KimSSL_get_key_update_type() can be used to determine whether a key update 41e71b7053SJung-uk Kimoperation has been scheduled but not yet performed. The type of the pending key 42e71b7053SJung-uk Kimupdate operation will be returned if there is one, or SSL_KEY_UPDATE_NONE 43e71b7053SJung-uk Kimotherwise. 44e71b7053SJung-uk Kim 45e71b7053SJung-uk KimSSL_renegotiate() and SSL_renegotiate_abbreviated() should only be called for 46e71b7053SJung-uk Kimconnections that have negotiated TLSv1.2 or less. Calling them on any other 47e71b7053SJung-uk Kimconnection will result in an error. 48e71b7053SJung-uk Kim 49e71b7053SJung-uk KimWhen called from the client side, SSL_renegotiate() schedules a completely new 50e71b7053SJung-uk Kimhandshake over an existing SSL/TLS connection. The next time an IO operation 51e71b7053SJung-uk Kimsuch as SSL_read_ex() or SSL_write_ex() takes place on the connection a check 52e71b7053SJung-uk Kimwill be performed to confirm that it is a suitable time to start a 53e71b7053SJung-uk Kimrenegotiation. If so, then it will be initiated immediately. OpenSSL will not 54e71b7053SJung-uk Kimattempt to resume any session associated with the connection in the new 55e71b7053SJung-uk Kimhandshake. 56e71b7053SJung-uk Kim 57e71b7053SJung-uk KimWhen called from the client side, SSL_renegotiate_abbreviated() works in the 58e71b7053SJung-uk Kimsame was as SSL_renegotiate() except that OpenSSL will attempt to resume the 59e71b7053SJung-uk Kimsession associated with the current connection in the new handshake. 60e71b7053SJung-uk Kim 61e71b7053SJung-uk KimWhen called from the server side, SSL_renegotiate() and 62e71b7053SJung-uk KimSSL_renegotiate_abbreviated() behave identically. They both schedule a request 63e71b7053SJung-uk Kimfor a new handshake to be sent to the client. The next time an IO operation is 64e71b7053SJung-uk Kimperformed then the same checks as on the client side are performed and then, if 65e71b7053SJung-uk Kimappropriate, the request is sent. The client may or may not respond with a new 66e71b7053SJung-uk Kimhandshake and it may or may not attempt to resume an existing session. If 67e71b7053SJung-uk Kima new handshake is started then this will be handled transparently by calling 68e71b7053SJung-uk Kimany OpenSSL IO function. 69e71b7053SJung-uk Kim 70e71b7053SJung-uk KimIf an OpenSSL client receives a renegotiation request from a server then again 71e71b7053SJung-uk Kimthis will be handled transparently through calling any OpenSSL IO function. For 72e71b7053SJung-uk Kima TLS connection the client will attempt to resume the current session in the 73e71b7053SJung-uk Kimnew handshake. For historical reasons, DTLS clients will not attempt to resume 74e71b7053SJung-uk Kimthe session in the new handshake. 75e71b7053SJung-uk Kim 76e71b7053SJung-uk KimThe SSL_renegotiate_pending() function returns 1 if a renegotiation or 77e71b7053SJung-uk Kimrenegotiation request has been scheduled but not yet acted on, or 0 otherwise. 78e71b7053SJung-uk Kim 79e71b7053SJung-uk Kim=head1 RETURN VALUES 80e71b7053SJung-uk Kim 81e71b7053SJung-uk KimSSL_key_update(), SSL_renegotiate() and SSL_renegotiate_abbreviated() return 1 82e71b7053SJung-uk Kimon success or 0 on error. 83e71b7053SJung-uk Kim 84e71b7053SJung-uk KimSSL_get_key_update_type() returns the update type of the pending key update 85e71b7053SJung-uk Kimoperation or SSL_KEY_UPDATE_NONE if there is none. 86e71b7053SJung-uk Kim 87e71b7053SJung-uk KimSSL_renegotiate_pending() returns 1 if a renegotiation or renegotiation request 88e71b7053SJung-uk Kimhas been scheduled but not yet acted on, or 0 otherwise. 89e71b7053SJung-uk Kim 90e71b7053SJung-uk Kim=head1 SEE ALSO 91e71b7053SJung-uk Kim 92e71b7053SJung-uk KimL<ssl(7)>, L<SSL_read_ex(3)>, 93e71b7053SJung-uk KimL<SSL_write_ex(3)>, 94e71b7053SJung-uk KimL<SSL_do_handshake(3)> 95e71b7053SJung-uk Kim 96e71b7053SJung-uk Kim=head1 HISTORY 97e71b7053SJung-uk Kim 98e71b7053SJung-uk KimThe SSL_key_update() and SSL_get_key_update_type() functions were added in 99e71b7053SJung-uk KimOpenSSL 1.1.1. 100e71b7053SJung-uk Kim 101e71b7053SJung-uk Kim=head1 COPYRIGHT 102e71b7053SJung-uk Kim 103*6935a639SJung-uk KimCopyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved. 104e71b7053SJung-uk Kim 105e71b7053SJung-uk KimLicensed under the OpenSSL license (the "License"). You may not use 106e71b7053SJung-uk Kimthis file except in compliance with the License. You can obtain a copy 107e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at 108e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>. 109e71b7053SJung-uk Kim 110e71b7053SJung-uk Kim=cut 111