From 69e0f8cca691dc474300422c48e14713ace8dd2c Mon Sep 17 00:00:00 2001 From: Shane Lontis Date: Mon, 7 Jun 2021 11:33:28 +1000 Subject: [PATCH] Fix AIX FIPS DEP. The entry point needs the option 'binitfini', but it was not being added since the perl code to detect the match did not work. The entry point for AIX is no longer static - so a wrapper has been added to call the static version. Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/15636) --- Configurations/10-main.conf | 2 +- Configurations/unix-Makefile.tmpl | 2 +- providers/fips/self_test.c | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf index a07624e96b..138ad8a6ae 100644 --- a/Configurations/10-main.conf +++ b/Configurations/10-main.conf @@ -1180,7 +1180,7 @@ my %targets = ( module_ldflags => "-Wl,-G,-bsymbolic,-bnoentry", shared_ldflag => "-Wl,-G,-bsymbolic,-bnoentry", shared_defflag => "-Wl,-bE:", - shared_fipsflag => "-Wl,-binitfini:init:cleanup", + shared_fipsflag => "-Wl,-binitfini:_init:_cleanup", perl_platform => 'AIX', }, "aix-gcc" => { diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 80f38dd1a2..ff04e65163 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -1838,7 +1838,7 @@ EOF my @deps = compute_lib_depends(@{$args{deps}}); my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); # Next line needs to become "less magic" (see PR #11950) - $shared_def .= ' '.$target{shared_fipsflag} if (m/providers\/fips/ && defined $target{shared_fipsflag}); + $shared_def .= ' '.$target{shared_fipsflag} if (defined $target{shared_fipsflag} && $shared_def =~ m/providers\/fips/); my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); my $deps = join(" \\\n" . ' ' x (length($dso) + 2), fill_lines(' ', $COLUMNS - length($dso) - 2, diff --git a/providers/fips/self_test.c b/providers/fips/self_test.c index a4d7a4ffe2..e6813e292d 100644 --- a/providers/fips/self_test.c +++ b/providers/fips/self_test.c @@ -105,10 +105,24 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } return TRUE; } -#elif defined(__sun) || defined(_AIX) +#elif defined(__sun) # pragma init(init) # pragma fini(cleanup) +#elif defined(_AIX) +void _init(void); +void _cleanup(void); +# pragma init(_init) +# pragma fini(_cleanup) +void _init(void) +{ + init(); +} +void _cleanup(void) +{ + cleanup(); +} + #elif defined(__hpux) # pragma init "init" # pragma fini "cleanup"