fix builds on OpenSSL <= 1.0.x

I thought OpenSSL 1.0.x offered the new-style OpenSSL_version_num() API
to obtain version number, but they don't.
This commit is contained in:
Damien Miller 2018-10-26 13:43:28 +11:00
parent 859754bdeb
commit 406a24b25d
2 changed files with 14 additions and 1 deletions

View File

@ -2601,7 +2601,11 @@ if test "x$openssl" = "xyes" ; then
fd = fopen(DATA,"w"); fd = fopen(DATA,"w");
if(fd == NULL) if(fd == NULL)
exit(1); exit(1);
#if OPENSSL_VERSION_NUMBER < 0x10100000L
# define OpenSSL_version_num SSLeay
# define OpenSSL_version SSLeay_version
# define OPENSSL_VERSION SSLEAY_VERSION
#endif
if ((rc = fprintf(fd, "%08lx (%s)\n", if ((rc = fprintf(fd, "%08lx (%s)\n",
(unsigned long)OpenSSL_version_num(), (unsigned long)OpenSSL_version_num(),
OpenSSL_version(OPENSSL_VERSION))) < 0) OpenSSL_version(OPENSSL_VERSION))) < 0)
@ -2646,6 +2650,9 @@ if test "x$openssl" = "xyes" ; then
#include <openssl/opensslv.h> #include <openssl/opensslv.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
]], [[ ]], [[
#if OPENSSL_VERSION_NUMBER < 0x10100000L
# define OpenSSL_version_num SSLeay
#endif
exit(OpenSSL_version_num() == OPENSSL_VERSION_NUMBER ? 0 : 1); exit(OpenSSL_version_num() == OPENSSL_VERSION_NUMBER ? 0 : 1);
]])], ]])],
[ [

View File

@ -33,6 +33,12 @@ int ssh_compatible_openssl(long, long);
# error OpenSSL 0.9.8f or greater is required # error OpenSSL 0.9.8f or greater is required
#endif #endif
#if OPENSSL_VERSION_NUMBER < 0x10100000L
# define OpenSSL_version_num SSLeay
# define OpenSSL_version SSLeay_version
# define OPENSSL_VERSION SSLEAY_VERSION
#endif
#if OPENSSL_VERSION_NUMBER < 0x10000001L #if OPENSSL_VERSION_NUMBER < 0x10000001L
# define LIBCRYPTO_EVP_INL_TYPE unsigned int # define LIBCRYPTO_EVP_INL_TYPE unsigned int
#else #else