From 650c66873793bed505802f316b15772a0f887743 Mon Sep 17 00:00:00 2001 From: "Randall S. Becker" Date: Fri, 26 Mar 2021 06:34:49 -0600 Subject: [PATCH] Corrected missing definitions from NonStop SPT build. This change includes swapping the PUT and SPT configuration, includes of sys/stat.h and sys/types.h in the correct scope to be picked up by SPT definitions. Fixes: #14698 Fixes: #14734 CLA: The author has the permission to grant the OpenSSL Team the right to use this change. Signed-off-by: Randall S. Becker Reviewed-by: Richard Levitte Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14736) --- Configurations/50-nonstop.conf | 4 ++-- crypto/conf/conf_def.c | 2 ++ crypto/rand/randfile.c | 9 +++++++++ crypto/ui/ui_openssl.c | 2 +- crypto/x509/by_dir.c | 9 +++++++++ e_os.h | 2 +- include/internal/cryptlib.h | 12 ++++++++++-- ssl/ssl_sess.c | 4 ++++ ssl/statem/extensions.c | 5 +++++ ssl/statem/statem.c | 5 +++++ 10 files changed, 48 insertions(+), 6 deletions(-) diff --git a/Configurations/50-nonstop.conf b/Configurations/50-nonstop.conf index 5792674788..7524c50016 100644 --- a/Configurations/50-nonstop.conf +++ b/Configurations/50-nonstop.conf @@ -168,13 +168,13 @@ 'nonstop-model-put' => { template => 1, defines => ['_PUT_MODEL_', - '_REENTRANT', '_ENABLE_FLOSS_THREADS'], + '_REENTRANT', '_THREAD_SUPPORT_FUNCTIONS'], ex_libs => '-lput', }, 'nonstop-model-spt' => { template => 1, defines => ['_SPT_MODEL_', - '_REENTRANT', '_THREAD_SUPPORT_FUNCTIONS'], + '_REENTRANT', '_ENABLE_FLOSS_THREADS'], ex_libs => '-lspt', }, diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c index e840742544..bfb718753b 100644 --- a/crypto/conf/conf_def.c +++ b/crypto/conf/conf_def.c @@ -13,6 +13,8 @@ #include #ifdef __TANDEM # include /* strcasecmp */ +# include /* needed for stat.h */ +# include /* struct stat */ #endif #include "internal/cryptlib.h" #include "internal/o_dir.h" diff --git a/crypto/rand/randfile.c b/crypto/rand/randfile.c index 655dc71b06..c3246c4c62 100644 --- a/crypto/rand/randfile.c +++ b/crypto/rand/randfile.c @@ -7,6 +7,15 @@ * https://www.openssl.org/source/license.html */ +#if defined (__TANDEM) && defined (_SPT_MODEL_) +/* + * These definitions have to come first in SPT due to scoping of the + * declarations in c99 associated with SPT use of stat. + */ +# include +# include +#endif + #include "internal/cryptlib.h" #include diff --git a/crypto/ui/ui_openssl.c b/crypto/ui/ui_openssl.c index 42524d42a2..c9cce93d5c 100644 --- a/crypto/ui/ui_openssl.c +++ b/crypto/ui/ui_openssl.c @@ -127,7 +127,7 @@ # define TTY_set(tty,data) ioctl(tty,TIOCSETP,data) # endif -# if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) +# if !defined(_LIBC) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) && ! (defined(OPENSSL_SYS_TANDEM) && defined(_SPT_MODEL_)) # include # endif diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index 6c0894796b..258ad51852 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -7,6 +7,15 @@ * https://www.openssl.org/source/license.html */ +#if defined (__TANDEM) && defined (_SPT_MODEL_) + /* + * These definitions have to come first in SPT due to scoping of the + * declarations in c99 associated with SPT use of stat. + */ +# include +# include +#endif + #include "e_os.h" #include "internal/cryptlib.h" #include diff --git a/e_os.h b/e_os.h index 3e7a13f94d..a4290cfc65 100644 --- a/e_os.h +++ b/e_os.h @@ -297,7 +297,7 @@ struct servent *getservbyname(const char *name, const char *proto); /* ----------------------------- HP NonStop -------------------------------- */ /* Required to support platform variant without getpid() and pid_t. */ -# ifdef __TANDEM +# if defined(__TANDEM) && defined(_GUARDIAN_TARGET) # include # include # define getservbyname(name,proto) getservbyname((char*)name,proto) diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h index fb46657dba..ea42447e78 100644 --- a/include/internal/cryptlib.h +++ b/include/internal/cryptlib.h @@ -217,10 +217,18 @@ static ossl_inline void ossl_sleep(unsigned long millis) ts.tv_sec = (long int) (millis / 1000); ts.tv_nsec = (long int) (millis % 1000) * 1000000ul; nanosleep(&ts, NULL); -# elif defined(__TANDEM) && !defined(_REENTRANT) -# include +# elif defined(__TANDEM) +# if !defined(_REENTRANT) +# include /* HPNS does not support usleep for non threaded apps */ PROCESS_DELAY_(millis * 1000); +# elif defined(_SPT_MODEL_) +# include +# include + usleep(millis * 1000); +# else + usleep(millis * 1000); +# endif # else usleep(millis * 1000); # endif diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index 4e4f9aacea..cb225b544a 100644 --- a/ssl/ssl_sess.c +++ b/ssl/ssl_sess.c @@ -8,6 +8,10 @@ * https://www.openssl.org/source/license.html */ +#if defined(__TANDEM) && defined(_SPT_MODEL_) +# include +# include /* timeval */ +#endif #include #include #include diff --git a/ssl/statem/extensions.c b/ssl/statem/extensions.c index 0ce436d082..2f624c0e64 100644 --- a/ssl/statem/extensions.c +++ b/ssl/statem/extensions.c @@ -7,6 +7,11 @@ * https://www.openssl.org/source/license.html */ +#if defined(__TANDEM) && defined(_SPT_MODEL_) +# include +# include /* timeval */ +#endif + #include #include "internal/nelem.h" #include "internal/cryptlib.h" diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c index 74c270d002..3b6e78e3f8 100644 --- a/ssl/statem/statem.c +++ b/ssl/statem/statem.c @@ -7,6 +7,11 @@ * https://www.openssl.org/source/license.html */ +#if defined(__TANDEM) && defined(_SPT_MODEL_) +# include +# include /* timeval */ +#endif + #include "internal/cryptlib.h" #include #include "../ssl_local.h" -- 2.39.2