From 8523288e6d667f052bda092e01ab17986782fede Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 10 Aug 2016 00:45:51 -0400 Subject: Test CBC mode padding. This is a regression test for https://github.com/openssl/openssl/pull/1431. It tests a maximally-padded record with each possible invalid offset. This required fixing a bug in Message.pm where the client sending a fatal alert followed by close_notify was still treated as success. Reviewed-by: Rich Salz Reviewed-by: Matt Caswell --- util/TLSProxy/Message.pm | 6 +++--- util/TLSProxy/Proxy.pm | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/TLSProxy/Message.pm b/util/TLSProxy/Message.pm index 321e080ea3..1810d8c30e 100644 --- a/util/TLSProxy/Message.pm +++ b/util/TLSProxy/Message.pm @@ -199,14 +199,14 @@ sub get_messages print " [".$record->decrypt_data."]\n"; } elsif ($record->content_type == TLSProxy::Record::RT_ALERT) { my ($alertlev, $alertdesc) = unpack('CC', $record->decrypt_data); - #All alerts end the test - $end = 1; #A CloseNotify from the client indicates we have finished successfully #(we assume) - if (!$server && $alertlev == AL_LEVEL_WARN + if (!$end && !$server && $alertlev == AL_LEVEL_WARN && $alertdesc == AL_DESC_CLOSE_NOTIFY) { $success = 1; } + #All alerts end the test + $end = 1; } return @messages; diff --git a/util/TLSProxy/Proxy.pm b/util/TLSProxy/Proxy.pm index e0ce43aa77..eeb83ed74f 100644 --- a/util/TLSProxy/Proxy.pm +++ b/util/TLSProxy/Proxy.pm @@ -493,4 +493,15 @@ sub serverpid } return $self->{serverpid}; } + +sub fill_known_data +{ + my $length = shift; + my $ret = ""; + for (my $i = 0; $i < $length; $i++) { + $ret .= chr($i); + } + return $ret; +} + 1; -- cgit v1.2.3