1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Upgrade openssl from 1.1.0e to 1.1.1b, with source code. 4.0.78

This commit is contained in:
winlin 2021-03-01 20:47:57 +08:00
parent 8f1c992379
commit 96dbd7bced
1476 changed files with 616554 additions and 4 deletions

View file

@ -0,0 +1,21 @@
package OpenSSL::Glob;
use strict;
use warnings;
use File::Glob;
use Exporter;
use vars qw($VERSION @ISA @EXPORT);
$VERSION = '0.1';
@ISA = qw(Exporter);
@EXPORT = qw(glob);
sub glob {
goto &File::Glob::bsd_glob if $^O ne "VMS";
goto &CORE::glob;
}
1;
__END__

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,91 @@
# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (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
package OpenSSL::Test::Simple;
use strict;
use warnings;
use Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = "0.2";
@ISA = qw(Exporter);
@EXPORT = qw(simple_test);
=head1 NAME
OpenSSL::Test::Simple - a few very simple test functions
=head1 SYNOPSIS
use OpenSSL::Test::Simple;
simple_test("my_test_name", "destest", "des");
=head1 DESCRIPTION
Sometimes, the functions in L<OpenSSL::Test> are quite tedious for some
repetitive tasks. This module provides functions to make life easier.
You could call them hacks if you wish.
=cut
use OpenSSL::Test;
use OpenSSL::Test::Utils;
=over 4
=item B<simple_test NAME, PROGRAM, ALGORITHM>
Runs a test named NAME, running the program PROGRAM with no arguments,
to test the algorithm ALGORITHM.
A complete recipe looks like this:
use OpenSSL::Test::Simple;
simple_test("test_bf", "bftest", "bf");
=back
=cut
# args:
# name (used with setup())
# algorithm (used to check if it's at all supported)
# name of binary (the program that does the actual test)
sub simple_test {
my ($name, $prgr, @algos) = @_;
setup($name);
if (scalar(disabled(@algos))) {
if (scalar(@algos) == 1) {
plan skip_all => $algos[0]." is not supported by this OpenSSL build";
} else {
my $last = pop @algos;
plan skip_all => join(", ", @algos)." and $last are not supported by this OpenSSL build";
}
}
plan tests => 1;
ok(run(test([$prgr])), "running $prgr");
}
=head1 SEE ALSO
L<OpenSSL::Test>
=head1 AUTHORS
Richard Levitte E<lt>levitte@openssl.orgE<gt> with inspiration
from Rich Salz E<lt>rsalz@openssl.orgE<gt>.
=cut
1;

View file

@ -0,0 +1,240 @@
# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (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
package OpenSSL::Test::Utils;
use strict;
use warnings;
use Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = "0.1";
@ISA = qw(Exporter);
@EXPORT = qw(alldisabled anydisabled disabled config available_protocols
have_IPv4 have_IPv6);
=head1 NAME
OpenSSL::Test::Utils - test utility functions
=head1 SYNOPSIS
use OpenSSL::Test::Utils;
my @tls = available_protocols("tls");
my @dtls = available_protocols("dtls");
alldisabled("dh", "dsa");
anydisabled("dh", "dsa");
config("fips");
have_IPv4();
have_IPv6();
=head1 DESCRIPTION
This module provides utility functions for the testing framework.
=cut
use OpenSSL::Test qw/:DEFAULT bldtop_file/;
=over 4
=item B<available_protocols STRING>
Returns a list of strings for all the available SSL/TLS versions if
STRING is "tls", or for all the available DTLS versions if STRING is
"dtls". Otherwise, it returns the empty list. The strings in the
returned list can be used with B<alldisabled> and B<anydisabled>.
=item B<alldisabled ARRAY>
=item B<anydisabled ARRAY>
In an array context returns an array with each element set to 1 if the
corresponding feature is disabled and 0 otherwise.
In a scalar context, alldisabled returns 1 if all of the features in
ARRAY are disabled, while anydisabled returns 1 if any of them are
disabled.
=item B<config STRING>
Returns an item from the %config hash in \$TOP/configdata.pm.
=item B<have_IPv4>
=item B<have_IPv6>
Return true if IPv4 / IPv6 is possible to use on the current system.
=back
=cut
our %available_protocols;
our %disabled;
our %config;
my $configdata_loaded = 0;
sub load_configdata {
# We eval it so it doesn't run at compile time of this file.
# The latter would have bldtop_file() complain that setup() hasn't
# been run yet.
my $configdata = bldtop_file("configdata.pm");
eval { require $configdata;
%available_protocols = %configdata::available_protocols;
%disabled = %configdata::disabled;
%config = %configdata::config;
};
$configdata_loaded = 1;
}
# args
# list of 1s and 0s, coming from check_disabled()
sub anyof {
my $x = 0;
foreach (@_) { $x += $_ }
return $x > 0;
}
# args
# list of 1s and 0s, coming from check_disabled()
sub allof {
my $x = 1;
foreach (@_) { $x *= $_ }
return $x > 0;
}
# args
# list of strings, all of them should be names of features
# that can be disabled.
# returns a list of 1s (if the corresponding feature is disabled)
# and 0s (if it isn't)
sub check_disabled {
return map { exists $disabled{lc $_} ? 1 : 0 } @_;
}
# Exported functions #################################################
# args:
# list of features to check
sub anydisabled {
load_configdata() unless $configdata_loaded;
my @ret = check_disabled(@_);
return @ret if wantarray;
return anyof(@ret);
}
# args:
# list of features to check
sub alldisabled {
load_configdata() unless $configdata_loaded;
my @ret = check_disabled(@_);
return @ret if wantarray;
return allof(@ret);
}
# !!! Kept for backward compatibility
# args:
# single string
sub disabled {
anydisabled(@_);
}
sub available_protocols {
load_configdata() unless $configdata_loaded;
my $protocol_class = shift;
if (exists $available_protocols{lc $protocol_class}) {
return @{$available_protocols{lc $protocol_class}}
}
return ();
}
sub config {
load_configdata() unless $configdata_loaded;
return $config{$_[0]};
}
# IPv4 / IPv6 checker
my $have_IPv4 = -1;
my $have_IPv6 = -1;
my $IP_factory;
sub check_IP {
my $listenaddress = shift;
eval {
require IO::Socket::IP;
my $s = IO::Socket::IP->new(
LocalAddr => $listenaddress,
LocalPort => 0,
Listen=>1,
);
$s or die "\n";
$s->close();
};
if ($@ eq "") {
return 1;
}
eval {
require IO::Socket::INET6;
my $s = IO::Socket::INET6->new(
LocalAddr => $listenaddress,
LocalPort => 0,
Listen=>1,
);
$s or die "\n";
$s->close();
};
if ($@ eq "") {
return 1;
}
eval {
require IO::Socket::INET;
my $s = IO::Socket::INET->new(
LocalAddr => $listenaddress,
LocalPort => 0,
Listen=>1,
);
$s or die "\n";
$s->close();
};
if ($@ eq "") {
return 1;
}
return 0;
}
sub have_IPv4 {
if ($have_IPv4 < 0) {
$have_IPv4 = check_IP("127.0.0.1");
}
return $have_IPv4;
}
sub have_IPv6 {
if ($have_IPv6 < 0) {
$have_IPv6 = check_IP("::1");
}
return $have_IPv6;
}
=head1 SEE ALSO
L<OpenSSL::Test>
=head1 AUTHORS
Stephen Henson E<lt>steve@openssl.orgE<gt> and
Richard Levitte E<lt>levitte@openssl.orgE<gt>
=cut
1;

View file

@ -0,0 +1,149 @@
# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (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
package OpenSSL::Util::Pod;
use strict;
use warnings;
use Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = "0.1";
@ISA = qw(Exporter);
@EXPORT = qw(extract_pod_info);
@EXPORT_OK = qw();
=head1 NAME
OpenSSL::Util::Pod - utilities to manipulate .pod files
=head1 SYNOPSIS
use OpenSSL::Util::Pod;
my %podinfo = extract_pod_info("foo.pod");
# or if the file is already opened... Note that this consumes the
# remainder of the file.
my %podinfo = extract_pod_info(\*STDIN);
=head1 DESCRIPTION
=over
=item B<extract_pod_info "FILENAME", HASHREF>
=item B<extract_pod_info "FILENAME">
=item B<extract_pod_info GLOB, HASHREF>
=item B<extract_pod_info GLOB>
Extracts information from a .pod file, given a STRING (file name) or a
GLOB (a file handle). The result is given back as a hash table.
The additional hash is for extra parameters:
=over
=item B<section =E<gt> N>
The value MUST be a number, and will be the man section number
to be used with the given .pod file.
=item B<debug =E<gt> 0|1>
If set to 1, extra debug text will be printed on STDERR
=back
=back
=head1 RETURN VALUES
=over
=item B<extract_pod_info> returns a hash table with the following
items:
=over
=item B<section =E<gt> N>
The man section number this .pod file belongs to. Often the same as
was given as input.
=item B<names =E<gt> [ "name", ... ]>
All the names extracted from the NAME section.
=back
=back
=cut
sub extract_pod_info {
my $input = shift;
my $defaults_ref = shift || {};
my %defaults = ( debug => 0, section => 0, %$defaults_ref );
my $fh = undef;
my $filename = undef;
# If not a file handle, then it's assume to be a file path (a string)
unless (ref $input eq "GLOB") {
$filename = $input;
open $fh, $input or die "Trying to read $filename: $!\n";
print STDERR "DEBUG: Reading $input\n" if $defaults{debug};
$input = $fh;
}
my %podinfo = ( section => $defaults{section});
while(<$input>) {
s|\R$||;
# Stop reading when we have reached past the NAME section.
last if (m|^=head1|
&& defined $podinfo{lastsect}
&& $podinfo{lastsect} eq "NAME");
# Collect the section name
if (m|^=head1\s*(.*)|) {
$podinfo{lastsect} = $1;
$podinfo{lastsect} =~ s/\s+$//;
print STDERR "DEBUG: Found new pod section $1\n"
if $defaults{debug};
print STDERR "DEBUG: Clearing pod section text\n"
if $defaults{debug};
$podinfo{lastsecttext} = "";
}
next if (m|^=| || m|^\s*$|);
# Collect the section text
print STDERR "DEBUG: accumulating pod section text \"$_\"\n"
if $defaults{debug};
$podinfo{lastsecttext} .= " " if $podinfo{lastsecttext};
$podinfo{lastsecttext} .= $_;
}
if (defined $fh) {
close $fh;
print STDERR "DEBUG: Done reading $filename\n" if $defaults{debug};
}
$podinfo{lastsecttext} =~ s| - .*$||;
my @names =
map { s|\s+||g; $_ }
split(m|,|, $podinfo{lastsecttext});
return ( section => $podinfo{section}, names => [ @names ] );
}
1;