Author: stsp Date: Tue Dec 20 09:46:27 2016 New Revision: 1775239 URL: http://svn.apache.org/viewvc?rev=1775239&view=rev Log: Check for BIO wrapper functions instead of making blind assumptions about their existence based on the value of the OPENSSL_VERSION_NUMBER macro.
Fixes some of the build problems with LibreSSL. * SConstruct: Check for BIO_set_init and provide SERF_NO_SSL_BIO_WRAPPERS. * buckets/ssl_buckets.c: Use SERF_NO_SSL_BIO_WRAPPERS instead of USE_LEGACY_OPENSSL where BIO wrappers are used. Modified: serf/trunk/SConstruct serf/trunk/buckets/ssl_buckets.c Modified: serf/trunk/SConstruct URL: http://svn.apache.org/viewvc/serf/trunk/SConstruct?rev=1775239&r1=1775238&r2=1775239&view=diff ============================================================================== --- serf/trunk/SConstruct (original) +++ serf/trunk/SConstruct Tue Dec 20 09:46:27 2016 @@ -415,6 +415,12 @@ else: env.Append(CPPPATH=['$OPENSSL/include']) env.Append(LIBPATH=['$OPENSSL/lib']) +# Check for OpenSSL functions which are only available in some of +# the versions we support. Also handles forks like LibreSSL. +conf = Configure(env) +if not conf.CheckFunc('BIO_set_init'): + env.Append(CPPDEFINES=['SERF_NO_SSL_BIO_WRAPPERS']) +env = conf.Finish() # If build with gssapi, get its information and define SERF_HAVE_GSSAPI if gssapi and CALLOUT_OKAY: Modified: serf/trunk/buckets/ssl_buckets.c URL: http://svn.apache.org/viewvc/serf/trunk/buckets/ssl_buckets.c?rev=1775239&r1=1775238&r2=1775239&view=diff ============================================================================== --- serf/trunk/buckets/ssl_buckets.c (original) +++ serf/trunk/buckets/ssl_buckets.c Tue Dec 20 09:46:27 2016 @@ -322,7 +322,7 @@ static void log_ssl_error(serf_ssl_conte static void bio_set_data(BIO *bio, void *data) { -#ifndef USE_LEGACY_OPENSSL +#ifndef SERF_NO_SSL_BIO_WRAPPERS BIO_set_data(bio, data); #else bio->ptr = data; @@ -331,7 +331,7 @@ static void bio_set_data(BIO *bio, void static void *bio_get_data(BIO *bio) { -#ifndef USE_LEGACY_OPENSSL +#ifndef SERF_NO_SSL_BIO_WRAPPERS return BIO_get_data(bio); #else return bio->ptr; @@ -463,7 +463,7 @@ static int bio_file_gets(BIO *bio, char static int bio_bucket_create(BIO *bio) { -#ifndef USE_LEGACY_OPENSSL +#ifndef SERF_NO_SSL_BIO_WRAPPERS BIO_set_shutdown(bio, 1); BIO_set_init(bio, 1); BIO_set_data(bio, NULL); @@ -506,7 +506,7 @@ static long bio_bucket_ctrl(BIO *bio, in return ret; } -#ifdef USE_LEGACY_OPENSSL +#ifdef SERF_NO_SSL_BIO_WRAPPERS static BIO_METHOD bio_bucket_method = { BIO_TYPE_MEM, "Serf SSL encryption and decryption buckets", @@ -542,7 +542,7 @@ static BIO_METHOD *bio_meth_bucket_new(v { BIO_METHOD *biom = NULL; -#ifndef USE_LEGACY_OPENSSL +#ifndef SERF_NO_SSL_BIO_WRAPPERS biom = BIO_meth_new(BIO_TYPE_MEM, "Serf SSL encryption and decryption buckets"); if (biom) { @@ -563,7 +563,7 @@ static BIO_METHOD *bio_meth_file_new(voi { BIO_METHOD *biom = NULL; -#ifndef USE_LEGACY_OPENSSL +#ifndef SERF_NO_SSL_BIO_WRAPPERS biom = BIO_meth_new(BIO_TYPE_FILE, "Wrapper around APR file structures"); if (biom) { BIO_meth_set_write(biom, bio_file_write); @@ -582,7 +582,7 @@ static BIO_METHOD *bio_meth_file_new(voi static void bio_meth_free(BIO_METHOD *biom) { -#ifndef USE_LEGACY_OPENSSL +#ifndef SERF_NO_SSL_BIO_WRAPPERS BIO_meth_free(biom); #endif }