From 8ef61d3ec1c1e78bae48209c6ae8e7c7d103bdea Mon Sep 17 00:00:00 2001 From: bcook <> Date: Wed, 3 Dec 2014 22:16:02 +0000 Subject: Move Windows OS-specific functions to make porting easier. Several functions that need to be redefined for a Windows port are right in the middle of other code that is relatively portable. This patch isolates the functions that need Windows-specific implementations so they can be built conditionally in the portable tree. Add calls to BIO_sock_init() as-needed to openssl(1) so that socket IO works on Windows. Sorry, these are no-op on other platforms. ok jsing@ deraadt@ --- src/usr.bin/openssl/s_socket.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/usr.bin/openssl/s_socket.c') diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c index 2ce31eb5ef..7c416d69be 100644 --- a/src/usr.bin/openssl/s_socket.c +++ b/src/usr.bin/openssl/s_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_socket.c,v 1.2 2014/11/06 13:46:09 jsing Exp $ */ +/* $OpenBSD: s_socket.c,v 1.3 2014/12/03 22:16:02 bcook Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -85,6 +85,11 @@ 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; @@ -176,6 +181,11 @@ 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); -- cgit v1.2.3-55-g6feb