Fixing the real cause for the TLS test failure

The mocking function for SSL_read was returning the value that I assigned,
regardless of the size of the buffer. This commit fixes that, if the buffer
is smaller than the value assigned, then the size of the buffer is returned
instead. Same fix was applied to the write function.