Added code to handle unexpected EOF on OpenSSL 3