SSL_set_bio.3ossl 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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_SET_BIO 3ossl"
  58. .TH SSL_SET_BIO 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_set_bio, SSL_set0_rbio, SSL_set0_wbio \- connect the SSL object with a BIO
  65. .SH SYNOPSIS
  66. .IX Header "SYNOPSIS"
  67. .Vb 1
  68. \& #include <openssl/ssl.h>
  69. \&
  70. \& void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);
  71. \& void SSL_set0_rbio(SSL *s, BIO *rbio);
  72. \& void SSL_set0_wbio(SSL *s, BIO *wbio);
  73. .Ve
  74. .SH DESCRIPTION
  75. .IX Header "DESCRIPTION"
  76. \&\fBSSL_set0_rbio()\fR connects the BIO \fBrbio\fR for the read operations of the \fBssl\fR
  77. object. The SSL engine inherits the behaviour of \fBrbio\fR. If the BIO is
  78. nonblocking then the \fBssl\fR object will also have nonblocking behaviour. This
  79. function transfers ownership of \fBrbio\fR to \fBssl\fR. It will be automatically
  80. freed using \fBBIO_free_all\fR\|(3) when the \fBssl\fR is freed. On calling this
  81. function, any existing \fBrbio\fR that was previously set will also be freed via a
  82. call to \fBBIO_free_all\fR\|(3) (this includes the case where the \fBrbio\fR is set to
  83. the same value as previously).
  84. .PP
  85. \&\fBSSL_set0_wbio()\fR works in the same as \fBSSL_set0_rbio()\fR except that it connects
  86. the BIO \fBwbio\fR for the write operations of the \fBssl\fR object. Note that if the
  87. rbio and wbio are the same then \fBSSL_set0_rbio()\fR and \fBSSL_set0_wbio()\fR each take
  88. ownership of one reference. Therefore, it may be necessary to increment the
  89. number of references available using \fBBIO_up_ref\fR\|(3) before calling the set0
  90. functions.
  91. .PP
  92. \&\fBSSL_set_bio()\fR is similar to \fBSSL_set0_rbio()\fR and \fBSSL_set0_wbio()\fR except
  93. that it connects both the \fBrbio\fR and the \fBwbio\fR at the same time, and
  94. transfers the ownership of \fBrbio\fR and \fBwbio\fR to \fBssl\fR according to
  95. the following set of rules:
  96. .IP \(bu 2
  97. If neither the \fBrbio\fR or \fBwbio\fR have changed from their previous values
  98. then nothing is done.
  99. .IP \(bu 2
  100. If the \fBrbio\fR and \fBwbio\fR parameters are different and both are different
  101. to their
  102. previously set values then one reference is consumed for the rbio and one
  103. reference is consumed for the wbio.
  104. .IP \(bu 2
  105. If the \fBrbio\fR and \fBwbio\fR parameters are the same and the \fBrbio\fR is not
  106. the same as the previously set value then one reference is consumed.
  107. .IP \(bu 2
  108. If the \fBrbio\fR and \fBwbio\fR parameters are the same and the \fBrbio\fR is the
  109. same as the previously set value, then no additional references are consumed.
  110. .IP \(bu 2
  111. If the \fBrbio\fR and \fBwbio\fR parameters are different and the \fBrbio\fR is the
  112. same as the
  113. previously set value then one reference is consumed for the \fBwbio\fR and no
  114. references are consumed for the \fBrbio\fR.
  115. .IP \(bu 2
  116. If the \fBrbio\fR and \fBwbio\fR parameters are different and the \fBwbio\fR is the
  117. same as the previously set value and the old \fBrbio\fR and \fBwbio\fR values
  118. were the same as each other then one reference is consumed for the \fBrbio\fR
  119. and no references are consumed for the \fBwbio\fR.
  120. .IP \(bu 2
  121. If the \fBrbio\fR and \fBwbio\fR parameters are different and the \fBwbio\fR
  122. is the same as the
  123. previously set value and the old \fBrbio\fR and \fBwbio\fR values were different
  124. to each other, then one reference is consumed for the \fBrbio\fR and one
  125. reference is consumed for the \fBwbio\fR.
  126. .PP
  127. Because of this complexity, this function should be avoided;
  128. use \fBSSL_set0_rbio()\fR and \fBSSL_set0_wbio()\fR instead.
  129. .PP
  130. Where a new BIO is set on a QUIC connection SSL object, blocking mode will be
  131. disabled on that SSL object if the BIO cannot support blocking mode. If another
  132. BIO is subsequently set on the SSL object which can support blocking mode,
  133. blocking mode will not be automatically re-enabled. For more information, see
  134. \&\fBSSL_set_blocking_mode\fR\|(3).
  135. .SH "RETURN VALUES"
  136. .IX Header "RETURN VALUES"
  137. \&\fBSSL_set_bio()\fR, \fBSSL_set0_rbio()\fR and \fBSSL_set0_wbio()\fR cannot fail.
  138. .SH "SEE ALSO"
  139. .IX Header "SEE ALSO"
  140. \&\fBSSL_get_rbio\fR\|(3),
  141. \&\fBSSL_connect\fR\|(3), \fBSSL_accept\fR\|(3),
  142. \&\fBSSL_shutdown\fR\|(3), \fBssl\fR\|(7), \fBbio\fR\|(7)
  143. .SH HISTORY
  144. .IX Header "HISTORY"
  145. \&\fBSSL_set0_rbio()\fR and \fBSSL_set0_wbio()\fR were added in OpenSSL 1.1.0.
  146. .SH COPYRIGHT
  147. .IX Header "COPYRIGHT"
  148. Copyright 2000\-2023 The OpenSSL Project Authors. All Rights Reserved.
  149. .PP
  150. Licensed under the Apache License 2.0 (the "License"). You may not use
  151. this file except in compliance with the License. You can obtain a copy
  152. in the file LICENSE in the source distribution or at
  153. <https://www.openssl.org/source/license.html>.