Codebase list openssl / 3f1f62b
TLSProxy/Record.pm: add is_fatal_alert method. (resolve uninitialized variable warning and harmonize output). Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5975) Andy Polyakov 6 years ago
1 changed file(s) with 15 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
6666
6767 my $recnum = 1;
6868 while (length ($packet) > 0) {
69 print " Record $recnum";
70 if ($server) {
71 print " (server -> client)\n";
72 } else {
73 print " (client -> server)\n";
74 }
69 print " Record $recnum ", $server ? "(server -> client)\n"
70 : "(client -> server)\n";
7571
7672 #Get the record header (unpack can't fail if $packet is too short)
7773 my ($content_type, $version, $len) = unpack('Cnn', $packet);
7874
79 if (length($packet) < TLS_RECORD_HEADER_LENGTH + $len) {
75 if (length($packet) < TLS_RECORD_HEADER_LENGTH + ($len // 0)) {
8076 print "Partial data : ".length($packet)." bytes\n";
8177 $partial = $packet;
8278 last;
388384 }
389385 return $self->{outer_content_type};
390386 }
387 sub is_fatal_alert
388 {
389 my $self = shift;
390 my $server = shift;
391
392 if (($self->{flight} & 1) == $server
393 && $self->{content_type} == TLSProxy::Record::RT_ALERT) {
394 my ($level, $alert) = unpack('CC', $self->decrypt_data);
395 return $alert if ($level == 2);
396 }
397 return 0;
398 }
391399 1;