Fix compatibility with LibreSSL and OpenSSL < 1.1.