Rework DSO API conditions and configuration option
authorRichard Levitte <levitte@openssl.org>
Sun, 31 Mar 2019 14:15:02 +0000 (16:15 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 1 Apr 2019 04:14:50 +0000 (06:14 +0200)
'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)

Configure
INSTALL
crypto/dso/dso_openssl.c
crypto/include/internal/dso_conf.h.in
crypto/init.c
include/internal/dsoerr.h

index 5aaa6401073df6851e47299f089c6b6b13663651..258f99184d3ac98aab71dfd221cff90899eca46d 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -24,7 +24,7 @@ use OpenSSL::Glob;
 my $orig_death_handler = $SIG{__DIE__};
 $SIG{__DIE__} = \&death_handler;
 
 my $orig_death_handler = $SIG{__DIE__};
 $SIG{__DIE__} = \&death_handler;
 
-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";
+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";
 
 # Options:
 #
 
 # Options:
 #
@@ -59,8 +59,6 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
 # [no-]pic      [don't] try to build position independent code when supported.
 #               If disabled, it also disables shared and dynamic-engine.
 # no-asm        do not use assembler
 # [no-]pic      [don't] try to build position independent code when supported.
 #               If disabled, it also disables shared and dynamic-engine.
 # no-asm        do not use assembler
-# no-dso        do not compile in any native shared-library methods. This
-#               will ensure that all methods just return NULL.
 # no-egd        do not compile support for the entropy-gathering daemon APIs
 # [no-]zlib     [don't] compile support for zlib compression.
 # zlib-dynamic  Like "zlib", but the zlib library is expected to be a shared
 # no-egd        do not compile support for the entropy-gathering daemon APIs
 # [no-]zlib     [don't] compile support for zlib compression.
 # 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
 # -static       while -static is also a pass-through compiler option (and
 #               as such is limited to environments where it's actually
 #               meaningful), it triggers a number configuration options,
 # -static       while -static is also a pass-through compiler option (and
 #               as such is limited to environments where it's actually
 #               meaningful), it triggers a number configuration options,
-#               namely no-dso, no-pic, no-shared and no-threads. It is
+#               namely no-pic, no-shared and no-threads. It is
 #               argued that the only reason to produce statically linked
 #               binaries (and in context it means executables linked with
 #               -static flag, and not just executables linked with static
 #               argued that the only reason to produce statically linked
 #               binaries (and in context it means executables linked with
 #               -static flag, and not just executables linked with static
@@ -359,7 +357,6 @@ my @disablables = (
     "dgram",
     "dh",
     "dsa",
     "dgram",
     "dh",
     "dsa",
-    "dso",
     "dtls",
     "dynamic-engine",
     "ec",
     "dtls",
     "dynamic-engine",
     "ec",
@@ -440,6 +437,7 @@ my %deprecated_disablables = (
     "hw-padlock" => "padlockeng",
     "ripemd" => "rmd160",
     "ui" => "ui-console",
     "hw-padlock" => "padlockeng",
     "ripemd" => "rmd160",
     "ui" => "ui-console",
+    "dso" => undef,
     );
 
 # All of the following are disabled by default:
     );
 
 # All of the following are disabled by default:
@@ -494,9 +492,6 @@ my @disable_cascades = (
 
     "crypto-mdebug"     => [ "crypto-mdebug-backtrace" ],
 
 
     "crypto-mdebug"     => [ "crypto-mdebug-backtrace" ],
 
-    # Without DSO, we can't load dynamic engines, so don't build them dynamic
-    "dso"               => [ "dynamic-engine" ],
-
     # Without position independent code, there can be no shared libraries or DSOs
     "pic"               => [ "shared" ],
     "shared"            => [ "dynamic-engine" ],
     # Without position independent code, there can be no shared libraries or DSOs
     "pic"               => [ "shared" ],
     "shared"            => [ "dynamic-engine" ],
@@ -876,7 +871,6 @@ while (@argvcopy)
                 elsif (/^-static$/)
                         {
                         push @{$useradd{LDFLAGS}}, $_;
                 elsif (/^-static$/)
                         {
                         push @{$useradd{LDFLAGS}}, $_;
-                        $disabled{"dso"} = "forced";
                         $disabled{"pic"} = "forced";
                         $disabled{"shared"} = "forced";
                         $disabled{"threads"} = "forced";
                         $disabled{"pic"} = "forced";
                         $disabled{"shared"} = "forced";
                         $disabled{"threads"} = "forced";
@@ -1211,7 +1205,7 @@ foreach my $what (sort keys %disabled) {
 
     $config{options} .= " no-$what";
 
 
     $config{options} .= " no-$what";
 
-    if (!grep { $what eq $_ } ( 'buildtest-c++', 'dso', 'threads', 'shared',
+    if (!grep { $what eq $_ } ( 'buildtest-c++', 'threads', 'shared',
                                 'pic', 'dynamic-engine', 'makedepend',
                                 'zlib-dynamic', 'zlib', 'sse2' )) {
         (my $WHAT = uc $what) =~ s|-|_|g;
                                 'pic', 'dynamic-engine', 'makedepend',
                                 'zlib-dynamic', 'zlib', 'sse2' )) {
         (my $WHAT = uc $what) =~ s|-|_|g;
diff --git a/INSTALL b/INSTALL
index cffa241a7ba1a1690c0512c314858d49f85157c7..9273db3b635198077c71365fbbc5388f51a96440 100644 (file)
--- a/INSTALL
+++ b/INSTALL
                    on BSD implementations, in which case it can be disabled with
                    no-devcryptoeng.
 
                    on BSD implementations, in which case it can be disabled with
                    no-devcryptoeng.
 
-  no-dso
-                   Don't build support for loading Dynamic Shared Objects.
-
   no-dynamic-engine
                    Don't build the dynamically loaded engines. This only has an
                    effect in a "shared" build
   no-dynamic-engine
                    Don't build the dynamically loaded engines. This only has an
                    effect in a "shared" build
index d834b2ecaf6cec1ccd9477a39192245e5ccae4ee..0e2443804ce3788ae4bf24c9fb2276a2c2d15219 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "dso_locl.h"
 
 
 #include "dso_locl.h"
 
-#if !defined(DSO_VMS) && !defined(DSO_DLCFN) && !defined(DSO_DL) && !defined(DSO_WIN32) && !defined(DSO_DLFCN)
+#ifdef DSO_NONE
 
 static DSO_METHOD dso_meth_null = {
     "NULL shared library method"
 
 static DSO_METHOD dso_meth_null = {
     "NULL shared library method"
index 6e6b9bc28193b0088c85df88d88392d1eedc8d6d..b6703f7c1d7bfc791c780e4582ddc1b3c4d6f319 100644 (file)
@@ -10,7 +10,6 @@
 
 #ifndef HEADER_DSO_CONF_H
 # define HEADER_DSO_CONF_H
 
 #ifndef HEADER_DSO_CONF_H
 # define HEADER_DSO_CONF_H
-{- output_off() if $disabled{dso} -}
 {-  # The DSO code currently always implements all functions so that no
     # applications will have to worry about that from a compilation point
     # of view. However, the "method"s may return zero unless that platform
 {-  # The DSO code currently always implements all functions so that no
     # applications will have to worry about that from a compilation point
     # of view. However, the "method"s may return zero unless that platform
@@ -18,6 +17,9 @@
     # by a define "DSO_<name>" ... we translate the "dso_scheme" config
     # string entry into using the following logic;
     my $scheme = uc $target{dso_scheme};
     # by a define "DSO_<name>" ... we translate the "dso_scheme" config
     # string entry into using the following logic;
     my $scheme = uc $target{dso_scheme};
+    if (!$scheme) {
+        $scheme = "NONE";
+    }
     my @macros = ( "DSO_$scheme" );
     if ($scheme eq 'DLFCN') {
         @macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" );
     my @macros = ( "DSO_$scheme" );
     if ($scheme eq 'DLFCN') {
         @macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" );
@@ -26,5 +28,4 @@
     }
     join("\n", map { "# define $_" } @macros); -}
 # define DSO_EXTENSION "{- platform->dsoext() -}"
     }
     join("\n", map { "# define $_" } @macros); -}
 # define DSO_EXTENSION "{- platform->dsoext() -}"
-{- output_on() if $disabled{dso} -}
 #endif
 #endif
index dfc5c5f81cb513fe3bfa4b18519e5f9424ecfcea..463da9853dd56092066c6de6d96f4ae286018335 100644 (file)
@@ -160,8 +160,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
 {
     OSSL_TRACE(INIT, "ossl_init_load_crypto_nodelete()\n");
 
 {
     OSSL_TRACE(INIT, "ossl_init_load_crypto_nodelete()\n");
 
-#if !defined(OPENSSL_NO_DSO) \
-    && !defined(OPENSSL_USE_NODELETE) \
+#if !defined(OPENSSL_USE_NODELETE) \
     && !defined(OPENSSL_NO_PINSHARED)
 # if defined(DSO_WIN32) && !defined(_WIN32_WCE)
     {
     && !defined(OPENSSL_NO_PINSHARED)
 # if defined(DSO_WIN32) && !defined(_WIN32_WCE)
     {
@@ -179,7 +178,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
                     (ret == TRUE ? "No!" : "Yes."));
         return (ret == TRUE) ? 1 : 0;
     }
                     (ret == TRUE ? "No!" : "Yes."));
         return (ret == TRUE) ? 1 : 0;
     }
-# else
+# elif !defined(DSO_NONE)
     /*
      * Deliberately leak a reference to ourselves. This will force the library
      * to remain loaded until the atexit() handler is run at process exit.
     /*
      * Deliberately leak a reference to ourselves. This will force the library
      * to remain loaded until the atexit() handler is run at process exit.
@@ -733,8 +732,7 @@ int OPENSSL_atexit(void (*handler)(void))
 {
     OPENSSL_INIT_STOP *newhand;
 
 {
     OPENSSL_INIT_STOP *newhand;
 
-#if !defined(OPENSSL_NO_DSO) \
-    && !defined(OPENSSL_USE_NODELETE)\
+#if !defined(OPENSSL_USE_NODELETE)\
     && !defined(OPENSSL_NO_PINSHARED)
     {
         union {
     && !defined(OPENSSL_NO_PINSHARED)
     {
         union {
@@ -759,7 +757,7 @@ int OPENSSL_atexit(void (*handler)(void))
             if (!ret)
                 return 0;
         }
             if (!ret)
                 return 0;
         }
-# else
+# elif !defined(DSO_NONE)
         /*
          * Deliberately leak a reference to the handler. This will force the
          * library/code containing the handler to remain loaded until we run the
         /*
          * Deliberately leak a reference to the handler. This will force the
          * library/code containing the handler to remain loaded until we run the
index 3645aa5c7a53e51ffd5f9e87c19fd39c4901d030..8347d854e367597898b76ca40c3e36b7a53c8896 100644 (file)
 
 # include <openssl/opensslconf.h>
 
 
 # include <openssl/opensslconf.h>
 
-# ifndef OPENSSL_NO_DSO
-
-#  ifdef  __cplusplus
+# ifdef  __cplusplus
 extern "C"
 extern "C"
-#  endif
+# endif
 int ERR_load_DSO_strings(void);
 
 /*
 int ERR_load_DSO_strings(void);
 
 /*
@@ -83,5 +81,4 @@ int ERR_load_DSO_strings(void);
 #  define DSO_R_UNLOAD_FAILED                              107
 #  define DSO_R_UNSUPPORTED                                108
 
 #  define DSO_R_UNLOAD_FAILED                              107
 #  define DSO_R_UNSUPPORTED                                108
 
-# endif
 #endif
 #endif