Corrected missing definitions from NonStop SPT build.
authorRandall S. Becker <rsbecker@nexbridge.com>
Fri, 26 Mar 2021 12:34:49 +0000 (06:34 -0600)
committerTomas Mraz <tomas@openssl.org>
Thu, 1 Apr 2021 13:52:25 +0000 (15:52 +0200)
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 <rsbecker@nexbridge.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14736)

Configurations/50-nonstop.conf
crypto/conf/conf_def.c
crypto/rand/randfile.c
crypto/ui/ui_openssl.c
crypto/x509/by_dir.c
e_os.h
include/internal/cryptlib.h
ssl/ssl_sess.c
ssl/statem/extensions.c
ssl/statem/statem.c

index 57926747887ba7acc633ec5cf21864d390956c5b..7524c5001622a37c45359fe6a5fd6628cb62d249 100644 (file)
     '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',
     },
 
index e840742544433f68962d468a136de387709f787f..bfb718753be417b473633566be48d68cc19d6fa8 100644 (file)
@@ -13,6 +13,8 @@
 #include <string.h>
 #ifdef __TANDEM
 # include <strings.h> /* strcasecmp */
+# include <sys/types.h> /* needed for stat.h */
+# include <sys/stat.h> /* struct stat */
 #endif
 #include "internal/cryptlib.h"
 #include "internal/o_dir.h"
index 655dc71b06609b25619a7f4216cb6fe2c8a4d2c8..c3246c4c62a8464acd053e47ef48acdbdf681346 100644 (file)
@@ -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 <sys/types.h>
+# include <sys/stat.h>
+#endif
+
 #include "internal/cryptlib.h"
 
 #include <errno.h>
index 42524d42a282d75807b72b846c9bea8952506d34..c9cce93d5c39c06c876c04ed6e1a038d5d06f640 100644 (file)
 #  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 <sys/ioctl.h>
 # endif
 
index 6c0894796bb7f945a09cbd46313d0e01965b26cb..258ad518525743358e989e3de041792f9f139040 100644 (file)
@@ -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 <sys/types.h>
+# include <sys/stat.h>
+#endif
+
 #include "e_os.h"
 #include "internal/cryptlib.h"
 #include <stdio.h>
diff --git a/e_os.h b/e_os.h
index 3e7a13f94d1cc0076362c8279ea3b172b5480fe4..a4290cfc65b06d07b9599d5c71bf5125bc2718ff 100644 (file)
--- 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 <strings.h>
 #  include <netdb.h>
 #  define getservbyname(name,proto)          getservbyname((char*)name,proto)
index fb46657dba6edc9e1a91bada23642445cd3b84c0..ea42447e7884d7c3fd93f0ae867857df4b482ef1 100644 (file)
@@ -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 <cextdecs.h(PROCESS_DELAY_)>
+# elif defined(__TANDEM)
+#  if !defined(_REENTRANT)
+#   include <cextdecs.h(PROCESS_DELAY_)>
     /* HPNS does not support usleep for non threaded apps */
     PROCESS_DELAY_(millis * 1000);
+#  elif defined(_SPT_MODEL_)
+#   include <spthread.h>
+#   include <spt_extensions.h>
+    usleep(millis * 1000);
+#  else
+    usleep(millis * 1000);
+#  endif
 # else
     usleep(millis * 1000);
 # endif
index 4e4f9aaceac3c2b5b9bed1f02a0aee66722ccd10..cb225b544a1186c7a6e88a373483719a3da73e9f 100644 (file)
@@ -8,6 +8,10 @@
  * https://www.openssl.org/source/license.html
  */
 
+#if defined(__TANDEM) && defined(_SPT_MODEL_)
+# include <spthread.h>
+# include <spt_extensions.h> /* timeval */
+#endif
 #include <stdio.h>
 #include <openssl/rand.h>
 #include <openssl/engine.h>
index 0ce436d082802e7b4522b3b956ca5c9b87fe865c..2f624c0e64f2a18df0974817c2966f57ccec2fac 100644 (file)
@@ -7,6 +7,11 @@
  * https://www.openssl.org/source/license.html
  */
 
+#if defined(__TANDEM) && defined(_SPT_MODEL_)
+# include <spthread.h>
+# include <spt_extensions.h> /* timeval */
+#endif
+
 #include <string.h>
 #include "internal/nelem.h"
 #include "internal/cryptlib.h"
index 74c270d002e930c88294909e6f411256c3b3c162..3b6e78e3f84a84d2d8359a9e54a63ede09d3365c 100644 (file)
@@ -7,6 +7,11 @@
  * https://www.openssl.org/source/license.html
  */
 
+#if defined(__TANDEM) && defined(_SPT_MODEL_)
+# include <spthread.h>
+# include <spt_extensions.h> /* timeval */
+#endif
+
 #include "internal/cryptlib.h"
 #include <openssl/rand.h>
 #include "../ssl_local.h"