Manual Pages for UNIX Darwin command on man SSL_read
MyWebUniversity

Manual Pages for UNIX Darwin command on man SSL_read

SSLread(3) OpenSSL SSLread(3)

NAME

SSLread - read bytes from a TLS/SSL connection.

SYNOPSIS

#include

int SSLread(SSL *ssl, void *buf, int num);

DESCRIPTION

SSLread() tries to read nnuumm bytes from the specified ssssll into the buffer bbuuff. NNOOTTEESS If necessary, SSLread() will negotiate a TLS/SSL session, if not already explicitly performed by SSLconnect(3) or SSLaccept(3). If the

peer requests a re-negotiation, it will be performed transparently

during the SSLread() operation. The behaviour of SSLread() depends on the underlying BIO. For the transparent negotiation to succeed, the ssssll must have been initialized to client or server mode. This is being done by calling SSLsetconnectstate(3) or SSLsetacceptstate() before the first call to an SSLread() or SSLwrite(3) function. SSLread() works based on the SSL/TLS records. The data are received in records (with a maximum record size of 16kB for SSLv3/TLSv1). Only when a record has been completely received, it can be processed (decryption and check of integrity). Therefore data that was not retrieved at the last call of SSLread() can still be buffered inside the SSL layer and will be retrieved on the next call to SSLread(). If nnuumm is higher than the number of bytes buffered, SSLread() will return with the bytes buffered. If no more bytes are in the buffer, SSLread() will trigger the processing of the next record. Only when the record has been received and processed completely, SSLread() will return reporting success. At most the contents of the record will be returned. As the size of an SSL/TLS record may exceed the maximum packet size of the underlying transport (e.g. TCP), it may be necessary to read several packets from the transport layer before the record is complete and SSLread() can succeed. If the underlying BIO is bblloocckkiinngg, SSLread() will only return, once the read operation has been finished or an error occurred, except when

a renegotiation take place, in which case a SSLERRORWANTREAD may

occur. This behaviour can be controlled with the SSLMODEAUTORETRY flag of the SSLCTXsetmode(3) call.

If the underlying BIO is nnoonn-bblloocckkiinngg, SSLread() will also return when

the underlying BIO could not satisfy the needs of SSLread() to continue the operation. In this case a call to SSLgeterror(3) with the return value of SSLread() will yield SSSSLLEERRRROORRWWAANNTTRREEAADD or

SSSSLLEERRRROORRWWAANNTTWWRRIITTEE. As at any time a re-negotiation is possible, a

call to SSLread() can also cause write operations! The calling process then must repeat the call after taking appropriate action to satisfy the needs of SSLread(). The action depends on the underlying BIO. When

using a non-blocking socket, nothing is to be done, but select() can be

used to check for the required condition. When using a buffering BIO, like a BIO pair, data must be written into or retrieved out of the BIO before being able to continue. WWAARRNNIINNGG When an SSLread() operation has to be repeated because of SSSSLLEERRRROORRWWAANNTTRREEAADD or SSSSLLEERRRROORRWWAANNTTWWRRIITTEE, it must be repeated with the same arguments.

RETURN VALUES

The following return values can occur: >0 The read operation was successful; the return value is the number of bytes actually read from the TLS/SSL connection. 0 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 SSLRECEIVEDSHUTDOWN flag in the ssl shutdown state is set (see SSLshutdown(3), SSLsetshutdown(3)). It is also possible, that the peer simply shut down the underlying transport and the shutdown is incomplete. Call SSLgeterror() with the return value rreett to find out, whether an error occurred or the

connection was shut down cleanly (SSLERRORZERORETURN).

SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only be detected, whether the underlying connection was closed. It cannot be checked, whether the closure was initiated by the peer or by something else. <0 The read operation was not successful, because either an error occurred or action must be taken by the calling process. Call SSLgeterror() with the return value rreett to find out the reason.

SEE ALSO

SSLgeterror(3), SSLwrite(3), SSLCTXsetmode(3), SSLCTXnew(3), SSLconnect(3), SSLaccept(3) SSLsetconnectstate(3), SSLshutdown(3), SSLsetshutdown(3), ssl(3), bio(3)

0.9.7l 2001-09-13 SSLread(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™