Debian Codegraph @

upstream/debian-unstable/man3/SSL_key_update.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "SSL_KEY_UPDATE 3SSL"
58 .TH SSL_KEY_UPDATE 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 SSL_key_update,
65 SSL_get_key_update_type,
66 SSL_renegotiate,
67 SSL_renegotiate_abbreviated,
68 SSL_renegotiate_pending
69 \&\- initiate and obtain information about updating connection keys
70 .SH SYNOPSIS
71 .IX Header "SYNOPSIS"
72 .Vb 1
73 \& #include <openssl/ssl.h>
74 \&
75 \& int SSL_key_update(SSL *s, int updatetype);
76 \& int SSL_get_key_update_type(const SSL *s);
77 \&
78 \& int SSL_renegotiate(SSL *s);
79 \& int SSL_renegotiate_abbreviated(SSL *s);
80 \& int SSL_renegotiate_pending(const SSL *s);
81 .Ve
82 .SH DESCRIPTION
83 .IX Header "DESCRIPTION"
84 \&\fBSSL_key_update()\fR schedules an update of the keys for the current TLS connection.
85 If the \fBupdatetype\fR parameter is set to \fBSSL_KEY_UPDATE_NOT_REQUESTED\fR then
86 the sending keys for this connection will be updated and the peer will be
87 informed of the change. If the \fBupdatetype\fR parameter is set to
88 \&\fBSSL_KEY_UPDATE_REQUESTED\fR then the sending keys for this connection will be
89 updated and the peer will be informed of the change along with a request for the
90 peer to additionally update its sending keys. It is an error if \fBupdatetype\fR is
91 set to \fBSSL_KEY_UPDATE_NONE\fR.
92 .PP
93 \&\fBSSL_key_update()\fR must only be called after the initial handshake has been
94 completed and TLSv1.3 or QUIC has been negotiated, at the same time, the
95 application needs to ensure that the writing of data has been completed. The key
96 update will not take place until the next time an IO operation such as
97 \&\fBSSL_read_ex()\fR or \fBSSL_write_ex()\fR takes place on the connection. Alternatively
98 \&\fBSSL_do_handshake()\fR can be called to force the update to take place immediately.
99 .PP
100 \&\fBSSL_get_key_update_type()\fR can be used to determine whether a key update
101 operation has been scheduled but not yet performed. The type of the pending key
102 update operation will be returned if there is one, or SSL_KEY_UPDATE_NONE
103 otherwise.
104 .PP
105 \&\fBSSL_renegotiate()\fR and \fBSSL_renegotiate_abbreviated()\fR should only be called for
106 connections that have negotiated TLSv1.2 or less. Calling them on any other
107 connection will result in an error.
108 .PP
109 When called from the client side, \fBSSL_renegotiate()\fR schedules a completely new
110 handshake over an existing SSL/TLS connection. The next time an IO operation
111 such as \fBSSL_read_ex()\fR or \fBSSL_write_ex()\fR takes place on the connection a check
112 will be performed to confirm that it is a suitable time to start a
113 renegotiation. If so, then it will be initiated immediately. OpenSSL will not
114 attempt to resume any session associated with the connection in the new
115 handshake. Note that some servers will respond to reneogitation attempts with
116 a "no_renegotiation" alert. An OpenSSL will immediately fail the connection in
117 this case.
118 .PP
119 When called from the client side, \fBSSL_renegotiate_abbreviated()\fR works in the
120 same was as \fBSSL_renegotiate()\fR except that OpenSSL will attempt to resume the
121 session associated with the current connection in the new handshake.
122 .PP
123 When called from the server side, \fBSSL_renegotiate()\fR and
124 \&\fBSSL_renegotiate_abbreviated()\fR behave identically. They both schedule a request
125 for a new handshake to be sent to the client. The next time an IO operation is
126 performed then the same checks as on the client side are performed and then, if
127 appropriate, the request is sent. The client may or may not respond with a new
128 handshake and it may or may not attempt to resume an existing session. If
129 a new handshake is started then this will be handled transparently by calling
130 any OpenSSL IO function.
131 .PP
132 If an OpenSSL client receives a renegotiation request from a server then again
133 this will be handled transparently through calling any OpenSSL IO function. For
134 a TLS connection the client will attempt to resume the current session in the
135 new handshake. For historical reasons, DTLS clients will not attempt to resume
136 the session in the new handshake.
137 .PP
138 The \fBSSL_renegotiate_pending()\fR function returns 1 if a renegotiation or
139 renegotiation request has been scheduled but not yet acted on, or 0 otherwise.
140 .SH "USAGE WITH QUIC"
141 .IX Header "USAGE WITH QUIC"
142 \&\fBSSL_key_update()\fR can also be used to perform a key update when using QUIC. The
143 function must be called on a QUIC connection SSL object. This is normally done
144 automatically when needed. Since a locally initiated QUIC key update always
145 causes a peer to also trigger a key update, passing
146 \&\fBSSL_KEY_UPDATE_NOT_REQUESTED\fR as \fBupdatetype\fR has the same effect as passing
147 \&\fBSSL_KEY_UPDATE_REQUESTED\fR.
148 .PP
149 The QUIC connection must have been fully established before a key update can be
150 performed, and other QUIC protocol rules govern how frequently QUIC key update
151 can be performed. \fBSSL_key_update()\fR will fail if these requirements are not met.
152 .PP
153 Because QUIC key updates are always handled immediately,
154 \&\fBSSL_get_key_update_type()\fR always returns SSL_KEY_UPDATE_NONE when called on a
155 QUIC connection SSL object.
156 .SH "RETURN VALUES"
157 .IX Header "RETURN VALUES"
158 \&\fBSSL_key_update()\fR, \fBSSL_renegotiate()\fR and \fBSSL_renegotiate_abbreviated()\fR return 1
159 on success or 0 on error.
160 .PP
161 \&\fBSSL_get_key_update_type()\fR returns the update type of the pending key update
162 operation or SSL_KEY_UPDATE_NONE if there is none.
163 .PP
164 \&\fBSSL_renegotiate_pending()\fR returns 1 if a renegotiation or renegotiation request
165 has been scheduled but not yet acted on, or 0 otherwise.
166 .SH "SEE ALSO"
167 .IX Header "SEE ALSO"
168 \&\fBssl\fR\|(7), \fBSSL_read_ex\fR\|(3),
169 \&\fBSSL_write_ex\fR\|(3),
170 \&\fBSSL_do_handshake\fR\|(3)
171 .SH HISTORY
172 .IX Header "HISTORY"
173 The \fBSSL_key_update()\fR and \fBSSL_get_key_update_type()\fR functions were added in
174 OpenSSL 1.1.1.
175 .SH COPYRIGHT
176 .IX Header "COPYRIGHT"
177 Copyright 2017\-2025 The OpenSSL Project Authors. All Rights Reserved.
178 .PP
179 Licensed under the Apache License 2.0 (the "License"). You may not use
180 this file except in compliance with the License. You can obtain a copy
181 in the file LICENSE in the source distribution or at
182 <https://www.openssl.org/source/license.html>.