[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Fri Mar 23 14:53:48 UTC 2018


The branch master has been updated
       via  84e68a1bbaa98889cc6c20e9f35f0f96148d9642 (commit)
       via  cfaad1713e0dd71851aa281c2f1882d9832c90c4 (commit)
       via  b71fa7b32d0d80dc1fa5fedf7f0b9a991d746c41 (commit)
       via  c45bf277a1522a2eef94904f1c8ae18237c49a01 (commit)
      from  29f3cfddabfe448e9f5417ea228a99bb5e991017 (commit)


- Log -----------------------------------------------------------------
commit 84e68a1bbaa98889cc6c20e9f35f0f96148d9642
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Mar 23 14:18:16 2018 +0100

    test/shlibloadtest.c: make some variables block local
    
    myDSO_dsobyaddr and myDSO_free are only used in a narrow block of
    code, and can therefore be made local to that block.  Otherwise, some
    compilers may warn that they are unused.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5733)

commit cfaad1713e0dd71851aa281c2f1882d9832c90c4
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Mar 23 01:05:41 2018 +0100

    test/shlibloadtest.c: fix various errors
    
    These errors were hidden because compiling this file didn't get the
    macros derived from the dso_scheme attribute, and therefore, some code
    never got compiled.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5733)

commit b71fa7b32d0d80dc1fa5fedf7f0b9a991d746c41
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Mar 23 01:05:23 2018 +0100

    Include "internal/dso_conf.h" where needed and appropriate
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5733)

commit c45bf277a1522a2eef94904f1c8ae18237c49a01
Author: Richard Levitte <levitte at openssl.org>
Date:   Fri Mar 23 01:02:08 2018 +0100

    Move the handling of dso_scheme to dso_conf.h
    
    The macros resulting from the dso_scheme attribute were defined for
    libraries only, but there's a test program that uses the macros as
    well.  The easier way is to move the handling of this macro to
    crypto/include/internal/dso_conf.h and having the modules that need it
    include it.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5733)

-----------------------------------------------------------------------

Summary of changes:
 Configure                             | 23 -----------------------
 crypto/include/internal/dso_conf.h.in | 17 ++++++++++++++++-
 crypto/init.c                         |  1 +
 test/build.info                       |  2 +-
 test/shlibloadtest.c                  | 14 ++++++++------
 5 files changed, 26 insertions(+), 31 deletions(-)

diff --git a/Configure b/Configure
index ce33f48..7a2ef9b 100755
--- a/Configure
+++ b/Configure
@@ -1232,29 +1232,6 @@ if ($target =~ /linux.*-mips/ && !$disabled{asm}
 	unshift @{$config{cxxflags}}, $value if $config{CXX};
 }
 
-# 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
-# has support compiled in for them. Currently each method is enabled
-# by a define "DSO_<name>" ... we translate the "dso_scheme" config
-# string entry into using the following logic;
-if (!$disabled{dso} && $target{dso_scheme} ne "")
-	{
-	$target{dso_scheme} =~ tr/[a-z]/[A-Z]/;
-	if ($target{dso_scheme} eq "DLFCN")
-		{
-		unshift @{$config{lib_defines}}, "DSO_DLFCN", "HAVE_DLFCN_H";
-		}
-	elsif ($target{dso_scheme} eq "DLFCN_NO_H")
-		{
-		unshift @{$config{lib_defines}}, "DSO_DLFCN";
-		}
-	else
-		{
-		unshift @{$config{lib_defines}}, "DSO_$target{dso_scheme}";
-		}
-	}
-
 # If threads aren't disabled, check how possible they are
 unless ($disabled{threads}) {
     if ($auto_threads) {
diff --git a/crypto/include/internal/dso_conf.h.in b/crypto/include/internal/dso_conf.h.in
index daa5e24..ded87ca 100644
--- a/crypto/include/internal/dso_conf.h.in
+++ b/crypto/include/internal/dso_conf.h.in
@@ -10,6 +10,21 @@
 
 #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
+    # has support compiled in for them. Currently each method is enabled
+    # by a define "DSO_<name>" ... we translate the "dso_scheme" config
+    # string entry into using the following logic;
+    my $scheme = uc $target{dso_scheme};
+    my @macros = ( "DSO_$scheme" );
+    if ($scheme eq 'DLFCN') {
+        @macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" );
+    } elsif ($scheme eq "DLFCN_NO_H") {
+        @macros = ( "DSO_DLFCN" );
+    }
+    join("\n", map { "# define $_" } @macros); -}
 # define DSO_EXTENSION "{- $target{dso_extension} -}"
+{- output_on() if $disabled{dso} -}
 #endif
diff --git a/crypto/init.c b/crypto/init.c
index 27be7b6..a0bad56 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <assert.h>
 #include "internal/thread_once.h"
+#include "internal/dso_conf.h"
 #include "internal/dso.h"
 #include "internal/store.h"
 
diff --git a/test/build.info b/test/build.info
index ddd3e20..f6f36fa 100644
--- a/test/build.info
+++ b/test/build.info
@@ -378,7 +378,7 @@ INCLUDE_MAIN___test_libtestutil_OLB = /INCLUDE=MAIN
   IF[{- !$disabled{shared} -}]
     PROGRAMS_NO_INST=shlibloadtest
     SOURCE[shlibloadtest]=shlibloadtest.c
-    INCLUDE[shlibloadtest]=../include
+    INCLUDE[shlibloadtest]=../include ../crypto/include
     DEPEND[shlibloadtest]=libtestutil.a
   ENDIF
 
diff --git a/test/shlibloadtest.c b/test/shlibloadtest.c
index f759a31..a8cf8e7 100644
--- a/test/shlibloadtest.c
+++ b/test/shlibloadtest.c
@@ -13,6 +13,7 @@
 #include <openssl/opensslv.h>
 #include <openssl/ssl.h>
 #include <openssl/ossl_typ.h>
+#include "internal/dso_conf.h"
 #include "testutil.h"
 
 typedef void DSO;
@@ -107,8 +108,6 @@ static int test_lib(void)
     SSL_CTX_free_t mySSL_CTX_free;
     ERR_get_error_t myERR_get_error;
     OpenSSL_version_num_t myOpenSSL_version_num;
-    DSO_dsobyaddr_t myDSO_dsobyaddr;
-    DSO_free_t myDSO_free;
     int result = 0;
 
     switch (test_type) {
@@ -162,14 +161,17 @@ static int test_lib(void)
 # define COMPATIBILITY_MASK 0xfff00000L
     myOpenSSL_version_num = (OpenSSL_version_num_t)symbols[1].func;
     if (!TEST_int_eq(myOpenSSL_version_num() & COMPATIBILITY_MASK,
-                     OPENSSL_VERSION_NUMBER & COMPATIBILITY_MASK)
+                     OPENSSL_VERSION_NUMBER & COMPATIBILITY_MASK))
         goto end;
     if (!TEST_int_ge(myOpenSSL_version_num() & ~COMPATIBILITY_MASK,
-                     OPENSSL_VERSION_NUMBER & ~COMPATIBILITY_MASK)
+                     OPENSSL_VERSION_NUMBER & ~COMPATIBILITY_MASK))
         goto end;
 
     if (test_type == DSO_REFTEST) {
 # ifdef DSO_DLFCN
+        DSO_dsobyaddr_t myDSO_dsobyaddr;
+        DSO_free_t myDSO_free;
+
         /*
          * This is resembling the code used in ossl_init_base() and
          * OPENSSL_atexit() to block unloading the library after dlclose().
@@ -189,9 +191,9 @@ static int test_lib(void)
         {
             DSO *hndl;
             /* use known symbol from crypto module */
-            if (!TEST_ptr(hndl = DSO_dsobyaddr((void (*)())ERR_get_error, 0)))
+            if (!TEST_ptr(hndl = myDSO_dsobyaddr((void (*)())ERR_get_error, 0)))
                 goto end;
-            DSO_free(hndl);
+            myDSO_free(hndl);
         }
 # endif /* DSO_DLFCN */
     }


More information about the openssl-commits mailing list