2
0

SSL_set_bio.pod 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. =pod
  2. =head1 NAME
  3. SSL_set_bio, SSL_set0_rbio, SSL_set0_wbio - connect the SSL object with a BIO
  4. =head1 SYNOPSIS
  5. #include <openssl/ssl.h>
  6. void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio);
  7. void SSL_set0_rbio(SSL *s, BIO *rbio);
  8. void SSL_set0_wbio(SSL *s, BIO *wbio);
  9. =head1 DESCRIPTION
  10. SSL_set0_rbio() connects the BIO B<rbio> for the read operations of the B<ssl>
  11. object. The SSL engine inherits the behaviour of B<rbio>. If the BIO is
  12. nonblocking then the B<ssl> object will also have nonblocking behaviour. This
  13. function transfers ownership of B<rbio> to B<ssl>. It will be automatically
  14. freed using L<BIO_free_all(3)> when the B<ssl> is freed. On calling this
  15. function, any existing B<rbio> that was previously set will also be freed via a
  16. call to L<BIO_free_all(3)> (this includes the case where the B<rbio> is set to
  17. the same value as previously).
  18. SSL_set0_wbio() works in the same as SSL_set0_rbio() except that it connects
  19. the BIO B<wbio> for the write operations of the B<ssl> object. Note that if the
  20. rbio and wbio are the same then SSL_set0_rbio() and SSL_set0_wbio() each take
  21. ownership of one reference. Therefore, it may be necessary to increment the
  22. number of references available using L<BIO_up_ref(3)> before calling the set0
  23. functions.
  24. SSL_set_bio() is similar to SSL_set0_rbio() and SSL_set0_wbio() except
  25. that it connects both the B<rbio> and the B<wbio> at the same time, and
  26. transfers the ownership of B<rbio> and B<wbio> to B<ssl> according to
  27. the following set of rules:
  28. =over 2
  29. =item *
  30. If neither the B<rbio> or B<wbio> have changed from their previous values
  31. then nothing is done.
  32. =item *
  33. If the B<rbio> and B<wbio> parameters are different and both are different
  34. to their
  35. previously set values then one reference is consumed for the rbio and one
  36. reference is consumed for the wbio.
  37. =item *
  38. If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is not
  39. the same as the previously set value then one reference is consumed.
  40. =item *
  41. If the B<rbio> and B<wbio> parameters are the same and the B<rbio> is the
  42. same as the previously set value, then no additional references are consumed.
  43. =item *
  44. If the B<rbio> and B<wbio> parameters are different and the B<rbio> is the
  45. same as the
  46. previously set value then one reference is consumed for the B<wbio> and no
  47. references are consumed for the B<rbio>.
  48. =item *
  49. If the B<rbio> and B<wbio> parameters are different and the B<wbio> is the
  50. same as the previously set value and the old B<rbio> and B<wbio> values
  51. were the same as each other then one reference is consumed for the B<rbio>
  52. and no references are consumed for the B<wbio>.
  53. =item *
  54. If the B<rbio> and B<wbio> parameters are different and the B<wbio>
  55. is the same as the
  56. previously set value and the old B<rbio> and B<wbio> values were different
  57. to each other, then one reference is consumed for the B<rbio> and one
  58. reference is consumed for the B<wbio>.
  59. =back
  60. Because of this complexity, this function should be avoided;
  61. use SSL_set0_rbio() and SSL_set0_wbio() instead.
  62. =head1 RETURN VALUES
  63. SSL_set_bio(), SSL_set0_rbio() and SSL_set0_wbio() cannot fail.
  64. =head1 SEE ALSO
  65. L<SSL_get_rbio(3)>,
  66. L<SSL_connect(3)>, L<SSL_accept(3)>,
  67. L<SSL_shutdown(3)>, L<ssl(7)>, L<bio(7)>
  68. =head1 HISTORY
  69. SSL_set0_rbio() and SSL_set0_wbio() were added in OpenSSL 1.1.0.
  70. =head1 COPYRIGHT
  71. Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
  72. Licensed under the Apache License 2.0 (the "License"). You may not use
  73. this file except in compliance with the License. You can obtain a copy
  74. in the file LICENSE in the source distribution or at
  75. L<https://www.openssl.org/source/license.html>.
  76. =cut