mirror of
https://github.com/drwetter/testssl.sh.git
synced 2025-01-01 06:19:44 +01:00
better platform support, revert to pure /bin/sh, better verbosity...
This commit is contained in:
parent
bed1f8cc0d
commit
f70bc4e08f
@ -1,13 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
#
|
||||||
# License GPLv2, see ../LICENSE
|
# License GPLv2, see ../LICENSE
|
||||||
|
#
|
||||||
|
# instructions @ https://github.com/drwetter/testssl.sh/tree/2.9dev/bin
|
||||||
|
|
||||||
echo
|
|
||||||
|
echo
|
||||||
echo "###################################################################"
|
echo "###################################################################"
|
||||||
echo "####### Build script for Peter Mosmans openssl #######"
|
echo "####### Build script for Peter Mosmans openssl #######"
|
||||||
echo "####### which contains all broken and all advanced features #######"
|
echo "####### which contains all broken and all advanced features #######"
|
||||||
echo "###################################################################"
|
echo "###################################################################"
|
||||||
echo
|
echo
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
STDOPTIONS="--prefix=/usr/ --openssldir=/etc/ssl -DOPENSSL_USE_BUILD_DATE enable-zlib \
|
STDOPTIONS="--prefix=/usr/ --openssldir=/etc/ssl -DOPENSSL_USE_BUILD_DATE enable-zlib \
|
||||||
@ -15,63 +18,76 @@ enable-ssl2 enable-ssl3 enable-ssl-trace enable-rc5 enable-rc2 \
|
|||||||
enable-gost enable-cms enable-md2 enable-mdc2 enable-ec enable-ec2m enable-ecdh enable-ecdsa \
|
enable-gost enable-cms enable-md2 enable-mdc2 enable-ec enable-ec2m enable-ecdh enable-ecdsa \
|
||||||
enable-seed enable-camellia enable-idea enable-rfc3779 experimental-jpake"
|
enable-seed enable-camellia enable-idea enable-rfc3779 experimental-jpake"
|
||||||
|
|
||||||
clean() {
|
|
||||||
case $NOCLEAN in
|
|
||||||
yes|Y|YES) ;;
|
|
||||||
*) make clean ;;
|
|
||||||
esac
|
|
||||||
#[ $? -ne 0 ] && error "no openssl directory"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
error() {
|
error() {
|
||||||
tput bold
|
tput bold
|
||||||
echo "### ERROR $1 ###"
|
echo "### ERROR $1 ###"
|
||||||
tput sgr0
|
tput sgr0
|
||||||
exit 2
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
clean() {
|
||||||
|
case $NOCLEAN in
|
||||||
|
yes|Y|YES) ;;
|
||||||
|
*) make clean
|
||||||
|
[ $? -ne 0 ] && error "no openssl directory"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
makeall() {
|
makeall() {
|
||||||
make depend || error "depend"
|
make depend || error "depend"
|
||||||
make || error "making"
|
make || error "making"
|
||||||
make report || error "testing/make report"
|
make report || error "testing/make report"
|
||||||
#FIXME: we need another error handler, as of now a failure doesn't mean a return status of 1
|
#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
|
# see https://github.com/openssl/openssl/pull/336
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
copyfiles() {
|
copyfiles() {
|
||||||
echo; apps/openssl version -a; echo
|
local ret
|
||||||
if grep static <<< "$1"; then
|
local target=../openssl.$(uname).$(uname -m).$1
|
||||||
cp -p apps/openssl ../openssl.$(uname).$(uname -m)
|
|
||||||
else
|
echo; apps/openssl version -a; echo
|
||||||
cp -p apps/openssl ../openssl.$(uname).$(uname -m).krb5
|
if [ -e "$target" ]; then
|
||||||
fi
|
case $(uname) in
|
||||||
return $?
|
*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
|
||||||
}
|
}
|
||||||
|
|
||||||
testv6_patch() {
|
testv6_patch() {
|
||||||
if grep -q 'ending bracket for IPv6' apps/s_socket.c; then
|
if grep -q 'ending bracket for IPv6' apps/s_socket.c; then
|
||||||
STDOPTIONS="$STDOPTIONS -DOPENSSL_USE_IPV6"
|
STDOPTIONS="$STDOPTIONS -DOPENSSL_USE_IPV6"
|
||||||
else
|
echo "detected IPv6 patch thus compiling in IPv6 support"
|
||||||
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
|
echo
|
||||||
read a
|
else
|
||||||
fi
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
testv6_patch
|
testv6_patch
|
||||||
|
|
||||||
|
|
||||||
case $(uname) in
|
case $(uname) in
|
||||||
Linux|FreeBSD)
|
Linux|FreeBSD)
|
||||||
case $(uname -m) in
|
case $(uname -m) in
|
||||||
"i686") clean
|
i686|armv7l) clean
|
||||||
if [[ "$1" = krb ]]; then
|
if [ "$1" == krb ]; then
|
||||||
name2add=krb
|
name2add=krb
|
||||||
./config $STDOPTIONS no-ec_nistp_64_gcc_128 --with-krb5-flavor=MIT
|
./config $STDOPTIONS no-ec_nistp_64_gcc_128 --with-krb5-flavor=MIT
|
||||||
else
|
else
|
||||||
@ -81,13 +97,13 @@ case $(uname) in
|
|||||||
[ $? -ne 0 ] && error "configuring"
|
[ $? -ne 0 ] && error "configuring"
|
||||||
makeall && copyfiles "$name2add"
|
makeall && copyfiles "$name2add"
|
||||||
[ $? -ne 0 ] && error "copying files"
|
[ $? -ne 0 ] && error "copying files"
|
||||||
apps/openssl ciphers -V 'ALL:COMPLEMENTOFALL' | wc -l
|
echo "\n(w/o 4 GOST ciphers): $(apps/openssl ciphers -V 'ALL:COMPLEMENTOFALL' | wc -l)"
|
||||||
echo
|
echo
|
||||||
echo "------------ all ok ------------"
|
echo "------------ all ok ------------"
|
||||||
echo
|
echo
|
||||||
;;
|
;;
|
||||||
"x86_64") clean
|
x86_64|amd64) clean
|
||||||
if [[ "$1" = krb ]]; then
|
if [ "$1" = krb ]; then
|
||||||
name2add=krb
|
name2add=krb
|
||||||
./config $STDOPTIONS enable-ec_nistp_64_gcc_128 --with-krb5-flavor=MIT
|
./config $STDOPTIONS enable-ec_nistp_64_gcc_128 --with-krb5-flavor=MIT
|
||||||
else
|
else
|
||||||
@ -97,22 +113,31 @@ case $(uname) in
|
|||||||
[ $? -ne 0 ] && error "configuring"
|
[ $? -ne 0 ] && error "configuring"
|
||||||
makeall && copyfiles "$name2add"
|
makeall && copyfiles "$name2add"
|
||||||
[ $? -ne 0 ] && error "copying files"
|
[ $? -ne 0 ] && error "copying files"
|
||||||
apps/openssl ciphers -V 'ALL:COMPLEMENTOFALL' | wc -l
|
echo "\n(w/o 4 GOST ciphers): $(apps/openssl ciphers -V 'ALL:COMPLEMENTOFALL' | wc -l)"
|
||||||
echo
|
echo
|
||||||
echo "------------ all ok ------------"
|
echo "------------ all ok ------------"
|
||||||
echo
|
echo
|
||||||
;;
|
;;
|
||||||
*) echo " Sorry, don't know this architecture $(uname -m)"
|
*) echo " Sorry, don't know this architecture $(uname -m)"
|
||||||
exit 1
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
Darwin)
|
||||||
|
case $(uname -m) in
|
||||||
|
x86_64) clean
|
||||||
|
echo "FIXME"
|
||||||
|
;;
|
||||||
|
i386) clean
|
||||||
|
echo "FIXME"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
Darwin)
|
*) echo " Sorry, don't know this OS $(uname)"
|
||||||
|
;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# vim:tw=90:ts=5:sw=5
|
|
||||||
# $Id: make-openssl.sh,v 1.14 2015/07/20 19:40:54 dirkw Exp $
|
# vim:ts=5:sw=5
|
||||||
|
# $Id: make-openssl.sh,v 1.18 2017/05/12 15:03:00 dirkw Exp $
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user