Commit Graph

49 Commits

Author SHA1 Message Date
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
792a5acb67 eng_rsax is gone 2015-07-20 01:08:01 -05:00
Brent Cook
ddeb740426 win32 openssl CLI: preserve original echo state
Mirror the patch to ui_openssl.c, also fix the broken conditional that
made it not actually turn off echo in the first place.

ok guenther@
2015-07-16 10:27:57 -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
4cffda193b build libcrypto with -DLIBRESSL_INTERNAL
Since libcrypto defines its own CPPFLAGS, we need to set this for
libcrypto specifically.
2015-07-15 19:17:27 -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
b9f1b83a79 update for mdc2 removal 2015-06-20 10:40:04 -05:00
Brent Cook
bc7b93470f add a missing header and fix typo in windows posix layer 2015-06-13 21:43:55 -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
8dedbb4b2b add Makefile.am.arc4random 2015-05-23 19:27:57 -05:00
Brent Cook
769d58e494 further refactoring, working libtls-standalone 2015-05-23 19:27:57 -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
fe3f7fc636 Add experimental AIX support.
This includes a WIP failsafe issetugid for now, while research continues
on the proper way to do this in a race-free fashion in AIX.
2015-03-31 09:25:21 -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
a859b93ff5 disable system issetugid on OS X since it is not fork-safe
Noticed while testing similar code for AIX.
ok beck@
2015-02-17 18:15:17 -06:00
Brent Cook
adc416e922 remove getuid/getgid fallbacks from hp-ux issetugid emulation
Fail closed if we cannot obtain the process flags. Noticed while looking
at a similar function for AIX.
2015-02-16 22:30:27 -06:00
Brent Cook
9de5b8a963 c_all* have merged into c_all.c 2015-02-08 19:40:03 -06:00
Brent Cook
d88e90def9 add by_mem.c for X509_STORE_load_mem 2015-01-26 10:20:26 -06:00
Brent Cook
a223365127 add NetBSD shims for arc4random
The current NetBSD release, 6.1.5, fails to reseed arc4random fork. Work
around it by providing arc4random/getentropy shims. Revisit when NetBSD
7 is available.
2015-01-21 06:14:24 -06:00
kinichiro
0308b63cbf Add support for HP-UX
tested on: HP-UX 11.31 ia64,
               gcc 4.7.1(HP AllianceOne version)
               gcc 4.2.3(http://hpux.connect.org.uk)
	       HP C/aC++

HP-UX defaults to use LP32 and it treats long as 32 bit (= 4 bytes).
This build forces LP64 for treating long as 64 bit.
2015-01-06 17:47:16 -06:00
Brent Cook
d2342f36bc allow Windows DLLs to be built
based on a patch from Jan Engelhardt
2014-12-14 16:59:35 -06:00
Brent Cook
9c685415ab disable inline assembly on Windows for now
There are issues building with inline assembly on Windows 64-bit.
2014-12-07 18:02:06 -06:00
Brent Cook
03cd45e2c7 Enable optimized crypto operations for x86_64
This adds initial support for assembly crypto acceleration on x86_64 for
ELF (Linux, *BSD, Solaris) and Mach-O (OS-X) systems.

The build method is a little different than OpenSSL and OpenBSD.  All
the .s files are generated ahead of time when the tarball is generated,
so there are no complicated makefile rules at configure/build time. This
also means the builds are faster and perl is not required on the build
system.

Thanks to Wouter Clarie for providing the initial cleanup and patch
that this is based on.
2014-12-07 16:26:28 -06:00
Brent Cook
976f64d932 read all library versions directly from files
This makes building and testing easier because the library Makefile.am
files are use directly rather than as templates. Thanks to Wouter Clarie
for the idea.
2014-12-06 18:59:25 -06:00
Brent Cook
29804a73cc simplify packaging for libcrypto.
Remove a lot of complex shell code. Upstream churn has slowed down, so
it is now easier to maintain this directly as automake files. This is
also needed to start integrating CPU-specific acceleration support.

Since we are deriving the copy list from the Makefile.am files, we can
now get rid of copy_src/copy_crypto.
2014-12-06 17:48:03 -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
宋冬生
648e913627 Use _WIN32 instead of __WIN32.
ok bcook@
2014-11-18 07:41:08 -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
a2373f7007 wrap arc4random header
ok @doug
2014-10-30 19:15:20 -05: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
00b51d5c25 conditionally build strnlen if needed.
it is only used by strndup

prodded by Sortie@
2014-08-02 21:59:36 -05:00
Brent Cook
b9ff0728e1 harmonize asprintf with OpenSSH
* use the original name for the file from OpenSSH (remove duplicate version)
 * add va_copy/__va_copy checks to configure
 * incorporate proposed fixes to openssh version:
   + include more system headers directly for various definitions
   + limit the scope of va_copy/va_end to their affected vsnprintf calls
   + simplify error handling, removing a dead assignment
2014-07-30 06:53:02 -05:00
Brent Cook
a07e337020 include comment on windows services 2014-07-29 18:21:58 -05:00
Brent Cook
983103b0db stub win32 issetugid implementation
ok deraadt@ beck@
2014-07-29 11:17:44 -05:00
Brent Cook
d328203f63 produce a error if platform has no arc4random hook
ok deraadt@ beck@
2014-07-29 11:17:27 -05:00
Brent Cook
35e2d8d048 add asprintf / vasprintf from OpenSSH portable
ok deraadt@ beck@
2014-07-29 11:17:22 -05:00
Brent Cook
0a74a4d464 add strndup/strnlen compat functions from OpenBSD 2014-07-28 07:07:23 -05:00
Brent Cook
6383a0722c remove thread_private.h, no longer needed 2014-07-27 06:09:51 -05:00
Brent Cook
f425f564d5 test for and use system explicit_bzero if it exists
ok beck@ guenther@
2014-07-21 19:54:07 -05:00
Brent Cook
edebb7a66e remove thread_private.h defines, moved to arc4random_*.h 2014-07-19 10:49:08 -05:00
Brent Cook
1b1bce16b1 update to newly-refactored arc4random compatibility shims
the thread-private bits can move next

ok beck@
2014-07-18 09:19:23 -05:00
Brent Cook
d697fdb4af initial underpinnings for mingw/cross compilation support
Use canonical host rather than target so that this works:
 CC=i686-w64-mingw32-gcc ./configure --host=i686-w64-mingw32

 Conditionally compile Linux issetugid compatibility function

ok beck@
2014-07-18 09:19:17 -05:00
Brent Cook
32d9eeeecf register the atfork handler from arc4random
From kettenis@

People have suggested using pthread_atfork(3) before, but discarded
the idea because it involves linking with -lpthread, which has other
undesirable consequences.  However:

* Most systems actually have pthread_atfork(3) in libc.  I verified
  this on OS X and Solaris.  I believe this is the case on Linux
  systems that use musl as well.

* On Linux systems that use glibc, this isn't the case.  However,
  those systems have __register_atfork(3), which is fully documented
  in the "Linux Standard Base Core Specification".

ok kettenis@ deraadt@ beck@
2014-07-15 14:50:05 -05:00
Brent Cook
65944782c3 add platform libraries to libcompat's LIBADD list
ok beck@
2014-07-12 03:34:08 -05:00
Bob Beck
c1f7374df0 We're probably gonna need this for solaris 10 2014-07-12 09:15:11 -06: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
Charlie Root
abe7bee360 Make things build again - add some missing headers
ok bcook@
2014-07-10 08:36:47 -06:00
Brent Cook
2b6dbc39ef initial top-level import of subdirectories 2014-07-10 06:22:54 -05:00