Skip to content

Commit

Permalink
run openssl verify-bio_st-match.sh script before build
Browse files Browse the repository at this point in the history
  • Loading branch information
mirostauder committed Mar 28, 2023
1 parent 1b05ff4 commit c2c3268
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ endif
libinjection: libinjection/libinjection/src/libinjection.a


BIO_MATCH := $(shell ./libssl/verify-bio_st-match.sh \&>/dev/null; echo $$?)
ifneq ($(BIO_MATCH),0)
$(error Incompatible OpenSSL version: struct bio_st mismatch!)
endif

libssl/openssl/libssl.a:
cd libssl && rm -rf openssl-openssl-*/ openssl-3*/ || true
cd libssl && tar -zxf openssl-*.tar.gz
Expand All @@ -93,6 +98,7 @@ libssl/openssl/libssl.a:

libssl: libssl/openssl/libssl.a


MIN_VERSION := 4.9.0
GCC_VERSION := $(shell gcc -dumpversion)
SORTED_VERSIONS := $(shell echo -e "$(GCC_VERSION)\n$(MIN_VERSION)" | sort -V)
Expand Down
6 changes: 3 additions & 3 deletions deps/libssl/verify-bio_st-match.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
pushd $(dirname $0) &>/dev/null
trap 'popd &>/dev/null' EXIT

echo "checking for './deps/libssl/openssl/crypto/bio/bio_local.h'"
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'"
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'"
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 ... "
Expand Down

0 comments on commit c2c3268

Please sign in to comment.