check for BIO_{get,set}_data and BIO_set_init

LibreSSL implements those functions since 2.7 so to fix build failure
with newer LibreSSL we need to check if those functions are implemented
in stead of just check for OpenSSL 1.1.

fixes #1156

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
This commit is contained in:
Natanael Copa 2018-04-02 20:32:02 +00:00
parent 4c3a3acf9b
commit dc775b0801
2 changed files with 11 additions and 4 deletions

View File

@ -359,6 +359,11 @@ PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.1],
if test "x${have_openssl}" = "xno"; then if test "x${have_openssl}" = "xno"; then
AC_MSG_NOTICE($OPENSSL_PKG_ERRORS) AC_MSG_NOTICE($OPENSSL_PKG_ERRORS)
fi fi
save_LIBS=$LIBS
LIBS=$OPENSSL_LIBS
AC_CHECK_FUNCS(BIO_set_data BIO_get_data BIO_set_init)
LIBS=$save_LIBS
# c-ares (for src) # c-ares (for src)
PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.5], [have_libcares=yes], PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.5], [have_libcares=yes],

View File

@ -44,13 +44,15 @@ using namespace nghttp2;
namespace shrpx { namespace shrpx {
#if !OPENSSL_1_1_API #ifndef HAVE_BIO_GET_DATA
void *BIO_get_data(BIO *bio) { return bio->ptr; } void *BIO_get_data(BIO *bio) { return bio->ptr; }
#endif
#ifndef HAVE_BIO_SET_DATA
void BIO_set_data(BIO *bio, void *ptr) { bio->ptr = ptr; } void BIO_set_data(BIO *bio, void *ptr) { bio->ptr = ptr; }
#endif
#ifndef HAVE_BIO_SET_INIT
void BIO_set_init(BIO *bio, int init) { bio->init = init; } void BIO_set_init(BIO *bio, int init) { bio->init = init; }
#endif
#endif // !OPENSSL_1_1_API
Connection::Connection(struct ev_loop *loop, int fd, SSL *ssl, Connection::Connection(struct ev_loop *loop, int fd, SSL *ssl,
MemchunkPool *mcpool, ev_tstamp write_timeout, MemchunkPool *mcpool, ev_tstamp write_timeout,