Skip to content

Commit

Permalink
Replace check for DTLS_client_method with OPENSSL_NO_DTLS
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Apr 2, 2024
1 parent c1c9fcc commit ba26cc7
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 36 deletions.
2 changes: 1 addition & 1 deletion ncat/ncat_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ int ncat_connect(void)
nsock_pool_set_broadcast(mypool, 1);

#ifdef HAVE_OPENSSL
#ifdef HAVE_DTLS_CLIENT_METHOD
#ifndef OPENSSL_NO_DTLS
if(o.proto == IPPROTO_UDP)
set_ssl_ctx_options((SSL_CTX *) nsock_pool_dtls_init(mypool, 0));
else
Expand Down
2 changes: 1 addition & 1 deletion ncat/ncat_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ int main(int argc, char *argv[])

if (o.proto == IPPROTO_UDP) {

#ifndef HAVE_DTLS_CLIENT_METHOD
#ifdef OPENSSL_NO_DTLS
if (o.ssl)
bye("OpenSSL does not have DTLS support compiled in.");
#endif
Expand Down
1 change: 0 additions & 1 deletion nsock/include/nsock_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
#undef HAVE_NETDB_H

#undef HAVE_OPENSSL
#undef HAVE_DTLS_CLIENT_METHOD
#undef HAVE_ALPN_SUPPORT

#undef HAVE_EPOLL
Expand Down
1 change: 0 additions & 1 deletion nsock/include/nsock_winconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,4 @@
#endif

#define HAVE_OPENSSL 1
#define HAVE_DTLS_CLIENT_METHOD 1
#endif /* NSOCK_WINCONFIG_H */
24 changes: 0 additions & 24 deletions nsock/src/configure
Original file line number Diff line number Diff line change
Expand Up @@ -4916,30 +4916,6 @@ $as_echo "#define HAVE_OPENSSL 1" >>confdefs.h
OPENSSL_LIBS="-lssl -lcrypto"
LIBS_TMP="$LIBS"
LIBS="$OPENSSL_LIBS $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DTLS_client_method" >&5
$as_echo_n "checking for DTLS_client_method... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <openssl/ssl.h>
int
main ()
{
DTLS_client_method()
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; };
$as_echo "#define HAVE_DTLS_CLIENT_METHOD 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_set_alpn_protos" >&5
$as_echo_n "checking for SSL_set_alpn_protos... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
Expand Down
4 changes: 0 additions & 4 deletions nsock/src/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,6 @@ if test "$use_openssl" = "yes"; then
OPENSSL_LIBS="-lssl -lcrypto"
LIBS_TMP="$LIBS"
LIBS="$OPENSSL_LIBS $LIBS"
AC_MSG_CHECKING([for DTLS_client_method])
AC_TRY_LINK([#include <openssl/ssl.h>], [DTLS_client_method()],
[AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_DTLS_CLIENT_METHOD, 1, [DTLS_client_method available])],
[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([for SSL_set_alpn_protos])
AC_TRY_LINK([#include <openssl/ssl.h>], [SSL_set_alpn_protos(NULL, NULL, 0)],
[AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_ALPN_SUPPORT, 1, [SSL ALPN protos support])],
Expand Down
2 changes: 1 addition & 1 deletion nsock/src/nsock_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ struct npool {
#if HAVE_OPENSSL
/* The SSL Context (options and such) */
SSL_CTX *sslctx;
#ifdef HAVE_DTLS_CLIENT_METHOD
#ifndef OPENSSL_NO_DTLS
SSL_CTX *dtlsctx;
#endif
#endif
Expand Down
6 changes: 3 additions & 3 deletions nsock/src/nsock_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ void nsp_ssl_cleanup(struct npool *nsp)
{
if (nsp->sslctx != NULL)
SSL_CTX_free(nsp->sslctx);
#ifdef HAVE_DTLS_CLIENT_METHOD
#ifndef OPENSSL_NO_DTLS
if (nsp->dtlsctx != NULL)
SSL_CTX_free(nsp->dtlsctx);
#endif
}
nsp->sslctx = NULL;
#ifdef HAVE_DTLS_CLIENT_METHOD
#ifndef OPENSSL_NO_DTLS
nsp->dtlsctx = NULL;
#endif
}
Expand Down Expand Up @@ -198,7 +198,7 @@ nsock_ssl_ctx nsock_pool_ssl_init(nsock_pool ms_pool, int flags) {
return nsock_pool_ssl_init_helper(ms->sslctx, flags);
}

#ifdef HAVE_DTLS_CLIENT_METHOD
#ifndef OPENSSL_NO_DTLS

/* Create an SSL_CTX and do initialisation, creating a DTLS client */
static SSL_CTX *dtls_init_common() {
Expand Down

0 comments on commit ba26cc7

Please sign in to comment.