From: Viktor Dukhovni Date: Sat, 31 Oct 2015 18:02:23 +0000 (-0400) Subject: Bitrot: 'SSLeay' function names purged from OpenSSL 1.1.0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32bb9198cc38124364d4f28a20de10922981e906;p=thirdparty%2Fpostfix.git Bitrot: 'SSLeay' function names purged from OpenSSL 1.1.0 --- diff --git a/postfix/src/tls/tls.h b/postfix/src/tls/tls.h index 11f9b24f7..853367623 100644 --- a/postfix/src/tls/tls.h +++ b/postfix/src/tls/tls.h @@ -83,6 +83,12 @@ extern const NAME_CODE tls_level_table[]; #if (OPENSSL_VERSION_NUMBER < 0x00090700f) #error "need OpenSSL version 0.9.7 or later" +#endif + + /* Backwards compatibility with OpenSSL < 1.1.0 */ +#if OPENSSL_VERSION_NUMBER < 0x10100000L +#define X509_up_ref(x) CRYPTO_add(&((x)->references), 1, CRYPTO_LOCK_X509) +#define OpenSSL_version_num SSLeay #endif /* SSL_CIPHER_get_name() got constified in 0.9.7g */ diff --git a/postfix/src/tls/tls_fprint.c b/postfix/src/tls/tls_fprint.c index a03e3cc1e..2bb7e21be 100644 --- a/postfix/src/tls/tls_fprint.c +++ b/postfix/src/tls/tls_fprint.c @@ -188,7 +188,7 @@ char *tls_serverid_digest(const TLS_CLIENT_START_PROPS *props, long protomask, msg_panic("digest algorithm \"%s\" not found", mdalg); /* Salt the session lookup key with the OpenSSL runtime version. */ - sslversion = SSLeay(); + sslversion = OpenSSL_version_num(); mdctx = EVP_MD_CTX_create(); checkok(EVP_DigestInit_ex(mdctx, md, NULL)); diff --git a/postfix/src/tls/tls_misc.c b/postfix/src/tls/tls_misc.c index 3497014ed..330a031db 100644 --- a/postfix/src/tls/tls_misc.c +++ b/postfix/src/tls/tls_misc.c @@ -935,7 +935,7 @@ void tls_check_version(void) TLS_VINFO lib_info; tls_version_split(OPENSSL_VERSION_NUMBER, &hdr_info); - tls_version_split(SSLeay(), &lib_info); + tls_version_split(OpenSSL_version_num(), &lib_info); if (lib_info.major != hdr_info.major || lib_info.minor != hdr_info.minor @@ -954,7 +954,7 @@ long tls_bug_bits(void) #if OPENSSL_VERSION_NUMBER >= 0x00908000L && \ OPENSSL_VERSION_NUMBER < 0x10000000L - long lib_version = SSLeay(); + long lib_version = OpenSSL_version_num(); /* * In OpenSSL 0.9.8[ab], enabling zlib compression breaks the padding bug diff --git a/postfix/src/tls/tls_server.c b/postfix/src/tls/tls_server.c index b74c32736..0fd842241 100644 --- a/postfix/src/tls/tls_server.c +++ b/postfix/src/tls/tls_server.c @@ -193,7 +193,7 @@ static SSL_SESSION *get_server_session_cb(SSL *ssl, unsigned char *session_id, buf = vstring_alloc(2 * (len + strlen(service))); \ hex_encode(buf, (char *) (id), (len)); \ vstring_sprintf_append(buf, "&s=%s", (service)); \ - vstring_sprintf_append(buf, "&l=%ld", (long) SSLeay()); \ + vstring_sprintf_append(buf, "&l=%ld", (long) OpenSSL_version_num()); \ } while (0)