From 38186bfd4e5be7f212d8e460420e081e0ad852e7 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Tue, 22 Mar 2016 13:35:03 -0400 Subject: [PATCH] Have only one DSO_METHOD_openssl Instead of have every DSO_METHOD_xxx in all platforms, ensure that only one DSO_METHOD_openssl is available on all platforms. Reviewed-by: Tim Hudson --- crypto/dso/Makefile.in | 4 +- crypto/dso/build.info | 2 +- crypto/dso/dso_dl.c | 11 ++---- crypto/dso/dso_dlfcn.c | 11 ++---- crypto/dso/dso_locl.h | 1 - crypto/dso/dso_null.c | 84 ---------------------------------------- crypto/dso/dso_openssl.c | 21 ++++------ crypto/dso/dso_vms.c | 11 ++---- crypto/dso/dso_win32.c | 11 ++---- include/openssl/dso.h | 26 ------------- util/libcrypto.num | 10 ++--- util/libssl.num | 2 +- 12 files changed, 28 insertions(+), 166 deletions(-) delete mode 100644 crypto/dso/dso_null.c diff --git a/crypto/dso/Makefile.in b/crypto/dso/Makefile.in index 8c517febce..e2fec28d4b 100644 --- a/crypto/dso/Makefile.in +++ b/crypto/dso/Makefile.in @@ -15,9 +15,9 @@ CFLAGS= $(INCLUDES) $(CFLAG) $(SHARED_CFLAG) GENERAL=Makefile LIB=$(TOP)/libcrypto.a -LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \ +LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c \ dso_openssl.c dso_win32.c dso_vms.c -LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \ +LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o \ dso_openssl.o dso_win32.o dso_vms.o SRC= $(LIBSRC) diff --git a/crypto/dso/build.info b/crypto/dso/build.info index 30b3a280ba..82b592d9a1 100644 --- a/crypto/dso/build.info +++ b/crypto/dso/build.info @@ -1,4 +1,4 @@ LIBS=../../libcrypto SOURCE[../../libcrypto]=\ - dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \ + dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c \ dso_openssl.c dso_win32.c dso_vms.c diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c index 1d6e12adc5..72ca4544aa 100644 --- a/crypto/dso/dso_dl.c +++ b/crypto/dso/dso_dl.c @@ -58,12 +58,7 @@ #include "dso_locl.h" -#ifndef DSO_DL -DSO_METHOD *DSO_METHOD_dl(void) -{ - return NULL; -} -#else +#ifdef DSO_DL # include @@ -95,9 +90,9 @@ static DSO_METHOD dso_meth_dl = { dl_globallookup }; -DSO_METHOD *DSO_METHOD_dl(void) +DSO_METHOD *DSO_METHOD_openssl(void) { - return (&dso_meth_dl); + return &dso_meth_dl; } /* diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c index e69daadc4c..09a49131ea 100644 --- a/crypto/dso/dso_dlfcn.c +++ b/crypto/dso/dso_dlfcn.c @@ -67,12 +67,7 @@ #include "dso_locl.h" -#ifndef DSO_DLFCN -DSO_METHOD *DSO_METHOD_dlfcn(void) -{ - return NULL; -} -#else +#ifdef DSO_DLFCN # ifdef HAVE_DLFCN_H # ifdef __osf__ @@ -117,9 +112,9 @@ static DSO_METHOD dso_meth_dlfcn = { dlfcn_globallookup }; -DSO_METHOD *DSO_METHOD_dlfcn(void) +DSO_METHOD *DSO_METHOD_openssl(void) { - return (&dso_meth_dlfcn); + return &dso_meth_dlfcn; } /* diff --git a/crypto/dso/dso_locl.h b/crypto/dso/dso_locl.h index 980448d25a..3d7d669d47 100644 --- a/crypto/dso/dso_locl.h +++ b/crypto/dso/dso_locl.h @@ -105,4 +105,3 @@ struct dso_meth_st { /* Perform global symbol lookup, i.e. among *all* modules */ void *(*globallookup) (const char *symname); }; - diff --git a/crypto/dso/dso_null.c b/crypto/dso/dso_null.c deleted file mode 100644 index ed8bcd77ef..0000000000 --- a/crypto/dso/dso_null.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project - * 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -/* - * This "NULL" method is provided as the fallback for systems that have no - * appropriate support for "shared-libraries". - */ - -#include "dso_locl.h" - -static DSO_METHOD dso_meth_null = { - "NULL shared library method", - NULL, /* load */ - NULL, /* unload */ - NULL, /* bind_var */ - NULL, /* bind_func */ - NULL, /* ctrl */ - NULL, /* dso_name_converter */ - NULL, /* dso_merger */ - NULL, /* init */ - NULL, /* finish */ - NULL, /* pathbyaddr */ - NULL /* globallookup */ -}; - -DSO_METHOD *DSO_METHOD_null(void) -{ - return &dso_meth_null; -} diff --git a/crypto/dso/dso_openssl.c b/crypto/dso/dso_openssl.c index 9b0123b29a..070f116217 100644 --- a/crypto/dso/dso_openssl.c +++ b/crypto/dso/dso_openssl.c @@ -58,21 +58,14 @@ #include "dso_locl.h" -/* We just pinch the method from an appropriate "default" method. */ +#if !defined(DSO_VMS) && !defined(DSO_DLCFN) && !defined(DSO_DL) && !defined(DSO_WIN32) && !defined(DSO_DLFCN) + +static DSO_METHOD dso_meth_null = { + "NULL shared library method" +}; DSO_METHOD *DSO_METHOD_openssl(void) { -#ifdef DEF_DSO_METHOD - return (DEF_DSO_METHOD()); -#elif defined(DSO_DLFCN) - return (DSO_METHOD_dlfcn()); -#elif defined(DSO_DL) - return (DSO_METHOD_dl()); -#elif defined(DSO_WIN32) - return (DSO_METHOD_win32()); -#elif defined(DSO_VMS) - return (DSO_METHOD_vms()); -#else - return (DSO_METHOD_null()); -#endif + return dso_meth_null(); } +#endif diff --git a/crypto/dso/dso_vms.c b/crypto/dso/dso_vms.c index 2fd6ffea2d..79e9963a26 100644 --- a/crypto/dso/dso_vms.c +++ b/crypto/dso/dso_vms.c @@ -58,12 +58,7 @@ #include "dso_locl.h" -#ifndef OPENSSL_SYS_VMS -DSO_METHOD *DSO_METHOD_vms(void) -{ - return NULL; -} -#else +#ifdef OPENSSL_SYS_VMS # pragma message disable DOLLARID # include @@ -129,9 +124,9 @@ typedef struct dso_internal_st { char imagename[NAMX_MAXRSS + 1]; } DSO_VMS_INTERNAL; -DSO_METHOD *DSO_METHOD_vms(void) +DSO_METHOD *DSO_METHOD_openssl(void) { - return (&dso_meth_vms); + return &dso_meth_vms; } static int vms_load(DSO *dso) diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c index e1d88b1d5e..e378d68946 100644 --- a/crypto/dso/dso_win32.c +++ b/crypto/dso/dso_win32.c @@ -58,12 +58,7 @@ #include "dso_locl.h" -#if !defined(DSO_WIN32) -DSO_METHOD *DSO_METHOD_win32(void) -{ - return NULL; -} -#else +#if defined(DSO_WIN32) # ifdef _WIN32_WCE # if _WIN32_WCE < 300 @@ -138,9 +133,9 @@ static DSO_METHOD dso_meth_win32 = { win32_globallookup }; -DSO_METHOD *DSO_METHOD_win32(void) +DSO_METHOD *DSO_METHOD_openssl(void) { - return (&dso_meth_win32); + return &dso_meth_win32; } /* diff --git a/include/openssl/dso.h b/include/openssl/dso.h index 77baf8ae25..70b19b65e9 100644 --- a/include/openssl/dso.h +++ b/include/openssl/dso.h @@ -214,32 +214,6 @@ DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname); */ DSO_METHOD *DSO_METHOD_openssl(void); -/* - * This method is defined for all platforms - if a platform has no DSO - * support then this will be the only method! - */ -DSO_METHOD *DSO_METHOD_null(void); - -/* - * If DSO_DLFCN is defined, the standard dlfcn.h-style functions (dlopen, - * dlclose, dlsym, etc) will be used and incorporated into this method. If - * not, this method will return NULL. - */ -DSO_METHOD *DSO_METHOD_dlfcn(void); - -/* - * If DSO_DL is defined, the standard dl.h-style functions (shl_load, - * shl_unload, shl_findsym, etc) will be used and incorporated into this - * method. If not, this method will return NULL. - */ -DSO_METHOD *DSO_METHOD_dl(void); - -/* If WIN32 is defined, use DLLs. If not, return NULL. */ -DSO_METHOD *DSO_METHOD_win32(void); - -/* If VMS is defined, use shared images. If not, return NULL. */ -DSO_METHOD *DSO_METHOD_vms(void); - /* * This function writes null-terminated pathname of DSO module containing * 'addr' into 'sz' large caller-provided 'path' and returns the number of diff --git a/util/libcrypto.num b/util/libcrypto.num index 2e2e6571cb..c0918bae15 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -138,7 +138,7 @@ X509v3_add_ext 135 1_1_0 EXIST::FUNCTION: v3_addr_subset 136 1_1_0 EXIST::FUNCTION:RFC3779 CRYPTO_strndup 137 1_1_0 EXIST::FUNCTION: OCSP_REQ_CTX_free 138 1_1_0 EXIST::FUNCTION: -DSO_METHOD_dlfcn 139 1_1_0 EXIST::FUNCTION: +DSO_METHOD_dlfcn 139 1_1_0 NOEXIST::FUNCTION: X509_STORE_new 140 1_1_0 EXIST::FUNCTION: ASN1_TYPE_free 141 1_1_0 EXIST::FUNCTION: PKCS12_BAGS_new 142 1_1_0 EXIST::FUNCTION: @@ -1491,7 +1491,7 @@ EVP_CIPHER_CTX_set_padding 1444 1_1_0 EXIST::FUNCTION: CTLOG_new_from_base64 1445 1_1_0 EXIST::FUNCTION:CT AES_bi_ige_encrypt 1446 1_1_0 EXIST::FUNCTION:AES ERR_pop_to_mark 1447 1_1_0 EXIST::FUNCTION: -DSO_METHOD_win32 1448 1_1_0 EXIST::FUNCTION: +DSO_METHOD_win32 1448 1_1_0 NOEXIST::FUNCTION: CRL_DIST_POINTS_new 1449 1_1_0 EXIST::FUNCTION: EVP_PKEY_get0_asn1 1450 1_1_0 EXIST::FUNCTION: EVP_camellia_192_ctr 1451 1_1_0 EXIST::FUNCTION:CAMELLIA @@ -1888,7 +1888,7 @@ ASN1_VISIBLESTRING_it 1831 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION ASN1_VISIBLESTRING_it 1831 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: X509V3_EXT_REQ_add_conf 1832 1_1_0 EXIST::FUNCTION: ASN1_STRING_to_UTF8 1833 1_1_0 EXIST::FUNCTION: -DSO_METHOD_null 1834 1_1_0 EXIST::FUNCTION: +DSO_METHOD_null 1834 1_1_0 NOEXIST::FUNCTION: EVP_MD_meth_set_update 1835 1_1_0 EXIST::FUNCTION: EVP_camellia_192_cbc 1836 1_1_0 EXIST::FUNCTION:CAMELLIA lh_stats_bio 1837 1_1_0 EXIST::FUNCTION: @@ -3116,7 +3116,7 @@ PEM_read_bio_RSAPublicKey 3009 1_1_0 EXIST::FUNCTION:RSA EVP_PKEY_asn1_set_private 3010 1_1_0 EXIST::FUNCTION: EVP_PKEY_get0_RSA 3011 1_1_0 EXIST::FUNCTION:RSA DES_ede3_cfb64_encrypt 3012 1_1_0 EXIST::FUNCTION:DES -DSO_METHOD_vms 3013 1_1_0 EXIST::FUNCTION: +DSO_METHOD_vms 3013 1_1_0 NOEXIST::FUNCTION: POLICY_MAPPING_free 3014 1_1_0 EXIST::FUNCTION: EVP_aes_128_gcm 3015 1_1_0 EXIST::FUNCTION:AES BIO_dgram_non_fatal_error 3016 1_1_0 EXIST::FUNCTION: @@ -3677,7 +3677,7 @@ EVP_CIPHER_CTX_cipher_data 3561 1_1_0 NOEXIST::FUNCTION: PKCS7_decrypt 3562 1_1_0 EXIST::FUNCTION: X509_STORE_set1_param 3563 1_1_0 EXIST::FUNCTION: RAND_file_name 3564 1_1_0 EXIST::FUNCTION: -DSO_METHOD_dl 3565 1_1_0 EXIST::FUNCTION: +DSO_METHOD_dl 3565 1_1_0 NOEXIST::FUNCTION: EVP_CipherInit_ex 3566 1_1_0 EXIST::FUNCTION: BIO_dgram_sctp_notification_cb 3567 1_1_0 EXIST::FUNCTION:SCTP ERR_load_RAND_strings 3568 1_1_0 EXIST::FUNCTION: diff --git a/util/libssl.num b/util/libssl.num index 7b4a7e6f5e..8b2155ec9f 100644 --- a/util/libssl.num +++ b/util/libssl.num @@ -58,7 +58,7 @@ SSL_get0_dane_authority 57 1_1_0 EXIST::FUNCTION: SSL_set_purpose 58 1_1_0 EXIST::FUNCTION: SSL_CTX_use_PrivateKey_file 59 1_1_0 EXIST::FUNCTION: SSL_get_rfd 60 1_1_0 EXIST::FUNCTION: -DTLSv1_listen 61 1_1_0 EXIST::FUNCTION: +DTLSv1_listen 61 1_1_0 EXIST::FUNCTION:SOCK SSL_set_ssl_method 62 1_1_0 EXIST::FUNCTION: SSL_get0_security_ex_data 63 1_1_0 EXIST::FUNCTION: SSLv3_client_method 64 1_1_0 EXIST::FUNCTION:DEPRECATEDIN_1_1_0,SSL3_METHOD -- 2.25.1