1=pod 2 3=head1 NAME 4 5SSL_read - read bytes from a TLS/SSL connection. 6 7=head1 SYNOPSIS 8 --- 15 unchanged lines hidden (view full) --- 24the SSL_read() operation. The behaviour of SSL_read() depends on the 25underlying BIO. 26 27For the transparent negotiation to succeed, the B<ssl> must have been 28initialized to client or server mode. This is not the case if a generic 29method is being used (see L<SSL_CTX_new(3)|SSL_CTX_new(3)>, so that 30L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() 31must be used before the first call to an SSL_read() or |
32L<SSL_write(3)|SSL_write(3)> function). |
33 |
34SSL_read() works based on the SSL/TLS records. The data are received in 35records (with a maximum record size of 16kB for SSLv3/TLSv1). Only when a 36record has been completely received, it can be processed (decryption and 37check of integrity). Therefore data that was not retrieved at the last 38call of SSL_read() can still be buffered inside the SSL layer and will be 39retrieved on the next call to SSL_read(). If B<num> is higher than the 40number of bytes buffered, SSL_read() will return with the bytes buffered. 41If no more bytes are in the buffer, SSL_read() will trigger the processing 42of the next record. Only when the record has been received and processed 43completely, SSL_read() will return reporting success. At most the contents 44of the record will be returned. As the size of an SSL/TLS record may exceed 45the maximum packet size of the underlying transport (e.g. TCP), it may 46be necessary to read several packets from the transport layer before the 47record is complete and SSL_read() can succeed. 48 |
49If the underlying BIO is B<blocking>, SSL_read() will only return, once the 50read operation has been finished or an error occurred, except when a 51renegotiation take place, in which case a SSL_ERROR_WANT_READ may occur. 52This behaviour can be controlled with the SSL_MODE_AUTO_RETRY flag of the 53L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)> call. 54 55If the underlying BIO is B<non-blocking>, SSL_read() will also return 56when the underlying BIO could not satisfy the needs of SSL_read() --- 51 unchanged lines hidden --- |