summaryrefslogtreecommitdiff
path: root/usr.bin/openssl
diff options
context:
space:
mode:
authorBrent Cook <bcook@cvs.openbsd.org>2015-03-22 10:36:23 +0000
committerBrent Cook <bcook@cvs.openbsd.org>2015-03-22 10:36:23 +0000
commit6ae4e951e6b669c7bb69fd13cc51d5abb8c16e07 (patch)
treea8736d9b0e20e8c1f6925f47eb79c5ea24c23107 /usr.bin/openssl
parentcea36c3288c902c7a5e11dc7ba8427130f43f194 (diff)
Since Windows needs BIO_sock_init() before you can call any networking
functions, and ocsp and s_time need networking enabled too, this just moves BIO_sock_init() up into main() as a catch-all for all of the commands. Of course, it is a no-op on any other platform. ok @guenther
Diffstat (limited to 'usr.bin/openssl')
-rw-r--r--usr.bin/openssl/openssl.c7
-rw-r--r--usr.bin/openssl/s_socket.c12
2 files changed, 7 insertions, 12 deletions
diff --git a/usr.bin/openssl/openssl.c b/usr.bin/openssl/openssl.c
index 76e1644f592..08e22ca829f 100644
--- a/usr.bin/openssl/openssl.c
+++ b/usr.bin/openssl/openssl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: openssl.c,v 1.2 2014/10/22 13:54:03 jsing Exp $ */
+/* $OpenBSD: openssl.c,v 1.3 2015/03/22 10:36:22 bcook Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -259,6 +259,11 @@ main(int argc, char **argv)
exit(1);
}
+ if (BIO_sock_init() != 1) {
+ BIO_printf(bio_err, "BIO_sock_init failed\n");
+ exit(1);
+ }
+
CRYPTO_set_locking_callback(lock_dbg_cb);
openssl_startup();
diff --git a/usr.bin/openssl/s_socket.c b/usr.bin/openssl/s_socket.c
index 7c416d69bec..f54fb217ec3 100644
--- a/usr.bin/openssl/s_socket.c
+++ b/usr.bin/openssl/s_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_socket.c,v 1.3 2014/12/03 22:16:02 bcook Exp $ */
+/* $OpenBSD: s_socket.c,v 1.4 2015/03/22 10:36:22 bcook Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -85,11 +85,6 @@ init_client(int *sock, char *host, char *port, int type, int af)
struct addrinfo hints, *ai_top, *ai;
int i, s;
- if (BIO_sock_init() != 1) {
- BIO_printf(bio_err, "BIO_sock_init failed\n");
- return (0);
- }
-
memset(&hints, '\0', sizeof(hints));
hints.ai_family = af;
hints.ai_socktype = type;
@@ -181,11 +176,6 @@ init_server_long(int *sock, int port, char *ip, int type)
struct sockaddr_in server;
int s = -1;
- if (BIO_sock_init() != 1) {
- BIO_printf(bio_err, "BIO_sock_init failed\n");
- return (0);
- }
-
memset((char *) &server, 0, sizeof(server));
server.sin_family = AF_INET;
server.sin_port = htons((unsigned short) port);