Skip to content

Commit bc3a812

Browse files
author
David Cooper
committed
Avoid ClientHello size bug
As described in testssl#1113, some servers will fail if the length of the ClientHello message is 522, 778, 1034, ... bytes (i.e., if length mod 256 = 10) or 526, 782, 1038, ... bytes (i.e., if length mod 256 = 14). This commit avoid this issue for normal testing by adding a 5-byte padding extension to the message if the length would otherwise be one of these lengths.
1 parent 15261b2 commit bc3a812

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

testssl.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11841,6 +11841,13 @@ socksend_tls_clienthello() {
1184111841
done
1184211842
len_extension=$len_extension+$len_padding_extension+0x4
1184311843
len_extension_hex=$(printf "%02x\n" $len_extension)
11844+
elif [[ ! "$extra_extensions_list" =~ " 0015 " ]] && ( [[ $((len_all%256)) -eq 10 ]] || [[ $((len_all%256)) -eq 14 ]] ); then
11845+
# Some servers fail if the length of the ClientHello is 522, 778, 1034, 1290, ... bytes.
11846+
# A few servers also fail if the length is 526, 782, 1038, 1294, ... bytes.
11847+
# So, if the ClientHello would be one of these length, add a 5-byte padding extension.
11848+
all_extensions="$all_extensions\\x00\\x15\\x00\\x01\\x00"
11849+
len_extension+=5
11850+
len_extension_hex=$(printf "%02x\n" $len_extension)
1184411851
fi
1184511852
len2twobytes "$len_extension_hex"
1184611853
all_extensions="

0 commit comments

Comments
 (0)