Go to file
Brent Cook 1bbde19a7c add minimal poll(2) implementation for Windows
This provides sufficient functionality to run openssl(1) from a Windows
console. This is based on the original select-based version from from
songdongsheng@live.cn. Changes:

 * use nfds_t directly for iterating the fds.
 * add WSAGetLastError -> errno mappings
 * handle POLLHUP and the OOB data cases for revents
 * handle sparse arrays of fds correctly
 * KNF style updates
 * teach poll how to handle file handles as well as sockets

This handles the socket/non-socket issue  by alternating a loop between
WaitForMultipleObjects for non-sockets and and select for sockets. One
would think this would be terrible for performance, but as of this
writing, poll consumes about 6% of the time doing a bulk transfer
between a Linux box and 'openssl.exe s_server'.

I tried to implement this all in terms of WaitForMultipleObjects with a
select 'poll' at the end to get extra specific socket status. However,
the cost of setting up an event handle for each socket, setting the
WSAEventSelect attributes, and cleaning them up reliably was pretty
high. Since the event handle associated with a socket is also global,
creating a new one cancels the previous one or can be disabled
externally.

In addition, the 'FD_WRITE' status of a socket event handle does not
behave in an expected fashion, being triggered by an edge on a write
event rather than being level triggered.

Another fun horror story is how stdin in windows might be a console, it
might be a pipe, it might be something else. If these all worked in the
same way, it would be great. But, since a console-stdin can also signal
on a mouse or window event, it means we can easily get stuck in a
blocking read (you can't make stdin non-blocking) if the non-character
events are not filtered out. So, poll does that too.

See here for various additional horror stories:

http://www.postgresql.org/message-id/4351.1336927207@sss.pgh.pa.us
2014-12-03 17:03:47 -06:00
apps add minimal poll(2) implementation for Windows 2014-12-03 17:03:47 -06:00
crypto Add conditional compilation for windows and posix functions. 2014-12-03 17:02:29 -06:00
include add minimal poll(2) implementation for Windows 2014-12-03 17:03:47 -06:00
man add missing commas from man links 2014-10-14 21:54:37 -05:00
ssl improve readability of generated Makefile.am files 2014-11-23 08:33:56 -06:00
tests update and mask unit tests when running on win32 2014-12-03 17:02:29 -06:00
.gitignore don't ignore a non-existent file 2014-12-03 17:02:23 -06:00
AUTHORS initial top-level import 2014-07-10 06:07:09 -05:00
autogen.sh initial top-level import 2014-07-10 06:07:09 -05:00
ChangeLog update with 2.1.1 changes 2014-10-15 22:28:34 -05:00
config Add an OpenSSL compatible ./config wrapper 2014-10-31 07:35:06 -05:00
configure.ac add minimal poll(2) implementation for Windows 2014-12-03 17:03:47 -06:00
dist.sh don't fail to make dist on a clean repo 2014-10-14 20:54:42 -05:00
libcrypto.pc.in add platform libraries to libcompat's LIBADD list 2014-07-12 03:34:08 -05:00
libressl.pub Add the public signing key so it can be fetched from github 2014-07-14 20:50:52 -06:00
libssl.pc.in add platform libraries to libcompat's LIBADD list 2014-07-12 03:34:08 -05:00
Makefile.am make 'autoreconf' work from dist tarball 2014-11-03 21:05:47 -06:00
Makefile.am.common allow inline asm 2014-08-16 14:16:01 -05:00
NEWS initial top-level import 2014-07-10 06:07:09 -05:00
OPENBSD_BRANCH tie master libressl branch to openbsd master 2014-07-31 22:08:30 -05:00
openssl.pc.in add platform libraries to libcompat's LIBADD list 2014-07-12 03:34:08 -05:00
README update README to reflect current porting approach 2014-11-03 01:18:32 -06:00
update.sh add minimal poll(2) implementation for Windows 2014-12-03 17:03:47 -06:00
VERSION bump version 2014-10-22 11:16:39 -05:00

This package is the official portable version of LibreSSL
	(http://www.libressl.org).

LibreSSL is a fork of OpenSSL developed by the OpenBSD project
(http://www.openbsd.org). LibreSSL is developed on OpenBSD. This
package then adds portability shims for other operating systems.

Official release tarballs are available at your friendly neighborhood
OpenBSD mirror in directory LibreSSL, e.g.:

	http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/

although we suggest that you use a mirror:

	http://www.openbsd.org/ftp.html

The LibreSSL portable build framework is also mirrored in Github:

	https://github.com/libressl-portable/portable

If you have checked this source using Git, follow these initial steps to
prepare the source tree for building:

 1. ensure you have the following packages installed:
	automake, autoconf, bash, git, libtool, perl, pod2man
 2. run './autogen.sh' to prepare the source tree for building
    or run './dist.sh' to prepare a tarball.

Once you have a source tree from Git or FTP, run these commands to build and
install the package:

  ./configure   # see ./configure --help for configuration options
  make check    # runs builtin unit tests
  make install  # set DESTDIR= to install to an alternate location

The resulting library and 'openssl' utility is largely API-compatible with
OpenSSL 1.0.1. However, it is not ABI compatible - you will need to relink your
programs to LibreSSL in order to use it, just as in moving from OpenSSL 0.9.8
to 1.0.1.

The project attempts to provide working alternatives for operating systems with
limited or broken security primitives (e.g. arc4random(3), issetugid(2)) and
assists with improving OS-native implementations where possible.

LibreSSL portable will build on any reasonably modern version of Linux,
Solaris, or OSX with a standards-compliant compiler and C library.