Home | History | Annotate | Line # | Download | only in man3
      1      1.1  christos =pod
      2      1.1  christos 
      3      1.1  christos =head1 NAME
      4      1.1  christos 
      5      1.1  christos SSL_set_fd, SSL_set_rfd, SSL_set_wfd - connect the SSL object with a file descriptor
      6      1.1  christos 
      7      1.1  christos =head1 SYNOPSIS
      8      1.1  christos 
      9      1.1  christos  #include <openssl/ssl.h>
     10      1.1  christos 
     11      1.1  christos  int SSL_set_fd(SSL *ssl, int fd);
     12      1.1  christos  int SSL_set_rfd(SSL *ssl, int fd);
     13      1.1  christos  int SSL_set_wfd(SSL *ssl, int fd);
     14      1.1  christos 
     15      1.1  christos =head1 DESCRIPTION
     16      1.1  christos 
     17      1.1  christos SSL_set_fd() sets the file descriptor B<fd> as the input/output facility
     18      1.1  christos for the TLS/SSL (encrypted) side of B<ssl>. B<fd> will typically be the
     19      1.1  christos socket file descriptor of a network connection.
     20      1.1  christos 
     21      1.1  christos When performing the operation, a B<socket BIO> is automatically created to
     22      1.1  christos interface between the B<ssl> and B<fd>. The BIO and hence the SSL engine
     23  1.1.1.2  christos inherit the behaviour of B<fd>. If B<fd> is nonblocking, the B<ssl> will
     24  1.1.1.2  christos also have nonblocking behaviour.
     25      1.1  christos 
     26      1.1  christos If there was already a BIO connected to B<ssl>, BIO_free() will be called
     27      1.1  christos (for both the reading and writing side, if different).
     28      1.1  christos 
     29      1.1  christos SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only
     30      1.1  christos for the read channel or the write channel, which can be set independently.
     31      1.1  christos 
     32      1.1  christos =head1 RETURN VALUES
     33      1.1  christos 
     34      1.1  christos The following return values can occur:
     35      1.1  christos 
     36      1.1  christos =over 4
     37      1.1  christos 
     38      1.1  christos =item Z<>0
     39      1.1  christos 
     40      1.1  christos The operation failed. Check the error stack to find out why.
     41      1.1  christos 
     42      1.1  christos =item Z<>1
     43      1.1  christos 
     44      1.1  christos The operation succeeded.
     45      1.1  christos 
     46      1.1  christos =back
     47      1.1  christos 
     48  1.1.1.3  christos =head1 NOTES
     49  1.1.1.3  christos 
     50  1.1.1.3  christos On Windows, a socket handle is a 64-bit data type (UINT_PTR), which leads to a
     51  1.1.1.3  christos compiler warning (conversion from 'SOCKET' to 'int', possible loss of data) when
     52  1.1.1.3  christos passing the socket handle to SSL_set_*fd(). For the time being, this warning can
     53  1.1.1.3  christos safely be ignored, because although the Microsoft documentation claims that the
     54  1.1.1.3  christos upper limit is INVALID_SOCKET-1 (2^64 - 2), in practice the current socket()
     55  1.1.1.3  christos implementation returns an index into the kernel handle table, the size of which
     56  1.1.1.3  christos is limited to 2^24.
     57  1.1.1.3  christos 
     58  1.1.1.3  christos 
     59      1.1  christos =head1 SEE ALSO
     60      1.1  christos 
     61      1.1  christos L<SSL_get_fd(3)>, L<SSL_set_bio(3)>,
     62      1.1  christos L<SSL_connect(3)>, L<SSL_accept(3)>,
     63      1.1  christos L<SSL_shutdown(3)>, L<ssl(7)> , L<bio(7)>
     64      1.1  christos 
     65      1.1  christos =head1 COPYRIGHT
     66      1.1  christos 
     67  1.1.1.3  christos Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
     68      1.1  christos 
     69  1.1.1.4  christos Licensed under the Apache License 2.0 (the "License").  You may not use
     70      1.1  christos this file except in compliance with the License.  You can obtain a copy
     71      1.1  christos in the file LICENSE in the source distribution or at
     72      1.1  christos L<https://www.openssl.org/source/license.html>.
     73      1.1  christos 
     74      1.1  christos =cut
     75