[openssl] master update

Dr. Paul Dale pauli at openssl.org
Thu Jun 24 05:55:50 UTC 2021


The branch master has been updated
       via  0652197407e1cb0d550f9528d9253c79f980608d (commit)
       via  505fcdb5de382623aa8a1230579334b58aa72b45 (commit)
      from  2fee3a77f8179c8e4c0e33d622549270b380fa8a (commit)


- Log -----------------------------------------------------------------
commit 0652197407e1cb0d550f9528d9253c79f980608d
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Jun 23 08:21:04 2021 +0200

    TEST: Modify simpledynamic.[ch] to allow use on VMS as well
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15872)

commit 505fcdb5de382623aa8a1230579334b58aa72b45
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Jun 23 08:10:37 2021 +0200

    test/recipes/90-test_shlibload.t: Modify to work with known file names
    
    Using File::Temp::tempfile() is admirable, but isn't necessary for the
    sort of thing we use it for.
    
    Furthermore, since tempfile() returns an opened file handle for
    reading for the file in question, it may have effect that the file
    becomes unwritable.  This is the default on VMS, and since tempfile()
    doesn't seem to have any option to affect this, it means that
    test/shlibloadtest.c can't write the magic line to that file.
    
    Also, if we consider forensics, to be able to see what a test produced
    to determine what went wrong, it's better to use specific and known
    file names.
    
    Therefore, this test is modified to use well known file names, and to
    open them for reading after the shlibloadtest program has been run
    instead of before.
    
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    Reviewed-by: Paul Dale <pauli at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15872)

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

Summary of changes:
 test/recipes/90-test_shlibload.t | 62 +++++++++++++++++++++++-----------------
 test/simpledynamic.c             |  2 +-
 test/simpledynamic.h             | 13 ++++++---
 3 files changed, 45 insertions(+), 32 deletions(-)

diff --git a/test/recipes/90-test_shlibload.t b/test/recipes/90-test_shlibload.t
index d3944308d3..29826f7252 100644
--- a/test/recipes/90-test_shlibload.t
+++ b/test/recipes/90-test_shlibload.t
@@ -8,7 +8,6 @@
 
 use OpenSSL::Test qw/:DEFAULT srctop_dir bldtop_dir/;
 use OpenSSL::Test::Utils;
-use File::Temp qw(tempfile);
 
 #Load configdata.pm
 
@@ -29,35 +28,44 @@ plan tests => 10;
 
 my $libcrypto = platform->sharedlib('libcrypto');
 my $libssl = platform->sharedlib('libssl');
+my $atexit_outfile;
 
-(my $fh, my $filename) = tempfile();
-ok(run(test(["shlibloadtest", "-crypto_first", $libcrypto, $libssl, $filename])),
-   "running shlibloadtest -crypto_first $filename");
-ok(check_atexit($fh));
-unlink $filename;
-($fh, $filename) = tempfile();
-ok(run(test(["shlibloadtest", "-ssl_first", $libcrypto, $libssl, $filename])),
-   "running shlibloadtest -ssl_first $filename");
-ok(check_atexit($fh));
-unlink $filename;
-($fh, $filename) = tempfile();
-ok(run(test(["shlibloadtest", "-just_crypto", $libcrypto, $libssl, $filename])),
-   "running shlibloadtest -just_crypto $filename");
-ok(check_atexit($fh));
-unlink $filename;
-($fh, $filename) = tempfile();
-ok(run(test(["shlibloadtest", "-dso_ref", $libcrypto, $libssl, $filename])),
-   "running shlibloadtest -dso_ref $filename");
-ok(check_atexit($fh));
-unlink $filename;
-($fh, $filename) = tempfile();
-ok(run(test(["shlibloadtest", "-no_atexit", $libcrypto, $libssl, $filename])),
-   "running shlibloadtest -no_atexit $filename");
-ok(!check_atexit($fh));
-unlink $filename;
+$atexit_outfile = 'atexit-cryptofirst.txt';
+1 while unlink $atexit_outfile;
+ok(run(test(["shlibloadtest", "-crypto_first", $libcrypto, $libssl, $atexit_outfile])),
+   "running shlibloadtest -crypto_first $atexit_outfile");
+ok(check_atexit($atexit_outfile));
+
+$atexit_outfile = 'atexit-sslfirst.txt';
+1 while unlink $atexit_outfile;
+ok(run(test(["shlibloadtest", "-ssl_first", $libcrypto, $libssl, $atexit_outfile])),
+   "running shlibloadtest -ssl_first $atexit_outfile");
+ok(check_atexit($atexit_outfile));
+
+$atexit_outfile = 'atexit-justcrypto.txt';
+1 while unlink $atexit_outfile;
+ok(run(test(["shlibloadtest", "-just_crypto", $libcrypto, $libssl, $atexit_outfile])),
+   "running shlibloadtest -just_crypto $atexit_outfile");
+ok(check_atexit($atexit_outfile));
+
+$atexit_outfile = 'atexit-dsoref.txt';
+1 while unlink $atexit_outfile;
+ok(run(test(["shlibloadtest", "-dso_ref", $libcrypto, $libssl, $atexit_outfile])),
+   "running shlibloadtest -dso_ref $atexit_outfile");
+ok(check_atexit($atexit_outfile));
+
+$atexit_outfile = 'atexit-noatexit.txt';
+1 while unlink $atexit_outfile;
+ok(run(test(["shlibloadtest", "-no_atexit", $libcrypto, $libssl, $atexit_outfile])),
+   "running shlibloadtest -no_atexit $atexit_outfile");
+ok(!check_atexit($atexit_outfile));
 
 sub check_atexit {
-    my $fh = shift;
+    my $filename = shift;
+
+    open my $fh, '<', $filename;
+    return 0 unless defined $fh;
+
     my $data = <$fh>;
 
     return 1 if (defined $data && $data =~ m/atexit\(\) run/);
diff --git a/test/simpledynamic.c b/test/simpledynamic.c
index bbeeae02a4..390836891f 100644
--- a/test/simpledynamic.c
+++ b/test/simpledynamic.c
@@ -12,7 +12,7 @@
 #include <openssl/e_os2.h>
 #include "simpledynamic.h"
 
-#if defined(DSO_DLFCN)
+#if defined(DSO_DLFCN) || defined(DSO_VMS)
 
 int sd_load(const char *filename, SD *lib, int type)
 {
diff --git a/test/simpledynamic.h b/test/simpledynamic.h
index bf5b21552f..d6e1dcbfd1 100644
--- a/test/simpledynamic.h
+++ b/test/simpledynamic.h
@@ -12,13 +12,18 @@
 
 # include "crypto/dso_conf.h"
 
-# if defined(DSO_DLFCN)
+# if defined(DSO_DLFCN) || defined(DSO_VMS)
 
 #  include <dlfcn.h>
 
 #  define SD_INIT       NULL
-#  define SD_SHLIB      (RTLD_GLOBAL|RTLD_LAZY)
-#  define SD_MODULE     (RTLD_LOCAL|RTLD_NOW)
+#  ifdef DSO_VMS
+#   define SD_SHLIB     0
+#   define SD_MODULE    0
+#  else
+#   define SD_SHLIB     (RTLD_GLOBAL|RTLD_LAZY)
+#   define SD_MODULE    (RTLD_LOCAL|RTLD_NOW)
+#  endif
 
 typedef void *SD;
 typedef void *SD_SYM;
@@ -36,7 +41,7 @@ typedef void *SD_SYM;
 
 # endif
 
-# if defined(DSO_DLFCN) || defined(DSO_WIN32)
+# if defined(DSO_DLFCN) || defined(DSO_WIN32) || defined(DSO_VMS)
 int sd_load(const char *filename, SD *sd, int type);
 int sd_sym(SD sd, const char *symname, SD_SYM *sym);
 int sd_close(SD lib);


More information about the openssl-commits mailing list