1. Removed internal openssl bio structure

2. Added finding system openssl library and using it
3. Removed libssl depedancy
pull/4740/head
Yashwant Sahu 1 year ago
parent 5ce49f7d2b
commit 2e46f53baf

52
deps/Makefile vendored

@ -38,7 +38,7 @@ endif
STDCPP := -std=c++$(shell echo $(CPLUSPLUS) | cut -c3-4) -DCXX$(shell echo $(CPLUSPLUS) | cut -c3-4)
targets := libconfig libdaemon jemalloc mariadb_client re2 sqlite3 pcre lz4 cityhash microhttpd curl ev libssl libhttpserver libinjection prometheus-cpp postgresql libusual libscram
targets := libconfig libdaemon jemalloc mariadb_client re2 sqlite3 pcre lz4 cityhash microhttpd curl ev libhttpserver libinjection prometheus-cpp postgresql libusual libscram
ifeq ($(SYS_KERN),Linux)
targets += coredumper
endif
@ -69,19 +69,26 @@ endif
libinjection: libinjection/libinjection/src/libinjection.a
libssl_path := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1)
libssl/openssl/libssl.a:
cd libssl && rm -rf openssl-openssl-*/ openssl-3*/ || true
cd libssl && tar -zxf openssl-*.tar.gz
cd libssl && ./verify-bio_st-match.sh
# cd libssl/openssl && patch crypto/ec/curve448/curve448.c < ../curve448.c-multiplication-overflow.patch
# cd libssl/openssl && patch crypto/asn1/a_time.c < ../a_time.c-multiplication-overflow.patch
cd libssl/openssl && ./config no-ssl3 no-tests
cd libssl/openssl && CC=${CC} CXX=${CXX} ${MAKE}
cd libssl/openssl && ln -fs ./ lib # curl wants this path
ifneq ($(libssl_path),)
SSL_LDIR := $(dir $(libssl_path))
$(info Found OpenSSL libs at $(SSL_LDIR))
else
$(error Warning: OpenSSL library not found. exiting, please install openssl.)
endif
ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1)
libssl: libssl/openssl/libssl.a
ifneq ($(ssl_header_path),)
SSL_IDIR := $(shell dirname $(ssl_header_path))
$(info Found OpenSSL headers at $(SSL_IDIR))
else
$(error Warning: OpenSSL headers not found. exiting, please install openssl.)
endif
curl_lib_path:
ln -fs $(SSL_LDIR)/ lib # curl wants this path
libhttpserver/libhttpserver/build/src/.libs/libhttpserver.a: libmicrohttpd/libmicrohttpd/src/microhttpd/.libs/libmicrohttpd.a re2/re2/obj/libre2.a
cd libhttpserver && rm -rf libhttpserver-*/ || true
@ -120,7 +127,7 @@ coredumper/coredumper/src/libcoredumper.a:
cd coredumper/coredumper && CC=${CC} CXX=${CXX} ${MAKE}
coredumper: coredumper/coredumper/src/libcoredumper.a
curl/curl/lib/.libs/libcurl.a: libssl/openssl/libssl.a
curl/curl/lib/.libs/libcurl.a: $(SSL_LDIR)/libssl.a
cd curl && rm -rf curl-*/ || true
cd curl && tar -zxf curl-*.tar.gz
# cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-crypto-auth --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --with-ssl=$(shell pwd)/../../libssl/openssl/ && CC=${CC} CXX=${CXX} ${MAKE}
@ -128,8 +135,8 @@ curl/curl/lib/.libs/libcurl.a: libssl/openssl/libssl.a
ifeq ($(SYS_KERN),Darwin)
cd curl/curl && patch configure < ../configure.patch
endif
cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --without-zstd --with-ssl=$(shell pwd)/libssl/openssl/ --enable-shared=yes
cd curl/curl && LD_LIBRARY_PATH=$(shell pwd)/libssl/openssl CFLAGS=-fPIC CC=${CC} CXX=${CXX} ${MAKE}
cd curl/curl && ./configure --disable-debug --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp --disable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-ntlm-wb --disable-tls-srp --without-nghttp2 --without-libidn2 --without-libssh2 --without-brotli --without-librtmp --without-libpsl --without-zstd --with-ssl --enable-shared=yes
cd curl/curl && LD_LIBRARY_PATH=$(SSL_LDIR) CFLAGS=-fPIC CC=${CC} CXX=${CXX} ${MAKE}
curl: curl/curl/lib/.libs/libcurl.a
@ -194,11 +201,11 @@ jemalloc/jemalloc/lib/libjemalloc.a:
jemalloc: jemalloc/jemalloc/lib/libjemalloc.a
mariadb-client-library/mariadb_client/libmariadb/libmariadbclient.a: libssl/openssl/libssl.a
mariadb-client-library/mariadb_client/libmariadb/libmariadbclient.a: $(SSL_LDIR)/libssl.a
cd mariadb-client-library && rm -rf mariadb-connector-c-*/ || true
cd mariadb-client-library && tar -zxf mariadb-connector-c-3.3.8-src.tar.gz
cd mariadb-client-library/mariadb_client && patch -p0 < ../plugin_auth_CMakeLists.txt.patch
cd mariadb-client-library/mariadb_client && cmake . -Wno-dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=$(shell pwd)/libssl/openssl/ -DOPENSSL_LIBRARIES=$(shell pwd)/libssl/openssl/ -DICONV_LIBRARIES=$(brew --prefix libiconv)/lib -DICONV_INCLUDE=$(brew --prefix libiconv)/include .
cd mariadb-client-library/mariadb_client && cmake . -Wno-dev -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPENSSL_ROOT_DIR=$(SSL_LDIR) -DOPENSSL_LIBRARIES=$(SSL_LDIR) -DICONV_LIBRARIES=$(brew --prefix libiconv)/lib -DICONV_INCLUDE=$(brew --prefix libiconv)/include .
ifeq ($(PROXYDEBUG),1)
cd mariadb-client-library/mariadb_client && patch -p0 < ../ma_context.h.patch
else ifeq ($(USEVALGRIND),1)
@ -304,30 +311,30 @@ pcre/pcre/.libs/libpcre.a:
pcre: pcre/pcre/.libs/libpcre.a
postgresql/postgresql/src/interfaces/libpq/libpq.a : libssl/openssl/libssl.a
postgresql/postgresql/src/interfaces/libpq/libpq.a : $(SSL_LDIR)/libssl.a
cd postgresql && rm -rf postgresql-*/ || true
cd postgresql && tar -zxf postgresql-*.tar.gz
cd postgresql/postgresql && patch -p0 < ../get_result_from_pgconn.patch
cd postgresql/postgresql && patch -p0 < ../handle_row_data.patch
#cd postgresql/postgresql && LD_LIBRARY_PATH="$(shell pwd)/libssl/openssl" ./configure --with-ssl=openssl --with-includes="$(shell pwd)/libssl/openssl/include/" --with-libraries="$(shell pwd)/libssl/openssl/" --without-readline --enable-debug CFLAGS="-ggdb -O0 -fno-omit-frame-pointer" CPPFLAGS="-g -O0"
cd postgresql/postgresql && LD_LIBRARY_PATH="$(shell pwd)/libssl/openssl" ./configure --with-ssl=openssl --with-includes="$(shell pwd)/libssl/openssl/include/" --with-libraries="$(shell pwd)/libssl/openssl/" --without-readline
cd postgresql/postgresql && LD_LIBRARY_PATH="$(SSL_LDIR)" ./configure --with-ssl=openssl --with-includes="$(SSL_IDIR)" --with-libraries="$(SSL_LDIR)" --without-readline
cd postgresql/postgresql/src/interfaces/libpq && CC=${CC} CXX=${CXX} ${MAKE} MAKELEVEL=0
#cd postgresql/postgresql && CC=${CC} CXX=${CXX} ${MAKE} -f src/interfaces/libpq/Makefile all
postgresql: postgresql/postgresql/src/interfaces/libpq/libpq.a
libusual/libusual/.libs/libusual.a: libssl/openssl/libssl.a
libusual/libusual/.libs/libusual.a: $(SSL_LDIR)/libssl.a
cd libusual && rm -rf libusual-*/ || true
cd libusual && tar -zxf libusual-*.tar.gz
cd libusual/libusual && ./autogen.sh
cd libusual/libusual && ./configure --with-openssl="$(shell pwd)/libssl/openssl/" --disable-shared
cd libusual/libusual && ./configure --with-openssl="$(SSL_LDIR)" --disable-shared
cd libusual/libusual && CC=${CC} CXX=${CXX} ${MAKE}
libusual: libusual/libusual/.libs/libusual.a
libscram/lib/libscram.a: libssl/openssl/libssl.a postgresql/postgresql/src/interfaces/libpq/libpq.a
libscram/lib/libscram.a: $(SSL_LDIR)/libssl.a postgresql/postgresql/src/interfaces/libpq/libpq.a
cd libscram && rm -rf lib/* || true
cd libscram && CC=${CC} CXX=${CXX} ${MAKE} LIBOPENSSL_DIR="$(shell pwd)/libssl/openssl" POSTGRESQL_DIR="$(shell pwd)/postgresql/postgresql/"
cd libscram && CC=${CC} CXX=${CXX} ${MAKE} LIBOPENSSL_DIR="$(SSL_LDIR)" POSTGRESQL_DIR="$(shell pwd)/postgresql/postgresql/"
libscram: libscram/lib/libscram.a
@ -355,7 +362,6 @@ cleanall:
cd libmicrohttpd && rm -rf libmicrohttpd-*/ || true
cd curl && rm -rf curl-*/ || true
cd libev && rm -rf libev-*/ || true
cd libssl && rm -rf openssl-openssl-*/ openssl-3*/ || true
cd libconfig && rm -rf libconfig-*/ || true
cd prometheus-cpp && rm -rf prometheus-cpp-*/ || true
cd cityhash && rm -rf cityhash-*/ || true

@ -1,18 +0,0 @@
In ProxySQL 2.0.4 , libssl was upgrade from 1.1.0h to 1.1.1b .
In ProxySQL 2.0.7 , libssl was downgraded back to 1.1.0h . See [bug 2244](https://github.com/sysown/proxysql/issues/2244) .
In ProxySQL 2.1.1 , libssl was upgraded to version 1.1.1j
In ProxySQL 2.4.0 , libssl was upgraded from version 1.1.1j to 3.0.2
In ProxySQL 2.4.8 , libssl was upgraded from version 3.0.2 to 3.0.8
In ProxySQL 2.5.x , libssl was upgraded from version 3.0.8 to 3.1.0
Do not upgrade without extensive testing.
See note about `struct bio_st` in MySQL_Data_Stream.cpp .
Run `verify-bio_st-match.sh` to confirm compatibility.

@ -1,9 +0,0 @@
@@ -248,7 +248,7 @@
}
o++;
}
- if (offset && !OPENSSL_gmtime_adj(&tmp, 0, offset * offsign))
+ if (offset && !OPENSSL_gmtime_adj(&tmp, 0, (long) offset * offsign))
goto err;
} else {
/* not Z, or not +/- in non-strict mode */

@ -1,9 +0,0 @@
@@ -588,7 +588,7 @@
assert(position >= 0);
if (odd & (1 << (table_bits + 1)))
delta -= (1 << (table_bits + 1));
- current -= delta * (1 << pos);
+ current -= (long) delta * (1 << pos);
control[position].power = pos + 16 * (w - 1);
control[position].addend = delta;
position--;

@ -1 +0,0 @@
openssl-3.3.1

Binary file not shown.

@ -1,31 +0,0 @@
#!/usr/bin/env bash
# make sure we have correct cwd
pushd $(dirname $0) &>/dev/null
trap 'popd &>/dev/null' EXIT
echo "checking for 'deps/libssl/openssl/crypto/bio/bio_local.h'"
if [[ ! -e './openssl/crypto/bio/bio_local.h' ]]; then
echo "extracting 'openssl-*.tar.gz'"
tar -zxf openssl-*.tar.gz
fi
echo "extracting 'struct bio_st' from 'deps/libssl/openssl/crypto/bio/bio_local.h'"
DEPBIOST=$(cd ../../; cat ./deps/libssl/openssl/crypto/bio/bio_local.h | sed -n '/^struct bio_st {/,/}/p')
echo "extracting 'struct bio_st' from 'lib/mysql_data_stream.cpp'"
LIBBIOST=$(cd ../../; cat ./lib/mysql_data_stream.cpp | sed '/^\/\*/,/*\//d' | sed -n '/^struct bio_st {/,/}/p')
echo -n "Comparing ... "
if [[ "$LIBBIOST" =~ "$DEPBIOST" ]]; then
echo "PASS - bio_st is a match!"
else
echo "FAIL - bio_st does not match!"
echo
echo ">>> lib/mysql_data_stream.cpp"
echo "$LIBBIOST"
echo "==="
echo "$DEPBIOST"
echo "<<< deps/libssl/openssl/crypto/bio/bio_local.h"
exit 1
fi

@ -11,61 +11,6 @@
#include "openssl/x509v3.h"
/*
in libssl 1.1.0
struct bio_st {
const BIO_METHOD *method;
long (*callback) (struct bio_st *, int, const char *, int, long, long);
char *cb_arg;
int init;
int shutdown;
int flags;
int retry_reason;
int num;
void *ptr;
struct bio_st *next_bio;
struct bio_st *prev_bio;
int references;
uint64_t num_read;
uint64_t num_write;
CRYPTO_EX_DATA ex_data;
CRYPTO_RWLOCK *lock;
};
*/
typedef int CRYPTO_REF_COUNT;
/**
* @brief This is the 'bio_st' struct definition from libssl 3.0.0. NOTE: This is an internal struct from
* OpenSSL library, currently it's used for performing checks on the reads/writes performed on the BIO objects.
* It's extremely important to keep this struct up to date with each OpenSSL dependency update.
*/
struct bio_st {
OSSL_LIB_CTX* libctx;
const BIO_METHOD* method;
/* bio, mode, argp, argi, argl, ret */
#ifndef OPENSSL_NO_DEPRECATED_3_0
BIO_callback_fn callback;
#endif
BIO_callback_fn_ex callback_ex;
char* cb_arg; /* first argument for the callback */
int init;
int shutdown;
int flags; /* extra storage */
int retry_reason;
int num;
void* ptr;
struct bio_st* next_bio; /* used by filter BIOs */
struct bio_st* prev_bio; /* used by filter BIOs */
CRYPTO_REF_COUNT references;
uint64_t num_read;
uint64_t num_write;
CRYPTO_EX_DATA ex_data;
CRYPTO_RWLOCK* lock;
};
#define RESULTSET_BUFLEN_DS_16K 16000
#define RESULTSET_BUFLEN_DS_1M 1000*1024
@ -602,8 +547,8 @@ int PgSQL_Data_Stream::read_from_net() {
//ssize_t n = read(fd, buf, sizeof(buf));
int n = recv(fd, buf, sizeof(buf), 0);
//proxy_info("SSL recv of %d bytes\n", n);
proxy_debug(PROXY_DEBUG_NET, 7, "Session=%p: recv() read %d bytes. num_write: %lu , num_read: %lu\n", sess, n, rbio_ssl->num_write, rbio_ssl->num_read);
if (n > 0 || rbio_ssl->num_write > rbio_ssl->num_read) {
proxy_debug(PROXY_DEBUG_NET, 7, "Session=%p: recv() read %d bytes. num_write: %lu , num_read: %lu\n", sess, n, BIO_number_written(rbio_ssl), BIO_number_read(rbio_ssl));
if (n > 0 || BIO_number_written(rbio_ssl) > BIO_number_read(rbio_ssl)) {
//on_read_cb(buf, (size_t)n);
char buf2[MY_SSL_BUFFER];
@ -728,7 +673,7 @@ int PgSQL_Data_Stream::write_to_net() {
if (encrypted == false) {
return 0;
}
if (ssl_write_len == 0 && wbio_ssl->num_write == wbio_ssl->num_read) {
if (ssl_write_len == 0 && BIO_number_written(wbio_ssl) == BIO_number_read(wbio_ssl)) {
return 0;
}
}
@ -738,7 +683,7 @@ int PgSQL_Data_Stream::write_to_net() {
bytes_io = SSL_write(ssl, queue_r_ptr(queueOUT), s);
//proxy_info("Used SSL_write to write %d bytes\n", bytes_io);
proxy_debug(PROXY_DEBUG_NET, 7, "Session=%p, Datastream=%p: SSL_write() wrote %d bytes . queueOUT before: %u\n", sess, this, bytes_io, queue_data(queueOUT));
if (ssl_write_len || wbio_ssl->num_write > wbio_ssl->num_read) {
if (ssl_write_len || BIO_number_written(wbio_ssl) > BIO_number_read(wbio_ssl)) {
//proxy_info("ssl_write_len = %d , num_write = %d , num_read = %d\n", ssl_write_len , wbio_ssl->num_write , wbio_ssl->num_read);
char buf[MY_SSL_BUFFER];
do {
@ -861,7 +806,7 @@ void PgSQL_Data_Stream::set_pollout() {
_pollfd->events |= POLLOUT;
}
if (encrypted) {
if (ssl_write_len || wbio_ssl->num_write > wbio_ssl->num_read) {
if (ssl_write_len || BIO_number_written(wbio_ssl) > BIO_number_read(wbio_ssl)) {
_pollfd->events |= POLLOUT;
}
else {
@ -966,7 +911,7 @@ int PgSQL_Data_Stream::write_to_net_poll() {
}
if (call_write_to_net == false) {
if (encrypted) {
if (ssl_write_len || wbio_ssl->num_write > wbio_ssl->num_read) {
if (ssl_write_len || BIO_number_written(wbio_ssl) > BIO_number_read(wbio_ssl)) {
call_write_to_net = true;
}
}
@ -1338,7 +1283,7 @@ void PgSQL_Data_Stream::destroy_MySQL_Connection_From_Pool(bool sq) {
}
bool PgSQL_Data_Stream::data_in_rbio() {
if (rbio_ssl->num_write > rbio_ssl->num_read) {
if (BIO_number_written(rbio_ssl) > BIO_number_read(rbio_ssl)) {
return true;
}
return false;

@ -14,93 +14,6 @@ using json = nlohmann::json;
#include "openssl/x509v3.h"
/**
* @brief This is the 'bio_st' struct definition from libssl. NOTE: This is an internal struct from
* OpenSSL library, currently it's used for performing checks on the reads/writes performed on the BIO objects.
* It's extremely important to keep this struct up to date with each OpenSSL dependency update.
*/
typedef int CRYPTO_REF_COUNT;
#if (OPENSSL_VERSION_NUMBER & 0xFFFF0000) == 0x10100000
#pragma message "libssl 1.1.x detected"
struct bio_st {
const BIO_METHOD *method;
/* bio, mode, argp, argi, argl, ret */
BIO_callback_fn callback;
BIO_callback_fn_ex callback_ex;
char *cb_arg; /* first argument for the callback */
int init;
int shutdown;
int flags; /* extra storage */
int retry_reason;
int num;
void *ptr;
struct bio_st *next_bio; /* used by filter BIOs */
struct bio_st *prev_bio; /* used by filter BIOs */
CRYPTO_REF_COUNT references;
uint64_t num_read;
uint64_t num_write;
CRYPTO_EX_DATA ex_data;
CRYPTO_RWLOCK *lock;
};
#elif (OPENSSL_VERSION_NUMBER & 0xFFFF0000) == 0x30000000 || (OPENSSL_VERSION_NUMBER & 0xFFFF0000) == 0x30100000
#pragma message "libssl 3.0.x / 3.1.x detected"
struct bio_st {
OSSL_LIB_CTX *libctx;
const BIO_METHOD *method;
/* bio, mode, argp, argi, argl, ret */
#ifndef OPENSSL_NO_DEPRECATED_3_0
BIO_callback_fn callback;
#endif
BIO_callback_fn_ex callback_ex;
char *cb_arg; /* first argument for the callback */
int init;
int shutdown;
int flags; /* extra storage */
int retry_reason;
int num;
void *ptr;
struct bio_st *next_bio; /* used by filter BIOs */
struct bio_st *prev_bio; /* used by filter BIOs */
CRYPTO_REF_COUNT references;
uint64_t num_read;
uint64_t num_write;
CRYPTO_EX_DATA ex_data;
CRYPTO_RWLOCK *lock;
};
#elif (OPENSSL_VERSION_NUMBER & 0xFFFF0000) == 0x30200000 || (OPENSSL_VERSION_NUMBER & 0xFFFF0000) == 0x30300000
#pragma message "libssl 3.2.x / 3.3.x detected"
struct bio_st {
OSSL_LIB_CTX *libctx;
const BIO_METHOD *method;
/* bio, mode, argp, argi, argl, ret */
#ifndef OPENSSL_NO_DEPRECATED_3_0
BIO_callback_fn callback;
#endif
BIO_callback_fn_ex callback_ex;
char *cb_arg; /* first argument for the callback */
int init;
int shutdown;
int flags; /* extra storage */
int retry_reason;
int num;
void *ptr;
struct bio_st *next_bio; /* used by filter BIOs */
struct bio_st *prev_bio; /* used by filter BIOs */
CRYPTO_REF_COUNT references;
uint64_t num_read;
uint64_t num_write;
CRYPTO_EX_DATA ex_data;
};
#else
#error "libssl version not supported: OPENSSL_VERSION_NUMBER = " ##OPENSSL_VERSION_NUMBER
#endif
#define RESULTSET_BUFLEN_DS_16K 16000
#define RESULTSET_BUFLEN_DS_1M 1000*1024
@ -608,7 +521,7 @@ int MySQL_Data_Stream::read_from_net() {
int ssl_recv_bytes = recv(fd, buf, sizeof(buf), 0);
proxy_debug(PROXY_DEBUG_NET, 7, "Session=%p: recv() read %d bytes. num_write: %lu , num_read: %lu\n", sess, ssl_recv_bytes, rbio_ssl->num_write , rbio_ssl->num_read);
if (ssl_recv_bytes > 0 || rbio_ssl->num_write > rbio_ssl->num_read) {
if (ssl_recv_bytes > 0 || BIO_number_written(rbio_ssl) > BIO_number_read(rbio_ssl)) {
char buf2[MY_SSL_BUFFER];
int n2;
enum sslstatus status;
@ -731,7 +644,7 @@ int MySQL_Data_Stream::write_to_net() {
if (encrypted == false) {
return 0;
}
if (ssl_write_len == 0 && wbio_ssl->num_write == wbio_ssl->num_read) {
if (ssl_write_len == 0 && BIO_number_written(wbio_ssl) == BIO_number_read(wbio_ssl)) {
return 0;
}
}
@ -741,7 +654,7 @@ int MySQL_Data_Stream::write_to_net() {
bytes_io = SSL_write (ssl, queue_r_ptr(queueOUT), s);
//proxy_info("Used SSL_write to write %d bytes\n", bytes_io);
proxy_debug(PROXY_DEBUG_NET, 7, "Session=%p, Datastream=%p: SSL_write() wrote %d bytes . queueOUT before: %u\n", sess, this, bytes_io, queue_data(queueOUT));
if (ssl_write_len || wbio_ssl->num_write > wbio_ssl->num_read) {
if (ssl_write_len || BIO_number_written(wbio_ssl) > BIO_number_read(wbio_ssl)) {
//proxy_info("ssl_write_len = %d , num_write = %d , num_read = %d\n", ssl_write_len , wbio_ssl->num_write , wbio_ssl->num_read);
char buf[MY_SSL_BUFFER];
do {
@ -857,7 +770,7 @@ void MySQL_Data_Stream::set_pollout() {
_pollfd->events |= POLLOUT;
}
if (encrypted) {
if (ssl_write_len || wbio_ssl->num_write > wbio_ssl->num_read) {
if (ssl_write_len || BIO_number_written(wbio_ssl) > BIO_number_read(wbio_ssl)) {
_pollfd->events |= POLLOUT;
} else {
if (!SSL_is_init_finished(ssl)) {
@ -955,7 +868,7 @@ int MySQL_Data_Stream::write_to_net_poll() {
}
if (call_write_to_net == false) {
if (encrypted) {
if (ssl_write_len || wbio_ssl->num_write > wbio_ssl->num_read) {
if (ssl_write_len || BIO_number_written(wbio_ssl) > BIO_number_read(wbio_ssl)) {
call_write_to_net = true;
}
}
@ -1629,7 +1542,7 @@ void MySQL_Data_Stream::destroy_MySQL_Connection_From_Pool(bool sq) {
}
bool MySQL_Data_Stream::data_in_rbio() {
if (rbio_ssl->num_write > rbio_ssl->num_read) {
if (BIO_number_written(rbio_ssl) > BIO_number_read(rbio_ssl)) {
return true;
}
return false;

@ -81,9 +81,23 @@ CURL_PATH := $(DEPS_PATH)/curl/curl
CURL_IDIR := $(CURL_PATH)/include
CURL_LDIR := $(CURL_PATH)/lib/.libs
SSL_PATH := $(DEPS_PATH)/libssl/openssl/
SSL_IDIR := $(SSL_PATH)/include
SSL_LDIR := $(SSL_PATH)
libssl_path := $(shell find /usr /usr/local /opt -name "libssl.so" 2>/dev/null | head -n 1)
ifneq ($(libssl_path),)
SSL_LDIR := $(dir $(libssl_path))
$(info Found OpenSSL libs at $(SSL_LDIR))
else
$(error Warning: OpenSSL library not found. exiting, please install openssl.)
endif
ssl_header_path := $(shell find /usr /usr/local /opt -name "ssl.h" -path "*/openssl/*" 2>/dev/null | head -n 1)
ifneq ($(ssl_header_path),)
SSL_IDIR := $(shell dirname $(ssl_header_path))
$(info Found OpenSSL headers at $(SSL_IDIR))
else
$(error Warning: OpenSSL headers not found. exiting, please install openssl.)
endif
EV_PATH := $(DEPS_PATH)/libev/libev/
EV_IDIR := $(EV_PATH)

Loading…
Cancel
Save