Skip to content

Commit 3cd1273

Browse files
committed
Address complaint by Travis
Despite the fact google doesn't support RC4 ciphers, testssl.sh called sslv2_sockets(). Google answered with a >= TLS alert. Building a sum then failed then in sslv2_sockets(). This fixes sslv2_sockets() and introduces count_chars() as a helper function (tested also under old FreeBSD to make sure it works under MacOSX).
1 parent 888f4f9 commit 3cd1273

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

testssl.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,10 @@ count_ciphers() {
803803
echo $(wc -w <<< "${1//:/ }")
804804
}
805805

806+
count_chars() {
807+
echo $(wc -c <<< "$1")
808+
}
809+
806810
newline_to_spaces() {
807811
tr '\n' ' ' <<< "$1" | sed 's/ $//'
808812
}
@@ -14331,8 +14335,8 @@ sslv2_sockets() {
1433114335
if "$parse_complete"; then
1433214336
if [[ -s "$SOCK_REPLY_FILE" ]]; then
1433314337
server_hello=$(hexdump -v -e '16/1 "%02X"' "$SOCK_REPLY_FILE")
14334-
server_hello_len=2 + $(hex2dec "${server_hello:1:3}")
14335-
response_len=$(wc -c "$SOCK_REPLY_FILE" | awk '{ print $1 }')
14338+
server_hello_len=$((2 + $(hex2dec "${server_hello:1:3}") ))
14339+
response_len=$(count_chars "$SOCK_REPLY_FILE")
1433614340
for (( 1; response_len < server_hello_len; 1 )); do
1433714341
sock_reply_file2=${SOCK_REPLY_FILE}.2
1433814342
mv "$SOCK_REPLY_FILE" "$sock_reply_file2"
@@ -14344,7 +14348,7 @@ sslv2_sockets() {
1434414348
[[ ! -s "$SOCK_REPLY_FILE" ]] && break
1434514349
cat "$SOCK_REPLY_FILE" >> "$sock_reply_file2"
1434614350
mv "$sock_reply_file2" "$SOCK_REPLY_FILE"
14347-
response_len=$(wc -c "$SOCK_REPLY_FILE" | awk '{ print $1 }')
14351+
response_len=$(count_chars "$SOCK_REPLY_FILE")
1434814352
done
1434914353
fi
1435014354
fi
@@ -14362,6 +14366,7 @@ sslv2_sockets() {
1436214366
return $ret
1436314367
}
1436414368

14369+
1436514370
# arg1: supported groups extension
1436614371
# arg2: "all" - process full response (including Certificate and certificate_status handshake messages)
1436714372
# "ephemeralkey" - extract the server's ephemeral key (if any)

0 commit comments

Comments
 (0)