Commit Graph

43 Commits

Author SHA1 Message Date
Brent Cook
b13529f791 Revert "remove DEFAULT_CA_FILE patch, since libtls handles this by default"
This reverts commit 30adf9c06e.
2016-07-09 12:40:22 -05:00
Brent Cook
30adf9c06e remove DEFAULT_CA_FILE patch, since libtls handles this by default 2016-07-07 07:27:39 -05:00
Brent Cook
552817b77f Land #192, fix fix ld warning "attempted multiple inclusion of file" on Solaris 2016-05-02 02:03:03 -05:00
kinichiro
02e1cc4df1 fix ld warning "attempted multiple inclusion of file" on Solaris
- To avoid ld warning on Solaris, use abs_top_builddir in Makefile.am
2016-04-21 16:12:47 +09:00
kinichiro
bda62f7fe4 add cmake build options
- add cmake build options as configure provides
  * -DENABLE_ASM (default ON)
  * -DENABLE_EXTRATESTS (default OFF)
  * -DENABLE_NC (default OFF)
  * -DOPENSSLDIR (default ${CMAKE_INSTALL_PREFIX}/etc/ssl)

- add biotest and pidwraptest if ENABLE_EXTRATESTS is ON

- add compiler flag `-fno-common` if CMAKE_SYSTEM_NAME is Darwin
  to prevent link error Undefined symbols "_OPENSSL_ia32cap_P"
2016-04-14 15:16:52 +09: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
Brent Cook
28aaab4323 allow optionally installing nc(1) with '--enable-nc' 2015-12-07 08:14:51 -06:00
Brent Cook
1988b8f65e fixup cert.pem path override for libtls, add for nc(1)
this also fixes the formatting of help for nc(1)
2015-12-07 07:55:05 -06:00
Brent Cook
7109fb3260 ensure we don't pass a negative int to ctypes functions
Some implementations, e.g. cygwin, use a table lookup that can cast
a char to a negative array offset.
2015-11-23 02:06:03 -06:00
Brent Cook
0086809a82 update apps.h include 2015-10-18 10:48:17 -05: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
Jeremy Huddleston Sequoia
9afc452761 nc: Use AM_CPPFLAGS, not CPPFLAGS in Makefile.am
CPPFLAGS should just be set by the user at configure time

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
2015-10-14 16:33:25 -05:00
Brent Cook
a7f031ba55 add b64_ntop checking and fallback for nc(1) 2015-10-01 07:40:26 -05:00
Brent Cook
630e7b6040 visual studio path updates 2015-09-18 08:43:57 -05:00
Brent Cook
c7ae7c0c9d fix a library paths, nc patch 2015-09-13 19:15:34 -05:00
Brent Cook
eaa4c1cc8a a few more linux nc build tweaks 2015-09-13 19:06: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
a896d400a0 move windows file IO mode setup to apps_win.c 2015-09-13 09:31:41 -05:00
Brent Cook
02b7539cf5 readd openssl.1, distribute nc.1 2015-09-13 07:23:04 -05:00
Brent Cook
a787f964a1 restrict nc to openbsd builds for now 2015-09-12 10:51:11 -05:00
Brent Cook
dcbaa6b699 correct nc compat path 2015-09-12 10:15:00 -05:00
Brent Cook
a64c42a09d add some backcompat in nc, don't install it 2015-09-12 09:50:44 -05:00
Brent Cook
854f4f69af add 'nc' to the distribution as an example of libtls client and server 2015-09-12 08:08:24 -05:00
Brent Cook
c5eef7f11c remove engine.c from CMake 2015-09-11 18:52:22 -05:00
Brent Cook
6db3fc7c31 remove engine from openssl(1) 2015-09-11 09:47:40 -05:00
Jeff Davey
5461dea7f1 Add install targets and shared libraries to CMake 2015-08-18 13:20:19 -06:00
Brent Cook
a9122f74e0 add cmake tests 2015-07-21 22:21:14 -05: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
db974c34e9 fixup how OPENSSLDIR is derived and expanded
As per
http://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Installation-Directory-Variables.html
we should not try to expand variables like sysconfdir in the
configure script, but rather derive the correct value in the Makefiles
instead. This fixes missing expansions as the preprocessor define.
2015-07-15 20:02:38 -05:00
Brent Cook
bda20bd13f Improve automatic handling of OPENSSLDIR
Install a default cert.pem, openssl.cnf, x509v3.cnf in OPENSSLDIR, which
is derived by default from sysconfdir and the prefix setting.
2015-07-12 22:10:48 -05:00
Brent Cook
ad2a38ab4a rework CFLAGS/CPPFLAGS settings during configuration
Move define adjustments to CPPFLAGS.
Adjust user CFLAGS directly, do not override during configuration.
USER_CFLAGS is not necessary to build libcompat_noopt correctly.
2015-03-22 07:43:55 -05:00
Brent Cook
148aebdbb1 fix hangs reading stdin on Windows 2015-03-08 20:47:03 -05:00
Brent Cook
28311d4355 conditionally build certhash into openssl(1)
For now, look for openat and symlink. We may switch to just needing
symlink later.
2015-02-14 18:54:43 -06:00
Brent Cook
5e96c047f7 add the new openssl(1) certhash command 2015-02-11 20:50:10 -06:00
Brent Cook
13035fa666 simplify building the apps Makefile
Remove extra machinery in favor of a plain-old Makefile.am.
Tighten up what files are copied on build, package a simple openssl.cnf.
2014-12-06 11:20:56 -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
Brent Cook
58fcd3c39c Add conditional compilation for windows and posix functions.
This adds a Windows-specific versions of several symbols from libcrypto
and openssl(1).
2014-12-03 17:02:29 -06:00
Brent Cook
2103690cbf improve readability of generated Makefile.am files 2014-11-23 08:33:56 -06:00
Brent Cook
0aeb93b9fc override native arc4random_buf on FreeBSD
The FreeBSD-native arc4random_buf implementation falls back to weak
sources of entropy if the sysctl fails. Remove these dangerous fallbacks
by overriding locally.

Unfortunately, pthread_atfork() is broken on FreeBSD (at least 9 and 10)
if a program does not link to -lthr. Callbacks registered with
pthread_atfork() simply fail silently. So, it is not always possible to
detect a PID wraparound. I wish we could do better.

This improves arc4random_buf's safety compared to the native FreeBSD
implementation. Tested on FreeBSD 9 and 10.

ok beck@ deraadt@
2014-11-03 01:19:36 -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
Brent Cook
4335a49f51 use correct link order for app and tests
ok beck@ guenther@
2014-07-21 19:53:52 -05:00
Brent Cook
8b125f31bb build strtonum directly into apps/openssl
it is not needed as a library export

ok beck@
2014-07-11 04:47:03 -05:00
Brent Cook
2b6dbc39ef initial top-level import of subdirectories 2014-07-10 06:22:54 -05:00