[openssl-users] Find size of available data prior to ssl_read
Martin Brampton
martin at black-sheep-research.com
Wed Dec 16 18:23:25 UTC 2015
Is there a way to obtain the amount of data available to be read?
I'm working with a system that operates in non-blocking mode using
epoll. When an EPOLLIN event is received the aim is to read the data.
For the non-SSL case, the amount of data can be obtained using ioctl
FIONREAD. This is used to malloc a suitable sized buffer, followed by
read the data into the buffer.
How should the SSL version of our code work? At present it is using the
sum of the number obtained from ioctl FIONREAD (which seems suspect when
SSL is in use and appears to be always too large) and the number from
ssl_pending (which seems to be zero). The buffer then has to be truncated.
Can this approach work? Could it be improved? Or is there some
fundamental problem with operating in this way?
More information about the openssl-users
mailing list