compat.sh: regroup arguments even more

This commit is contained in:
Manuel Pégourié-Gonnard 2014-02-19 14:24:24 +01:00
parent 1b31d7fd97
commit 9ada01a70c

View File

@ -390,40 +390,49 @@ add_polarssl_ciphersuites()
setup_arguments() setup_arguments()
{ {
# avoid an avalanche of errors due to typos
case $MODE in
ssl3|tls1|tls1_1|tls1_2)
;;
*)
echo "error: invalid mode: $MODE" >&2
exit 1;
esac
P_SERVER_ARGS="server_addr=0.0.0.0 force_version=$MODE"
P_CLIENT_ARGS="server_name=0.0.0.0 force_version=$MODE"
O_SERVER_ARGS="-www -quiet -cipher NULL,ALL -$MODE"
O_CLIENT_ARGS="-$MODE"
if [ "X$VERIFY" = "XYES" ]; if [ "X$VERIFY" = "XYES" ];
then then
P_SERVER_BASE="ca_file=data_files/test-ca_cat12.crt auth_mode=required" P_SERVER_ARGS="$P_SERVER_ARGS ca_file=data_files/test-ca_cat12.crt auth_mode=required"
P_CLIENT_BASE="ca_file=data_files/test-ca_cat12.crt" P_CLIENT_ARGS="$P_CLIENT_ARGS ca_file=data_files/test-ca_cat12.crt"
O_SERVER_BASE="-CAfile data_files/test-ca_cat12.crt -Verify 10" O_SERVER_ARGS="$O_SERVER_ARGS -CAfile data_files/test-ca_cat12.crt -Verify 10"
O_CLIENT_BASE="-CAfile data_files/test-ca_cat12.crt" O_CLIENT_ARGS="$O_CLIENT_ARGS -CAfile data_files/test-ca_cat12.crt"
else
P_SERVER_BASE=""
P_CLIENT_BASE=""
O_SERVER_BASE=""
O_CLIENT_BASE=""
fi fi
case $TYPE in case $TYPE in
"ECDSA") "ECDSA")
P_SERVER_ARGS="$P_SERVER_BASE crt_file=data_files/server5.crt key_file=data_files/server5.key" P_SERVER_ARGS="$P_SERVER_ARGS crt_file=data_files/server5.crt key_file=data_files/server5.key"
P_CLIENT_ARGS="$P_CLIENT_BASE crt_file=data_files/server6.crt key_file=data_files/server6.key" P_CLIENT_ARGS="$P_CLIENT_ARGS crt_file=data_files/server6.crt key_file=data_files/server6.key"
O_SERVER_ARGS="$O_SERVER_BASE -cert data_files/server5.crt -key data_files/server5.key" O_SERVER_ARGS="$O_SERVER_ARGS -cert data_files/server5.crt -key data_files/server5.key"
O_CLIENT_ARGS="$O_CLIENT_BASE -cert data_files/server6.crt -key data_files/server6.key" O_CLIENT_ARGS="$O_CLIENT_ARGS -cert data_files/server6.crt -key data_files/server6.key"
;; ;;
"RSA") "RSA")
P_SERVER_ARGS="$P_SERVER_BASE crt_file=data_files/server1.crt key_file=data_files/server1.key" P_SERVER_ARGS="$P_SERVER_ARGS crt_file=data_files/server1.crt key_file=data_files/server1.key"
P_CLIENT_ARGS="$P_CLIENT_BASE crt_file=data_files/server2.crt key_file=data_files/server2.key" P_CLIENT_ARGS="$P_CLIENT_ARGS crt_file=data_files/server2.crt key_file=data_files/server2.key"
O_SERVER_ARGS="$O_SERVER_BASE -cert data_files/server1.crt -key data_files/server1.key" O_SERVER_ARGS="$O_SERVER_ARGS -cert data_files/server1.crt -key data_files/server1.key"
O_CLIENT_ARGS="$O_CLIENT_BASE -cert data_files/server2.crt -key data_files/server2.key" O_CLIENT_ARGS="$O_CLIENT_ARGS -cert data_files/server2.crt -key data_files/server2.key"
;; ;;
"PSK") "PSK")
P_SERVER_ARGS="$P_SERVER_BASE psk=6162636465666768696a6b6c6d6e6f70" P_SERVER_ARGS="$P_SERVER_ARGS psk=6162636465666768696a6b6c6d6e6f70"
P_CLIENT_ARGS="$P_CLIENT_BASE psk=6162636465666768696a6b6c6d6e6f70" P_CLIENT_ARGS="$P_CLIENT_ARGS psk=6162636465666768696a6b6c6d6e6f70"
# openssl s_server won't start without certificates... # openssl s_server won't start without certificates...
O_SERVER_ARGS="$O_SERVER_BASE -psk 6162636465666768696a6b6c6d6e6f70 -cert data_files/server1.crt -key data_files/server1.key" O_SERVER_ARGS="$O_SERVER_ARGS -psk 6162636465666768696a6b6c6d6e6f70 -cert data_files/server1.crt -key data_files/server1.key"
O_CLIENT_ARGS="$O_CLIENT_BASE -psk 6162636465666768696a6b6c6d6e6f70" O_CLIENT_ARGS="$O_CLIENT_ARGS -psk 6162636465666768696a6b6c6d6e6f70"
;; ;;
esac esac
} }
@ -434,15 +443,6 @@ do
for MODE in $MODES; for MODE in $MODES;
do do
# avoid an avalanche of errors due to typos
case $MODE in
ssl3|tls1|tls1_1|tls1_2)
;;
*)
echo "error: invalid mode: $MODE" >&2
exit 1;
esac
echo "-----------" echo "-----------"
echo "Running for $MODE (Verify: $VERIFY)" echo "Running for $MODE (Verify: $VERIFY)"
echo "-----------" echo "-----------"
@ -453,8 +453,8 @@ do
setup_arguments setup_arguments
setup_ciphersuites setup_ciphersuites
log "$OPENSSL s_server -www -quiet -cipher NULL,ALL $O_SERVER_ARGS -$MODE" log "$OPENSSL s_server $O_SERVER_ARGS"
$OPENSSL s_server -www -quiet -cipher NULL,ALL $O_SERVER_ARGS -$MODE >/dev/null 2>&1 & $OPENSSL s_server $O_SERVER_ARGS >/dev/null 2>&1 &
PROCESS_ID=$! PROCESS_ID=$!
sleep 1 sleep 1
@ -462,8 +462,8 @@ sleep 1
for i in $P_CIPHERS; for i in $P_CIPHERS;
do do
let "tests++" let "tests++"
log "../programs/ssl/ssl_client2 $P_CLIENT_ARGS force_ciphersuite=$i force_version=$MODE" log "../programs/ssl/ssl_client2 $P_CLIENT_ARGS force_ciphersuite=$i"
RESULT="$( ../programs/ssl/ssl_client2 $P_CLIENT_ARGS force_ciphersuite=$i force_version=$MODE )" RESULT="$( ../programs/ssl/ssl_client2 $P_CLIENT_ARGS force_ciphersuite=$i )"
EXIT=$? EXIT=$?
echo -n "OpenSSL Server - PolarSSL Client - $i : $EXIT - " echo -n "OpenSSL Server - PolarSSL Client - $i : $EXIT - "
if [ "$EXIT" = "2" ]; if [ "$EXIT" = "2" ];
@ -473,8 +473,8 @@ do
elif [ "$EXIT" != "0" ]; elif [ "$EXIT" != "0" ];
then then
echo Failed echo Failed
echo "$OPENSSL s_server -www -quiet -cipher NULL,ALL $O_SERVER_ARGS -$MODE" echo "$OPENSSL s_server $O_SERVER_ARGS"
echo "ssl_client2 force_ciphersuite=$i force_version=$MODE $P_CLIENT_ARGS" echo "ssl_client2 force_ciphersuite=$i $P_CLIENT_ARGS"
echo $RESULT echo $RESULT
let "failed++" let "failed++"
else else
@ -484,8 +484,8 @@ done
kill $PROCESS_ID 2>/dev/null kill $PROCESS_ID 2>/dev/null
wait $PROCESS_ID 2>/dev/null wait $PROCESS_ID 2>/dev/null
log "../programs/ssl/ssl_server2 server_addr=0.0.0.0 $P_SERVER_ARGS force_version=$MODE > /dev/null" log "../programs/ssl/ssl_server2 $P_SERVER_ARGS > /dev/null"
../programs/ssl/ssl_server2 server_addr=0.0.0.0 $P_SERVER_ARGS force_version=$MODE > /dev/null & ../programs/ssl/ssl_server2 $P_SERVER_ARGS > /dev/null &
PROCESS_ID=$! PROCESS_ID=$!
sleep 1 sleep 1
@ -493,8 +493,8 @@ sleep 1
for i in $O_CIPHERS; for i in $O_CIPHERS;
do do
let "tests++" let "tests++"
log "$OPENSSL s_client -$MODE -cipher $i $O_CLIENT_ARGS" log "$OPENSSL s_client $O_CLIENT_ARGS -cipher $i"
RESULT="$( ( echo -e 'GET HTTP/1.0'; echo; sleep 1 ) | $OPENSSL s_client -$MODE -cipher $i $O_CLIENT_ARGS 2>&1 )" RESULT="$( ( echo -e 'GET HTTP/1.0'; echo; sleep 1 ) | $OPENSSL s_client $O_CLIENT_ARGS -cipher $i 2>&1 )"
EXIT=$? EXIT=$?
echo -n "PolarSSL Server - OpenSSL Client - $i : $EXIT - " echo -n "PolarSSL Server - OpenSSL Client - $i : $EXIT - "
@ -507,8 +507,8 @@ do
let "skipped++" let "skipped++"
else else
echo Failed echo Failed
echo "ssl_server2 $P_SERVER_ARGS force_version=$MODE" echo "ssl_server2 $P_SERVER_ARGS"
echo "$OPENSSL s_client -$MODE -cipher $i $O_CLIENT_ARGS" echo "$OPENSSL s_client $O_CLIENT_ARGS -cipher $i"
echo $RESULT echo $RESULT
let "failed++" let "failed++"
fi fi
@ -522,8 +522,8 @@ add_polarssl_ciphersuites
for i in $P_CIPHERS; for i in $P_CIPHERS;
do do
let "tests++" let "tests++"
log "../programs/ssl/ssl_client2 force_ciphersuite=$i force_version=$MODE $P_CLIENT_ARGS" log "../programs/ssl/ssl_client2 force_ciphersuite=$i $P_CLIENT_ARGS"
RESULT="$( ../programs/ssl/ssl_client2 force_ciphersuite=$i force_version=$MODE $P_CLIENT_ARGS )" RESULT="$( ../programs/ssl/ssl_client2 force_ciphersuite=$i $P_CLIENT_ARGS )"
EXIT=$? EXIT=$?
echo -n "PolarSSL Server - PolarSSL Client - $i : $EXIT - " echo -n "PolarSSL Server - PolarSSL Client - $i : $EXIT - "
if [ "$EXIT" = "2" ]; if [ "$EXIT" = "2" ];
@ -534,7 +534,7 @@ do
then then
echo Failed echo Failed
echo "ssl_server2 $P_SERVER_ARGS" echo "ssl_server2 $P_SERVER_ARGS"
echo "ssl_client2 force_ciphersuite=$i force_version=$MODE $P_CLIENT_ARGS" echo "ssl_client2 force_ciphersuite=$i $P_CLIENT_ARGS"
echo $RESULT echo $RESULT
let "failed++" let "failed++"
else else