From: deraadt Date: Sat, 19 Apr 2014 16:46:08 +0000 (+0000) Subject: remove the openssl_fdset wrapper, and a variety of VMS'ism's like X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9df57394285489c61441d62e548ae549cdcc46b4;p=openbsd remove the openssl_fdset wrapper, and a variety of VMS'ism's like crazy (void *) casts all over the place ok beck jsing --- diff --git a/lib/libssl/src/apps/apps.h b/lib/libssl/src/apps/apps.h index eae0f4708a3..9a5b77f8079 100644 --- a/lib/libssl/src/apps/apps.h +++ b/lib/libssl/src/apps/apps.h @@ -170,8 +170,6 @@ extern BIO *bio_err; # endif #endif -# define openssl_fdset(a,b) FD_SET(a, b) - typedef struct args_st { char **data; int count; diff --git a/lib/libssl/src/apps/ocsp.c b/lib/libssl/src/apps/ocsp.c index 91e5b8cbd29..5b296a96b71 100644 --- a/lib/libssl/src/apps/ocsp.c +++ b/lib/libssl/src/apps/ocsp.c @@ -1131,10 +1131,10 @@ query_responder(BIO * err, BIO * cbio, char *path, } if (req_timeout != -1 && rv <= 0) { FD_ZERO(&confds); - openssl_fdset(fd, &confds); + FD_SET(fd, &confds); tv.tv_usec = 0; tv.tv_sec = req_timeout; - rv = select(fd + 1, NULL, (void *) &confds, NULL, &tv); + rv = select(fd + 1, NULL, &confds, NULL, &tv); if (rv == 0) { BIO_puts(err, "Timeout on connect\n"); return NULL; @@ -1160,13 +1160,13 @@ query_responder(BIO * err, BIO * cbio, char *path, if (req_timeout == -1) continue; FD_ZERO(&confds); - openssl_fdset(fd, &confds); + FD_SET(fd, &confds); tv.tv_usec = 0; tv.tv_sec = req_timeout; if (BIO_should_read(cbio)) - rv = select(fd + 1, (void *) &confds, NULL, NULL, &tv); + rv = select(fd + 1, &confds, NULL, NULL, &tv); else if (BIO_should_write(cbio)) - rv = select(fd + 1, NULL, (void *) &confds, NULL, &tv); + rv = select(fd + 1, NULL, &confds, NULL, &tv); else { BIO_puts(err, "Unexpected retry condition\n"); goto err; diff --git a/lib/libssl/src/apps/s_client.c b/lib/libssl/src/apps/s_client.c index fada0827a47..94f02e8d5a4 100644 --- a/lib/libssl/src/apps/s_client.c +++ b/lib/libssl/src/apps/s_client.c @@ -1432,29 +1432,23 @@ re_start: ssl_pending = read_ssl && SSL_pending(con); + /* XXX should add tests for fd_set overflow */ + if (!ssl_pending) { if (tty_on) { if (read_tty) - openssl_fdset(fileno(stdin), &readfds); + FD_SET(fileno(stdin), &readfds); if (write_tty) - openssl_fdset(fileno(stdout), &writefds); + FD_SET(fileno(stdout), &writefds); } if (read_ssl) - openssl_fdset(SSL_get_fd(con), &readfds); + FD_SET(SSL_get_fd(con), &readfds); if (write_ssl) - openssl_fdset(SSL_get_fd(con), &writefds); + FD_SET(SSL_get_fd(con), &writefds); /* printf("mode tty(%d %d%d) ssl(%d%d)\n", tty_on,read_tty,write_tty,read_ssl,write_ssl);*/ - /* - * Note: under VMS with SOCKETSHR the second - * parameter is currently of type (int *) whereas - * under other systems it is (void *) if you don't - * have a cast it will choke the compiler: if you do - * have a cast then you can either go for (int *) or - * (void *). - */ - i = select(width, (void *) &readfds, (void *) &writefds, + i = select(width, &readfds, &writefds, NULL, timeoutp); if (i < 0) { BIO_printf(bio_err, "bad select %d\n", diff --git a/lib/libssl/src/apps/s_server.c b/lib/libssl/src/apps/s_server.c index 1082ee51eea..b5c6c2fa7bc 100644 --- a/lib/libssl/src/apps/s_server.c +++ b/lib/libssl/src/apps/s_server.c @@ -1773,23 +1773,15 @@ sv_body(char *hostname, int s, unsigned char *context) if (!read_from_sslcon) { FD_ZERO(&readfds); - openssl_fdset(fileno(stdin), &readfds); - openssl_fdset(s, &readfds); - /* - * Note: under VMS with SOCKETSHR the second - * parameter is currently of type (int *) whereas - * under other systems it is (void *) if you don't - * have a cast it will choke the compiler: if you do - * have a cast then you can either go for (int *) or - * (void *). - */ + FD_SET(fileno(stdin), &readfds); + FD_SET(s, &readfds); if ((SSL_version(con) == DTLS1_VERSION) && DTLSv1_get_timeout(con, &timeout)) timeoutp = &timeout; else timeoutp = NULL; - i = select(width, (void *) &readfds, NULL, NULL, timeoutp); + i = select(width, &readfds, NULL, NULL, timeoutp); if ((SSL_version(con) == DTLS1_VERSION) && DTLSv1_handle_timeout(con) > 0) { BIO_printf(bio_err, "TIMEOUT occured\n"); diff --git a/lib/libssl/src/apps/s_socket.c b/lib/libssl/src/apps/s_socket.c index 01257a525e7..a44dddb6f50 100644 --- a/lib/libssl/src/apps/s_socket.c +++ b/lib/libssl/src/apps/s_socket.c @@ -245,7 +245,7 @@ do_accept(int acc_sock, int *sock, char **host) int ret; struct hostent *h1, *h2; static struct sockaddr_in from; - int len; + socklen_t len; /* struct linger ling; */ if (!ssl_sock_init()) @@ -255,13 +255,7 @@ redoit: memset((char *) &from, 0, sizeof(from)); len = sizeof(from); - /* - * Note: under VMS with SOCKETSHR the fourth parameter is currently - * of type (int *) whereas under other systems it is (void *) if you - * don't have a cast it will choke the compiler: if you do have a - * cast then you can either go for (int *) or (void *). - */ - ret = accept(acc_sock, (struct sockaddr *) & from, (void *) &len); + ret = accept(acc_sock, (struct sockaddr *) & from, &len); if (ret == -1) { if (errno == EINTR) { /* check_timeout(); */ diff --git a/lib/libssl/src/apps/s_time.c b/lib/libssl/src/apps/s_time.c index 169a9d78395..d8f7294c1e5 100644 --- a/lib/libssl/src/apps/s_time.c +++ b/lib/libssl/src/apps/s_time.c @@ -598,15 +598,8 @@ doConnection(SSL * scon) i = SSL_get_fd(serverCon); width = i + 1; FD_ZERO(&readfds); - openssl_fdset(i, &readfds); - /* - * Note: under VMS with SOCKETSHR the 2nd parameter - * is currently of type (int *) whereas under other - * systems it is (void *) if you don't have a cast it - * will choke the compiler: if you do have a cast - * then you can either go for (int *) or (void *). - */ - select(width, (void *) &readfds, NULL, NULL, NULL); + FD_SET(i, &readfds); + select(width, &readfds, NULL, NULL, NULL); continue; } break;