diff options
Diffstat (limited to 'util/perl/OpenSSL')
-rw-r--r-- | util/perl/OpenSSL/Ordinals.pm | 2 | ||||
-rw-r--r-- | util/perl/OpenSSL/ParseC.pm | 10 | ||||
-rw-r--r-- | util/perl/OpenSSL/Test.pm | 60 | ||||
-rw-r--r-- | util/perl/OpenSSL/Util.pm | 59 | ||||
-rwxr-xr-x | util/perl/OpenSSL/config.pm | 31 | ||||
-rw-r--r-- | util/perl/OpenSSL/stackhash.pm | 4 |
6 files changed, 119 insertions, 47 deletions
diff --git a/util/perl/OpenSSL/Ordinals.pm b/util/perl/OpenSSL/Ordinals.pm index 4d8c616b5b0a..da5a31bd21ab 100644 --- a/util/perl/OpenSSL/Ordinals.pm +++ b/util/perl/OpenSSL/Ordinals.pm @@ -414,6 +414,8 @@ sub _parse_features { my $def = $'; if ($def =~ m{^ZLIB$}) { $features{$&} = $op; } + if ($def =~ m{^BROTLI$}) { $features{$&} = $op; } + if ($def =~ m{^ZSTD$}) { $features{$&} = $op; } if ($def =~ m{^OPENSSL_USE_}) { $features{$'} = $op; } if ($def =~ m{^OPENSSL_NO_}) { $features{$'} = !$op; } } diff --git a/util/perl/OpenSSL/ParseC.pm b/util/perl/OpenSSL/ParseC.pm index f98dd0e25e3b..837559e1d022 100644 --- a/util/perl/OpenSSL/ParseC.pm +++ b/util/perl/OpenSSL/ParseC.pm @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2018-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 @@ -266,9 +266,15 @@ my @opensslchandlers = ( { regexp => qr/OSSL_DEPRECATEDIN_\d+_\d+(?:_\d+)?\s+(.*)/, massager => sub { return $1; }, }, + { regexp => qr/OSSL_DEPRECATEDIN_\d+_\d+(?:_\d+)?_FOR<<<.*>>>(.*)/, + massager => sub { return $1; }, + }, { regexp => qr/(.*?)\s+OSSL_DEPRECATEDIN_\d+_\d+(?:_\d+)?\s+(.*)/, massager => sub { return "$1 $2"; }, }, + { regexp => qr/(.*?)\s+OSSL_DEPRECATEDIN_\d+_\d+(?:_\d+)?_FOR<<<.*>>>(.*)/, + massager => sub { return "$1 $2"; }, + }, ##### # Core stuff @@ -292,7 +298,7 @@ EOF { regexp => qr/(.*)\bLHASH_OF<<<\((.*?)\)>>>(.*)/, massager => sub { return ("$1struct lhash_st_$2$3"); } }, - { regexp => qr/DEFINE_LHASH_OF(?:_INTERNAL)?<<<\((.*)\)>>>/, + { regexp => qr/DEFINE_LHASH_OF(?:_INTERNAL|_EX)?<<<\((.*)\)>>>/, massager => sub { return (<<"EOF"); static ossl_inline LHASH_OF($1) * lh_$1_new(unsigned long (*hfn)(const $1 *), diff --git a/util/perl/OpenSSL/Test.pm b/util/perl/OpenSSL/Test.pm index 00ef1832d3a0..3123c1d3ec29 100644 --- a/util/perl/OpenSSL/Test.pm +++ b/util/perl/OpenSSL/Test.pm @@ -10,6 +10,7 @@ package OpenSSL::Test; use strict; use warnings; +use Carp; use Test::More 0.96; use Exporter; @@ -557,8 +558,11 @@ operating system. =cut sub bldtop_dir { - return __bldtop_dir(@_); # This caters for operating systems that have + my $d = __bldtop_dir(@_); # This caters for operating systems that have # a very distinct syntax for directories. + + croak "$d isn't a directory" if -e $d && ! -d $d; + return $d; } =over 4 @@ -576,7 +580,10 @@ operating system. =cut sub bldtop_file { - return __bldtop_file(@_); + my $f = __bldtop_file(@_); + + croak "$f isn't a file" if -e $f && ! -f $f; + return $f; } =over 4 @@ -594,8 +601,11 @@ operating system. =cut sub srctop_dir { - return __srctop_dir(@_); # This caters for operating systems that have + my $d = __srctop_dir(@_); # This caters for operating systems that have # a very distinct syntax for directories. + + croak "$d isn't a directory" if -e $d && ! -d $d; + return $d; } =over 4 @@ -613,7 +623,10 @@ operating system. =cut sub srctop_file { - return __srctop_file(@_); + my $f = __srctop_file(@_); + + croak "$f isn't a file" if -e $f && ! -f $f; + return $f; } =over 4 @@ -630,7 +643,10 @@ operating system. =cut sub data_dir { - return __data_dir(@_); + my $d = __data_dir(@_); + + croak "$d isn't a directory" if -e $d && ! -d $d; + return $d; } =over 4 @@ -647,15 +663,20 @@ file path as a string, adapted to the local operating system. =cut sub data_file { - return __data_file(@_); + my $f = __data_file(@_); + + croak "$f isn't a file" if -e $f && ! -f $f; + return $f; } =over 4 -=item B<result_dir> +=item B<result_dir LIST> -C<result_dir> returns the directory where test output files should be placed -as a string, adapted to the local operating system. +LIST is a list of directories that make up a path from the result directory +associated with the test (see L</DESCRIPTION> above). +C<result_dir> returns the resulting directory as a string, adapted to the local +operating system. =back @@ -664,17 +685,20 @@ as a string, adapted to the local operating system. sub result_dir { BAIL_OUT("Must run setup() first") if (! $test_name); - return catfile($directories{RESULTS}); + my $d = catdir($directories{RESULTS},@_); + + croak "$d isn't a directory" if -e $d && ! -d $d; + return $d; } =over 4 -=item B<result_file FILENAME> +=item B<result_file LIST, FILENAME> -FILENAME is the name of a test output file. -C<result_file> returns the path of the given file as a string, -prepending to the file name the path to the directory where test output files -should be placed, adapted to the local operating system. +LIST is a list of directories that make up a path from the data directory +associated with the test (see L</DESCRIPTION> above) and FILENAME is the name +of a file located in that directory path. C<result_file> returns the resulting +file path as a string, adapted to the local operating system. =back @@ -683,8 +707,10 @@ should be placed, adapted to the local operating system. sub result_file { BAIL_OUT("Must run setup() first") if (! $test_name); - my $f = pop; - return catfile(result_dir(),@_,$f); + my $f = catfile(result_dir(),@_); + + croak "$f isn't a file" if -e $f && ! -f $f; + return $f; } =over 4 diff --git a/util/perl/OpenSSL/Util.pm b/util/perl/OpenSSL/Util.pm index 44e87afee2e3..970fc009b3bc 100644 --- a/util/perl/OpenSSL/Util.pm +++ b/util/perl/OpenSSL/Util.pm @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2018-2023 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 @@ -192,28 +192,47 @@ sub fixup_cmd { return fixup_cmd_elements(@_) unless $^O eq 'VMS'; # The rest is VMS specific - my $prog = shift; - - # On VMS, running random executables without having a command symbol - # means running them with the MCR command. This is an old PDP-11 - # command that stuck around. - # This assumes that we're passed the name of an executable. This is a - # safe assumption for OpenSSL command lines - my $prefix = 'MCR'; - - if ($prog =~ /^MCR$/i) { - # If the first element is "MCR" (independent of case) already, then - # we assume that the program it runs is already written the way it - # should, and just grab it. - $prog = shift; + my $cmd = shift; + + # Prefix to be applied as needed. Essentially, we need to determine + # if the command is an executable file (something.EXE), and invoke it + # with the MCR command in that case. MCR is an old PDP-11 command that + # stuck around. + my @prefix; + + if ($cmd =~ m|^\@|) { + # The command is an invocation of a command procedure (also known as + # "script"), no modification needed. + @prefix = (); + } elsif ($cmd =~ m|^MCR$|) { + # The command is MCR, so there's nothing much to do apart from + # making sure that the file name following it isn't treated with + # fixup_cmd_elements(), 'cause MCR doesn't like strings. + @prefix = ( $cmd ); + $cmd = shift; } else { - # If the command itself doesn't have a directory spec, make sure - # that there is one. Otherwise, MCR assumes that the program - # resides in SYS$SYSTEM: - $prog = '[]' . $prog unless $prog =~ /^(?:[\$a-z0-9_]+:)?[<\[]/i; + # All that's left now is to check whether the command is an executable + # file, and if it's not, simply assume that it is a DCL command. + + # Make sure we have a proper file name, i.e. add the default + # extension '.exe' if there isn't one already. + my $executable = ($cmd =~ m|.[a-z0-9\$]*$|) ? $cmd : $cmd . '.exe'; + if (-e $executable) { + # It seems to be an executable, so we make sure to prefix it + # with MCR, for proper invocation. We also make sure that + # there's a directory specification, or otherwise, MCR will + # assume that the executable is in SYS$SYSTEM: + @prefix = ( 'MCR' ); + $cmd = '[]' . $cmd unless $cmd =~ /^(?:[\$a-z0-9_]+:)?[<\[]/i; + } else { + # If it isn't an executable, then we assume that it's a DCL + # command, and do no further processing, apart from argument + # fixup. + @prefix = (); + } } - return ( $prefix, $prog, fixup_cmd_elements(@_) ); + return ( @prefix, $cmd, fixup_cmd_elements(@_) ); } =item dump_data REF, OPTS diff --git a/util/perl/OpenSSL/config.pm b/util/perl/OpenSSL/config.pm index 695d6bab0b9f..04aef069f928 100755 --- a/util/perl/OpenSSL/config.pm +++ b/util/perl/OpenSSL/config.pm @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 1998-2023 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 1998-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 @@ -92,7 +92,8 @@ my $guess_patterns = [ [ 'IRIX64:.*', 'mips4-sgi-irix64' ], [ 'Linux:[2-9]\..*', '${MACHINE}-whatever-linux2' ], [ 'Linux:1\..*', '${MACHINE}-whatever-linux1' ], - [ 'GNU.*', 'hurd-x86' ], + [ 'GNU:.*86-AT386', 'hurd-x86' ], + [ 'GNU:.*86_64-AT386', 'hurd-x86_64' ], [ 'LynxOS:.*', '${MACHINE}-lynx-lynxos' ], # BSD/OS always says 386 [ 'BSD\/OS:4\..*', 'i486-whatever-bsdi4' ], @@ -513,7 +514,7 @@ EOF if ( $ISA64 == 1 && $KERNEL_BITS eq '' ) { print <<EOF; WARNING! To build 64-bit package, do this: - KERNEL_BITS=64 $WHERE/Configure \[\[ options \]\] + KERNEL_BITS=64 $WHERE/Configure [options...] EOF maybe_abort(); } @@ -537,7 +538,7 @@ EOF print <<EOF; WARNING! To build 32-bit package, do this: - KERNEL_BITS=32 $WHERE/Configure \[\[ options \]\] + KERNEL_BITS=32 $WHERE/Configure [options...] EOF maybe_abort(); return { target => "darwin64-x86_64" }; @@ -683,6 +684,17 @@ EOF defines => [ 'B_ENDIAN' ] } ], [ 'sh.*-.*-linux2', { target => "linux-generic32", defines => [ 'L_ENDIAN' ] } ], + [ 'loongarch64-.*-linux2', + sub { + my $disable = [ 'asm' ]; + if ( okrun('echo xvadd.w \$xr0,\$xr0,\$xr0', + "$CC -c -x assembler - -o /dev/null 2>/dev/null") ) { + $disable = []; + } + return { target => "linux64-loongarch64", + disable => $disable, }; + } + ], [ 'm68k.*-.*-linux2', { target => "linux-generic32", defines => [ 'B_ENDIAN' ] } ], [ 's390-.*-linux2', { target => "linux-generic32", @@ -787,14 +799,19 @@ EOF disable => [ 'sse2' ] } ], [ 'alpha.*-.*-.*bsd.*', { target => "BSD-generic64", defines => [ 'L_ENDIAN' ] } ], - [ 'powerpc64-.*-.*bsd.*', { target => "BSD-generic64", - defines => [ 'B_ENDIAN' ] } ], + [ 'powerpc-.*-.*bsd.*', { target => "BSD-ppc" } ], + [ 'powerpc64-.*-.*bsd.*', { target => "BSD-ppc64" } ], + [ 'powerpc64le-.*-.*bsd.*', { target => "BSD-ppc64le" } ], [ 'riscv64-.*-.*bsd.*', { target => "BSD-riscv64" } ], [ 'sparc64-.*-.*bsd.*', { target => "BSD-sparc64" } ], + [ 'ia64-.*-openbsd.*', { target => "BSD-nodef-ia64" } ], [ 'ia64-.*-.*bsd.*', { target => "BSD-ia64" } ], [ 'x86_64-.*-dragonfly.*', { target => "BSD-x86_64" } ], + [ 'amd64-.*-openbsd.*', { target => "BSD-nodef-x86_64" } ], [ 'amd64-.*-.*bsd.*', { target => "BSD-x86_64" } ], [ 'arm64-.*-.*bsd.*', { target => "BSD-aarch64" } ], + [ 'armv6-.*-.*bsd.*', { target => "BSD-armv4" } ], + [ 'armv7-.*-.*bsd.*', { target => "BSD-armv4" } ], [ '.*86.*-.*-.*bsd.*', sub { # mimic ld behaviour when it's looking for libc... @@ -812,6 +829,7 @@ EOF disable => [ 'sse2' ] }; } ], + [ '.*-.*-openbsd.*', { target => "BSD-nodef-generic32" } ], [ '.*-.*-.*bsd.*', { target => "BSD-generic32" } ], [ 'x86_64-.*-haiku', { target => "haiku-x86_64" } ], [ '.*-.*-haiku', { target => "haiku-x86" } ], @@ -841,6 +859,7 @@ EOF cflags => [ '-march=armv7-a' ], cxxflags => [ '-march=armv7-a' ] } ], [ 'arm.*-.*-android', { target => "android-armeabi" } ], + [ 'riscv64-.*-android', { target => "android-riscv64" } ], [ '.*-hpux1.*', sub { my $KERNEL_BITS = $ENV{KERNEL_BITS}; diff --git a/util/perl/OpenSSL/stackhash.pm b/util/perl/OpenSSL/stackhash.pm index 4d59eab0c937..7c2459b8a406 100644 --- a/util/perl/OpenSSL/stackhash.pm +++ b/util/perl/OpenSSL/stackhash.pm @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2020-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 @@ -85,7 +85,7 @@ sub generate_lhash_macros { my $macros = <<END_MACROS; DEFINE_LHASH_OF_INTERNAL(${type}); -#define lh_${type}_new(hfn, cmp) ((LHASH_OF(${type}) *)OPENSSL_LH_new(ossl_check_${type}_lh_hashfunc_type(hfn), ossl_check_${type}_lh_compfunc_type(cmp))) +#define lh_${type}_new(hfn, cmp) ((LHASH_OF(${type}) *)OPENSSL_LH_set_thunks(OPENSSL_LH_new(ossl_check_${type}_lh_hashfunc_type(hfn), ossl_check_${type}_lh_compfunc_type(cmp)), lh_${type}_hash_thunk, lh_${type}_comp_thunk, lh_${type}_doall_thunk, lh_${type}_doall_arg_thunk)) #define lh_${type}_free(lh) OPENSSL_LH_free(ossl_check_${type}_lh_type(lh)) #define lh_${type}_flush(lh) OPENSSL_LH_flush(ossl_check_${type}_lh_type(lh)) #define lh_${type}_insert(lh, ptr) ((${type} *)OPENSSL_LH_insert(ossl_check_${type}_lh_type(lh), ossl_check_${type}_lh_plain_type(ptr))) |