Compare commits

...

64 Commits

Author SHA1 Message Date
Brent Cook
d193b171b6 Add '-windows' to windows binary archive. 2015-03-02 23:17:48 -06:00
Brent Cook
79492b46f6 add windows README, package README files with distribution 2015-03-02 23:14:35 -06:00
Brent Cook
e0855bdb1d point out where to report bugs, update links. 2015-03-02 21:12:47 -06:00
Brent Cook
3b3a290b73 update changelog with security updates 2015-03-02 20:47:26 -06:00
Brent Cook
3cb34ee99f add a simple code coverage generation script
The lcov tools (http://ltp.sourceforge.net/coverage/lcov.php) are
required to generate reports.

Original idea from this PR, thanks to Jim Barlow for doing the initial
integration work.

https://github.com/libressl-portable/portable/pull/58
2015-03-01 17:37:12 -06:00
Brent Cook
701aa50e77 ignore temp windows library build files 2015-03-01 17:16:00 -06:00
Brent Cook
933820a0f5 separate the BSWAP check from the action
checks need to be unconditional with autoconf
2015-03-01 16:30:23 -06:00
Brent Cook
8695b50688 check if the BSWAP assembly for ARM works before building 2015-03-01 15:57:21 -06:00
Brent Cook
557df7eed8 refine building windows binaries, enable shared 2015-03-01 05:34:43 -06:00
Brent Cook
f94d3d671c update windows binary build script
This puts the 32 and 64-bit binaries in the same zip file, adds debug
files that are compatible with Visual Studio/windbg, and updates for the
new configure options.
2015-02-24 19:42:26 -06:00
Brent Cook
ab0d3e54a2 add windows-specific hardening options
This enables DEP and ALSR capabilities. Stack protection is enabled
optionally, there are some extra linking steps required that make it
difficult to enable by default.
2015-02-24 19:39:16 -06:00
Brent Cook
347c03d3a0 remove openat requirement for building certhash 2015-02-23 09:48:04 -06:00
Brent Cook
9da890ffb9 update libtls mlinks 2015-02-23 09:25:53 -06:00
Brent Cook
f54d0d4f38 remove unneeded continuation characters in ssl/crypto mlinks list 2015-02-23 09:25:53 -06:00
Brent Cook
2c5ac47db4 Update initial changelog for 2.1.4 2015-02-22 18:06:46 -06:00
Brent Cook
329df39a13 enable Windows NX / ALSR / stack protector
I will update my toolchain and try --high-entropy-va and
stack-protector-strong later. We will probably need to ship libssp-0.dll
as well. Thanks to jsg for hints.
2015-02-19 23:05:51 -06:00
Brent Cook
7ba784891d add script for building windows binary distribution packages 2015-02-19 21:23:31 -06:00
Brent Cook
49d80f0e89 add missing line continuation 2015-02-19 21:16:55 -06: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
ad7ac48d03 add strsep fallback for libtls 2015-02-14 20:03:39 -06: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
2286578fd4 update for new manpage conversions, add links 2015-02-14 18:15:15 -06:00
Brent Cook
5e96c047f7 add the new openssl(1) certhash command 2015-02-11 20:50:10 -06:00
Brent Cook
687a5083f4 rc5 is removed 2015-02-10 11:10:04 -06:00
Brent Cook
9de5b8a963 c_all* have merged into c_all.c 2015-02-08 19:40:03 -06:00
Brent Cook
c386ab2149 disable biotest 2015-02-06 20:41:07 -06:00
Brent Cook
be5d0cca13 update with latest, add more tests
this adds the new bytestring apis and new regression tests
2015-02-06 20:17:31 -06:00
Brent Cook
a323f52a3f be even nicer to OS X's fork 2015-01-31 22:42:08 -06:00
Brent Cook
fc7ba46906 be nicer to travis OS X machines, remove unneeded 'make clean' 2015-01-31 22:35:52 -06:00
Brent Cook
100625e317 only use the specific build matrix
use sudo to install mingw toolchains
2015-01-31 22:24:31 -06:00
Brent Cook
5ea47a8fa2 fix whitespace in yml 2015-01-31 22:17:39 -06:00
Brent Cook
dd7ed132ee update travis-ci build to check mingw32/64 targets 2015-01-31 22:13:19 -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
6c46e80871 bump version 2015-01-26 10:30:17 -06:00
Brent Cook
d88e90def9 add by_mem.c for X509_STORE_load_mem 2015-01-26 10:20:26 -06:00
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
29 changed files with 1660 additions and 1051 deletions

3
.gitignore vendored
View File

@@ -38,6 +38,7 @@ Makefile.in
*.lo *.lo
*.la *.la
*.def
*.pc *.pc
# tests # tests
@@ -53,6 +54,7 @@ tests/timingsafe*
tests/*test tests/*test
tests/*test.c tests/*test.c
tests/memmem.c tests/memmem.c
tests/pbkdf2*
tests/*.pem tests/*.pem
tests/testssl tests/testssl
tests/*.txt tests/*.txt
@@ -110,6 +112,7 @@ apps/openssl
apps/openssl.cnf apps/openssl.cnf
!apps/apps_win.c !apps/apps_win.c
!apps/poll_win.c !apps/poll_win.c
!apps/certhash_disabled.c
crypto/compat/arc4random.c crypto/compat/arc4random.c
crypto/compat/chacha_private.h crypto/compat/chacha_private.h

24
.travis.yml Normal file
View File

@@ -0,0 +1,24 @@
language: c
matrix:
include:
- compiler: clang
os: osx
env: ARCH=native
- compiler: gcc
os: osx
env: ARCH=native
- compiler: clang
os: linux
env: ARCH=native
- compiler: gcc
os: linux
env: ARCH=native
- compiler: gcc
os: linux
env: ARCH=mingw32
- compiler: gcc
os: linux
env: ARCH=mingw64
script:
"./scripts/travis"

113
ChangeLog
View File

@@ -10,7 +10,7 @@ generation are here:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libcrypto/ http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libcrypto/
A new simplified SSL wrapper library is here: A simplified TLS wrapper library is here:
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libtls/ http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libtls/
@@ -19,15 +19,122 @@ with relevant portions of the C library, to a Git repository. This makes it
easier to follow all of the relevant changes to the upstream project in a easier to follow all of the relevant changes to the upstream project in a
single place: single place:
https://github.com/libressl-portable/openbsd/commits/master https://github.com/libressl-portable/openbsd
The portable bits of the project are largely maintained out-of-tree, and their The portable bits of the project are largely maintained out-of-tree, and their
history is also available from Git. history is also available from Git.
https://github.com/libressl-portable/portable/commits/master https://github.com/libressl-portable/portable
LibreSSL Portable Release Notes: LibreSSL Portable Release Notes:
2.1.4 - Security and feature updates
* Improvements to libtls:
- a new API for loading CA chains directly from memory instead of a
file, allowing verification with privilege separation in a chroot
without direct access to CA certificate files.
- Ciphers default to TLSv1.2 with AEAD and PFS.
- Improved error handling and message generation
- New APIs and improved documentation
* Added X509_STORE_load_mem API for loading certificates from memory.
This facilitates accessing certificates from a chrooted environment.
* New AEAD "MAC alias" allows configuring TLSv1.2 AEAD ciphers by
using 'TLSv1.2+AEAD' as the cipher selection string.
* Dead and disabled code removal including MD5, Netscape workarounds,
non-POSIX IO, SCTP, RFC 3779 support, many #if 0 sections, and more.
* ASN1 macro maze expanded to aid reading and searching the code.
* NULL pointer asserts removed in favor of letting the OS/signal
handler catch them.
* Refactored argument handling in openssl(1) for consistency and
maintainability.
* New openssl(1) command 'certhash' replaces the c_rehash script.
* Support for building with OPENSSL_NO_DEPRECATED
* Server-side support for TLS_FALLBACK_SCSV for compatibility with
various auditor and vulnerability scanners.
* Dozens of issues found with the Coverity scanner fixed.
* Security Updates:
- Fix a minor information leak that was introduced in t1_lib.c
r1.71, whereby an additional 28 bytes of .rodata (or .data) is
provided to the network. In most cases this is a non-issue since
the memory content is already public. Issue found and reported by
Felix Groebert of the Google Security Team.
- Fixes for the following low-severity issues were integrated into
LibreSSL from OpenSSL 1.0.1k:
CVE-2015-0205 - DH client certificates accepted without
verification
CVE-2014-3570 - Bignum squaring may produce incorrect results
CVE-2014-8275 - Certificate fingerprints can be modified
CVE-2014-3572 - ECDHE silently downgrades to ECDH [Client]
Reported by Karthikeyan Bhargavan of the PROSECCO team at INRIA.
The following CVEs were fixed in earlier LibreSSL releases:
CVE-2015-0206 - Memory leak handling repeated DLTS records
CVE-2014-3510 - Flaw handling DTLS anonymous EC(DH) ciphersuites.
The following CVEs did not apply to LibreSSL:
CVE-2014-3571 - DTLS segmentation fault in dtls1_get_record
CVE-2014-3569 - no-ssl3 configuration sets method to NULL
CVE-2015-0204 - RSA silently downgrades to EXPORT_RSA
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 = README README.windows VERSION config scripts

4
README
View File

@@ -18,6 +18,10 @@ The LibreSSL portable build framework is also mirrored in Github:
https://github.com/libressl-portable/portable https://github.com/libressl-portable/portable
Please report bugs either to tech@openbsd.org, or to the github issue tracker:
https://github.com/libressl-portable/portable/issues
If you have checked this source using Git, follow these initial steps to If you have checked this source using Git, follow these initial steps to
prepare the source tree for building: prepare the source tree for building:

40
README.windows Normal file
View File

@@ -0,0 +1,40 @@
# Building
For Windows systems, LibreSSL supports the mingw-w64 toolchain, which can use
GCC or Clang as the compiler. Contrary to its name, mingw-w64 supports both
32-bit and 64-bit build environments. If your project already uses mingw-w64,
then LibreSSL should integrate very nicely. Old versions of the mingw-w64
toolchain, such as the one packaged with Ubuntu 12.04, may have trouble
building LibreSSL. Please try it with a recent toolchain if you encounter
troubles. If you are building under Cygwin, only builds with the mingw-w64
compiler are supported, though you can easily use Cygwin to drive the build
process.
To configure and build LibreSSL for a 32-bit system, use the following
build steps:
CC=i686-w64-mingw32-gcc ./configure --host=i686-w64-mingw32
make
make check
For 64-bit builds, use these instead:
CC=x86_64-w64-mingw32-gcc ./configure --host=x86_64-w64-mingw32
make
make check
# Using Libressl with Visual Studio
A script for generating ready-to-use .DLL and static .LIB files is included in
the source repository at
https://github.com/libressl-portable/portable/blob/master/dist-win.sh
This script uses mingw-w64 to build LibreSSL and then uses Visual Studio tools
to generate compatible library import files ready-to-use with Visual
Studio projects. Static and dynamic libraries are included. The script uses
cv2pdb to generate Visual Studio and windbg compatible debug files. cv2pdb is a
tool developed for the D language and can be found here:
https://github.com/rainers/cv2pdb
Pre-build Windows binaries are available with the LibreSSL release for your
convenience.

View File

@@ -1 +1 @@
2.1.2 2.1.4

View File

@@ -57,6 +57,12 @@ openssl_SOURCES += verify.c
openssl_SOURCES += version.c openssl_SOURCES += version.c
openssl_SOURCES += x509.c openssl_SOURCES += x509.c
if BUILD_CERTHASH
openssl_SOURCES += certhash.c
else
openssl_SOURCES += certhash_disabled.c
endif
if HOST_WIN if HOST_WIN
openssl_SOURCES += apps_win.c openssl_SOURCES += apps_win.c
else else

13
apps/certhash_disabled.c Normal file
View File

@@ -0,0 +1,13 @@
/*
* Public domain
* certhash dummy implementation for platforms without symlinks
*/
#include "apps.h"
int
certhash_main(int argc, char **argv)
{
fprintf(stderr, "certhash is not enabled on this platform\n");
return (1);
}

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*)
@@ -47,7 +55,9 @@ 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 +67,117 @@ 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_ARG_ENABLE([windows-ssp],
[AS_HELP_STRING([--enable-windows-ssp],
[Enable building the stack smashing protection on
Windows. This currently distributing libssp-0.dll.])])
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]])
# Windows security flags
AS_IF([test "x$HOST_OS" = "xwin"], [
CHECK_LDFLAG([[-Wl,--nxcompat]])
CHECK_LDFLAG([[-Wl,--dynamicbase]])
CHECK_LDFLAG([[-Wl,--high-entropy-va]])
])
# Use stack-protector-strong if available; if not, fallback to
# stack-protector-all which is considered to be overkill
AS_IF([test "x$enable_windows_ssp" = "xyes" -o "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])
)
)
AS_IF([test "x$HOST_OS" = "xwin"], [
AC_SEARCH_LIBS([__stack_chk_guard],[ssp])
])
])
])
# 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,22 +188,25 @@ 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"
AC_CHECK_FUNCS([arc4random_buf asprintf explicit_bzero funopen getauxval]) AC_CHECK_FUNCS([arc4random_buf asprintf explicit_bzero funopen getauxval])
AC_CHECK_FUNCS([getentropy issetugid memmem poll reallocarray]) AC_CHECK_FUNCS([getentropy issetugid memmem poll reallocarray])
AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strtonum]) AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum])
AC_CHECK_FUNCS([symlink])
AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp]) AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp])
# Share test results with automake # Share test results with automake
@@ -104,13 +222,23 @@ AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes])
AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes]) AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes])
AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes]) AM_CONDITIONAL([HAVE_STRNDUP], [test "x$ac_cv_func_strndup" = xyes])
AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes]) AM_CONDITIONAL([HAVE_STRNLEN], [test "x$ac_cv_func_strnlen" = xyes])
AM_CONDITIONAL([HAVE_STRSEP], [test "x$ac_cv_func_strsep" = xyes])
AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes]) AM_CONDITIONAL([HAVE_STRTONUM], [test "x$ac_cv_func_strtonum" = xyes])
AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes]) AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes])
AM_CONDITIONAL([HAVE_TIMINGSAFE_MEMCMP], [test "x$ac_cv_func_timingsafe_memcmp" = xyes]) AM_CONDITIONAL([HAVE_TIMINGSAFE_MEMCMP], [test "x$ac_cv_func_timingsafe_memcmp" = xyes])
AM_CONDITIONAL([BUILD_CERTHASH], [test "x$ac_cv_func_symlink" = xyes])
# 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])
# overrides for issetugid implementations with known issues
AM_CONDITIONAL([HAVE_ISSETUGID],
[test "x$HOST_OS" != xdarwin \
-a "x$ac_cv_func_issetugid" = 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([[
@@ -155,6 +283,23 @@ AC_ARG_ENABLE([asm],
AS_HELP_STRING([--disable-asm], [Disable assembly])) AS_HELP_STRING([--disable-asm], [Disable assembly]))
AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno"]) AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno"])
old_cflags=$CFLAGS
CFLAGS="$old_cflags -I$srcdir/include"
AC_TRY_COMPILE([#include "$srcdir/crypto/modes/modes_lcl.h"],
[int a = 0; BSWAP4(a);],
BSWAP4=yes, BSWAP4=no)
CFLAGS="$old_cflags"
case $host_cpu in
*sparc*)
CFLAGS="$CFLAGS -D__STRICT_ALIGNMENT"
;;
*arm*)
AS_IF([test "x$BSWAP4" = "xyes"],,
CFLAGS="$old_cflags -D__STRICT_ALIGNMENT")
;;
esac
AM_CONDITIONAL([HOST_ASM_ELF_X86_64], AM_CONDITIONAL([HOST_ASM_ELF_X86_64],
[test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"]) [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"])
AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64], AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64],

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,12 @@ 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_DARWIN
libcompat_la_SOURCES += compat/issetugid_osx.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 +114,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
@@ -484,8 +498,6 @@ libcrypto_la_SOURCES += evp/bio_b64.c
libcrypto_la_SOURCES += evp/bio_enc.c libcrypto_la_SOURCES += evp/bio_enc.c
libcrypto_la_SOURCES += evp/bio_md.c libcrypto_la_SOURCES += evp/bio_md.c
libcrypto_la_SOURCES += evp/c_all.c libcrypto_la_SOURCES += evp/c_all.c
libcrypto_la_SOURCES += evp/c_allc.c
libcrypto_la_SOURCES += evp/c_alld.c
libcrypto_la_SOURCES += evp/digest.c libcrypto_la_SOURCES += evp/digest.c
libcrypto_la_SOURCES += evp/e_aes.c libcrypto_la_SOURCES += evp/e_aes.c
libcrypto_la_SOURCES += evp/e_aes_cbc_hmac_sha1.c libcrypto_la_SOURCES += evp/e_aes_cbc_hmac_sha1.c
@@ -762,6 +774,7 @@ noinst_HEADERS += whrlpool/wp_locl.h
# x509 # x509
libcrypto_la_SOURCES += x509/by_dir.c libcrypto_la_SOURCES += x509/by_dir.c
libcrypto_la_SOURCES += x509/by_file.c libcrypto_la_SOURCES += x509/by_file.c
libcrypto_la_SOURCES += x509/by_mem.c
libcrypto_la_SOURCES += x509/x509_att.c libcrypto_la_SOURCES += x509/x509_att.c
libcrypto_la_SOURCES += x509/x509_cmp.c libcrypto_la_SOURCES += x509/x509_cmp.c
libcrypto_la_SOURCES += x509/x509_d2.c libcrypto_la_SOURCES += x509/x509_d2.c

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,17 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/pstat.h>
/*
* HP-UX does not have issetugid().
* Use pstat_getproc() and check PS_CHANGEDPRIV bit of pst_flag. If this call
* cannot be used, assume we must be running in a privileged environment.
*/
int issetugid(void)
{
struct pst_status buf;
if (pstat_getproc(&buf, sizeof(buf), 0, getpid()) == 1 &&
!(buf.pst_flag & PS_CHANGEDPRIV))
return 0;
return 1;
}

View File

@@ -0,0 +1,16 @@
/*
* issetugid implementation for OS X
* Public domain
*/
#include <unistd.h>
/*
* OS X has issetugid, but it is not fork-safe as of version 10.10.
* See this Solaris report for test code that fails similarly:
* http://mcarpenter.org/blog/2013/01/15/solaris-issetugid%282%29-bug
*/
int issetugid(void)
{
return 1;
}

56
dist-win.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
set -e
#set -x
export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH
VERSION=`cat VERSION`
DIST=libressl-$VERSION-windows
rm -fr $DIST
mkdir -p $DIST
for ARCH in X86 X64; do
if [ $ARCH = X86 ]; then
HOST=i686-w64-mingw32
ARCHDIR=x86
else
HOST=x86_64-w64-mingw32
ARCHDIR=x64
fi
echo Building for $HOST
CC=$HOST-gcc ./configure --host=$HOST --enable-libtls
make clean
PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
make -j 4 check
make -j 4 install DESTDIR=`pwd`/stage-$ARCHDIR
mkdir -p $DIST/$ARCHDIR
#cp -a stage-$ARCHDIR/usr/local/lib/* $DIST/$ARCHDIR
if [ ! -e $DIST/include ]; then
cp -a stage-$ARCHDIR/usr/local/include $DIST
sed -i -e 'N;/\n.*__non/s/"\? *\n/ /;P;D' \
$DIST/include/openssl/*.h $DIST/include/*.h
sed -i -e 'N;/\n.*__attr/s/"\? *\n/ /;P;D' \
$DIST/include/openssl/*.h $DIST/include/*.h
sed -i -e "s/__attr.*;/;/" \
-e "s/sys\/time.h/winsock2.h/" \
$DIST/include/openssl/*.h $DIST/include/*.h
fi
cp stage-$ARCHDIR/usr/local/bin/* $DIST/$ARCHDIR
#cp /usr/$HOST/sys-root/mingw/bin/libssp* $DIST/$ARCHDIR
for i in libcrypto libssl libtls; do
DLL=$(basename `ls -1 $DIST/$ARCHDIR/$i*.dll`|cut -d. -f1)
echo EXPORTS > $DLL.def
dumpbin /exports $DIST/$ARCHDIR/$DLL.dll | \
awk '{print $4}' | awk 'NF' |tail -n +9 >> $DLL.def
lib /MACHINE:$ARCH /def:$DLL.def /out:$DIST/$ARCHDIR/$DLL.lib
cv2pdb $DIST/$ARCHDIR/$DLL.dll
done
done
zip -r $DIST.zip $DIST

37
gen-coverage-report.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/bin/sh
VERSION=$(cat VERSION)
DESTDIR=libressl-coverage-$VERSION
echo "This will generate a code coverage report under $DESTDIR"
echo
if [ "x$(which lcov)" = "x" ]; then
echo "'lcov' is required but not found!"
exit 1
fi
if [ "x$(which genhtml)" = "x" ]; then
echo "'genhtml' is required but not found!"
exit 1
fi
find -name '*.gcda' -o -name '*.gcno' -delete
rm -fr $DESTDIR
echo "Configuring to build with code coverage support"
./configure --enable-libtls CFLAGS='-O0 -fprofile-arcs -ftest-coverage'
echo "Running all code paths"
make clean
make check
echo "Generating report"
mkdir -p $DESTDIR
find tests -name '*.gcda' -o -name '*.gcno' -delete
lcov --directory . --capture --output-file $DESTDIR/coverage.tmp \
--test-name "LibreSSL $VERSION"
genhtml --prefix . --output-directory $DESTDIR \
--title "LibreSSL $VERSION" --legend --show-detail $DESTDIR/coverage.tmp
echo "Code coverage report is available under $DESTDIR"

View File

@@ -26,6 +26,7 @@ noinst_HEADERS += sys/select.h
noinst_HEADERS += sys/socket.h noinst_HEADERS += sys/socket.h
noinst_HEADERS += sys/times.h noinst_HEADERS += sys/times.h
noinst_HEADERS += sys/types.h noinst_HEADERS += sys/types.h
noinst_HEADERS += sys/uio.h
if ENABLE_LIBTLS if ENABLE_LIBTLS
include_HEADERS = tls.h include_HEADERS = tls.h

View File

@@ -33,6 +33,10 @@ size_t strnlen(const char *str, size_t maxlen);
#endif #endif
#endif #endif
#ifndef HAVE_STRSEP
char *strsep(char **stringp, const char *delim);
#endif
#ifndef HAVE_EXPLICIT_BZERO #ifndef HAVE_EXPLICIT_BZERO
void explicit_bzero(void *, size_t); void explicit_bzero(void *, size_t);
#endif #endif

17
include/sys/uio.h Normal file
View File

@@ -0,0 +1,17 @@
/*
* Public domain
* sys/select.h compatibility shim
*/
#ifndef _WIN32
#include_next <sys/uio.h>
#else
#include <sys/types.h>
struct iovec {
void *iov_base;
size_t iov_len;
};
#endif

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:

2026
man/links

File diff suppressed because it is too large Load Diff

33
scripts/travis Executable file
View File

@@ -0,0 +1,33 @@
#!/bin/sh
set -e
./autogen.sh
if [ "x$ARCH" = "xnative" ]; then
./configure --enable-libtls
if [ `uname` = "Darwin" ]; then
# OS X runs out of resources if we run 'make -j check'
make check
else
make -j distcheck
fi
else
CPU=i686
if [ "x$ARCH" = "xmingw64" ]; then
CPU=x86_64
fi
export CC=$CPU-w64-mingw32-gcc
if [ -z $(which $CC) ]; then
# Update Ubuntu 12.04 with current mingw toolchain
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo apt-add-repository -y ppa:tobydox/mingw-x-precise
sudo apt-get update
sudo apt-get install -y $ARCH-x-gcc make
export PATH=$PATH:/opt/$ARCH/bin
fi
./configure --host=$CPU-w64-mingw32 --enable-libtls
make -j
fi

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,10 +4,14 @@ 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 += bs_ber.c
libssl_la_SOURCES += bs_cbb.c
libssl_la_SOURCES += bs_cbs.c
libssl_la_SOURCES += d1_both.c libssl_la_SOURCES += d1_both.c
libssl_la_SOURCES += d1_clnt.c libssl_la_SOURCES += d1_clnt.c
libssl_la_SOURCES += d1_enc.c libssl_la_SOURCES += d1_enc.c
@@ -50,3 +54,4 @@ libssl_la_SOURCES += t1_srvr.c
noinst_HEADERS = srtp.h noinst_HEADERS = srtp.h
noinst_HEADERS += ssl_locl.h noinst_HEADERS += ssl_locl.h
noinst_HEADERS += bytestring.h

View File

@@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.am.common
AM_CPPFLAGS += -I $(top_srcdir)/crypto/modes AM_CPPFLAGS += -I $(top_srcdir)/crypto/modes
AM_CPPFLAGS += -I $(top_srcdir)/crypto/asn1 AM_CPPFLAGS += -I $(top_srcdir)/crypto/asn1
AM_CPPFLAGS += -I $(top_srcdir)/ssl
LDADD = $(PLATFORM_LDADD) $(PROG_LDADD) LDADD = $(PLATFORM_LDADD) $(PROG_LDADD)
LDADD += $(top_builddir)/ssl/libssl.la LDADD += $(top_builddir)/ssl/libssl.la

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
@@ -15,4 +16,9 @@ libtls_la_SOURCES += tls_server.c
libtls_la_SOURCES += tls_util.c libtls_la_SOURCES += tls_util.c
libtls_la_SOURCES += tls_verify.c libtls_la_SOURCES += tls_verify.c
noinst_HEADERS = tls_internal.h noinst_HEADERS = tls_internal.h
if !HAVE_STRSEP
libtls_la_SOURCES += strsep.c
endif
endif endif

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
@@ -96,12 +96,16 @@ copy_hdrs crypto "stack/stack.h lhash/lhash.h stack/safestack.h opensslv.h
bio/bio.h cast/cast.h cmac/cmac.h conf/conf_api.h des/des.h dh/dh.h bio/bio.h cast/cast.h cmac/cmac.h conf/conf_api.h des/des.h dh/dh.h
dsa/dsa.h cms/cms.h engine/engine.h ui/ui.h pkcs12/pkcs12.h ts/ts.h dsa/dsa.h cms/cms.h engine/engine.h ui/ui.h pkcs12/pkcs12.h ts/ts.h
md4/md4.h ripemd/ripemd.h whrlpool/whrlpool.h idea/idea.h mdc2/mdc2.h md4/md4.h ripemd/ripemd.h whrlpool/whrlpool.h idea/idea.h mdc2/mdc2.h
rc2/rc2.h rc4/rc4.h rc5/rc5.h ui/ui_compat.h txt_db/txt_db.h rc2/rc2.h rc4/rc4.h ui/ui_compat.h txt_db/txt_db.h
chacha/chacha.h evp/evp.h poly1305/poly1305.h camellia/camellia.h chacha/chacha.h evp/evp.h poly1305/poly1305.h camellia/camellia.h
gost/gost.h" gost/gost.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
@@ -154,7 +168,11 @@ done
echo copying libtls source echo copying libtls source
rm -f tls/*.c tls/*.h rm -f tls/*.c tls/*.h
for i in `awk '/SOURCES|HEADERS/ { print $3 }' tls/Makefile.am` ; do for i in `awk '/SOURCES|HEADERS/ { print $3 }' tls/Makefile.am` ; do
$CP $libtls_src/$i tls if [ -e $libtls_src/$i ]; then
$CP $libtls_src/$i tls
else
$CP $libc_src/string/$i tls
fi
done done
# copy openssl(1) source # copy openssl(1) source
@@ -176,30 +194,23 @@ done
# copy libcrypto tests # copy libcrypto tests
echo "copying tests" echo "copying tests"
rm -f tests/biotest.c for i in `find $libcrypto_regress -name '*.c'`; do
for i in aead/aeadtest.c aeswrap/aes_wrap.c base64/base64test.c bf/bftest.c \ $CP "$i" tests
bn/general/bntest.c bn/mont/mont.c \
cast/casttest.c chacha/chachatest.c cts128/cts128test.c \
des/destest.c dh/dhtest.c dsa/dsatest.c ec/ectest.c ecdh/ecdhtest.c \
ecdsa/ecdsatest.c engine/enginetest.c evp/evptest.c exp/exptest.c \
gcm128/gcm128test.c hmac/hmactest.c idea/ideatest.c ige/igetest.c \
md4/md4test.c md5/md5test.c mdc2/mdc2test.c poly1305/poly1305test.c \
pkcs7/pkcs7test.c pqueue/pq_test.c rand/randtest.c rc2/rc2test.c \
rc4/rc4test.c rmd/rmdtest.c sha/shatest.c sha1/sha1test.c \
sha256/sha256test.c sha512/sha512test.c utf8/utf8test.c \
gost/gost2814789t.c ; do
$CP $libcrypto_regress/$i tests
done done
# the BIO tests rely on resolver results that are OS and environment-specific
rm tests/biotest.c
# copy libc tests # copy libc tests
$CP $libc_regress/arc4random-fork/arc4random-fork.c tests/arc4randomforktest.c $CP $libc_regress/arc4random-fork/arc4random-fork.c tests/arc4randomforktest.c
$CP $libc_regress/explicit_bzero/explicit_bzero.c tests $CP $libc_regress/explicit_bzero/explicit_bzero.c tests
$CP $libc_regress/timingsafe/timingsafe.c tests $CP $libc_regress/timingsafe/timingsafe.c tests
# copy libssl tests # copy libssl tests
$CP $libssl_regress/asn1/asn1test.c tests
$CP $libssl_regress/ssl/testssl tests $CP $libssl_regress/ssl/testssl tests
$CP $libssl_regress/ssl/ssltest.c tests for i in `find $libssl_regress -name '*.c'`; do
$CP "$i" tests
done
$CP $libssl_regress/certs/ca.pem tests $CP $libssl_regress/certs/ca.pem tests
$CP $libssl_regress/certs/server.pem tests $CP $libssl_regress/certs/server.pem tests
@@ -283,6 +294,11 @@ echo "copying manpages"
$CP $i . $CP $i .
echo "dist_man_MANS += $NAME" >> Makefile.am echo "dist_man_MANS += $NAME" >> Makefile.am
done done
for i in `ls -1 $libcrypto_src/man/*.3 | sort`; do
NAME=`basename "$i"`
$CP $i .
echo "dist_man_MANS += $NAME" >> Makefile.am
done
$CP $openssl_app_src/openssl.1 . $CP $openssl_app_src/openssl.1 .
echo "dist_man_MANS += openssl.1" >> Makefile.am echo "dist_man_MANS += openssl.1" >> Makefile.am
$CP $libtls_src/tls_init.3 . $CP $libtls_src/tls_init.3 .