summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRandall S. Becker <rsbecker@nexbridge.com>2020-09-06 16:37:47 -0500
committerRichard Levitte <levitte@openssl.org>2020-09-12 20:32:11 +0200
commit08073700cc50bcd0df5c0ee68c100e300a320d03 (patch)
tree33e0641543cc32390ba73c49901183de01fdb9db /crypto
parentf0c62c53286b3a79cc059354a6d3425b35bb1d50 (diff)
NonStop port updates for 3.0.0.
HPE NonStop Port Changes for 3.0.0 Includes unthreaded, PUT, and SPT for OSS. The port changes include wrapping where necessary for FLOSS and appropriate configuration changes to support that. Two tests are excluded as being inappropriate for the platform. The changes are: * Added /usr/local/include to nonstop-nsx_spt_floss to load floss.h * Added SPT Floss variant for NonStop * Wrapped FLOSS definitions in OPENSSL_TANDEM_FLOSS to allow selective enablement. * SPT build configuration for NonStop * Skip tests not relevant for NonStop * PUT configuration changes required for NonStop platforms * Configurations/50-nonstop.conf: updates for TNS/X platform. * FLOSS instrumentation for HPE NonStop TNS/X and TNS/E platforms. * Configurations/50-nonstop.conf: modifications for non-PUT TNS/E platform b * Fix use of DELAY in ssltestlib.c for HPNS. * Fixed commit merge issues and added floss to http_server.c CLA: Permission is granted by the author to the OpenSSL team to use these modifications. Fixes #5087. Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12800)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/b_sock.c8
-rw-r--r--crypto/conf/conf_def.c3
-rw-r--r--crypto/cryptlib.c12
-rw-r--r--crypto/dso/dso_dlfcn.c2
-rw-r--r--crypto/rand/rand_egd.c70
-rw-r--r--crypto/threads_pthread.c6
6 files changed, 98 insertions, 3 deletions
diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index 79f7743b2f..61dbf474f9 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -23,7 +23,13 @@
static int wsa_init_done = 0;
# endif
-# ifndef _WIN32
+# if defined __TANDEM
+# include <unistd.h>
+# include <sys/time.h> /* select */
+# if defined(OPENSSL_TANDEM_FLOSS)
+# include <floss.h(floss_select)>
+# endif
+# elif !defined _WIN32
# include <unistd.h>
# include <sys/select.h>
# else
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
index 5475429abd..6f7c06afd7 100644
--- a/crypto/conf/conf_def.c
+++ b/crypto/conf/conf_def.c
@@ -11,6 +11,9 @@
#include <stdio.h>
#include <string.h>
+#ifdef __TANDEM
+# include <strings.h> /* strcasecmp */
+#endif
#include "internal/cryptlib.h"
#include "internal/o_dir.h"
#include <openssl/lhash.h>
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
index bc29a3b583..0f6d38e67b 100644
--- a/crypto/cryptlib.c
+++ b/crypto/cryptlib.c
@@ -471,3 +471,15 @@ size_t OPENSSL_instrument_bus2(unsigned int *out, size_t cnt, size_t max)
return 0;
}
#endif
+
+#if defined(__TANDEM) && defined(OPENSSL_VPROC)
+/*
+ * Define a VPROC function for HP NonStop build crypto library.
+ * This is used by platform version identification tools.
+ * Do not inline this procedure or make it static.
+ */
+# define OPENSSL_VPROC_STRING_(x) x##_CRYPTO
+# define OPENSSL_VPROC_STRING(x) OPENSSL_VPROC_STRING_(x)
+# define OPENSSL_VPROC_FUNC OPENSSL_VPROC_STRING(OPENSSL_VPROC)
+void OPENSSL_VPROC_FUNC(void) {}
+#endif /* __TANDEM */
diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c
index b8bbed87e8..bb34c6ed42 100644
--- a/crypto/dso/dso_dlfcn.c
+++ b/crypto/dso/dso_dlfcn.c
@@ -32,7 +32,7 @@ DEFINE_STACK_OF(void)
# if defined(__SCO_VERSION__) || defined(_SCO_ELF) || \
(defined(__osf__) && !defined(RTLD_NEXT)) || \
(defined(__OpenBSD__) && !defined(RTLD_SELF)) || \
- defined(__ANDROID__)
+ defined(__ANDROID__) || defined(__TANDEM)
# undef HAVE_DLINFO
# endif
# endif
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index cd87531943..c6dcd87f04 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -54,6 +54,60 @@ struct sockaddr_un {
# include <string.h>
# include <errno.h>
+# if defined(OPENSSL_SYSNAME_TANDEM)
+/*
+ * HPNS:
+ *
+ * Our current MQ 5.3 EGD requies compatability-mode sockets
+ * This code forces the mode to compatibility if required
+ * and then restores the mode.
+ *
+ * Needs review:
+ *
+ * The better long-term solution is to either run two EGD's each in one of
+ * the two modes or revise the EGD code to listen on two different sockets
+ * (each in one of the two modes).
+ */
+_variable
+int hpns_socket(int family,
+ int type,
+ int protocol,
+ char* transport)
+{
+ int socket_rc;
+ char current_transport[20];
+
+# define AF_UNIX_PORTABILITY "$ZAFN2"
+# define AF_UNIX_COMPATIBILITY "$ZPLS"
+
+ if (!_arg_present(transport) || transport != NULL || transport[0] == '\0')
+ return socket(family, type, protocol);
+
+ socket_transport_name_get(AF_UNIX, current_transport, 20);
+
+ if (strcmp(current_transport,transport) == 0)
+ return socket(family, type, protocol);
+
+ /* set the requested socket transport */
+ if (socket_transport_name_set(AF_UNIX, transport))
+ return -1;
+
+ socket_rc = socket(family,type,protocol);
+
+ /* set mode back to what it was */
+ if (socket_transport_name_set(AF_UNIX, current_transport))
+ return -1;
+
+ return socket_rc;
+}
+
+/*#define socket(a,b,c,...) hpns_socket(a,b,c,__VA_ARGS__) */
+
+static int hpns_connect_attempt = 0;
+
+# endif /* defined(OPENSSL_SYS_HPNS) */
+
+
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
{
FILE *fp = NULL;
@@ -71,7 +125,11 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
return -1;
strcpy(addr.sun_path, path);
i = offsetof(struct sockaddr_un, sun_path) + strlen(path);
+#if defined(OPENSSL_SYSNAME_TANDEM)
+ fd = hpns_socket(AF_UNIX, SOCK_STREAM, 0, AF_UNIX_COMPATIBILITY);
+#else
fd = socket(AF_UNIX, SOCK_STREAM, 0);
+#endif
if (fd == -1 || (fp = fdopen(fd, "r+")) == NULL)
return -1;
setbuf(fp, NULL);
@@ -100,6 +158,18 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
/* No error, try again */
break;
default:
+# if defined(OPENSSL_SYSNAME_TANDEM)
+ if (hpns_connect_attempt == 0) {
+ /* try the other kind of AF_UNIX socket */
+ close(fd);
+ fd = hpns_socket(AF_UNIX, SOCK_STREAM, 0, AF_UNIX_PORTABILITY);
+ if (fd == -1)
+ return -1;
+ ++hpns_connect_attempt;
+ break; /* try the connect again */
+ }
+# endif
+
ret = -1;
goto err;
}
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index 8b60251e77..936aa7f0c7 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -49,7 +49,11 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
}
pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ #if defined(__TANDEM) && defined(_SPT_MODEL_)
+ pthread_mutexattr_setkind_np(&attr,MUTEX_RECURSIVE_NP);
+ #else
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ #endif
if (pthread_mutex_init(lock, &attr) != 0) {
pthread_mutexattr_destroy(&attr);