Skip to content

Commit 31b6ed7

Browse files
committed
Rework DSO API conditions and configuration option
'no-dso' is meaningless, as it doesn't get any macro defined. Therefore, we remove all checks of OPENSSL_NO_DSO. However, there may be some odd platforms with no DSO scheme. For those, we generate the internal macro DSO_NONE aand use it. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/#8622)
1 parent 9c119bc commit 31b6ed7

6 files changed

Lines changed: 14 additions & 27 deletions

File tree

Configure

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use OpenSSL::Glob;
2424
my $orig_death_handler = $SIG{__DIE__};
2525
$SIG{__DIE__} = \&death_handler;
2626

27-
my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n";
27+
my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n";
2828

2929
# Options:
3030
#
@@ -59,8 +59,6 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
5959
# [no-]pic [don't] try to build position independent code when supported.
6060
# If disabled, it also disables shared and dynamic-engine.
6161
# no-asm do not use assembler
62-
# no-dso do not compile in any native shared-library methods. This
63-
# will ensure that all methods just return NULL.
6462
# no-egd do not compile support for the entropy-gathering daemon APIs
6563
# [no-]zlib [don't] compile support for zlib compression.
6664
# zlib-dynamic Like "zlib", but the zlib library is expected to be a shared
@@ -76,7 +74,7 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
7674
# -static while -static is also a pass-through compiler option (and
7775
# as such is limited to environments where it's actually
7876
# meaningful), it triggers a number configuration options,
79-
# namely no-dso, no-pic, no-shared and no-threads. It is
77+
# namely no-pic, no-shared and no-threads. It is
8078
# argued that the only reason to produce statically linked
8179
# binaries (and in context it means executables linked with
8280
# -static flag, and not just executables linked with static
@@ -359,7 +357,6 @@ my @disablables = (
359357
"dgram",
360358
"dh",
361359
"dsa",
362-
"dso",
363360
"dtls",
364361
"dynamic-engine",
365362
"ec",
@@ -440,6 +437,7 @@ my %deprecated_disablables = (
440437
"hw-padlock" => "padlockeng",
441438
"ripemd" => "rmd160",
442439
"ui" => "ui-console",
440+
"dso" => undef,
443441
);
444442

445443
# All of the following are disabled by default:
@@ -494,9 +492,6 @@ my @disable_cascades = (
494492

495493
"crypto-mdebug" => [ "crypto-mdebug-backtrace" ],
496494

497-
# Without DSO, we can't load dynamic engines, so don't build them dynamic
498-
"dso" => [ "dynamic-engine" ],
499-
500495
# Without position independent code, there can be no shared libraries or DSOs
501496
"pic" => [ "shared" ],
502497
"shared" => [ "dynamic-engine" ],
@@ -876,7 +871,6 @@ while (@argvcopy)
876871
elsif (/^-static$/)
877872
{
878873
push @{$useradd{LDFLAGS}}, $_;
879-
$disabled{"dso"} = "forced";
880874
$disabled{"pic"} = "forced";
881875
$disabled{"shared"} = "forced";
882876
$disabled{"threads"} = "forced";
@@ -1211,7 +1205,7 @@ foreach my $what (sort keys %disabled) {
12111205

12121206
$config{options} .= " no-$what";
12131207

1214-
if (!grep { $what eq $_ } ( 'buildtest-c++', 'dso', 'threads', 'shared',
1208+
if (!grep { $what eq $_ } ( 'buildtest-c++', 'threads', 'shared',
12151209
'pic', 'dynamic-engine', 'makedepend',
12161210
'zlib-dynamic', 'zlib', 'sse2' )) {
12171211
(my $WHAT = uc $what) =~ s|-|_|g;

INSTALL

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,6 @@
353353
on BSD implementations, in which case it can be disabled with
354354
no-devcryptoeng.
355355

356-
no-dso
357-
Don't build support for loading Dynamic Shared Objects.
358-
359356
no-dynamic-engine
360357
Don't build the dynamically loaded engines. This only has an
361358
effect in a "shared" build

crypto/dso/dso_openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "dso_locl.h"
1111

12-
#if !defined(DSO_VMS) && !defined(DSO_DLCFN) && !defined(DSO_DL) && !defined(DSO_WIN32) && !defined(DSO_DLFCN)
12+
#ifdef DSO_NONE
1313

1414
static DSO_METHOD dso_meth_null = {
1515
"NULL shared library method"

crypto/include/internal/dso_conf.h.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010

1111
#ifndef HEADER_DSO_CONF_H
1212
# define HEADER_DSO_CONF_H
13-
{- output_off() if $disabled{dso} -}
1413
{- # The DSO code currently always implements all functions so that no
1514
# applications will have to worry about that from a compilation point
1615
# of view. However, the "method"s may return zero unless that platform
1716
# has support compiled in for them. Currently each method is enabled
1817
# by a define "DSO_<name>" ... we translate the "dso_scheme" config
1918
# string entry into using the following logic;
2019
my $scheme = uc $target{dso_scheme};
20+
if (!$scheme) {
21+
$scheme = "NONE";
22+
}
2123
my @macros = ( "DSO_$scheme" );
2224
if ($scheme eq 'DLFCN') {
2325
@macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" );
@@ -26,5 +28,4 @@
2628
}
2729
join("\n", map { "# define $_" } @macros); -}
2830
# define DSO_EXTENSION "{- platform->dsoext() -}"
29-
{- output_on() if $disabled{dso} -}
3031
#endif

crypto/init.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
160160
{
161161
OSSL_TRACE(INIT, "ossl_init_load_crypto_nodelete()\n");
162162

163-
#if !defined(OPENSSL_NO_DSO) \
164-
&& !defined(OPENSSL_USE_NODELETE) \
163+
#if !defined(OPENSSL_USE_NODELETE) \
165164
&& !defined(OPENSSL_NO_PINSHARED)
166165
# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
167166
{
@@ -179,7 +178,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
179178
(ret == TRUE ? "No!" : "Yes."));
180179
return (ret == TRUE) ? 1 : 0;
181180
}
182-
# else
181+
# elif !defined(DSO_NONE)
183182
/*
184183
* Deliberately leak a reference to ourselves. This will force the library
185184
* to remain loaded until the atexit() handler is run at process exit.
@@ -733,8 +732,7 @@ int OPENSSL_atexit(void (*handler)(void))
733732
{
734733
OPENSSL_INIT_STOP *newhand;
735734

736-
#if !defined(OPENSSL_NO_DSO) \
737-
&& !defined(OPENSSL_USE_NODELETE)\
735+
#if !defined(OPENSSL_USE_NODELETE)\
738736
&& !defined(OPENSSL_NO_PINSHARED)
739737
{
740738
union {
@@ -759,7 +757,7 @@ int OPENSSL_atexit(void (*handler)(void))
759757
if (!ret)
760758
return 0;
761759
}
762-
# else
760+
# elif !defined(DSO_NONE)
763761
/*
764762
* Deliberately leak a reference to the handler. This will force the
765763
* library/code containing the handler to remain loaded until we run the

include/internal/dsoerr.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717

1818
# include <openssl/opensslconf.h>
1919

20-
# ifndef OPENSSL_NO_DSO
21-
22-
# ifdef __cplusplus
20+
# ifdef __cplusplus
2321
extern "C"
24-
# endif
22+
# endif
2523
int ERR_load_DSO_strings(void);
2624

2725
/*
@@ -83,5 +81,4 @@ int ERR_load_DSO_strings(void);
8381
# define DSO_R_UNLOAD_FAILED 107
8482
# define DSO_R_UNSUPPORTED 108
8583

86-
# endif
8784
#endif

0 commit comments

Comments
 (0)