2021-06-15 09:52:49 +02:00
|
|
|
#!/usr/bin/env bash
|
2017-05-12 17:21:45 +02:00
|
|
|
#
|
2019-02-22 15:09:05 +01:00
|
|
|
# This script compiles the "bad openssl" version, 1.0.2 supporting legacy
|
|
|
|
# cryptography for Linux, FreeBSD and Darwin.
|
2017-05-12 17:21:45 +02:00
|
|
|
#
|
2019-02-22 15:09:05 +01:00
|
|
|
# License GPLv2, see ../LICENSE
|
2015-07-17 11:01:33 +02:00
|
|
|
|
2019-02-22 11:17:57 +01:00
|
|
|
|
|
|
|
STDOPTIONS="--prefix=/usr/ -DOPENSSL_USE_BUILD_DATE enable-zlib \
|
2015-07-20 12:48:24 +02:00
|
|
|
enable-ssl2 enable-ssl3 enable-ssl-trace enable-rc5 enable-rc2 \
|
2015-07-20 21:46:04 +02:00
|
|
|
enable-gost enable-cms enable-md2 enable-mdc2 enable-ec enable-ec2m enable-ecdh enable-ecdsa \
|
2016-06-23 11:04:58 +02:00
|
|
|
enable-seed enable-camellia enable-idea enable-rfc3779 experimental-jpake"
|
2015-06-10 08:15:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
error() {
|
2017-05-12 17:21:45 +02:00
|
|
|
tput bold
|
|
|
|
echo "### ERROR $1 ###"
|
|
|
|
tput sgr0
|
|
|
|
exit 2
|
|
|
|
}
|
|
|
|
|
|
|
|
clean() {
|
|
|
|
case $NOCLEAN in
|
|
|
|
yes|Y|YES) ;;
|
2019-02-22 11:17:57 +01:00
|
|
|
*)
|
|
|
|
if [ -e "Makefile" ]; then
|
|
|
|
make clean
|
|
|
|
[ $? -ne 0 ] && error "no openssl directory"
|
|
|
|
fi
|
2017-05-12 17:21:45 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
return 0
|
2015-06-10 08:15:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
makeall() {
|
2017-05-12 17:21:45 +02:00
|
|
|
make depend || error "depend"
|
|
|
|
make || error "making"
|
|
|
|
make report || error "testing/make report"
|
|
|
|
#FIXME: we need another error handler, as of now a failure doesn't mean a return status of != 0
|
|
|
|
# see https://github.com/openssl/openssl/pull/336
|
|
|
|
return 0
|
2015-06-10 08:15:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
copyfiles() {
|
2017-05-12 17:21:45 +02:00
|
|
|
local ret
|
|
|
|
local target=../openssl.$(uname).$(uname -m).$1
|
|
|
|
|
|
|
|
echo; apps/openssl version -a; echo
|
|
|
|
if [ -e "$target" ]; then
|
|
|
|
case $(uname) in
|
|
|
|
*BSD|*Darwin)
|
|
|
|
mv $target $target-$(stat -f "%Sm" -t "%Y-%m-%d %H:%M" "$target" | sed -e 's/ .*$//' -e 's/-//g')
|
|
|
|
;;
|
|
|
|
*) mv $target $target-$(stat -c %y $target | awk '{ print $1 }' | sed -e 's/ .*$//' -e 's/-//g') ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
cp -pf apps/openssl ../openssl.$(uname).$(uname -m).$1
|
|
|
|
ret=$?
|
|
|
|
echo
|
|
|
|
ls -l apps/openssl ../openssl.$(uname).$(uname -m).$1
|
|
|
|
return $ret
|
2015-06-10 08:15:28 +02:00
|
|
|
}
|
|
|
|
|
2016-06-23 11:04:58 +02:00
|
|
|
testv6_patch() {
|
2017-05-12 17:21:45 +02:00
|
|
|
if grep -q 'ending bracket for IPv6' apps/s_socket.c; then
|
|
|
|
STDOPTIONS="$STDOPTIONS -DOPENSSL_USE_IPV6"
|
|
|
|
echo "detected IPv6 patch thus compiling in IPv6 support"
|
2015-06-10 08:15:28 +02:00
|
|
|
echo
|
2017-05-12 17:21:45 +02:00
|
|
|
else
|
|
|
|
echo
|
|
|
|
echo "no IPv6 patch (Fedora) detected!! -- Press ^C and dl & apply from"
|
|
|
|
echo "https://github.com/drwetter/testssl.sh/blob/master/bin/fedora-dirk-ipv6.diff"
|
|
|
|
echo "or press any key to ignore"
|
|
|
|
echo
|
|
|
|
read a
|
|
|
|
fi
|
2016-06-23 11:04:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-12 17:58:20 +02:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "###################################################################"
|
|
|
|
echo "####### Build script for Peter Mosmans openssl fork #######"
|
|
|
|
echo "####### which contains all broken and all advanced features #######"
|
|
|
|
echo "###################################################################"
|
|
|
|
echo
|
|
|
|
|
2016-06-23 11:04:58 +02:00
|
|
|
testv6_patch
|
|
|
|
|
2017-05-12 17:58:20 +02:00
|
|
|
if [ "$1" = krb ]; then
|
|
|
|
name2add=krb
|
|
|
|
else
|
2019-02-22 11:17:57 +01:00
|
|
|
if [ $(uname) != "Darwin" ]; then
|
|
|
|
name2add=static
|
|
|
|
else
|
|
|
|
name2add=dynamic
|
|
|
|
fi
|
2017-05-12 17:58:20 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "doing a build for $(uname).$(uname -m)".$name2add
|
|
|
|
echo
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
|
2016-06-23 11:04:58 +02:00
|
|
|
case $(uname) in
|
2017-05-12 17:21:45 +02:00
|
|
|
Linux|FreeBSD)
|
2019-02-22 15:09:05 +01:00
|
|
|
openssldir_option='--openssldir=/etc/ssl'
|
2016-06-23 11:04:58 +02:00
|
|
|
case $(uname -m) in
|
2017-05-12 17:21:45 +02:00
|
|
|
i686|armv7l) clean
|
2017-05-12 17:58:20 +02:00
|
|
|
if [ "$1" = krb ]; then
|
2019-02-22 15:09:05 +01:00
|
|
|
./config $openssldir_option $STDOPTIONS no-ec_nistp_64_gcc_128 --with-krb5-flavor=MIT
|
2016-06-23 11:04:58 +02:00
|
|
|
else
|
2019-02-22 15:09:05 +01:00
|
|
|
./config $openssldir_option $STDOPTIONS no-ec_nistp_64_gcc_128 -static
|
2016-06-23 11:04:58 +02:00
|
|
|
fi
|
|
|
|
[ $? -ne 0 ] && error "configuring"
|
|
|
|
;;
|
2017-05-12 17:21:45 +02:00
|
|
|
x86_64|amd64) clean
|
|
|
|
if [ "$1" = krb ]; then
|
2019-02-22 15:09:05 +01:00
|
|
|
./config $openssldir_option $STDOPTIONS enable-ec_nistp_64_gcc_128 --with-krb5-flavor=MIT
|
2016-06-23 11:04:58 +02:00
|
|
|
else
|
2019-02-22 15:09:05 +01:00
|
|
|
./config $openssldir_option $STDOPTIONS enable-ec_nistp_64_gcc_128 -static
|
2016-06-23 11:04:58 +02:00
|
|
|
fi
|
|
|
|
[ $? -ne 0 ] && error "configuring"
|
|
|
|
;;
|
2017-05-12 17:21:45 +02:00
|
|
|
*) echo " Sorry, don't know this architecture $(uname -m)"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
Darwin)
|
2019-02-22 15:09:05 +01:00
|
|
|
openssldir_option='--openssldir=/private/etc/ssl/'
|
2017-05-12 17:21:45 +02:00
|
|
|
case $(uname -m) in
|
2019-02-22 15:09:05 +01:00
|
|
|
# No Kerberos (yet?) for Darwin. Static doesn't work for Darwin (#1204)
|
2019-02-22 11:17:57 +01:00
|
|
|
x86_64) clean || echo "nothing to clean"
|
2019-03-19 10:00:13 +01:00
|
|
|
./Configure $openssldir_option $STDOPTIONS enable-ec_nistp_64_gcc_128 darwin64-x86_64-cc
|
2019-02-22 10:07:46 +01:00
|
|
|
[ $? -ne 0 ] && error "configuring"
|
2017-05-12 17:21:45 +02:00
|
|
|
;;
|
2019-02-22 11:17:57 +01:00
|
|
|
i386) clean || echo "nothing to clean"
|
2019-02-22 15:09:05 +01:00
|
|
|
./config $openssldir_option $STDOPTIONS no-ec_nistp_64_gcc_128 darwin64-x86_64-cc
|
2019-02-22 10:07:46 +01:00
|
|
|
[ $? -ne 0 ] && error "configuring"
|
2016-06-23 11:04:58 +02:00
|
|
|
;;
|
|
|
|
esac
|
2015-06-10 08:15:28 +02:00
|
|
|
;;
|
2017-05-12 17:21:45 +02:00
|
|
|
*) echo " Sorry, don't know this OS $(uname)"
|
|
|
|
;;
|
2015-06-10 08:15:28 +02:00
|
|
|
esac
|
|
|
|
|
2017-05-12 17:21:45 +02:00
|
|
|
|
2017-05-12 17:58:20 +02:00
|
|
|
makeall && copyfiles "$name2add"
|
|
|
|
[ $? -ne 0 ] && error "copying files"
|
|
|
|
echo
|
|
|
|
echo "(w/o 4 GOST ciphers): $(apps/openssl ciphers -V 'ALL:COMPLEMENTOFALL' | wc -l)"
|
|
|
|
echo
|
|
|
|
echo "------------ all ok ------------"
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
2021-05-31 22:31:31 +02:00
|
|
|
# vim:ts=5:sw=5:expandtab
|
2019-02-22 10:07:46 +01:00
|
|
|
# $Id: make-openssl.sh,v 1.20 2019/02/22 09:07:07 dirkw Exp $
|
2015-06-10 08:15:28 +02:00
|
|
|
|