2
0
mirror of https://github.com/mozilla/cipherscan.git synced 2024-09-28 23:53:41 +02:00

Store the found protocols in an array, rather than a CSV-joined string.

This commit is contained in:
Richard Soderberg 2015-09-18 14:59:30 -07:00
parent 1828183e3f
commit 32bf52a452

View File

@ -469,7 +469,7 @@ test_cipher_on_target() {
local sslcommand="$*" local sslcommand="$*"
cipher="" cipher=""
local cmnd="" local cmnd=""
protocols="" protocols=()
pfs="" pfs=""
previous_cipher="" previous_cipher=""
certificates="" certificates=""
@ -577,16 +577,12 @@ test_cipher_on_target() {
fi fi
# handling of TLSv1.2 only cipher suites # handling of TLSv1.2 only cipher suites
if [[ ! -z "$previous_cipher" ]] && [[ "$previous_cipher" != "$current_cipher" ]] && [[ "$current_cipher" != "0000" ]]; then if [[ ! -z "$previous_cipher" ]] && [[ "$previous_cipher" != "$current_cipher" ]] && [[ "$current_cipher" != "0000" ]]; then
unset protocols protocols=()
fi fi
previous_cipher=$current_cipher previous_cipher=$current_cipher
# connection succeeded, add TLS version to positive results # connection succeeded, add TLS version to positive results
if [[ -z "$protocols" ]]; then protocols+=("$current_protocol")
protocols=$current_protocol
else
protocols="$protocols,$current_protocol"
fi
cipher=$current_cipher cipher=$current_cipher
pfs=$current_pfs pfs=$current_pfs
[[ -z $pfs ]] && pfs="None" [[ -z $pfs ]] && pfs="None"
@ -606,9 +602,13 @@ test_cipher_on_target() {
return 2 return 2
fi fi
# Pre-join this, since we use it in a couple of places below.
join_array_by_char ',' "${protocols[@]}"
protocols_csv="$joined_array"
# if cipher contains NONE, the cipher wasn't accepted # if cipher contains NONE, the cipher wasn't accepted
if [[ "$cipher" == '(NONE) ' ]]; then if [[ "$cipher" == '(NONE) ' ]]; then
result="$cipher $protocols $pubkey $sigalg $trusted $tickethint $ocspstaple $pfs $current_curves $curves_ordering" result="$cipher $protocols_csv $pubkey $sigalg $trusted $tickethint $ocspstaple $pfs $current_curves $curves_ordering"
verbose "handshake failed, server returned ciphersuite '$result'" verbose "handshake failed, server returned ciphersuite '$result'"
return 1 return 1
fi fi
@ -629,7 +629,7 @@ test_cipher_on_target() {
current_curves="$(get_curve_name "$(echo $pfs|cut -d ',' -f2)")" current_curves="$(get_curve_name "$(echo $pfs|cut -d ',' -f2)")"
fi fi
fi fi
result="$cipher $protocols $pubkey $sigalg $trusted $tickethint $ocspstaple $pfs $current_curves $curves_ordering" result="$cipher $protocols_csv $pubkey $sigalg $trusted $tickethint $ocspstaple $pfs $current_curves $curves_ordering"
verbose "handshake succeeded, server returned ciphersuite '$result'" verbose "handshake succeeded, server returned ciphersuite '$result'"
return 0 return 0
} }