Fix compilation with OpenSSL 1.0.1

This commit is contained in:
dmiller 2026-02-25 20:43:12 +00:00
parent a16b2848ef
commit 25a76d7876
4 changed files with 14 additions and 0 deletions

View file

@ -194,6 +194,7 @@ static void set_ssl_ctx_options(SSL_CTX *ctx)
bye("Unable to set OpenSSL cipher list: %s", ERR_error_string(ERR_get_error(), NULL));
}
#if OPENSSL_VERSION_NUMBER >= 0x010002000L
if (o.sslalpn) {
size_t alpn_len;
unsigned char *alpn = next_protos_parse(&alpn_len, o.sslalpn);
@ -212,6 +213,7 @@ static void set_ssl_ctx_options(SSL_CTX *ctx)
free(alpn);
}
#endif
}
#endif

View file

@ -84,6 +84,9 @@
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#include <openssl/err.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define DTLS_server_method DTLSv1_server_method
#endif
#endif
#ifdef WIN32

View file

@ -519,7 +519,11 @@ int main(int argc, char *argv[])
}
else if (strcmp(long_options[option_index].name, "ssl-alpn") == 0) {
o.ssl = 1;
#if OPENSSL_VERSION_NUMBER >= 0x010002000L
o.sslalpn = Strdup(optarg);
#else
bye("This version of OpenSSL does not support ALPN.");
#endif
}
#else
else if (strcmp(long_options[option_index].name, "ssl-cert") == 0) {

View file

@ -64,6 +64,9 @@
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <openssl/provider.h>
#endif
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define DTLS_client_method DTLSv1_client_method
#endif
/* Disallow anonymous ciphers (Diffie-Hellman key agreement), low bit-strength
* ciphers, export-crippled ciphers, and MD5. Prefer ciphers in decreasing order
@ -214,8 +217,10 @@ nsock_ssl_ctx nsock_pool_dtls_init(nsock_pool ms_pool, int flags) {
ms->dtlsctx = dtls_init_common();
dtls_ctx = (SSL_CTX *) nsock_pool_ssl_init_helper(ms->dtlsctx, flags);
#ifdef SSL_OP_TLSEXT_PADDING
/* Don't add padding or the ClientHello will fragment and not connect properly. */
SSL_CTX_clear_options(dtls_ctx, SSL_OP_TLSEXT_PADDING);
#endif
if (!SSL_CTX_set_cipher_list(dtls_ctx, "DEFAULT"))
fatal("Unable to set OpenSSL cipher list: %s",