Compare commits

...

28 Commits

Author SHA1 Message Date
Brent Cook
20e329e272 add 2.1.3 notes 2015-01-21 08:04:11 -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
Brent Cook
ec81c28219 catch GCC versions that only warn on unused flags
Noticed while building with GCC 4.2 with HP-UX. Switching the ERROR to a
WARN for a first release while we continue to survey the field.
2015-01-06 17:47:16 -06:00
Brent Cook
f2d68c7d21 remove bash-style comparisons from tests 2015-01-06 17:47:16 -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
4b7e78153c quoting and ensure old_*flags are restored before the 'else' 2015-01-05 21:22:36 -06:00
Brent Cook
872ecfd856 preserve CFLAGS between hardening checks, enable mingw
Allow hardening CFLAGS for mingw that do not cause link-time failures.
Add proper quoting on flags for commas
Check LDFLAGS for linker-only flags.
2015-01-05 20:59:53 -06:00
Brent Cook
303b972d55 simplify hardening check logic, disable for mingw
Rather than doing separate linker/compiler checks, just build a
non-empty program with each so that the compiler will actually try to
use the hardening features. Reduce redundancy in the macro calls by just
setting the flag that was just tested.

Also, disable hardening for mingw, since its trying to use a
libssp-0.dll file that I can't find right now. The detected hardening
flags break mingw builds currently.
2015-01-05 20:23:48 -06:00
Brent Cook
5be407a424 move public domain to top, help automatic tools 2015-01-02 07:42:15 -06:00
Jim Barlow
813e7bdac1 Change comments to remark on script not being needed for clang >= 5.1 2015-01-01 15:03:03 -08:00
Jim Barlow
750cc5306d Fix build failure of "make distcheck" (new scripts/ folder missing) 2014-12-31 07:17:47 -08:00
Jim Barlow
701204bf34 Fix typo causing output of clang test to read "CLANG" instead of yes/no 2014-12-31 07:06:49 -08:00
Jim Barlow
2dc0a6ac3c Merge recent upstream changes with compiler hardening
Conflicts:
	configure.ac
2014-12-30 15:13:19 -08:00
Brent Cook
9adc6d6458 Revert "do not double-link libcrypto"
This reverts commit c83d468cfd.
It wasn't as superfluous as I thought on all platforms.
2014-12-27 16:52:25 -06:00
Brent Cook
c83d468cfd do not double-link libcrypto
libssl already has LIBFLAGS for libcrypto, so adding -lcrypto is superfluous.
2014-12-27 16:34:48 -06:00
Brent Cook
23c90228ac enable __STRICT_ALIGNMENT on sparc 2014-12-27 16:34:02 -06:00
Jim Barlow
c0a8ddc163 configure.ac: use executable hardening where available
Where available, enable stack smashing protection, fortify source,
no-strict-overflow, and read only relocations.

Many Linux distributions automatically enable most of these options.
They are no brainers. The difference introduced here is in asking for a
few more aggressive options. An option to disable the more aggressive
options is provided (--disable-hardening). When set, configure will fall
back to the default CFLAGS on the system - in many cases that will still
be hardened. There is no point in going further than that.

Options enabled are:

-fstack-protector-strong is a relatively new GCC-4.9 feature that is
supposed to give a better balance between performance and protection.
-all is considered too aggressive, but was used in Chromium and other
security critical systems until -strong became available. Follow their
lead and use -strong when possible. clang 6.0 supports -all but not
-strong.

_FORTIFY_SOURCE replaces certain unsafe C str* and mem* functions with
more robust equivalents when the compiler can determine the length of
the buffers involved.

-fno-strict-overflow instructs GCC to not make optimizations based on
the assumption that signed arithmetic will wrap around on overflow (e.g.
(short)0x7FFF + 1 == 0). This prevents the optimizer from doing some
unexpected things. Further improvements should trap signed overflows and
reduce the use of signed to refer to naturally unsigned quantities.

I did not set -fPIE (position independent executables). The critical
function of Open/LibreSSL is as a library, not an executable.

Tested on Ubuntu Linux 14.04.1 LTS, OS X 10.10.1 with "make check".

The code added to m4/ is GPLv3 but con

Signed-off-by: Jim Barlow <jim@purplerock.ca>
2014-12-23 21:47:03 -08:00
Jim Barlow
a6c072343a configure.ac: use executable hardening where available
Where available, enable stack smashing protection, fortify source,
no-strict-overflow, and read only relocations.

Many Linux distributions automatically enable most of these options.
They are no brainers. The difference introduced here is in asking for a
few more aggressive options. An option to disable the more aggressive
options is provided (--disable-hardening). When set, configure will fall
back to the default CFLAGS on the system - in many cases that will still
be hardened. There is no point in going further than that.

Options enabled are:

-fstack-protector-strong is a relatively new GCC-4.9 feature that is
supposed to give a better balance between performance and protection.
-all is considered too aggressive, but was used in Chromium and other
security critical systems until -strong became available. Follow their
lead and use -strong when possible. clang 6.0 supports -all but not
-strong.

_FORTIFY_SOURCE replaces certain unsafe C str* and mem* functions with
more robust equivalents when the compiler can determine the length of
the buffers involved.

-fno-strict-overflow instructs GCC to not make optimizations based on
the assumption that signed arithmetic will wrap around on overflow (e.g.
(short)0x7FFF + 1 == 0). This prevents the optimizer from doing some
unexpected things. Further improvements should trap signed overflows and
reduce the use of signed to refer to naturally unsigned quantities.

I did not set -fPIE (position independent executables). The critical
function of Open/LibreSSL is as a library, not an executable.

Tested on Ubuntu Linux 14.04.1 LTS, OS X 10.10.1 with "make check".

Signed-off-by: Jim Barlow <jim@purplerock.ca>
2014-12-23 05:24:24 -08:00
Jim Barlow
164f684eb8 configure.ac: Modify clang check to save result to a variable
...and leave a note that -Qunused-arguments is being applied to CFLAGS
not LDFLAGS, probably in error.
2014-12-23 04:38:43 -08:00
Brent Cook
04158cd40e do not mark GNU_STACK WX in ELFs generated from assembly
When generating ELF objects from assembly, gcc and clang mark the
GNU_STACK program headers as RWX by default. This is a security issue,
so we make sure it is marked only RW.

This modifies Anthony G. Basile's original patch for Linux to set
.note.GNU-stack whenever the assembler supports it. It is surprising
that any modern toolchain would enable an executable stack without an
explicit request. The number of programs that need an executable stack
is surely much smaller than the number of programs that include assembly.
2014-12-22 23:04:47 -06:00
Technion
8c6c07c5ba Add wrapper file "config" to distribution. 2014-12-15 07:43:17 +00:00
Brent Cook
56f7523337 enable OS X and Linux CI builds 2014-12-14 21:03:38 -06:00
Brent Cook
733c252857 add Travis CI configuration 2014-12-14 20:46:14 -06:00
Brent Cook
c2dccc1418 add all LIBADD dependencies for tls
The libtool transitive dependency magic does not seem to work for
cross-compilation, so explicitly specify them here.
2014-12-14 20:38:02 -06:00
Brent Cook
a29b174e31 bump version
append portable version number to the version string
2014-12-14 17:12:50 -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
09e5a841cd add LIBADD library dependencies to libssl/libtls
From Jan Engelhardt
2014-12-14 16:59:35 -06:00
Brent Cook
2669771c7e Use the individual library versions in LibreSSL pc files
Previously, they were all using the portable package version, rather
than the individual library versions. openssl(1)'s pc file represents
the LibreSSL-portable release however.

$ pkg-config --modversion libtls
1:0:0
$ pkg-config --modversion openssl
2.1.2
$ pkg-config --modversion libssl
30:0:0
$ pkg-config --modversion libcrypto
30:3:0

ok beck@ deraadt@
2014-12-14 16:59:26 -06:00
15 changed files with 270 additions and 19 deletions

8
.travis.yml Normal file
View File

@@ -0,0 +1,8 @@
language: c
compiler:
- clang
- gcc
os:
- linux
- osx
script: "./dist.sh"

View File

@@ -28,6 +28,48 @@ history is also available from Git.
LibreSSL Portable Release Notes: LibreSSL Portable Release Notes:
2.1.3 - Security update and OS support improvements
* Fixed various memory leaks in DTLS, including fixes for
CVE-2015-0206.
* Added Application-Layer Protocol Negotiation (ALPN) support.
* Removed GOST R 34.10-94 signature authentication.
* Removed nonfunctional Netscape browser-hang workaround code.
* Simplfied and refactored SSL/DTLS handshake code.
* Added SHA256 Camellia cipher suites for TLS 1.2 from RFC 5932.
* Hide timing info about padding errors during handshakes.
* Improved libtls support for non-blocking sockets, added randomized
session ID contexts. Work is ongoing with this library - feedback
and potential use-cases are welcome.
* Support building Windows DLLs.
Thanks to Jan Engelhard.
* Packaged config wrapper for better compatibility with OpenSSL-based
build systems.
Thanks to @technion from github
* Ensure the stack is marked non-executable for assembly sections.
Thanks to Anthony G. Bastile.
* Enable extra compiler hardening flags by default, where applicable.
The default set of hardening features can vary by OS to OS, so
feedback is welcome on this. To disable the default hardening flags,
specify '--disable-hardening' during configure.
Thanks to Jim Barlow
* Initial HP-UX support, tested with HP-UX 11.31 ia64
Thanks to Kinichiro Inoguchi
* Initial NetBSD support, tested with NetBSD 6.1.5 x86_64
Imported from OpenNTPD, thanks to @gitisihara from github
2.1.2 - Many new features and improvements 2.1.2 - Many new features and improvements
* Added reworked GOST cipher suite support * Added reworked GOST cipher suite support
thanks to Dmitry Eremin-Solenikov thanks to Dmitry Eremin-Solenikov

View File

@@ -8,4 +8,4 @@ if ENABLE_LIBTLS
pkgconfig_DATA += libtls.pc pkgconfig_DATA += libtls.pc
endif endif
EXTRA_DIST = VERSION EXTRA_DIST = VERSION config scripts

View File

@@ -1 +1 @@
2.1.2 2.1.3

View File

@@ -22,18 +22,26 @@ case $host_os in
HOST_ABI=elf HOST_ABI=elf
AC_SUBST([PROG_LDADD], ['-lthr']) AC_SUBST([PROG_LDADD], ['-lthr'])
;; ;;
*hpux*)
HOST_OS=hpux;
CFLAGS="$CFLAGS -mlp64 -D_XOPEN_SOURCE=600 -D__STRICT_ALIGNMENT"
AC_SUBST([PLATFORM_LDADD], ['-lpthread'])
;;
*linux*) *linux*)
HOST_OS=linux HOST_OS=linux
HOST_ABI=elf HOST_ABI=elf
CFLAGS="$CFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE" CFLAGS="$CFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE"
;; ;;
*netbsd*)
HOST_OS=netbsd
;;
*openbsd*) *openbsd*)
HOST_ABI=elf HOST_ABI=elf
AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded]) AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded])
;; ;;
*mingw*) *mingw*)
HOST_OS=win HOST_OS=win
CFLAGS="$CFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600 -DOPENSSL_NO_SPEED -D__USE_MINGW_ANSI_STDIO" CFLAGS="$CFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600 -DOPENSSL_NO_SPEED -DNO_SYSLOG -D__USE_MINGW_ANSI_STDIO"
AC_SUBST([PLATFORM_LDADD], ['-lws2_32']) AC_SUBST([PLATFORM_LDADD], ['-lws2_32'])
;; ;;
*solaris*) *solaris*)
@@ -45,9 +53,17 @@ case $host_os in
*) ;; *) ;;
esac esac
case $host_cpu in
*sparc*)
CFLAGS="$CFLAGS -D__STRICT_ALIGNMENT"
;;
esac
AM_CONDITIONAL([HOST_DARWIN], [test x$HOST_OS = xdarwin]) AM_CONDITIONAL([HOST_DARWIN], [test x$HOST_OS = xdarwin])
AM_CONDITIONAL([HOST_FREEBSD], [test x$HOST_OS = xfreebsd]) AM_CONDITIONAL([HOST_FREEBSD], [test x$HOST_OS = xfreebsd])
AM_CONDITIONAL([HOST_HPUX], [test x$HOST_OS = xhpux])
AM_CONDITIONAL([HOST_LINUX], [test x$HOST_OS = xlinux]) AM_CONDITIONAL([HOST_LINUX], [test x$HOST_OS = xlinux])
AM_CONDITIONAL([HOST_NETBSD], [test x$HOST_OS = xnetbsd])
AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris]) AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris])
AM_CONDITIONAL([HOST_WIN], [test x$HOST_OS = xwin]) AM_CONDITIONAL([HOST_WIN], [test x$HOST_OS = xwin])
@@ -57,12 +73,102 @@ AC_CHECK_FUNC([clock_gettime],,
AC_CHECK_FUNC([dl_iterate_phdr],, AC_CHECK_FUNC([dl_iterate_phdr],,
[AC_SEARCH_LIBS([dl_iterate_phdr],[dl])]) [AC_SEARCH_LIBS([dl_iterate_phdr],[dl])])
AM_PROG_AS
AC_PROG_CC AC_PROG_CC
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AC_PROG_CC_STDC AC_PROG_CC_STDC
AM_PROG_CC_C_O AM_PROG_CC_C_O
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[CLANG=yes],
[CLANG=no]
)
AC_MSG_RESULT([$CLANG])
AS_IF([test "x$CLANG" = "xyes"], [CLANG_FLAGS=-Qunused-arguments])
# We want to check for compiler flag support. Prior to clang v5.1, there was no
# way to make clang's "argument unused" warning fatal. So we invoke the
# compiler through a wrapper script that greps for this message.
saved_CC="$CC"
saved_LD="$LD"
flag_wrap="$srcdir/scripts/wrap-compiler-for-flag-check"
CC="$flag_wrap $CC"
LD="$flag_wrap $LD"
AC_ARG_ENABLE([hardening],
[AS_HELP_STRING([--disable-hardening],
[Disable options to frustrate memory corruption exploits])],
[], [enable_hardening=yes])
AC_DEFUN([CHECK_CFLAG], [
AC_LANG_ASSERT(C)
AC_MSG_CHECKING([if $saved_CC supports "$1"])
old_cflags="$CFLAGS"
CFLAGS="$1 -Wall -Werror"
AC_TRY_LINK([
#include <stdio.h>
],
[printf("Hello")],
AC_MSG_RESULT([yes])
CFLAGS=$old_cflags
HARDEN_CFLAGS="$HARDEN_CFLAGS $1",
AC_MSG_RESULT([no])
CFLAGS=$old_cflags
[$2])
])
AC_DEFUN([CHECK_LDFLAG], [
AC_LANG_ASSERT(C)
AC_MSG_CHECKING([if $saved_LD supports "$1"])
old_ldflags="$LDFLAGS"
LDFLAGS="$1 -Wall -Werror"
AC_TRY_LINK([
#include <stdio.h>
],
[printf("Hello")],
AC_MSG_RESULT([yes])
LDFLAGS=$old_ldflags
HARDEN_LDFLAGS="$HARDEN_LDFLAGS $1",
AC_MSG_RESULT([no])
LDFLAGS=$old_ldflags
[$2])
])
AS_IF([test "x$enable_hardening" = "xyes"], [
# Tell GCC to NOT optimize based on signed arithmetic overflow
CHECK_CFLAG([[-fno-strict-overflow]])
# _FORTIFY_SOURCE replaces builtin functions with safer versions.
CHECK_CFLAG([[-D_FORTIFY_SOURCE=2]])
# Enable read only relocations
CHECK_LDFLAG([[-Wl,-z,relro]])
CHECK_LDFLAG([[-Wl,-z,now]])
])
# Use stack-protector-strong if available; if not, fallback to
# stack-protector-all which is considered to be overkill
AS_IF([test "x$enable_hardening" = "xyes" -a "x$HOST_OS" != "xwin"], [
CHECK_CFLAG([[-fstack-protector-strong]],
CHECK_CFLAG([[-fstack-protector-all]],
AC_MSG_WARN([compiler does not appear to support stack protection])
)
)
])
# Restore CC, LD
CC="$saved_CC"
LD="$saved_LD"
CFLAGS="$CFLAGS $HARDEN_CFLAGS"
LDFLAGS="$LDFLAGS $HARDEN_LDFLAGS"
# Removing the dependency on -Wno-pointer-sign should be a goal
save_cflags="$CFLAGS" save_cflags="$CFLAGS"
CFLAGS=-Wno-pointer-sign CFLAGS=-Wno-pointer-sign
AC_MSG_CHECKING([whether CC supports -Wno-pointer-sign]) AC_MSG_CHECKING([whether CC supports -Wno-pointer-sign])
@@ -73,16 +179,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
) )
CFLAGS="$save_cflags $AM_CFLAGS" CFLAGS="$save_cflags $AM_CFLAGS"
AC_MSG_CHECKING([if compiling with clang]) save_cflags="$CFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ CFLAGS=
#ifndef __clang__ AC_MSG_CHECKING([whether AS supports .note.GNU-stack])
not clang AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#endif __asm__(".section .note.GNU-stack,\"\",@progbits");]])],
]])],
[AC_MSG_RESULT([yes])] [AC_MSG_RESULT([yes])]
[CLANG_FLAGS=-Qunused-arguments], [AM_CFLAGS=-DHAVE_GNU_STACK],
[AC_MSG_RESULT([no])] [AC_MSG_RESULT([no])]
) )
CFLAGS="$save_cflags $AM_CFLAGS"
AM_PROG_AS
CFLAGS="$CFLAGS $CLANG_CFLAGS" CFLAGS="$CFLAGS $CLANG_CFLAGS"
LDFLAGS="$LDFLAGS $CLANG_FLAGS" LDFLAGS="$LDFLAGS $CLANG_FLAGS"
@@ -110,7 +218,10 @@ AM_CONDITIONAL([HAVE_TIMINGSAFE_MEMCMP], [test "x$ac_cv_func_timingsafe_memcmp"
# overrides for arc4random_buf implementations with known issues # overrides for arc4random_buf implementations with known issues
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF],
[test "x$HOST_OS" != xdarwin -a "x$HOST_OS" != xfreebsd -a "x$ac_cv_func_arc4random_buf" = xyes]) [test "x$HOST_OS" != xdarwin \
-a "x$HOST_OS" != xfreebsd \
-a "x$HOST_OS" != xnetbsd \
-a "x$ac_cv_func_arc4random_buf" = xyes])
AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [ AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ AC_LINK_IFELSE([AC_LANG_PROGRAM([[

View File

@@ -8,7 +8,7 @@ lib_LTLIBRARIES = libcrypto.la
EXTRA_DIST = VERSION EXTRA_DIST = VERSION
libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ -no-undefined
libcrypto_la_LIBADD = libcompat.la libcompatnoopt.la libcrypto_la_LIBADD = libcompat.la libcompatnoopt.la
libcrypto_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS) libcrypto_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
libcrypto_la_CFLAGS += -DOPENSSL_NO_HW_PADLOCK libcrypto_la_CFLAGS += -DOPENSSL_NO_HW_PADLOCK
@@ -74,9 +74,15 @@ if !HAVE_GETENTROPY
if HOST_FREEBSD if HOST_FREEBSD
libcompat_la_SOURCES += compat/getentropy_freebsd.c libcompat_la_SOURCES += compat/getentropy_freebsd.c
endif endif
if HOST_HPUX
libcompat_la_SOURCES += compat/getentropy_hpux.c
endif
if HOST_LINUX if HOST_LINUX
libcompat_la_SOURCES += compat/getentropy_linux.c libcompat_la_SOURCES += compat/getentropy_linux.c
endif endif
if HOST_NETBSD
libcompat_la_SOURCES += compat/getentropy_netbsd.c
endif
if HOST_DARWIN if HOST_DARWIN
libcompat_la_SOURCES += compat/getentropy_osx.c libcompat_la_SOURCES += compat/getentropy_osx.c
endif endif
@@ -94,6 +100,9 @@ if !HAVE_ISSETUGID
if HOST_LINUX if HOST_LINUX
libcompat_la_SOURCES += compat/issetugid_linux.c libcompat_la_SOURCES += compat/issetugid_linux.c
endif endif
if HOST_HPUX
libcompat_la_SOURCES += compat/issetugid_hpux.c
endif
if HOST_WIN if HOST_WIN
libcompat_la_SOURCES += compat/issetugid_win.c libcompat_la_SOURCES += compat/issetugid_win.c
endif endif
@@ -102,7 +111,9 @@ endif
noinst_HEADERS = noinst_HEADERS =
noinst_HEADERS += compat/arc4random.h noinst_HEADERS += compat/arc4random.h
noinst_HEADERS += compat/arc4random_freebsd.h noinst_HEADERS += compat/arc4random_freebsd.h
noinst_HEADERS += compat/arc4random_hpux.h
noinst_HEADERS += compat/arc4random_linux.h noinst_HEADERS += compat/arc4random_linux.h
noinst_HEADERS += compat/arc4random_netbsd.h
noinst_HEADERS += compat/arc4random_osx.h noinst_HEADERS += compat/arc4random_osx.h
noinst_HEADERS += compat/arc4random_solaris.h noinst_HEADERS += compat/arc4random_solaris.h
noinst_HEADERS += compat/arc4random_win.h noinst_HEADERS += compat/arc4random_win.h

View File

@@ -6,9 +6,15 @@
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#include "arc4random_freebsd.h" #include "arc4random_freebsd.h"
#elif defined(__hpux)
#include "arc4random_hpux.h"
#elif defined(__linux__) #elif defined(__linux__)
#include "arc4random_linux.h" #include "arc4random_linux.h"
#elif defined(__NetBSD__)
#include "arc4random_netbsd.h"
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include "arc4random_osx.h" #include "arc4random_osx.h"

View File

@@ -0,0 +1,26 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/pstat.h>
/*
* HP-UX does not have issetugid().
* This experimental implementation uses pstat_getproc() and get*id().
* First, try pstat_getproc() and check PS_CHANGEDPRIV bit of pst_flag.
* In case unsuccessful calling pstat_getproc(), using get*id().
*
*/
int issetugid(void)
{
struct pst_status buf;
if(pstat_getproc(&buf, sizeof(buf), 0, getpid()) != 1) {
perror("pstat_getproc()");
} else {
if(buf.pst_flag & PS_CHANGEDPRIV)
return 1;
}
if(getuid() != geteuid())
return 1;
if(getgid() != getegid())
return 1;
return 0;
}

View File

@@ -7,7 +7,7 @@ includedir=@includedir@
Name: LibreSSL-libssl Name: LibreSSL-libssl
Description: Secure Sockets Layer and cryptography libraries Description: Secure Sockets Layer and cryptography libraries
Version: @VERSION@ Version: @LIBCRYPTO_VERSION@
Requires: Requires:
Conflicts: Conflicts:
Libs: -L${libdir} -lcrypto Libs: -L${libdir} -lcrypto

View File

@@ -7,7 +7,7 @@ includedir=@includedir@
Name: LibreSSL-libssl Name: LibreSSL-libssl
Description: Secure Sockets Layer and cryptography libraries Description: Secure Sockets Layer and cryptography libraries
Version: @VERSION@ Version: @LIBSSL_VERSION@
Requires: Requires:
Requires.private: libcrypto Requires.private: libcrypto
Conflicts: Conflicts:

View File

@@ -7,7 +7,7 @@ includedir=@includedir@
Name: LibreSSL-libtls Name: LibreSSL-libtls
Description: Secure communications using the TLS socket protocol. Description: Secure communications using the TLS socket protocol.
Version: @VERSION@ Version: @LIBTLS_VERSION@
Requires: Requires:
Requires.private: libcrypto libssl Requires.private: libcrypto libssl
Conflicts: Conflicts:

View File

@@ -0,0 +1,31 @@
#!/bin/sh
# This file is in the public domain.
# https://github.com/kmcallister/autoharden/blob/c5c7842f39c2f8d19836bb5427d6479db4436d62/LICENSE
#
# From kmcallister:
# https://github.com/kmcallister/autoharden/blob/efaf5a16612589808c276a11536ea9a47071f74b/scripts/wrap-compiler-for-flag-check
# Prior to clang v5.1, there was no way to make
# clang's "argument unused" warning fatal. This
# wrapper script that greps for this warning message. Newer clang's have no issues.
#
# Ideally the search string would also include 'clang: ' but this output might
# depend on clang's argv[0].
#
set -o errexit
set -o nounset
if out=`"$@" 2>&1`; then
echo "$out"
if echo "$out" | grep 'warning: argument unused' >/dev/null; then
echo "$0: found clang warning"
exit 1
else
exit 0
fi
else
code=$?
echo "$out"
exit $code
fi

View File

@@ -4,8 +4,9 @@ lib_LTLIBRARIES = libssl.la
EXTRA_DIST = VERSION EXTRA_DIST = VERSION
libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ -no-undefined
libssl_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS) libssl_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
libssl_la_LIBADD = ../crypto/libcrypto.la
libssl_la_SOURCES = bio_ssl.c libssl_la_SOURCES = bio_ssl.c
libssl_la_SOURCES += d1_both.c libssl_la_SOURCES += d1_both.c

View File

@@ -5,8 +5,9 @@ lib_LTLIBRARIES = libtls.la
EXTRA_DIST = VERSION EXTRA_DIST = VERSION
libtls_la_LDFLAGS = -version-info @LIBTLS_VERSION@ libtls_la_LDFLAGS = -version-info @LIBTLS_VERSION@ -no-undefined
libtls_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS) libtls_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
libtls_la_LIBADD = ../crypto/libcrypto.la ../ssl/libssl.la $(PLATFORM_LDADD)
libtls_la_SOURCES = tls.c libtls_la_SOURCES = tls.c
libtls_la_SOURCES += tls_client.c libtls_la_SOURCES += tls_client.c

View File

@@ -86,7 +86,7 @@ copy_hdrs() {
done done
} }
copy_hdrs crypto "stack/stack.h lhash/lhash.h stack/safestack.h opensslv.h copy_hdrs crypto "stack/stack.h lhash/lhash.h stack/safestack.h
ossl_typ.h err/err.h crypto.h comp/comp.h x509/x509.h buffer/buffer.h ossl_typ.h err/err.h crypto.h comp/comp.h x509/x509.h buffer/buffer.h
objects/objects.h asn1/asn1.h bn/bn.h ec/ec.h ecdsa/ecdsa.h objects/objects.h asn1/asn1.h bn/bn.h ec/ec.h ecdsa/ecdsa.h
ecdh/ecdh.h rsa/rsa.h sha/sha.h x509/x509_vfy.h pkcs7/pkcs7.h pem/pem.h ecdh/ecdh.h rsa/rsa.h sha/sha.h x509/x509_vfy.h pkcs7/pkcs7.h pem/pem.h
@@ -102,6 +102,10 @@ copy_hdrs crypto "stack/stack.h lhash/lhash.h stack/safestack.h opensslv.h
copy_hdrs ssl "srtp.h ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h" copy_hdrs ssl "srtp.h ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h"
sed -e "s/\"LibreSSL .*\"/\"LibreSSL ${libressl_version}\"/" \
$libssl_src/src/crypto/opensslv.h > include/openssl/opensslv.h.lcl
$MV include/openssl/opensslv.h.lcl include/openssl/opensslv.h
# copy libcrypto source # copy libcrypto source
echo copying libcrypto source echo copying libcrypto source
rm -f crypto/*.c crypto/*.h rm -f crypto/*.c crypto/*.h
@@ -121,10 +125,20 @@ $CP crypto/compat/ui_openssl_win.c crypto/ui
asm_src=$libssl_src/src/crypto asm_src=$libssl_src/src/crypto
gen_asm_stdout() { gen_asm_stdout() {
perl $asm_src/$2 $1 > $3.tmp perl $asm_src/$2 $1 > $3.tmp
[[ $1 == "elf" ]] && cat <<-EOF >> $3.tmp
#if defined(HAVE_GNU_STACK)
.section .note.GNU-stack,"",%progbits
#endif
EOF
$MV $3.tmp $3 $MV $3.tmp $3
} }
gen_asm() { gen_asm() {
perl $asm_src/$2 $1 $3.tmp perl $asm_src/$2 $1 $3.tmp
[[ $1 == "elf" ]] && cat <<-EOF >> $3.tmp
#if defined(HAVE_GNU_STACK)
.section .note.GNU-stack,"",%progbits
#endif
EOF
$MV $3.tmp $3 $MV $3.tmp $3
} }
for abi in elf macosx; do for abi in elf macosx; do