mirror of
https://github.com/openssl/openssl.git
synced 2024-12-15 06:01:37 +08:00
214c724e00
It is valid according to the spec for a NextProto message to have no protocols listed in it. The OpenSSL implementation however does not allow us to create such a message. In order to check that we work as expected when communicating with a client that does generate such messages we have to use a TLSProxy test. Follow on from CVE-2024-5535 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Neil Horman <nhorman@openssl.org> (Merged from https://github.com/openssl/openssl/pull/24716)
63 lines
1.5 KiB
Perl
63 lines
1.5 KiB
Perl
# Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
# in the file LICENSE in the source distribution or at
|
|
# https://www.openssl.org/source/license.html
|
|
|
|
use strict;
|
|
|
|
package TLSProxy::NextProto;
|
|
|
|
use vars '@ISA';
|
|
push @ISA, 'TLSProxy::Message';
|
|
|
|
sub new
|
|
{
|
|
my $class = shift;
|
|
my ($isdtls,
|
|
$server,
|
|
$msgseq,
|
|
$msgfrag,
|
|
$msgfragoffs,
|
|
$data,
|
|
$records,
|
|
$startoffset,
|
|
$message_frag_lens) = @_;
|
|
|
|
my $self = $class->SUPER::new(
|
|
$isdtls,
|
|
$server,
|
|
TLSProxy::Message::MT_NEXT_PROTO,
|
|
$msgseq,
|
|
$msgfrag,
|
|
$msgfragoffs,
|
|
$data,
|
|
$records,
|
|
$startoffset,
|
|
$message_frag_lens);
|
|
|
|
return $self;
|
|
}
|
|
|
|
sub parse
|
|
{
|
|
# We don't support parsing at the moment
|
|
}
|
|
|
|
# This is supposed to reconstruct the on-the-wire message data following changes.
|
|
# For now though since we don't support parsing we just create an empty NextProto
|
|
# message - this capability is used in test_npn
|
|
sub set_message_contents
|
|
{
|
|
my $self = shift;
|
|
my $data;
|
|
|
|
$data = pack("C32", 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00);
|
|
$self->data($data);
|
|
}
|
|
1;
|