diff options
| author | Brent Cook <bcook@openbsd.org> | 2015-03-08 18:27:07 -0500 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2015-03-08 22:02:54 -0500 |
| commit | f7e4e4a2666aa5ea39536d425206e680d76769d9 (patch) | |
| tree | 13aa6671d47049af239073b96d907d63713f90c4 | |
| parent | 031f0aaa8f9b2e907195dbda8b7c451a08d58bbb (diff) | |
| download | portable-f7e4e4a2666aa5ea39536d425206e680d76769d9.tar.gz portable-f7e4e4a2666aa5ea39536d425206e680d76769d9.tar.bz2 portable-f7e4e4a2666aa5ea39536d425206e680d76769d9.zip | |
initialize winsock earlier in openssl(1)
This allows commands like ocsp to work properly since we no longer
initialize Winsock as a side-effect of doing a BIO_gethostbyname.
| -rw-r--r-- | patches/win_bio_sock_init.diff | 44 | ||||
| -rwxr-xr-x | update.sh | 20 |
2 files changed, 55 insertions, 9 deletions
diff --git a/patches/win_bio_sock_init.diff b/patches/win_bio_sock_init.diff new file mode 100644 index 0000000..e0221b9 --- /dev/null +++ b/patches/win_bio_sock_init.diff | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c | ||
| 2 | index e7dd11c..cfd4593 100644 | ||
| 3 | --- a/src/usr.bin/openssl/openssl.c | ||
| 4 | +++ b/src/usr.bin/openssl/openssl.c | ||
| 5 | @@ -253,6 +253,11 @@ main(int argc, char **argv) | ||
| 6 | arg.data = NULL; | ||
| 7 | arg.count = 0; | ||
| 8 | |||
| 9 | + if (BIO_sock_init() != 1) { | ||
| 10 | + fprintf(stderr, "BIO_sock_init failed\n"); | ||
| 11 | + exit(1); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); | ||
| 15 | if (bio_err == NULL) { | ||
| 16 | fprintf(stderr, "openssl: failed to initialise bio_err\n"); | ||
| 17 | diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c | ||
| 18 | index 3b96b1a..2ce31eb 100644 | ||
| 19 | --- a/src/usr.bin/openssl/s_socket.c | ||
| 20 | +++ b/src/usr.bin/openssl/s_socket.c | ||
| 21 | @@ -85,11 +85,6 @@ init_client(int *sock, char *host, char *port, int type, int af) | ||
| 22 | struct addrinfo hints, *ai_top, *ai; | ||
| 23 | int i, s; | ||
| 24 | |||
| 25 | - if (BIO_sock_init() != 1) { | ||
| 26 | - BIO_printf(bio_err, "BIO_sock_init failed\n"); | ||
| 27 | - return (0); | ||
| 28 | - } | ||
| 29 | - | ||
| 30 | memset(&hints, '\0', sizeof(hints)); | ||
| 31 | hints.ai_family = af; | ||
| 32 | hints.ai_socktype = type; | ||
| 33 | @@ -181,11 +176,6 @@ init_server_long(int *sock, int port, char *ip, int type) | ||
| 34 | struct sockaddr_in server; | ||
| 35 | int s = -1; | ||
| 36 | |||
| 37 | - if (BIO_sock_init() != 1) { | ||
| 38 | - BIO_printf(bio_err, "BIO_sock_init failed\n"); | ||
| 39 | - return (0); | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | memset((char *) &server, 0, sizeof(server)); | ||
| 43 | server.sin_family = AF_INET; | ||
| 44 | server.sin_port = htons((unsigned short) port); | ||
| @@ -18,15 +18,15 @@ fi | |||
| 18 | git pull --rebase) | 18 | git pull --rebase) |
| 19 | 19 | ||
| 20 | # setup source paths | 20 | # setup source paths |
| 21 | dir=`pwd` | 21 | CWD=`pwd` |
| 22 | libc_src=$dir/openbsd/src/lib/libc | 22 | libc_src=$CWD/openbsd/src/lib/libc |
| 23 | libc_regress=$dir/openbsd/src/regress/lib/libc | 23 | libc_regress=$CWD/openbsd/src/regress/lib/libc |
| 24 | libcrypto_src=$dir/openbsd/src/lib/libcrypto | 24 | libcrypto_src=$CWD/openbsd/src/lib/libcrypto |
| 25 | libcrypto_regress=$dir/openbsd/src/regress/lib/libcrypto | 25 | libcrypto_regress=$CWD/openbsd/src/regress/lib/libcrypto |
| 26 | libssl_src=$dir/openbsd/src/lib/libssl | 26 | libssl_src=$CWD/openbsd/src/lib/libssl |
| 27 | libssl_regress=$dir/openbsd/src/regress/lib/libssl | 27 | libssl_regress=$CWD/openbsd/src/regress/lib/libssl |
| 28 | libtls_src=$dir/openbsd/src/lib/libtls | 28 | libtls_src=$CWD/openbsd/src/lib/libtls |
| 29 | openssl_app_src=$dir/openbsd/src/usr.bin/openssl | 29 | openssl_app_src=$CWD/openbsd/src/usr.bin/openssl |
| 30 | 30 | ||
| 31 | # load library versions | 31 | # load library versions |
| 32 | source $libcrypto_src/crypto/shlib_version | 32 | source $libcrypto_src/crypto/shlib_version |
| @@ -184,6 +184,8 @@ for i in `awk '/SOURCES|HEADERS/ { print $3 }' apps/Makefile.am` ; do | |||
| 184 | $CP $openssl_app_src/$i apps | 184 | $CP $openssl_app_src/$i apps |
| 185 | fi | 185 | fi |
| 186 | done | 186 | done |
| 187 | # patch for openssl(1) oscp on windows | ||
| 188 | (cd apps; patch -p5 < $CWD/patches/win_bio_sock_init.diff) | ||
| 187 | 189 | ||
| 188 | # copy libssl source | 190 | # copy libssl source |
| 189 | echo "copying libssl source" | 191 | echo "copying libssl source" |
