Commit Graph

69 Commits

Author SHA1 Message Date
kinichiro
14905877a0 Enable tests on Visual Studio
- add patch for aeadtest.c to undef IN
- add patch for ocsp_test.c to call BIO_sock_init() before getaddrinfo()
- define STDERR_FILENO in unistd.h to build pkcs7test.c
- add option ENABLE_VSTEST(default OFF) to enable test on Visual Studio
- modify to pass test data file as an argument (aeadtest, evptest)
- add Windows scripts (ocsptest, pq_test, ssltest, testdsa, testenc, testrsa)
- do not build pidwraptest on MSVC
- fix some indentations
2016-10-30 21:40:24 -05:00
Brent Cook
b7ba692f72 ensure that __STRING works 2016-09-14 23:40:31 -05:00
Brent Cook
08837a82b6 more cdefs.h removal 2016-09-04 09:04:01 -05:00
Brent Cook
6f24864a73 cdefs.h should not be required anywhere 2016-09-04 07:57:59 -05:00
Brent Cook
6040ff04b0 wire up sys/types.h to pull in sys/cdefs.h 2016-09-04 07:38:16 -05:00
kinichiro
2510a5e6f9 modify cmake to build nc
- modify structure of CMakeLists.txt under apps/
  * move apps/CMakeLists.txt to apps/openssl/ since this is for openssl build
  * create new apps/nc/CMakeLists.txt for nc build
  * modify apps/CMakeLists.txt just add_subdirectory()

- add checking and compile of arc4random_uniform()

- add installing man files, openssl.1 and nc.1
2016-04-09 12:06:40 -05:00
kinichiro
14aa5f73ab modify include/compat/netinet/ip.h
- add including <netinet/in_systm.h> for n_long on HP-UX
2016-03-13 19:17:24 +09:00
Brent Cook
8c91563f60 add solaris include for getentropy(2) 2016-01-18 09:50:23 -06:00
Brent Cook
07e541cc2e replace err.h macros with inline functions
Passing NULL for the format is just easier with a function.
2016-01-03 21:20:03 -06:00
Brent Cook
38c577d758 include strings.h in string.h on AIX as well 2016-01-03 21:19:55 -06:00
Brent Cook
905e2a3b80 refresh nc(1) support 2015-12-06 23:32:18 -06:00
Brent Cook
75ef5bb160 wrap gets on Windows, replacing '\r\n' with '\n' 2015-12-05 13:58:37 -06:00
Brent Cook
585b57b202 no special workaround needed for MSVC2015 2015-12-02 08:39:22 -06:00
Brent Cook
0197a58969 Windows compatibility fixes
VS2013 has trouble with relative include paths for apps/openssl, so move
certhash_win/apps_win.c back to apps/openssl.

gmtime_r on mingw64 fails with negative time_t, override

gmtime_s fails all of the time unit tests, override

SHUT_RD/WR are defined in newer mingw64 headers, check before overriding
2015-10-18 09:28:10 -05:00
Brent Cook
a45e38e962 disable some tests with 32-bit time_t systems
Also disable use of _mkgmtime, it does not produce correct results.
2015-10-17 22:57:59 -05:00
Brent Cook
e8c9210073 unconditionally disable pledge for now
suggested by deraadt@ since there is still more coming
2015-10-15 19:34:42 -05:00
Brent Cook
4298ac9305 include timegm fallback 2015-10-15 09:16:38 -05:00
Brent Cook
1dd79f5d8f add limits.h shim for defining PATH_MAX on HP-UX 2015-10-14 23:54:25 -05:00
Brent Cook
ff52e6f4e3 check for pledge(2) 2015-10-12 15:34:03 -05:00
Brent Cook
41cebd325f resolve tame to 0 2015-10-07 10:59:22 -05:00
Brent Cook
442cc6f1b4 add tame(2) check 2015-10-07 08:55:05 -05:00
Brent Cook
a615d3c6d3 rename _mkgmtime as timegm on win32 2015-10-07 08:22:43 -05:00
Brent Cook
a7f031ba55 add b64_ntop checking and fallback for nc(1) 2015-10-01 07:40:26 -05:00
kinichiro
9606a6b5e9 add include/compat/readpassphrase.h to Makefile.am
fix for https://github.com/libressl-portable/portable/issues/138
2015-09-17 04:41:45 -05:00
Brent Cook
696ba18c6a fixup windows and older linux builds 2015-09-13 18:57:29 -05:00
Brent Cook
8c90be2a29 allow nc to build on linux and os x 2015-09-13 18:42:15 -05:00
Brent Cook
5dc6303714 remove support for old MSVC versions, KNF 2015-09-09 06:03:52 -05:00
Brent Cook
5f4e95e7c1 updates for MSVC 2015's degenerate headers
Note that 'perror' moves from stdio.h to stdlib.h, and 'rename' moves
from stdio.h to io.h. Also, standard C includes move from the compiler
to the Windows SDK, which changes the base path for the include files.
2015-09-09 06:02:28 -05:00
Brent Cook
5ccdd1380b distribute include and man CMakefiles 2015-09-07 00:31:59 -05:00
Jeff Davey
5461dea7f1 Add install targets and shared libraries to CMake 2015-08-18 13:20:19 -06:00
Brent Cook
a9b16c2d66 correct fallback err.h macro behavior 2015-07-22 09:00:38 -05:00
Brent Cook
9d5eb631e3 move sleep shim to posix_win.c 2015-07-21 12:52:29 -06:00
Brent Cook
cbdc8ca820 tighten up compat include paths, fix glibc compatibility 2015-07-21 12:04:07 -06:00
Brent Cook
5d8a1cf715 add initial CMake and Visual Studio build support
This moves the compatibility include files from include to
include/compat so we can use the awful MS C compiler
<../include/> trick to emulate the GNU #include_next extension.

This also removes a few old compat files we do not need anymore.
2015-07-21 12:08:18 -05:00
Brent Cook
a1a0f2c6e2 implement compatibility shim for __warn_references
This will allow us to warn about deprecated function references at link-time.
2015-07-17 16:54:23 -05:00
Brent Cook
8c6ed379eb add compatible version of arpa/nameser.h for Windows 2015-07-02 17:49:03 -05:00
Brent Cook
545454277a add check for inet_pton, nudge minimum win32 compat to 0x0501 2015-07-02 00:19:53 -05:00
Brent Cook
b4a6a61513 refactor win32 shims into posix_win.c
this also adds a rename shim that allows overwrites
2015-06-05 04:50:18 -05:00
Brent Cook
b239fc25fc all file IO should be binary, auto-append the flag 2015-06-05 04:50:17 -05:00
Brent Cook
3096ab0e45 remove issetuigid wrappers, now that all getenv calls are gone.
From deraadt@ upstream:

Remove all getenv() calls, especially those wrapped by issetugid().
getenv()'s wrapped by issetugid() are safe, but issetugid() is ...
difficult to impliment on many operating systems.  By accident, a grand
experiment was run over the last year, where issetugid() returned 1 (the
safe value) on a few operating systems.  Noone noticed & complained that
certain environment variables were not working.......
2015-04-14 07:55:23 -05:00
Brent Cook
dd646a3302 enable libtls by default
The API/ABI for the LibreSSL 2.1.x series is now fixed, so we can safely
enable libtls it by default. This is useful for new OpenNTPD and
OpenSMTPD releases as well.

ok deraadt@ beck@ sthen@
2015-03-19 00:39:50 -05:00
Brent Cook
ad7ac48d03 add strsep fallback for libtls 2015-02-14 20:03:39 -06:00
Brent Cook
9909bd7aa5 include 'struct iovec' for Windows
this is used for in-memory cert loading
2015-01-31 21:52:20 -06:00
Brent Cook
b3270494f0 add support for building libtls
Use './configure --enable-libtls' to build the library and install the
associated manpages. Note that the API and ABI of this library may
change still, though feedback is welcome.

ok deraadt@ jsing@ tedu@
2014-12-06 09:13:56 -06:00
Brent Cook
e83c30c158 monkey patch more POSIX-like behavior out of winsock 2
Windows sockets functions look on the outside like they behave similarly
to POSIX functions, but there are many subtle and glaring differences,
including errors reported via WSAGetLastError, read, write, and close do
not work on sockets, setsockopt takes a (char *) rather than (void *),
etc.

This header implements wrappers that coerce more POSIX-like behavior
from these functions, making portable code easier to develop.

BENEFITS:
One does not necessarily need to sprinkle #ifdefs around code to handle
the Windows and non-Windows behavior when porting code.

CAVEATS:
There may be performance implications with the 'mother-may-I'
approach to determining if a descriptor is a socket or a file.

The errno mappings are not 100% what one might expect compared to POSIX
since there were not always good 1:1 equivalents from the WSA errors.
2014-12-03 17:07:17 -06:00
Brent Cook
cccdd689e3 add minimal winsock->BSD networking header shims
also add license header to existing shims
2014-12-03 17:07:17 -06:00
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
宋冬生
648e913627 Use _WIN32 instead of __WIN32.
ok bcook@
2014-11-18 07:41:08 -06:00
Brent Cook
a4cc953911 Improve and simplify function and header detection logic.
Simplify autoconf checks by using AC_CHECK_FUNCS/HEADERS.
Clarify some ambiguous dependencies around strnlen/strndup.
Unconditionally enable pidwraptest for all arc4random implementations.
Remove HAVE_VASPRINTF conditional, since asprintf requires vasprintf.

ok @doug
2014-10-30 19:15:11 -05:00
kinichiro
a91d1013cf update string.h for include strings.h for HPUX environment 2014-10-22 12:45:01 -05:00