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