1SSL_SET_FD(3)                       OpenSSL                      SSL_SET_FD(3)
2
3
4

NAME

6       SSL_set_fd, SSL_set_rfd, SSL_set_wfd - connect the SSL object with a
7       file descriptor
8

SYNOPSIS

10        #include <openssl/ssl.h>
11
12        int SSL_set_fd(SSL *ssl, int fd);
13        int SSL_set_rfd(SSL *ssl, int fd);
14        int SSL_set_wfd(SSL *ssl, int fd);
15

DESCRIPTION

17       SSL_set_fd() sets the file descriptor fd as the input/output facility
18       for the TLS/SSL (encrypted) side of ssl. fd will typically be the
19       socket file descriptor of a network connection.
20
21       When performing the operation, a socket BIO is automatically created to
22       interface between the ssl and fd. The BIO and hence the SSL engine
23       inherit the behaviour of fd. If fd is nonblocking, the ssl will also
24       have nonblocking behaviour.
25
26       If there was already a BIO connected to ssl, BIO_free() will be called
27       (for both the reading and writing side, if different).
28
29       SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only
30       for the read channel or the write channel, which can be set
31       independently.
32

RETURN VALUES

34       The following return values can occur:
35
36       0   The operation failed. Check the error stack to find out why.
37
38       1   The operation succeeded.
39

NOTES

41       On Windows, a socket handle is a 64-bit data type (UINT_PTR), which
42       leads to a compiler warning (conversion from 'SOCKET' to 'int',
43       possible loss of data) when passing the socket handle to SSL_set_*fd().
44       For the time being, this warning can safely be ignored, because
45       although the Microsoft documentation claims that the upper limit is
46       INVALID_SOCKET-1 (2^64 - 2), in practice the current socket()
47       implementation returns an index into the kernel handle table, the size
48       of which is limited to 2^24.
49

SEE ALSO

51       SSL_get_fd(3), SSL_set_bio(3), SSL_connect(3), SSL_accept(3),
52       SSL_shutdown(3), ssl(7) , bio(7)
53
55       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
56
57       Licensed under the OpenSSL license (the "License").  You may not use
58       this file except in compliance with the License.  You can obtain a copy
59       in the file LICENSE in the source distribution or at
60       <https://www.openssl.org/source/license.html>.
61
62
63
641.1.1q                            2022-07-21                     SSL_SET_FD(3)
Impressum