2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-11-04 15:03:41 +01:00

Use local openssl & return microseconds for benchmark

This commit is contained in:
Julien Vehent 2013-07-19 09:45:06 -04:00
parent a651af9857
commit f5ff56344a
2 changed files with 18 additions and 15 deletions

View File

@ -1,9 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DOBENCHMARK=0 DOBENCHMARK=1
BENCHMARKITER=10 BENCHMARKITER=30
#OPENSSLBIN="/home/ulfr/Code/openssl/apps/openssl" OPENSSLBIN="./openssl"
OPENSSLBIN=$(which openssl)
REQUEST="GET / HTTP/1.1 REQUEST="GET / HTTP/1.1
Host: $TARGET Host: $TARGET
@ -52,8 +51,8 @@ EOF
# Time interval in nanoseconds # Time interval in nanoseconds
local t="$(($(date +%s%N) - t))" local t="$(($(date +%s%N) - t))"
verbose "Benchmarking done in $t nanoseconds" verbose "Benchmarking done in $t nanoseconds"
# Milliseconds # Microseconds
cipherbenchms="$((t/1000000/$BENCHMARKITER))" cipherbenchms="$((t/1000/$BENCHMARKITER))"
} }
@ -92,7 +91,6 @@ if [ ! -z $2 ]; then
fi fi
fi fi
echo
cipherspref=(); cipherspref=();
results=() results=()
get_cipher_pref "ALL" get_cipher_pref "ALL"
@ -100,19 +98,24 @@ ctr=1
for cipher in "${cipherspref[@]}"; do for cipher in "${cipherspref[@]}"; do
if [ $DOBENCHMARK -eq 1 ]; then if [ $DOBENCHMARK -eq 1 ]; then
bench_cipher "$cipher" bench_cipher "$cipher"
r=$(echo "$ctr $cipher $cipherbenchms"|awk '{printf "%-2d) %-30s avg_handshake= %-5d ms\n",$1,$2,$3}') r="$ctr $cipher $cipherbenchms"
else else
r=$(echo "$ctr $cipher"|awk '{printf "%-2d) %-30s\n",$1,$2}') r="$ctr $cipher"
fi fi
results=("${results[@]}" "$r") results=("${results[@]}" "$r")
ctr=$((ctr+1)) ctr=$((ctr+1))
done done
echo if [ $DOBENCHMARK -eq 1 ]; then
echo "Ciphersuites sorted by server preference" header="prio ciphersuite avg_handshake_microsec"
else
header="prio ciphersuite"
fi
ctr=0
for result in "${results[@]}"; do for result in "${results[@]}"; do
if [ $ctr -eq 0 ]; then
echo $header
ctr=$((ctr+1))
fi
echo $result echo $result
done done|column -t
echo
echo R | $OPENSSLBIN s_client -connect $TARGET 2>/dev/null| grep 'Secure Renegotiation'|sort|uniq

BIN
openssl Executable file

Binary file not shown.