Skip to content

Commit

Permalink
Fix SSL_get_client/server_random checks
Browse files Browse the repository at this point in the history
Needed for conditionally avoiding accessing private OpenSSL structures
in a following patch.

Backported from v3.1.x.
  • Loading branch information
spbnick committed Dec 7, 2016
1 parent c791133 commit ce91702
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
26 changes: 15 additions & 11 deletions configure
Expand Up @@ -8779,6 +8779,21 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
for ac_func in \
SSL_get_client_random \
SSL_get_server_random \
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
CPPFLAGS="$old_CPPFLAGS"
fi
Expand All @@ -8787,17 +8802,6 @@ fi
export OPENSSL_LIBS OPENSSL_LDFLAGS OPENSSL_CPPFLAGS
for ac_func in SSL_get_client_random
do :
ac_fn_c_check_func "$LINENO" "SSL_get_client_random" "ac_cv_func_SSL_get_client_random"
if test "x$ac_cv_func_SSL_get_client_random" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SSL_GET_CLIENT_RANDOM 1
_ACEOF
SSL_get_server_random
fi
done
fi
if test "x$PCAP_LIBS" = x; then
Expand Down
8 changes: 7 additions & 1 deletion configure.ac
Expand Up @@ -1174,6 +1174,13 @@ if test "x$WITH_OPENSSL" = xyes; then
AC_MSG_RESULT([cross-compiling (assuming yes)])
]
)
dnl #
dnl # Check if the new HMAC_CTX interface is defined
dnl #
AC_CHECK_FUNCS( \
SSL_get_client_random \
SSL_get_server_random \
)
CPPFLAGS="$old_CPPFLAGS"
fi

Expand All @@ -1182,7 +1189,6 @@ if test "x$WITH_OPENSSL" = xyes; then
AC_SUBST(OPENSSL_LDFLAGS)
AC_SUBST(OPENSSL_CPPFLAGS)
export OPENSSL_LIBS OPENSSL_LDFLAGS OPENSSL_CPPFLAGS
AC_CHECK_FUNCS(SSL_get_client_random,SSL_get_server_random)
fi

dnl #
Expand Down
3 changes: 3 additions & 0 deletions src/include/autoconf.h.in
Expand Up @@ -374,6 +374,9 @@
/* Define to 1 if you have the `SSL_get_client_random' function. */
#undef HAVE_SSL_GET_CLIENT_RANDOM

/* Define to 1 if you have the `SSL_get_server_random' function. */
#undef HAVE_SSL_GET_SERVER_RANDOM

/* Define to 1 if you have the <stdbool.h> header file. */
#undef HAVE_STDBOOL_H

Expand Down

0 comments on commit ce91702

Please sign in to comment.