NAMESSL_read — read bytes from a TLS/SSL connection
SSL_read(SSL *ssl, void *buf, int num);
DESCRIPTIONSSL_read() tries to read num bytes from the specified ssl into the buffer buf.
NOTESIf necessary, SSL_read() will negotiate a TLS/SSL session, if not already explicitly performed by SSL_connect(3) or SSL_accept(3). If the peer requests a re-negotiation, it will be performed transparently during the SSL_read() operation. The behaviour of SSL_read() depends on the underlying BIO.
WARNINGWhen an SSL_read() operation has to be repeated because of SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE, it must be repeated with the same arguments.
RETURN VALUESThe following return values can occur:
- The read operation was successful; the return value is the number of bytes actually read from the TLS/SSL connection.
The read operation was not successful. The reason may either be a clean shutdown due to a “close notify” alert sent by the peer (in which case the SSL_RECEIVED_SHUTDOWN flag in the ssl shutdown state is set (see SSL_shutdown(3) and SSL_set_shutdown(3)). It is also possible that the peer simply shut down the underlying transport and the shutdown is incomplete. Call SSL_get_error() with the return value to find out whether an error occurred or the connection was shut down cleanly (SSL_ERROR_ZERO_RETURN).
- The read operation was not successful, because either an error occurred or action must be taken by the calling process. Call SSL_get_error() with the return value to find out the reason.