diff options
author | Matt Caswell <matt@openssl.org> | 2015-08-13 15:17:14 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-08-26 10:38:02 +0100 |
commit | ddcc5e5b60e2e14a7f65cc8faff0642cb68f4343 (patch) | |
tree | aa9d9a992e72ab82d98afe152f7b8318c6243706 /util | |
parent | 8af538e5c55f43f9ae996d3f2cae04222cda6762 (diff) |
Add NewSessionTicket test suite
Add a set of tests for checking that NewSessionTicket messages are
behaving as expected.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/TLSProxy/ClientHello.pm | 3 | ||||
-rw-r--r-- | util/TLSProxy/Proxy.pm | 64 |
2 files changed, 60 insertions, 7 deletions
diff --git a/util/TLSProxy/ClientHello.pm b/util/TLSProxy/ClientHello.pm index 54fb5bb0d0..0b7dbbcdd6 100644 --- a/util/TLSProxy/ClientHello.pm +++ b/util/TLSProxy/ClientHello.pm @@ -58,7 +58,8 @@ package TLSProxy::ClientHello; use parent 'TLSProxy::Message'; use constant { - EXT_ENCRYPT_THEN_MAC => 22 + EXT_ENCRYPT_THEN_MAC => 22, + EXT_SESSION_TICKET => 35 }; sub new diff --git a/util/TLSProxy/Proxy.pm b/util/TLSProxy/Proxy.pm index af6c8ddaaf..75094f1a44 100644 --- a/util/TLSProxy/Proxy.pm +++ b/util/TLSProxy/Proxy.pm @@ -79,13 +79,16 @@ sub new server_addr => "localhost", server_port => 4443, filter => $filter, + serverflags => "", + clientflags => "", + serverconnects => 1, #Public read execute => $execute, cert => $cert, debug => $debug, - cipherc => "AES128-SHA", - ciphers => "", + cipherc => "", + ciphers => "AES128-SHA", flight => 0, record_list => [], message_list => [], @@ -101,12 +104,15 @@ sub clear { my $self = shift; - $self->{cipherc} = "AES128-SHA"; - $self->{ciphers} = ""; + $self->{cipherc} = ""; + $self->{ciphers} = "AES128-SHA"; $self->{flight} = 0; $self->{record_list} = []; $self->{message_list} = []; $self->{message_rec_list} = []; + $self->{serverflags} = ""; + $self->{clientflags} = ""; + $self->{serverconnects} = 1; TLSProxy::Message->clear(); TLSProxy::Record->clear(); @@ -120,6 +126,14 @@ sub restart $self->start; } +sub clientrestart +{ + my $self = shift; + + $self->clear; + $self->clientstart; +} + sub start { my ($self) = shift; @@ -132,13 +146,22 @@ sub start open(STDERR, ">&STDOUT"); my $execcmd = $self->execute." s_server -rev -engine ossltest -accept " .($self->server_port) - ." -cert ".$self->cert." -naccept 1"; + ." -cert ".$self->cert." -naccept ".$self->serverconnects; if ($self->ciphers ne "") { $execcmd .= " -cipher ".$self->ciphers; } + if ($self->serverflags ne "") { + $execcmd .= " ".$self->serverflags; + } exec($execcmd); } + $self->clientstart; +} + +sub clientstart +{ + my ($self) = shift; my $oldstdout; if(!$self->debug) { @@ -173,6 +196,9 @@ sub start if ($self->cipherc ne "") { $execcmd .= " -cipher ".$self->cipherc; } + if ($self->clientflags ne "") { + $execcmd .= " ".$self->clientflags; + } exec($execcmd); } } @@ -274,7 +300,9 @@ sub process_packet print "\n"; #Finished parsing. Call user provided filter here - $self->filter->($self); + if(defined $self->filter) { + $self->filter->($self); + } #Reconstruct the packet $packet = ""; @@ -392,4 +420,28 @@ sub ciphers } return $self->{ciphers}; } +sub serverflags +{ + my $self = shift; + if (@_) { + $self->{serverflags} = shift; + } + return $self->{serverflags}; +} +sub clientflags +{ + my $self = shift; + if (@_) { + $self->{clientflags} = shift; + } + return $self->{clientflags}; +} +sub serverconnects +{ + my $self = shift; + if (@_) { + $self->{serverconnects} = shift; + } + return $self->{serverconnects}; +} 1; |