xcrypt 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Rakefile +106 -0
- data/ext/libxcrypt/AUTHORS +38 -0
- data/ext/libxcrypt/COPYING.LIB +502 -0
- data/ext/libxcrypt/ChangeLog +239 -0
- data/ext/libxcrypt/INSTALL +380 -0
- data/ext/libxcrypt/LICENSING +152 -0
- data/ext/libxcrypt/Makefile.am +704 -0
- data/ext/libxcrypt/Makefile.in +4110 -0
- data/ext/libxcrypt/NEWS +630 -0
- data/ext/libxcrypt/README +1 -0
- data/ext/libxcrypt/README.md +179 -0
- data/ext/libxcrypt/THANKS +13 -0
- data/ext/libxcrypt/TODO +1 -0
- data/ext/libxcrypt/TODO.md +100 -0
- data/ext/libxcrypt/aclocal.m4 +2617 -0
- data/ext/libxcrypt/autogen.sh +33 -0
- data/ext/libxcrypt/autom4te.cache/output.0 +19884 -0
- data/ext/libxcrypt/autom4te.cache/output.1 +19884 -0
- data/ext/libxcrypt/autom4te.cache/output.2 +19884 -0
- data/ext/libxcrypt/autom4te.cache/output.3 +19885 -0
- data/ext/libxcrypt/autom4te.cache/requests +714 -0
- data/ext/libxcrypt/autom4te.cache/traces.0 +4088 -0
- data/ext/libxcrypt/autom4te.cache/traces.1 +1060 -0
- data/ext/libxcrypt/autom4te.cache/traces.2 +4088 -0
- data/ext/libxcrypt/autom4te.cache/traces.3 +1060 -0
- data/ext/libxcrypt/build-aux/ci/ci-log-dependency-versions +79 -0
- data/ext/libxcrypt/build-aux/ci/ci-log-logfiles +22 -0
- data/ext/libxcrypt/build-aux/ci/clang-gcov-wrapper +2 -0
- data/ext/libxcrypt/build-aux/ci/configure-wrapper +10 -0
- data/ext/libxcrypt/build-aux/ci/summarize-coverage +24 -0
- data/ext/libxcrypt/build-aux/m4/ax_append_compile_flags.m4 +46 -0
- data/ext/libxcrypt/build-aux/m4/ax_append_flag.m4 +50 -0
- data/ext/libxcrypt/build-aux/m4/ax_check_compile_flag.m4 +53 -0
- data/ext/libxcrypt/build-aux/m4/ax_check_vscript.m4 +142 -0
- data/ext/libxcrypt/build-aux/m4/ax_gcc_func_attribute.m4 +246 -0
- data/ext/libxcrypt/build-aux/m4/ax_require_defined.m4 +37 -0
- data/ext/libxcrypt/build-aux/m4/ax_valgrind_check.m4 +239 -0
- data/ext/libxcrypt/build-aux/m4/libtool.m4 +8488 -0
- data/ext/libxcrypt/build-aux/m4/ltoptions.m4 +467 -0
- data/ext/libxcrypt/build-aux/m4/ltsugar.m4 +124 -0
- data/ext/libxcrypt/build-aux/m4/ltversion.m4 +24 -0
- data/ext/libxcrypt/build-aux/m4/lt~obsolete.m4 +99 -0
- data/ext/libxcrypt/build-aux/m4/pkg_compat.m4 +88 -0
- data/ext/libxcrypt/build-aux/m4/zw_alignment.m4 +90 -0
- data/ext/libxcrypt/build-aux/m4/zw_automodern.m4 +307 -0
- data/ext/libxcrypt/build-aux/m4/zw_detect_asan.m4 +24 -0
- data/ext/libxcrypt/build-aux/m4/zw_endianness.m4 +152 -0
- data/ext/libxcrypt/build-aux/m4/zw_ld_wrap.m4 +47 -0
- data/ext/libxcrypt/build-aux/m4/zw_prog_perl.m4 +40 -0
- data/ext/libxcrypt/build-aux/m4/zw_simple_warnings.m4 +150 -0
- data/ext/libxcrypt/build-aux/m4/zw_static_assert.m4 +68 -0
- data/ext/libxcrypt/build-aux/m4-autogen/compile +364 -0
- data/ext/libxcrypt/build-aux/m4-autogen/config.guess +1815 -0
- data/ext/libxcrypt/build-aux/m4-autogen/config.sub +2354 -0
- data/ext/libxcrypt/build-aux/m4-autogen/depcomp +792 -0
- data/ext/libxcrypt/build-aux/m4-autogen/install-sh +541 -0
- data/ext/libxcrypt/build-aux/m4-autogen/ltmain.sh +11524 -0
- data/ext/libxcrypt/build-aux/m4-autogen/missing +236 -0
- data/ext/libxcrypt/build-aux/m4-autogen/test-driver +160 -0
- data/ext/libxcrypt/build-aux/scripts/BuildCommon.pm +712 -0
- data/ext/libxcrypt/build-aux/scripts/check-perlcritic-config +76 -0
- data/ext/libxcrypt/build-aux/scripts/compute-symver-floor +116 -0
- data/ext/libxcrypt/build-aux/scripts/expand-selected-hashes +80 -0
- data/ext/libxcrypt/build-aux/scripts/gen-crypt-h +131 -0
- data/ext/libxcrypt/build-aux/scripts/gen-crypt-hashes-h +141 -0
- data/ext/libxcrypt/build-aux/scripts/gen-crypt-symbol-vers-h +150 -0
- data/ext/libxcrypt/build-aux/scripts/gen-libcrypt-map +67 -0
- data/ext/libxcrypt/build-aux/scripts/move-if-change +84 -0
- data/ext/libxcrypt/build-aux/scripts/skip-if-exec-format-error +78 -0
- data/ext/libxcrypt/codecov.yml +4 -0
- data/ext/libxcrypt/config.h.in +303 -0
- data/ext/libxcrypt/configure +19885 -0
- data/ext/libxcrypt/configure.ac +549 -0
- data/ext/libxcrypt/doc/crypt.3 +512 -0
- data/ext/libxcrypt/doc/crypt.5 +343 -0
- data/ext/libxcrypt/doc/crypt_checksalt.3 +106 -0
- data/ext/libxcrypt/doc/crypt_gensalt.3 +285 -0
- data/ext/libxcrypt/doc/crypt_gensalt_ra.3 +1 -0
- data/ext/libxcrypt/doc/crypt_gensalt_rn.3 +1 -0
- data/ext/libxcrypt/doc/crypt_preferred_method.3 +68 -0
- data/ext/libxcrypt/doc/crypt_r.3 +1 -0
- data/ext/libxcrypt/doc/crypt_ra.3 +1 -0
- data/ext/libxcrypt/doc/crypt_rn.3 +1 -0
- data/ext/libxcrypt/lib/alg-des-tables.c +3858 -0
- data/ext/libxcrypt/lib/alg-des.c +269 -0
- data/ext/libxcrypt/lib/alg-des.h +74 -0
- data/ext/libxcrypt/lib/alg-gost3411-2012-const.h +313 -0
- data/ext/libxcrypt/lib/alg-gost3411-2012-core.c +238 -0
- data/ext/libxcrypt/lib/alg-gost3411-2012-core.h +51 -0
- data/ext/libxcrypt/lib/alg-gost3411-2012-hmac.c +78 -0
- data/ext/libxcrypt/lib/alg-gost3411-2012-hmac.h +46 -0
- data/ext/libxcrypt/lib/alg-gost3411-2012-precalc.h +1426 -0
- data/ext/libxcrypt/lib/alg-gost3411-2012-ref.h +67 -0
- data/ext/libxcrypt/lib/alg-hmac-sha1.c +140 -0
- data/ext/libxcrypt/lib/alg-hmac-sha1.h +35 -0
- data/ext/libxcrypt/lib/alg-md4.c +270 -0
- data/ext/libxcrypt/lib/alg-md4.h +43 -0
- data/ext/libxcrypt/lib/alg-md5.c +291 -0
- data/ext/libxcrypt/lib/alg-md5.h +43 -0
- data/ext/libxcrypt/lib/alg-sha1.c +288 -0
- data/ext/libxcrypt/lib/alg-sha1.h +34 -0
- data/ext/libxcrypt/lib/alg-sha256.c +630 -0
- data/ext/libxcrypt/lib/alg-sha256.h +123 -0
- data/ext/libxcrypt/lib/alg-sha512.c +311 -0
- data/ext/libxcrypt/lib/alg-sha512.h +81 -0
- data/ext/libxcrypt/lib/alg-sm3-hmac.c +113 -0
- data/ext/libxcrypt/lib/alg-sm3-hmac.h +42 -0
- data/ext/libxcrypt/lib/alg-sm3.c +449 -0
- data/ext/libxcrypt/lib/alg-sm3.h +63 -0
- data/ext/libxcrypt/lib/alg-yescrypt-common.c +713 -0
- data/ext/libxcrypt/lib/alg-yescrypt-opt.c +1568 -0
- data/ext/libxcrypt/lib/alg-yescrypt-platform.c +106 -0
- data/ext/libxcrypt/lib/alg-yescrypt.h +360 -0
- data/ext/libxcrypt/lib/byteorder.h +164 -0
- data/ext/libxcrypt/lib/crypt-bcrypt.c +1061 -0
- data/ext/libxcrypt/lib/crypt-des-obsolete.c +215 -0
- data/ext/libxcrypt/lib/crypt-des.c +491 -0
- data/ext/libxcrypt/lib/crypt-gensalt-static.c +40 -0
- data/ext/libxcrypt/lib/crypt-gost-yescrypt.c +182 -0
- data/ext/libxcrypt/lib/crypt-md5.c +232 -0
- data/ext/libxcrypt/lib/crypt-nthash.c +134 -0
- data/ext/libxcrypt/lib/crypt-obsolete.h +40 -0
- data/ext/libxcrypt/lib/crypt-pbkdf1-sha1.c +260 -0
- data/ext/libxcrypt/lib/crypt-port.h +514 -0
- data/ext/libxcrypt/lib/crypt-scrypt.c +247 -0
- data/ext/libxcrypt/lib/crypt-sha256.c +308 -0
- data/ext/libxcrypt/lib/crypt-sha512.c +323 -0
- data/ext/libxcrypt/lib/crypt-sm3-yescrypt.c +189 -0
- data/ext/libxcrypt/lib/crypt-sm3.c +308 -0
- data/ext/libxcrypt/lib/crypt-static.c +44 -0
- data/ext/libxcrypt/lib/crypt-sunmd5.c +314 -0
- data/ext/libxcrypt/lib/crypt-yescrypt.c +177 -0
- data/ext/libxcrypt/lib/crypt.c +421 -0
- data/ext/libxcrypt/lib/crypt.h.in +249 -0
- data/ext/libxcrypt/lib/gen-des-tables.c +363 -0
- data/ext/libxcrypt/lib/hashes.conf +59 -0
- data/ext/libxcrypt/lib/libcrypt.map.in +48 -0
- data/ext/libxcrypt/lib/libcrypt.minver +97 -0
- data/ext/libxcrypt/lib/libxcrypt.pc.in +15 -0
- data/ext/libxcrypt/lib/util-base64.c +26 -0
- data/ext/libxcrypt/lib/util-gensalt-sha.c +88 -0
- data/ext/libxcrypt/lib/util-get-random-bytes.c +154 -0
- data/ext/libxcrypt/lib/util-make-failure-token.c +48 -0
- data/ext/libxcrypt/lib/util-xbzero.c +43 -0
- data/ext/libxcrypt/lib/util-xstrcpy.c +42 -0
- data/ext/libxcrypt/lib/xcrypt.h.in +58 -0
- data/ext/libxcrypt/libxcrypt.spec.rpkg +481 -0
- data/ext/libxcrypt/rpkg.conf +2 -0
- data/ext/libxcrypt/rpkg.macros +86 -0
- data/ext/libxcrypt/test/TestCommon.pm +326 -0
- data/ext/libxcrypt/test/alg-des.c +80 -0
- data/ext/libxcrypt/test/alg-gost3411-2012-hmac.c +90 -0
- data/ext/libxcrypt/test/alg-gost3411-2012.c +191 -0
- data/ext/libxcrypt/test/alg-hmac-sha1.c +187 -0
- data/ext/libxcrypt/test/alg-md4.c +111 -0
- data/ext/libxcrypt/test/alg-md5.c +134 -0
- data/ext/libxcrypt/test/alg-pbkdf-hmac-sha256.c +269 -0
- data/ext/libxcrypt/test/alg-sha1.c +111 -0
- data/ext/libxcrypt/test/alg-sha256.c +141 -0
- data/ext/libxcrypt/test/alg-sha512.c +170 -0
- data/ext/libxcrypt/test/alg-sm3-hmac.c +149 -0
- data/ext/libxcrypt/test/alg-sm3.c +168 -0
- data/ext/libxcrypt/test/alg-yescrypt.c +466 -0
- data/ext/libxcrypt/test/badsalt.c +726 -0
- data/ext/libxcrypt/test/badsetting.c +350 -0
- data/ext/libxcrypt/test/byteorder.c +254 -0
- data/ext/libxcrypt/test/checksalt.c +265 -0
- data/ext/libxcrypt/test/compile-strong-alias.c +43 -0
- data/ext/libxcrypt/test/crypt-badargs.c +392 -0
- data/ext/libxcrypt/test/crypt-gost-yescrypt.c +149 -0
- data/ext/libxcrypt/test/crypt-nested-call.c +180 -0
- data/ext/libxcrypt/test/crypt-sm3-yescrypt.c +149 -0
- data/ext/libxcrypt/test/crypt-too-long-phrase.c +157 -0
- data/ext/libxcrypt/test/des-cases.h +196 -0
- data/ext/libxcrypt/test/des-obsolete.c +206 -0
- data/ext/libxcrypt/test/des-obsolete_r.c +207 -0
- data/ext/libxcrypt/test/explicit-bzero.c +334 -0
- data/ext/libxcrypt/test/gensalt-bcrypt_x.c +54 -0
- data/ext/libxcrypt/test/gensalt-extradata.c +246 -0
- data/ext/libxcrypt/test/gensalt-nested-call.c +126 -0
- data/ext/libxcrypt/test/gensalt-nthash.c +65 -0
- data/ext/libxcrypt/test/gensalt.c +599 -0
- data/ext/libxcrypt/test/getrandom-fallbacks.c +295 -0
- data/ext/libxcrypt/test/getrandom-interface.c +211 -0
- data/ext/libxcrypt/test/ka-table-gen.py +945 -0
- data/ext/libxcrypt/test/ka-table.inc +5849 -0
- data/ext/libxcrypt/test/ka-tester.c +240 -0
- data/ext/libxcrypt/test/preferred-method.c +133 -0
- data/ext/libxcrypt/test/short-outbuf.c +119 -0
- data/ext/libxcrypt/test/special-char-salt.c +1160 -0
- data/ext/libxcrypt/test/symbols-compat.pl +137 -0
- data/ext/libxcrypt/test/symbols-renames.pl +107 -0
- data/ext/libxcrypt/test/symbols-static.pl +87 -0
- data/ext/xcrypt/xcrypt.c +9 -0
- data/lib/xcrypt/ffi.rb +76 -0
- data/lib/xcrypt/version.rb +5 -0
- data/lib/xcrypt.rb +89 -0
- metadata +267 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#! /usr/bin/perl
|
|
2
|
+
# Written by Zack Weinberg <zackw at panix.com> in 2021.
|
|
3
|
+
# To the extent possible under law, Zack Weinberg has waived all
|
|
4
|
+
# copyright and related or neighboring rights to this work.
|
|
5
|
+
#
|
|
6
|
+
# See https://creativecommons.org/publicdomain/zero/1.0/ for further
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
# Compare the set of available Perl::Critic policies with the set of
|
|
10
|
+
# policies mentioned in .perlcriticrc. Fail the build if there are
|
|
11
|
+
# available policies that are not mentioned, or mentioned policies
|
|
12
|
+
# that are not available. This ensures that we always have the
|
|
13
|
+
# expected set of policies available when running perlcritic, and
|
|
14
|
+
# that we have thought about whether each one _should_ be enabled.
|
|
15
|
+
# ("Mentioned" does not mean "enabled". [-APolicy::WeDontWantToUse]
|
|
16
|
+
# counts as mentioning the policy for purpose of this script.)
|
|
17
|
+
|
|
18
|
+
# Ideally this would be a perlcritic policy itself, so it would get
|
|
19
|
+
# run on any invocation of perlcritic, not just on 'make distcheck'.
|
|
20
|
+
|
|
21
|
+
use v5.14; # implicit use strict, use feature ':5.14'
|
|
22
|
+
use warnings FATAL => 'all';
|
|
23
|
+
use utf8;
|
|
24
|
+
use open qw(:std :utf8);
|
|
25
|
+
no if $] >= 5.022, warnings => 'experimental::re_strict';
|
|
26
|
+
use if $] >= 5.022, re => 'strict';
|
|
27
|
+
|
|
28
|
+
use Perl::Critic ();
|
|
29
|
+
use Perl::Critic::UserProfile ();
|
|
30
|
+
|
|
31
|
+
sub all_policies {
|
|
32
|
+
return
|
|
33
|
+
map { ("$_" => 1) }
|
|
34
|
+
Perl::Critic->new(-profile => q(), -severity => 1)->policies();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
sub mentioned_policies {
|
|
38
|
+
return
|
|
39
|
+
map { (s/^Perl::Critic::Policy:://r => 1) }
|
|
40
|
+
Perl::Critic::UserProfile->new()->listed_policies();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
sub compare_mentioned_to_all {
|
|
44
|
+
my %all = all_policies();
|
|
45
|
+
my %mentioned = mentioned_policies();
|
|
46
|
+
|
|
47
|
+
my @unmentioned;
|
|
48
|
+
for my $p (keys %all) {
|
|
49
|
+
push @unmentioned, $p unless exists $mentioned{$p};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
my @uninstalled;
|
|
53
|
+
for my $p (keys %mentioned) {
|
|
54
|
+
push @uninstalled, $p unless exists $all{$p};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
my $fail = 0;
|
|
58
|
+
if (@unmentioned) {
|
|
59
|
+
print {*STDERR}
|
|
60
|
+
"*** Unmentioned policies:\n\t",
|
|
61
|
+
join("\n\t", sort @unmentioned),
|
|
62
|
+
"\n\n";
|
|
63
|
+
$fail = 1;
|
|
64
|
+
}
|
|
65
|
+
if (@uninstalled) {
|
|
66
|
+
print {*STDERR}
|
|
67
|
+
"*** Uninstalled policies:\n\t",
|
|
68
|
+
join("\n\t", sort @uninstalled),
|
|
69
|
+
"\n\n";
|
|
70
|
+
$fail = 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return $fail;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
exit compare_mentioned_to_all();
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#! /usr/bin/perl
|
|
2
|
+
# Written by Zack Weinberg <zackw at panix.com> in 2017 and 2020.
|
|
3
|
+
# To the extent possible under law, Zack Weinberg has waived all
|
|
4
|
+
# copyright and related or neighboring rights to this work.
|
|
5
|
+
#
|
|
6
|
+
# See https://creativecommons.org/publicdomain/zero/1.0/ for further
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
# Process libcrypt.minver and determine the minumum symbol version to
|
|
10
|
+
# use for compatibility symbols. Called from configure.ac.
|
|
11
|
+
|
|
12
|
+
use v5.14; # implicit use strict, use feature ':5.14'
|
|
13
|
+
use warnings FATAL => 'all';
|
|
14
|
+
use utf8;
|
|
15
|
+
use open qw(:std :utf8);
|
|
16
|
+
no if $] >= 5.022, warnings => 'experimental::re_strict';
|
|
17
|
+
use if $] >= 5.022, re => 'strict';
|
|
18
|
+
|
|
19
|
+
use FindBin ();
|
|
20
|
+
use lib ${FindBin::Bin};
|
|
21
|
+
use BuildCommon qw(
|
|
22
|
+
ensure_C_locale
|
|
23
|
+
sh_split
|
|
24
|
+
popen
|
|
25
|
+
subprocess_error
|
|
26
|
+
which
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
sub preprocessor_check {
|
|
30
|
+
my ($expr) = @_;
|
|
31
|
+
|
|
32
|
+
state @CC;
|
|
33
|
+
state @CFLAGS;
|
|
34
|
+
if (!@CC) {
|
|
35
|
+
@CC = which($ENV{CC} // 'cc');
|
|
36
|
+
die "C compiler not available\n" unless @CC;
|
|
37
|
+
|
|
38
|
+
@CFLAGS = sh_split($ENV{CFLAGS} // q{});
|
|
39
|
+
|
|
40
|
+
# Remove empty elements, particularly leading ones which
|
|
41
|
+
# cause issues with popen below.
|
|
42
|
+
@CFLAGS = grep { $_ } @CFLAGS;
|
|
43
|
+
|
|
44
|
+
# We call ensure_C_locale here, not from the main section,
|
|
45
|
+
# because this sub might not get called at all, in which
|
|
46
|
+
# case it would be unnecessary work.
|
|
47
|
+
ensure_C_locale();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# FIXME: We assume the compiler understands "-fsyntax-only -xc -"
|
|
51
|
+
# to mean "read standard input, interpret as C, check for errors,
|
|
52
|
+
# produce no output." This is true for all commonly used C
|
|
53
|
+
# compilers on operating systems where this feature is necessary.
|
|
54
|
+
print {*STDERR} "${FindBin::Bin}: testing $expr\n";
|
|
55
|
+
|
|
56
|
+
my $ccpipe = popen('|-', @CC, @CFLAGS, '-fsyntax-only', '-xc', '-');
|
|
57
|
+
print {$ccpipe} <<"EOF";
|
|
58
|
+
#include <limits.h>
|
|
59
|
+
#if !($expr)
|
|
60
|
+
#error nope
|
|
61
|
+
#endif
|
|
62
|
+
int avoid_empty_translation_unit;
|
|
63
|
+
EOF
|
|
64
|
+
if (close $ccpipe) {
|
|
65
|
+
return 1; # compilation successful
|
|
66
|
+
} elsif ($! == 0 && ($? & 0x7F) == 0) {
|
|
67
|
+
return 0; # compilation failed
|
|
68
|
+
} else {
|
|
69
|
+
subprocess_error(@CC);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
sub parse_minver_file {
|
|
74
|
+
my ($minver_file, $system, $cpu) = @_;
|
|
75
|
+
$system = lc $system;
|
|
76
|
+
$cpu = lc $cpu;
|
|
77
|
+
|
|
78
|
+
local $_;
|
|
79
|
+
open my $fh, '<', $minver_file
|
|
80
|
+
or die "$minver_file: $!\n";
|
|
81
|
+
while (<$fh>) {
|
|
82
|
+
next if /^#/;
|
|
83
|
+
chomp;
|
|
84
|
+
s/\s+$//;
|
|
85
|
+
next if $_ eq q{};
|
|
86
|
+
|
|
87
|
+
my ($vers, $vsys, $vcpu, $ppck) = split q{ }, $_, 4;
|
|
88
|
+
$vsys = lc $vsys;
|
|
89
|
+
$vcpu = lc $vcpu;
|
|
90
|
+
|
|
91
|
+
return $vers
|
|
92
|
+
if $system =~ /\A$vsys/
|
|
93
|
+
&& $cpu =~ /\A$vcpu/
|
|
94
|
+
&& (!defined $ppck || preprocessor_check($ppck));
|
|
95
|
+
}
|
|
96
|
+
print {*STDERR} "$0: no match for ${cpu}-${system}\n";
|
|
97
|
+
return 'ERROR';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
#
|
|
101
|
+
# Main
|
|
102
|
+
#
|
|
103
|
+
if (scalar(@ARGV) != 3) {
|
|
104
|
+
print {*STDERR} "usage: $0 libcrypt.minver host-os host-cpu\n";
|
|
105
|
+
print {*STDERR} "Environment variables \$CC and \$CFLAGS are honored.\n";
|
|
106
|
+
exit 2;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
exit 0 if eval {
|
|
110
|
+
print parse_minver_file(@ARGV), "\n";
|
|
111
|
+
close STDOUT or die "write error: $!\n";
|
|
112
|
+
1;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
print {*STDERR} "${FindBin::Script}: $@";
|
|
116
|
+
exit 1;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#! /usr/bin/perl
|
|
2
|
+
# Written by Zack Weinberg <zackw at panix.com> in 2018 and 2020.
|
|
3
|
+
# To the extent possible under law, Zack Weinberg has waived all
|
|
4
|
+
# copyright and related or neighboring rights to this work.
|
|
5
|
+
#
|
|
6
|
+
# See https://creativecommons.org/publicdomain/zero/1.0/ for further
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
# Using the information in lib/hashes.conf, validate a list of
|
|
10
|
+
# selected hashes and hash groups that was supplied as the argument of
|
|
11
|
+
# the --enable-hashes option to the configure script, expand all
|
|
12
|
+
# the groups, and remove duplicates.
|
|
13
|
+
#
|
|
14
|
+
# Caution: if you change the format of lib/hashes.conf you will
|
|
15
|
+
# probably need to modify gen-crypt-hashes-h as well as this script.
|
|
16
|
+
|
|
17
|
+
use v5.14; # implicit use strict, use feature ':5.14'
|
|
18
|
+
use warnings FATAL => 'all';
|
|
19
|
+
use utf8;
|
|
20
|
+
use open qw(:std :utf8);
|
|
21
|
+
no if $] >= 5.022, warnings => 'experimental::re_strict';
|
|
22
|
+
use if $] >= 5.022, re => 'strict';
|
|
23
|
+
|
|
24
|
+
use FindBin ();
|
|
25
|
+
use lib $FindBin::Bin;
|
|
26
|
+
use BuildCommon qw(
|
|
27
|
+
parse_hashes_conf
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
sub expand_selected {
|
|
31
|
+
my ($hconf, $selected) = @_;
|
|
32
|
+
|
|
33
|
+
if ($selected eq 'all') {
|
|
34
|
+
return keys %{$hconf->hashes};
|
|
35
|
+
} else {
|
|
36
|
+
my %enabled;
|
|
37
|
+
my @errors;
|
|
38
|
+
my $hashes = $hconf->hashes;
|
|
39
|
+
my $groups = $hconf->groups;
|
|
40
|
+
for my $w (split /,/, $selected) {
|
|
41
|
+
if ($w eq 'all') {
|
|
42
|
+
push @errors, "'all' must be used alone\n";
|
|
43
|
+
} elsif (exists $hashes->{$w}) {
|
|
44
|
+
$enabled{$w} = 1;
|
|
45
|
+
} elsif (exists $groups->{$w}) {
|
|
46
|
+
for my $h (@{$groups->{$w}}) {
|
|
47
|
+
$enabled{$h->name} = 1;
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
push @errors, "'$w' is not a hash or group name\n";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (scalar(%enabled) == 0) {
|
|
54
|
+
push @errors, "no hashes are enabled\n";
|
|
55
|
+
}
|
|
56
|
+
die join q{}, @errors if @errors;
|
|
57
|
+
return keys %enabled;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#
|
|
62
|
+
# Main
|
|
63
|
+
#
|
|
64
|
+
if (scalar(@ARGV) != 2) {
|
|
65
|
+
print {*STDERR}
|
|
66
|
+
"usage: ${FindBin::Script} hashes.conf names,of,selected,hashes\n";
|
|
67
|
+
exit 1;
|
|
68
|
+
}
|
|
69
|
+
exit 0 if eval {
|
|
70
|
+
my ($hashes_conf, $hashes_selected) = @ARGV;
|
|
71
|
+
my $hconf = parse_hashes_conf($hashes_conf);
|
|
72
|
+
my @enabled = expand_selected($hconf, $hashes_selected);
|
|
73
|
+
|
|
74
|
+
print ',', (join ',', sort @enabled), ",\n";
|
|
75
|
+
close STDOUT or die "write error: $!\n";
|
|
76
|
+
1;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
print {*STDERR} "${FindBin::Script}: $@";
|
|
80
|
+
exit 1;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#! /usr/bin/perl
|
|
2
|
+
# Written by Zack Weinberg <zackw at panix.com> in 2017.
|
|
3
|
+
# To the extent possible under law, Zack Weinberg has waived all
|
|
4
|
+
# copyright and related or neighboring rights to this work.
|
|
5
|
+
#
|
|
6
|
+
# See https://creativecommons.org/publicdomain/zero/1.0/ for further
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
# Generate (x)crypt.h from (x)crypt.h.in.
|
|
10
|
+
|
|
11
|
+
use v5.14; # implicit use strict, use feature ':5.14'
|
|
12
|
+
use warnings FATAL => 'all';
|
|
13
|
+
use utf8;
|
|
14
|
+
use open qw(:std :utf8);
|
|
15
|
+
no if $] >= 5.022, warnings => 'experimental::re_strict';
|
|
16
|
+
use if $] >= 5.022, re => 'strict';
|
|
17
|
+
|
|
18
|
+
use FindBin ();
|
|
19
|
+
use lib $FindBin::Bin;
|
|
20
|
+
use BuildCommon qw(
|
|
21
|
+
enabled_set
|
|
22
|
+
parse_hashes_conf
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
# Substitutions we know about are accumulated in this hash.
|
|
26
|
+
my %substs;
|
|
27
|
+
|
|
28
|
+
sub process_config_h {
|
|
29
|
+
my ($config_h) = @_;
|
|
30
|
+
open my $fh, '<', $config_h
|
|
31
|
+
or die "$config_h: $!\n";
|
|
32
|
+
|
|
33
|
+
my $have_sys_cdefs_h = 0;
|
|
34
|
+
my $have_sys_cdefs_begin_end_decls = 0;
|
|
35
|
+
my $have_sys_cdefs_throw = 0;
|
|
36
|
+
local $_;
|
|
37
|
+
while (<$fh>) {
|
|
38
|
+
chomp;
|
|
39
|
+
|
|
40
|
+
if ($_ eq '#define HAVE_SYS_CDEFS_H 1') {
|
|
41
|
+
$have_sys_cdefs_h = 1;
|
|
42
|
+
} elsif ($_ eq '#define HAVE_SYS_CDEFS_BEGIN_END_DECLS 1') {
|
|
43
|
+
$have_sys_cdefs_begin_end_decls = 1;
|
|
44
|
+
} elsif ($_ eq '#define HAVE_SYS_CDEFS_THROW 1') {
|
|
45
|
+
$have_sys_cdefs_throw = 1;
|
|
46
|
+
} elsif (/^#define PACKAGE_VERSION "((\d+)\.(\d+)\.\d+)"$/) {
|
|
47
|
+
$substs{XCRYPT_VERSION_STR} = $1;
|
|
48
|
+
$substs{XCRYPT_VERSION_MAJOR} = $2;
|
|
49
|
+
$substs{XCRYPT_VERSION_MINOR} = $3;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
die "$config_h: error: inconsistent <sys/cdefs.h> settings\n"
|
|
54
|
+
if !$have_sys_cdefs_h
|
|
55
|
+
&& ($have_sys_cdefs_begin_end_decls || $have_sys_cdefs_throw);
|
|
56
|
+
|
|
57
|
+
my $s = q{};
|
|
58
|
+
my $e = q{};
|
|
59
|
+
$s .= "#include <sys/cdefs.h>\n" if $have_sys_cdefs_h;
|
|
60
|
+
$s .= "#define __THROW /* nothing */\n" unless $have_sys_cdefs_throw;
|
|
61
|
+
$s .= "\n";
|
|
62
|
+
if ($have_sys_cdefs_begin_end_decls) {
|
|
63
|
+
$s .= '__BEGIN_DECLS';
|
|
64
|
+
$e .= '__END_DECLS';
|
|
65
|
+
} else {
|
|
66
|
+
$s .= "#ifdef __cplusplus\nextern \"C\" {\n#endif";
|
|
67
|
+
$e .= "#ifdef __cplusplus\n} /* extern \"C\" */\n#endif";
|
|
68
|
+
}
|
|
69
|
+
$substs{BEGIN_DECLS} = $s;
|
|
70
|
+
$substs{END_DECLS} = $e;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
sub process_hashes_conf {
|
|
75
|
+
my ($hashes_conf, $hashes_enabled) = @_;
|
|
76
|
+
my %enabled = enabled_set($hashes_enabled);
|
|
77
|
+
my $hconf = parse_hashes_conf($hashes_conf);
|
|
78
|
+
|
|
79
|
+
my $default_prefix_enabled = 0;
|
|
80
|
+
for my $e (@{$hconf->default_candidates}) {
|
|
81
|
+
if ($enabled{$e->name}) {
|
|
82
|
+
$default_prefix_enabled = 1;
|
|
83
|
+
last;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
$substs{DEFAULT_PREFIX_ENABLED} = $default_prefix_enabled;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
sub substitute {
|
|
91
|
+
my ($infile) = @_;
|
|
92
|
+
open my $fh, '<', $infile
|
|
93
|
+
or die "$infile: $!\n";
|
|
94
|
+
my $error = 0;
|
|
95
|
+
local $_;
|
|
96
|
+
my $subst1 = sub {
|
|
97
|
+
my $rep = $substs{$_[0]};
|
|
98
|
+
return $rep if defined $rep;
|
|
99
|
+
|
|
100
|
+
print {*STDERR} "$infile:$.: error: no substitution for $_[0]\n";
|
|
101
|
+
$error = 1;
|
|
102
|
+
return "!$_[0]!";
|
|
103
|
+
};
|
|
104
|
+
while (<$fh>) {
|
|
105
|
+
s/@([A-Z0-9_]+)@/&$subst1($1)/eg;
|
|
106
|
+
print;
|
|
107
|
+
}
|
|
108
|
+
exit 1 if $error;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
#
|
|
113
|
+
# Main
|
|
114
|
+
#
|
|
115
|
+
if (scalar(@ARGV) != 2 && scalar(@ARGV) != 4) {
|
|
116
|
+
print {*STDERR} 'usage: '
|
|
117
|
+
. ${FindBin::Script}
|
|
118
|
+
. ' template config.h [hashes.conf ,hashes,enabled,]' . "\n";
|
|
119
|
+
exit 1;
|
|
120
|
+
}
|
|
121
|
+
exit 0 if eval {
|
|
122
|
+
my $infile = shift @ARGV;
|
|
123
|
+
process_config_h(shift @ARGV);
|
|
124
|
+
process_hashes_conf(@ARGV) if @ARGV;
|
|
125
|
+
substitute($infile);
|
|
126
|
+
close STDOUT or die "write error: $!\n";
|
|
127
|
+
1;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
print {*STDERR} "${FindBin::Script}: $@";
|
|
131
|
+
exit 1;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#! /usr/bin/perl
|
|
2
|
+
# Written by Zack Weinberg <zackw at panix.com> in 2018 and 2020.
|
|
3
|
+
# To the extent possible under law, Zack Weinberg has waived all
|
|
4
|
+
# copyright and related or neighboring rights to this work.
|
|
5
|
+
#
|
|
6
|
+
# See https://creativecommons.org/publicdomain/zero/1.0/ for further
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
# Generate crypt-hashes.h from lib/hashes.conf and configure settings.
|
|
10
|
+
# Also responsible for checking lib/hashes.conf for errors.
|
|
11
|
+
#
|
|
12
|
+
# Caution: if you change the format of lib/hashes.conf you will
|
|
13
|
+
# probably need to modify expand-selected-hashes as well as this script.
|
|
14
|
+
|
|
15
|
+
use v5.14; # implicit use strict, use feature ':5.14'
|
|
16
|
+
use warnings FATAL => 'all';
|
|
17
|
+
use utf8;
|
|
18
|
+
use open qw(:std :utf8);
|
|
19
|
+
no if $] >= 5.022, warnings => 'experimental::re_strict';
|
|
20
|
+
use if $] >= 5.022, re => 'strict';
|
|
21
|
+
|
|
22
|
+
use File::Spec::Functions qw(splitpath);
|
|
23
|
+
use FindBin ();
|
|
24
|
+
use lib $FindBin::Bin;
|
|
25
|
+
use BuildCommon qw(
|
|
26
|
+
enabled_set
|
|
27
|
+
parse_hashes_conf
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
sub output {
|
|
31
|
+
my ($basehc, $hashes_enabled, $hconf) = @_;
|
|
32
|
+
my %enabled = enabled_set($hashes_enabled);
|
|
33
|
+
my @enabled_hashes;
|
|
34
|
+
|
|
35
|
+
print <<"EOT";
|
|
36
|
+
/* Generated by ${FindBin::Script} from $basehc. DO NOT EDIT. */
|
|
37
|
+
|
|
38
|
+
#ifndef _CRYPT_HASHES_H
|
|
39
|
+
#define _CRYPT_HASHES_H 1
|
|
40
|
+
|
|
41
|
+
EOT
|
|
42
|
+
for my $e (sort { $a->name cmp $b->name } values %{$hconf->hashes}) {
|
|
43
|
+
my $name = $e->name;
|
|
44
|
+
my $ena = $enabled{$name} // 0;
|
|
45
|
+
printf "#define INCLUDE_%-*s %d\n", $hconf->max_namelen, $name, $ena;
|
|
46
|
+
push @enabled_hashes, $e if $ena;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
print <<'EOT';
|
|
50
|
+
|
|
51
|
+
/* Internal symbol renames for static linkage, see crypt-port.h. */
|
|
52
|
+
EOT
|
|
53
|
+
for my $e (@enabled_hashes) {
|
|
54
|
+
my $name_rn = $e->name . '_rn';
|
|
55
|
+
printf "#define crypt_%-*s _crypt_crypt_%s\n",
|
|
56
|
+
$hconf->max_namelen + 5, $name_rn, $name_rn;
|
|
57
|
+
printf "#define gensalt_%-*s _crypt_gensalt_%s\n",
|
|
58
|
+
$hconf->max_namelen + 3, $name_rn, $name_rn;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
print <<'EOT';
|
|
62
|
+
|
|
63
|
+
/* Prototypes for hash algorithm entry points. */
|
|
64
|
+
EOT
|
|
65
|
+
for my $e (@enabled_hashes) {
|
|
66
|
+
my $name = $e->name;
|
|
67
|
+
print <<"EOT";
|
|
68
|
+
extern void crypt_${name}_rn (const char *, size_t, const char *,
|
|
69
|
+
size_t, uint8_t *, size_t, void *, size_t);
|
|
70
|
+
extern void gensalt_${name}_rn (unsigned long,
|
|
71
|
+
const uint8_t *, size_t, uint8_t *, size_t);
|
|
72
|
+
|
|
73
|
+
EOT
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
print <<'EOT';
|
|
77
|
+
#define HASH_ALGORITHM_TABLE_ENTRIES \
|
|
78
|
+
EOT
|
|
79
|
+
# Entries in this table can be in any order _except_ that the hash
|
|
80
|
+
# whose prefix is the empty string, if it's enabled, must be last.
|
|
81
|
+
# The simplest way to accomplish this is to sort the prefixes in
|
|
82
|
+
# descending order of length (and then alphabetically as a
|
|
83
|
+
# tiebreaker).
|
|
84
|
+
my @table_hashes = sort {
|
|
85
|
+
-(length($a->prefix) <=> length($b->prefix))
|
|
86
|
+
|| $a->prefix cmp $b->prefix
|
|
87
|
+
} @enabled_hashes;
|
|
88
|
+
|
|
89
|
+
for my $e (@table_hashes) {
|
|
90
|
+
my $name_rn = $e->name . '_rn,';
|
|
91
|
+
my $q_prefix = '"' . $e->prefix . '",';
|
|
92
|
+
my $str_nrbytes = $e->nrbytes . ',';
|
|
93
|
+
printf " { %-*s %d, crypt_%-*s gensalt_%-*s %-*s %s}, \\\n",
|
|
94
|
+
$hconf->max_prefixlen + 3, $q_prefix, length($e->prefix),
|
|
95
|
+
$hconf->max_namelen + 4, $name_rn,
|
|
96
|
+
$hconf->max_namelen + 4, $name_rn,
|
|
97
|
+
$hconf->max_nrbyteslen + 1, $str_nrbytes, $e->is_strong;
|
|
98
|
+
}
|
|
99
|
+
print " { 0, 0, 0, 0, 0, 0 }\n";
|
|
100
|
+
|
|
101
|
+
# The default_candidates array is in decreasing order of strength;
|
|
102
|
+
# select the first one that's enabled, if any.
|
|
103
|
+
my $default_prefix;
|
|
104
|
+
for my $e (@{$hconf->default_candidates}) {
|
|
105
|
+
if ($enabled{$e->name}) {
|
|
106
|
+
$default_prefix = $e->prefix;
|
|
107
|
+
last;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
print <<"EOT" if defined $default_prefix;
|
|
111
|
+
|
|
112
|
+
#define HASH_ALGORITHM_DEFAULT "$default_prefix"
|
|
113
|
+
EOT
|
|
114
|
+
print <<'EOT';
|
|
115
|
+
|
|
116
|
+
#endif /* crypt-hashes.h */
|
|
117
|
+
EOT
|
|
118
|
+
|
|
119
|
+
close STDOUT or die "write error: $!\n";
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#
|
|
124
|
+
# Main
|
|
125
|
+
#
|
|
126
|
+
if (scalar(@ARGV) != 2) {
|
|
127
|
+
print {*STDERR} "usage: ${FindBin::Script}"
|
|
128
|
+
. "hashes.conf ,names,of,enabled,hashes,\n";
|
|
129
|
+
exit 1;
|
|
130
|
+
}
|
|
131
|
+
exit 0 if eval {
|
|
132
|
+
my ($hashes_conf, $hashes_enabled) = @ARGV;
|
|
133
|
+
my (undef, undef, $basehc) = splitpath($hashes_conf);
|
|
134
|
+
|
|
135
|
+
my $hconf = parse_hashes_conf($hashes_conf);
|
|
136
|
+
output($basehc, $hashes_enabled, $hconf);
|
|
137
|
+
1;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
print {*STDERR} "${FindBin::Script}: $@";
|
|
141
|
+
exit 1;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#! /usr/bin/perl
|
|
2
|
+
# Written by Zack Weinberg <zackw at panix.com> in 2017 and 2021.
|
|
3
|
+
# To the extent possible under law, Zack Weinberg has waived all
|
|
4
|
+
# copyright and related or neighboring rights to this work.
|
|
5
|
+
#
|
|
6
|
+
# See https://creativecommons.org/publicdomain/zero/1.0/ for further
|
|
7
|
+
# details.
|
|
8
|
+
|
|
9
|
+
# Generate macros that control the symbol versions of the public
|
|
10
|
+
# library API, from a .map.in file.
|
|
11
|
+
#
|
|
12
|
+
# See libcrypt.map.in for an explanation of the format of .map.in
|
|
13
|
+
# files. See crypt-port.h for an explanation of how to use the macros
|
|
14
|
+
# generated by this program.
|
|
15
|
+
#
|
|
16
|
+
# Note: we currently don't support compatibility symbols that need
|
|
17
|
+
# a different definition from the default version.
|
|
18
|
+
|
|
19
|
+
use v5.14; # implicit use strict, use feature ':5.14'
|
|
20
|
+
use warnings FATAL => 'all';
|
|
21
|
+
use utf8;
|
|
22
|
+
use open qw(:std :utf8);
|
|
23
|
+
no if $] >= 5.022, warnings => 'experimental::re_strict';
|
|
24
|
+
use if $] >= 5.022, re => 'strict';
|
|
25
|
+
|
|
26
|
+
use FindBin ();
|
|
27
|
+
use lib $FindBin::Bin;
|
|
28
|
+
use BuildCommon qw(
|
|
29
|
+
parse_version_map_in
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
sub output {
|
|
33
|
+
my ($apply_symvers, $symvers) = @_;
|
|
34
|
+
my $basemap = $symvers->basemap;
|
|
35
|
+
print "/* Generated from $basemap by ${FindBin::Script}. "
|
|
36
|
+
. "DO NOT EDIT. */\n";
|
|
37
|
+
|
|
38
|
+
print <<'EOT';
|
|
39
|
+
|
|
40
|
+
#ifndef _CRYPT_SYMBOL_VERS_H
|
|
41
|
+
#define _CRYPT_SYMBOL_VERS_H 1
|
|
42
|
+
|
|
43
|
+
/* For each public symbol <sym>, INCLUDE_<sym> is true if it
|
|
44
|
+
has any versions above the backward compatibility minimum.
|
|
45
|
+
Compatibility-only symbols are not included in the static
|
|
46
|
+
library, or in the shared library when configured with
|
|
47
|
+
--disable-obsolete-api. */
|
|
48
|
+
#if defined PIC && ENABLE_OBSOLETE_API
|
|
49
|
+
|
|
50
|
+
EOT
|
|
51
|
+
|
|
52
|
+
for my $sym (@{$symvers->symbols}) {
|
|
53
|
+
printf "#define INCLUDE_%-*s %d\n",
|
|
54
|
+
$symvers->max_symlen, $sym->name, $sym->included;
|
|
55
|
+
}
|
|
56
|
+
print "\n#else\n\n";
|
|
57
|
+
for my $sym (@{$symvers->symbols}) {
|
|
58
|
+
printf "#define INCLUDE_%-*s %d\n",
|
|
59
|
+
$symvers->max_symlen, $sym->name,
|
|
60
|
+
$sym->included && !$sym->compat_only;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if ($apply_symvers =~ m/no/) {
|
|
64
|
+
print <<'EOT';
|
|
65
|
+
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
/* We are building this library with no symbol versioning
|
|
69
|
+
enabled, so let's define all macros for SYMVER_ to do
|
|
70
|
+
nothing. */
|
|
71
|
+
EOT
|
|
72
|
+
for my $sym (@{$symvers->symbols}) {
|
|
73
|
+
my $name = $sym->name;
|
|
74
|
+
print "#define SYMVER_$name symver_nop()\n";
|
|
75
|
+
}
|
|
76
|
+
print <<'EOT';
|
|
77
|
+
#endif
|
|
78
|
+
EOT
|
|
79
|
+
close STDOUT or die "write error: $!\n";
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
print <<'EOT';
|
|
84
|
+
|
|
85
|
+
#endif
|
|
86
|
+
|
|
87
|
+
/* When the public symbols are being given versions, they must be
|
|
88
|
+
defined under a different, private name first. */
|
|
89
|
+
#ifdef PIC
|
|
90
|
+
EOT
|
|
91
|
+
|
|
92
|
+
for my $sym (@{$symvers->symbols}) {
|
|
93
|
+
if ($sym->included) {
|
|
94
|
+
printf "#define %-*s _crypt_%s\n",
|
|
95
|
+
$symvers->max_symlen, $sym->name, $sym->name;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
print <<'EOT';
|
|
100
|
+
#endif
|
|
101
|
+
|
|
102
|
+
/* For each public symbol <sym> that is included, define its
|
|
103
|
+
highest version as the default, and aliases at each
|
|
104
|
+
compatibility version. */
|
|
105
|
+
EOT
|
|
106
|
+
|
|
107
|
+
for my $sym (@{$symvers->symbols}) {
|
|
108
|
+
my $name = $sym->name;
|
|
109
|
+
if (!$sym->included) {
|
|
110
|
+
print "#define SYMVER_$name symver_nop()\n";
|
|
111
|
+
next;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
my $seq = 0;
|
|
115
|
+
for my $v (@{$sym->versions}) {
|
|
116
|
+
if ($seq == 0) {
|
|
117
|
+
print "#define SYMVER_$name \\\n";
|
|
118
|
+
if ($sym->compat_only) {
|
|
119
|
+
print " symver_compat0 (\"$name\", $name, $v)";
|
|
120
|
+
} else {
|
|
121
|
+
print " symver_default (\"$name\", $name, $v)";
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
print "; \\\n"
|
|
125
|
+
. " symver_compat ($seq, \"$name\", $name, $name, $v)";
|
|
126
|
+
}
|
|
127
|
+
$seq++;
|
|
128
|
+
}
|
|
129
|
+
print "\n";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
print <<'EOT';
|
|
133
|
+
|
|
134
|
+
#endif /* crypt-symbol-vers.h */
|
|
135
|
+
EOT
|
|
136
|
+
|
|
137
|
+
close STDOUT or die "write error: $!\n";
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
#
|
|
142
|
+
# Main
|
|
143
|
+
#
|
|
144
|
+
exit 0 if eval {
|
|
145
|
+
output($ARGV[0], parse_version_map_in(@ARGV[1 .. 4]));
|
|
146
|
+
1;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
print {*STDERR} "${FindBin::Script}: $@";
|
|
150
|
+
exit 1;
|