SSL_key_update.3ossl 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  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 3ossl"
  58. .TH SSL_KEY_UPDATE 3ossl 2025-01-17 3.4.0 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.
  116. .PP
  117. When called from the client side, \fBSSL_renegotiate_abbreviated()\fR works in the
  118. same was as \fBSSL_renegotiate()\fR except that OpenSSL will attempt to resume the
  119. session associated with the current connection in the new handshake.
  120. .PP
  121. When called from the server side, \fBSSL_renegotiate()\fR and
  122. \&\fBSSL_renegotiate_abbreviated()\fR behave identically. They both schedule a request
  123. for a new handshake to be sent to the client. The next time an IO operation is
  124. performed then the same checks as on the client side are performed and then, if
  125. appropriate, the request is sent. The client may or may not respond with a new
  126. handshake and it may or may not attempt to resume an existing session. If
  127. a new handshake is started then this will be handled transparently by calling
  128. any OpenSSL IO function.
  129. .PP
  130. If an OpenSSL client receives a renegotiation request from a server then again
  131. this will be handled transparently through calling any OpenSSL IO function. For
  132. a TLS connection the client will attempt to resume the current session in the
  133. new handshake. For historical reasons, DTLS clients will not attempt to resume
  134. the session in the new handshake.
  135. .PP
  136. The \fBSSL_renegotiate_pending()\fR function returns 1 if a renegotiation or
  137. renegotiation request has been scheduled but not yet acted on, or 0 otherwise.
  138. .SH "USAGE WITH QUIC"
  139. .IX Header "USAGE WITH QUIC"
  140. \&\fBSSL_key_update()\fR can also be used to perform a key update when using QUIC. The
  141. function must be called on a QUIC connection SSL object. This is normally done
  142. automatically when needed. Since a locally initiated QUIC key update always
  143. causes a peer to also trigger a key update, passing
  144. \&\fBSSL_KEY_UPDATE_NOT_REQUESTED\fR as \fBupdatetype\fR has the same effect as passing
  145. \&\fBSSL_KEY_UPDATE_REQUESTED\fR.
  146. .PP
  147. The QUIC connection must have been fully established before a key update can be
  148. performed, and other QUIC protocol rules govern how frequently QUIC key update
  149. can be performed. \fBSSL_key_update()\fR will fail if these requirements are not met.
  150. .PP
  151. Because QUIC key updates are always handled immediately,
  152. \&\fBSSL_get_key_update_type()\fR always returns SSL_KEY_UPDATE_NONE when called on a
  153. QUIC connection SSL object.
  154. .SH "RETURN VALUES"
  155. .IX Header "RETURN VALUES"
  156. \&\fBSSL_key_update()\fR, \fBSSL_renegotiate()\fR and \fBSSL_renegotiate_abbreviated()\fR return 1
  157. on success or 0 on error.
  158. .PP
  159. \&\fBSSL_get_key_update_type()\fR returns the update type of the pending key update
  160. operation or SSL_KEY_UPDATE_NONE if there is none.
  161. .PP
  162. \&\fBSSL_renegotiate_pending()\fR returns 1 if a renegotiation or renegotiation request
  163. has been scheduled but not yet acted on, or 0 otherwise.
  164. .SH "SEE ALSO"
  165. .IX Header "SEE ALSO"
  166. \&\fBssl\fR\|(7), \fBSSL_read_ex\fR\|(3),
  167. \&\fBSSL_write_ex\fR\|(3),
  168. \&\fBSSL_do_handshake\fR\|(3)
  169. .SH HISTORY
  170. .IX Header "HISTORY"
  171. The \fBSSL_key_update()\fR and \fBSSL_get_key_update_type()\fR functions were added in
  172. OpenSSL 1.1.1.
  173. .SH COPYRIGHT
  174. .IX Header "COPYRIGHT"
  175. Copyright 2017\-2023 The OpenSSL Project Authors. All Rights Reserved.
  176. .PP
  177. Licensed under the Apache License 2.0 (the "License"). You may not use
  178. this file except in compliance with the License. You can obtain a copy
  179. in the file LICENSE in the source distribution or at
  180. <https://www.openssl.org/source/license.html>.