Compare commits

...

27 Commits

Author SHA1 Message Date
Brent Cook
3800681201 update Changelog 2017-01-09 03:31:28 -06:00
Simone Basso
730f199c9c Sync getentropy() checks with use-builtin-arc4random checks
Without this, we actually fail to build a library that includes the
bultin getentropy when compiling for 10.11 on 10.12.
2017-01-07 07:21:47 -06:00
Simone Basso
c4ee1a6fca m4/check-libc.m4: improve getentropy check
- according to man.openbsd.org getentropy() is in unistd.h

- according to macOS sierra's man it's in sys/random.h

- since sys/random.h is does not exist for iOS and for linux, do
  not attempt to include it, rather redeclare the prototype

- make sure that `./configure`:

    - uses getentropy() on macOS sierra

    - does not use getentropy() if compiling for 10.11

    - does not use getentropy() if compiling for ios armv7
2017-01-07 07:21:07 -06:00
Simone Basso
bd53433877 configure: fix getentropy() for sierra and ios
This diff changes the logic by which configure detects getentropy() to
ensure that we don't use the system wide getentropy

- with macOS sierra if the deployment target is lower than sierra as
  found by tor developers here

    https://gitweb.torproject.org/tor.git/commit/?id=https://gitweb.torproject.org/tor.git/commit/?id=16fcbd21c963a9a65bf55024680c8323c8b7175d

- with iOS unconditionally because an app linking libressl compiled with
  system wide getentropy has been rejected by the App store as I have
  documented here

    https://github.com/measurement-kit/measurement-kit/pull/994

I think something similar could also affect clock_gettime judging from
tor's patch, but this diff for now doesn't address that.

I do not have macOS < sierra, so I could only verify that configure was
not picking up system wide getentropy by compiling libressl using

    export CFLAGS="-mmacosx-version-min=10.11"

As regards iOS, removing the check for getentropy and recompiling (thus
using libressl builtin getentropy()) was enough to have another iteration
of the app accepted. Otherwise testing should be possible with:

    export LDFLAGS=-arch armv7 -miphoneos-version-min=7.1 -isysroot `xcrun --show-sdk-path --sdk iphoneos`
    export CPPFLAGS=-arch armv7 -isysroot `xcrun --show-sdk-path --sdk iphoneos`
    export CFLAGS=-arch armv7 -miphoneos-version-min=7.1 -isysroot `xcrun --show-sdk-path --sdk iphoneos`

Related ticket: https://github.com/libressl-portable/portable/issues/230
2017-01-07 07:21:07 -06:00
jacob berkman
7442568456 Disable netcat if arpa/telnet.h is not available (iOS) 2017-01-07 07:21:07 -06:00
Brent Cook
ebeda8bad3 update changelog for 2.3.9 2016-11-06 09:22:39 -06:00
Brent Cook
b67802c2db update changelog for 2.3.8 2016-09-23 05:43:25 -05:00
Brent Cook
25d8a429c1 update for 2.3.7 2016-07-31 17:59:59 -05:00
Brent Cook
926aa53242 set link library dependencies with MSVC, fixes #221 2016-07-31 17:12:47 -05:00
Brent Cook
950dcb2d07 properly enable strnlen checks for MSVC 2016-07-31 17:12:47 -05:00
Brent Cook
f6582d1d76 avoid BSWAP assembly for ARM <= v6 2016-07-19 05:49:05 -05:00
Brent Cook
3a193a58d4 format 64-bit int portably (windows wants %l64d) 2016-07-19 05:48:49 -05:00
celan69
94532f9619 Fix typo in USE_BUILTIN_ARC4RANDOM check
Solaris 11 recently introduced a builtin arc4random in libc which fails the tests in "make check". Found USE_BUILTIN_ARC4RANDOM, but could not get it to work. Apparently, there is a typo in the configure logic rendering USE_BUILTIN_ARC4RANDOM ineffective.
2016-07-19 05:46:16 -05:00
Brent Cook
0ae23dfcc3 bump changelog to sync tags with openbsd source 2016-06-07 07:04:16 -05:00
Brent Cook
bff756ef62 update changelog 2016-06-06 05:03:27 -05:00
Brent Cook
5b39a35bf8 Update changelog 2016-05-30 09:08:29 -05:00
Brent Cook
41d8aa6aef pushed encode.c change upstream 2016-05-03 09:25:59 -05:00
Brent Cook
b8b8628640 prefer limits.h over sys/limits.h 2016-05-03 02:13:13 -05:00
Brent Cook
6cb804b342 update changelog 2016-05-02 22:51:07 -05:00
Brent Cook
00eb776ee9 add constant_time_locl.h 2016-05-02 22:47:45 -05:00
Brent Cook
534ee348a9 check linker flags before checking for functions 2016-05-02 22:12:53 -05:00
kinichiro
ad914139c4 fix ld warning "attempted multiple inclusion of file" on Solaris
- To avoid ld warning on Solaris, use abs_top_builddir in Makefile.am
2016-05-02 22:12:53 -05:00
Brent Cook
6a136f72ff update changelog 2016-03-21 21:56:24 -05:00
Brent Cook
3b3f213ca5 updated changelog 2016-03-21 21:56:24 -05:00
Brent Cook
4b5daaaf44 set windows binary OPENSSLDIR to something plausible 2016-03-21 21:56:24 -05:00
kinichiro
1ffdb2ae25 modify include/compat/netinet/ip.h
- add including <netinet/in_systm.h> for n_long on HP-UX
2016-03-13 13:09:25 -05:00
Brent Cook
ef874034cf connect to the OPENBSD_5_9 branch 2016-03-12 17:30:33 -06:00
18 changed files with 230 additions and 18 deletions

View File

@ -107,7 +107,7 @@ if(HAVE_STRNDUP)
endif()
if(MSVC)
set(HAVE_STRNLEN)
set(HAVE_STRNLEN true)
add_definitions(-DHAVE_STRNLEN)
else()
check_function_exists(strnlen HAVE_STRNLEN)

View File

@ -28,6 +28,79 @@ history is also available from Git.
LibreSSL Portable Release Notes:
2.3.10 - Security and compatibility fixes
* Avoid a side-channel cache-timing attack that can leak the ECDSA
private keys when signing. This is due to BN_mod_inverse() being
used without the constant time flag being set.
This issue was reported by Cesar Pereida Garcia and Billy Brumley
(Tampere University of Technology). The fix was developed by Cesar
Pereida Garcia.
* iOS and MacOS compatibility updates from Simone Basso and Jacob
Berkman.
2.3.9 - Reliability improvements
* Avoid continual processing of an unlimited number of TLS records,
which can cause a denial-of-service condition.
2.3.8 - Security and reliability fixes
* Avoid unbounded memory growth in libssl, which can be triggered by a
TLS client repeatedly renegotiating and sending OCSP Status Request
TLS extensions.
* Avoid falling back to a weak digest for (EC)DH when using SNI with
libssl.
2.3.7 - OCSP fixes
* Fix several issues in the OCSP code that could result in the
incorrect generation and parsing of OCSP requests. This remediates a
lack of error checking on time parsing in these functions, and
ensures that only GENERALIZEDTIME formats are accepted for OCSP, as
per RFC 6960.
Issues reported, and fixes provided by Kazuki Yamaguchi <k@rhe.jp>
and Kinichiro Inoguchi <kinichiro.inoguchi@gmail.com>
2.3.6 - Security fix
* Correct a problem that prevents the DSA signing algorithm from
running in constant time even if the flag BN_FLG_CONSTTIME is set.
This issue was reported by Cesar Pereida (Aalto University), Billy
Brumley (Tampere University of Technology), and Yuval Yarom (The
University of Adelaide and NICTA). The fix was developed by Cesar
Pereida. See OpenBSD 5.9 errata 11, June 6, 2016
2.3.5 - Reliability fix
* Fixed an error in libcrypto when parsing some ASN.1 elements > 16k.
2.3.4 - Security Update
* Fix multiple vulnerabilities in libcrypto relating to ASN.1 and encoding.
From OpenSSL.
* Minor build fixes
2.3.3 - OpenBSD 5.9 release branch tagged
* Reworked build scripts to better sync with OpenNTPD-portable
* Fixed broken manpage links
* Fixed an nginx compatibility issue by adding an 'install_sw' make alias
* Fixed HP-UX builds
* Changed the default configuration directory to c:\LibreSSL\ssl on Windows
binary builds
* cert.pem has been reorganized and synced with Mozilla's certificate store
2.3.2 - Compatibility and Reliability fixes
* Changed format of LIBRESSL_VERSION_NUMBER to match that of

View File

@ -1 +1 @@
master
OPENBSD_5_9

View File

@ -11,9 +11,9 @@ endif
EXTRA_DIST = nc.1
nc_LDADD = $(PLATFORM_LDADD) $(PROG_LDADD)
nc_LDADD += $(top_builddir)/crypto/libcrypto.la
nc_LDADD += $(top_builddir)/ssl/libssl.la
nc_LDADD += $(top_builddir)/tls/libtls.la
nc_LDADD += $(abs_top_builddir)/crypto/libcrypto.la
nc_LDADD += $(abs_top_builddir)/ssl/libssl.la
nc_LDADD += $(abs_top_builddir)/tls/libtls.la
AM_CPPFLAGS += -I$(top_srcdir)/apps/nc/compat
if OPENSSLDIR_DEFINED

View File

@ -5,8 +5,8 @@ bin_PROGRAMS = openssl
dist_man_MANS = openssl.1
openssl_LDADD = $(PLATFORM_LDADD) $(PROG_LDADD)
openssl_LDADD += $(top_builddir)/ssl/libssl.la
openssl_LDADD += $(top_builddir)/crypto/libcrypto.la
openssl_LDADD += $(abs_top_builddir)/ssl/libssl.la
openssl_LDADD += $(abs_top_builddir)/crypto/libcrypto.la
openssl_SOURCES = apps.c
openssl_SOURCES += asn1pars.c

View File

@ -641,6 +641,9 @@ if (BUILD_SHARED)
add_library(crypto-objects OBJECT ${CRYPTO_SRC})
add_library(crypto STATIC $<TARGET_OBJECTS:crypto-objects>)
add_library(crypto-shared SHARED $<TARGET_OBJECTS:crypto-objects>)
if (MSVC)
target_link_libraries(crypto-shared crypto Ws2_32.lib)
endif()
set_target_properties(crypto-shared PROPERTIES OUTPUT_NAME crypto)
set_target_properties(crypto-shared PROPERTIES VERSION
${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION})

View File

@ -3,6 +3,7 @@ include $(top_srcdir)/Makefile.am.common
AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1
AM_CPPFLAGS += -I$(top_srcdir)/crypto/evp
AM_CPPFLAGS += -I$(top_srcdir)/crypto/modes
AM_CPPFLAGS += -I$(top_srcdir)/crypto
lib_LTLIBRARIES = libcrypto.la
@ -128,6 +129,7 @@ libcrypto_la_SOURCES += mem_dbg.c
libcrypto_la_SOURCES += o_init.c
libcrypto_la_SOURCES += o_str.c
libcrypto_la_SOURCES += o_time.c
noinst_HEADERS += constant_time_locl.h
noinst_HEADERS += cryptlib.h
noinst_HEADERS += md32_common.h
noinst_HEADERS += o_time.h

View File

@ -22,7 +22,7 @@ for ARCH in X86 X64; do
echo Building for $HOST
CC=$HOST-gcc ./configure --host=$HOST
CC=$HOST-gcc ./configure --host=$HOST --with-openssldir=c:/libressl/ssl
make clean
PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
make -j 4 check

View File

@ -3,6 +3,10 @@
* netinet/ip.h compatibility shim
*/
#if defined(__hpux)
#include <netinet/in_systm.h>
#endif
#ifndef _WIN32
#include_next <netinet/ip.h>
#else

View File

@ -47,7 +47,52 @@ AM_CONDITIONAL([HAVE_B64_NTOP], [test "x$ac_cv_func_b64_ntop_arg" = xyes])
AC_DEFUN([CHECK_CRYPTO_COMPAT], [
# Check crypto-related libc functions and syscalls
AC_CHECK_FUNCS([arc4random arc4random_buf arc4random_uniform])
AC_CHECK_FUNCS([explicit_bzero getauxval getentropy])
AC_CHECK_FUNCS([explicit_bzero getauxval])
AC_CACHE_CHECK([for getentropy], ac_cv_func_getentropy, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <unistd.h>
/*
* Explanation:
*
* - iOS <= 10.1 fails because of missing sys/random.h
*
* - in macOS 10.12 getentropy is not tagged as introduced in
* 10.12 so we cannot use it for target < 10.12
*/
#ifdef __APPLE__
# include <AvailabilityMacros.h>
# include <TargetConditionals.h>
# if (TARGET_OS_IPHONE || TARGET_OS_SIMULATOR)
# include <sys/random.h> /* Not available as of iOS <= 10.1 */
# else
# include <sys/random.h> /* Pre 10.12 systems should die here */
/* Based on: https://gitweb.torproject.org/tor.git/commit/?id=16fcbd21 */
# ifndef MAC_OS_X_VERSION_10_12
# define MAC_OS_X_VERSION_10_12 101200 /* Robustness */
# endif
# if defined(MAC_OS_X_VERSION_MIN_REQUIRED)
# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
# error "Targeting on Mac OSX 10.11 or earlier"
# endif
# endif
# endif
#endif /* __APPLE__ */
]], [[
char buffer;
(void)getentropy(&buffer, sizeof (buffer));
]])],
[ ac_cv_func_getentropy="yes" ],
[ ac_cv_func_getentropy="no"
])
])
AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp])
AM_CONDITIONAL([HAVE_ARC4RANDOM], [test "x$ac_cv_func_arc4random" = xyes])
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], [test "x$ac_cv_func_arc4random_buf" = xyes])
@ -59,13 +104,15 @@ AM_CONDITIONAL([HAVE_TIMINGSAFE_MEMCMP], [test "x$ac_cv_func_timingsafe_memcmp"
# Override arc4random_buf implementations with known issues
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF],
[test "x$USE_BUILTIN_ARC4RANDOM" != yes \
[test "x$USE_BUILTIN_ARC4RANDOM" != xyes \
-a "x$ac_cv_func_arc4random_buf" = xyes])
# Check for getentropy fallback dependencies
AC_CHECK_FUNC([getauxval])
AC_CHECK_FUNC([clock_gettime],, [AC_SEARCH_LIBS([clock_gettime],[rt posix4])])
AC_CHECK_FUNC([dl_iterate_phdr],, [AC_SEARCH_LIBS([dl_iterate_phdr],[dl])])
AC_SEARCH_LIBS([clock_gettime],[rt posix4])
AC_CHECK_FUNC([clock_gettime])
AC_SEARCH_LIBS([dl_iterate_phdr],[dl])
AC_CHECK_FUNC([dl_iterate_phdr])
])
AC_DEFUN([CHECK_VA_COPY], [

View File

@ -17,10 +17,45 @@ case $host_os in
*darwin*)
HOST_OS=darwin
HOST_ABI=macosx
#
# Don't use arc4random on systems before 10.12 because of
# weak seed on failure to open /dev/random, based on latest
# public source:
# http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c
USE_BUILTIN_ARC4RANDOM=yes
#
# We use the presence of getentropy() to detect 10.12. The
# following check take into account that:
#
# - iOS <= 10.1 fails because of missing getentropy and
# hence they miss sys/random.h
#
# - in macOS 10.12 getentropy is not tagged as introduced in
# 10.12 so we cannot use it for target < 10.12
#
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <AvailabilityMacros.h>
#include <unistd.h>
#include <sys/random.h> /* Systems without getentropy() should die here */
/* Based on: https://gitweb.torproject.org/tor.git/commit/?id=16fcbd21 */
#ifndef MAC_OS_X_VERSION_10_12
# define MAC_OS_X_VERSION_10_12 101200
#endif
#if defined(MAC_OS_X_VERSION_MIN_REQUIRED)
# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
# error "Running on Mac OSX 10.11 or earlier"
# endif
#endif
]], [[
char buf[1]; getentropy(buf, 1);
]])],
[ USE_BUILTIN_ARC4RANDOM=no ],
[ USE_BUILTIN_ARC4RANDOM=yes ]
)
AC_MSG_CHECKING([whether to use builtin arc4random])
AC_MSG_RESULT([$USE_BUILTIN_ARC4RANDOM])
# Not available on iOS
AC_CHECK_HEADER([arpa/telnet.h], [], [BUILD_NC=no])
;;
*freebsd*)
HOST_OS=freebsd

21
patches/modes_lcl.h Normal file
View File

@ -0,0 +1,21 @@
--- openbsd/src/lib/libssl/src/crypto/modes/modes_lcl.h Sat Dec 6 17:15:50 2014
+++ crypto/modes/modes_lcl.h Sun Jul 17 17:45:27 2016
@@ -43,14 +43,16 @@
asm ("bswapl %0" \
: "+r"(ret)); ret; })
# elif (defined(__arm__) || defined(__arm)) && !defined(__STRICT_ALIGNMENT)
-# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
+# if (__ARM_ARCH >= 6)
+# define BSWAP8(x) ({ u32 lo=(u64)(x)>>32,hi=(x); \
asm ("rev %0,%0; rev %1,%1" \
: "+r"(hi),"+r"(lo)); \
(u64)hi<<32|lo; })
-# define BSWAP4(x) ({ u32 ret; \
+# define BSWAP4(x) ({ u32 ret; \
asm ("rev %0,%1" \
: "=r"(ret) : "r"((u32)(x))); \
ret; })
+# endif
# endif
#endif
#endif

19
patches/ssl_txt.c.patch Normal file
View File

@ -0,0 +1,19 @@
--- ssl/ssl_txt.orig Sun Jul 17 17:26:59 2016
+++ ssl/ssl_txt.c Sun Jul 17 17:35:44 2016
@@ -82,6 +82,7 @@
* OTHERWISE.
*/
+#include <inttypes.h>
#include <stdio.h>
#include <openssl/buffer.h>
@@ -163,7 +164,7 @@
}
if (x->time != 0) {
- if (BIO_printf(bp, "\n Start Time: %lld", (long long)x->time) <= 0)
+ if (BIO_printf(bp, "\n Start Time: %"PRId64, (int64_t)x->time) <= 0)
goto err;
}
if (x->timeout != 0L) {

View File

@ -52,6 +52,9 @@ if (BUILD_SHARED)
add_library(ssl-objects OBJECT ${SSL_SRC})
add_library(ssl STATIC $<TARGET_OBJECTS:ssl-objects>)
add_library(ssl-shared SHARED $<TARGET_OBJECTS:ssl-objects>)
if (MSVC)
target_link_libraries(ssl-shared crypto-shared Ws2_32.lib)
endif()
set_target_properties(ssl-shared PROPERTIES OUTPUT_NAME ssl)
set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION}
SOVERSION ${SSL_MAJOR_VERSION})

View File

@ -6,7 +6,7 @@ EXTRA_DIST = VERSION
EXTRA_DIST += CMakeLists.txt
libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ -no-undefined
libssl_la_LIBADD = ../crypto/libcrypto.la
libssl_la_LIBADD = $(abs_top_builddir)/crypto/libcrypto.la
libssl_la_SOURCES = bio_ssl.c
libssl_la_SOURCES += bs_ber.c

View File

@ -7,9 +7,9 @@ AM_CPPFLAGS += -I $(top_srcdir)/apps/openssl
AM_CPPFLAGS += -I $(top_srcdir)/apps/openssl/compat
LDADD = $(PLATFORM_LDADD) $(PROG_LDADD)
LDADD += $(top_builddir)/ssl/libssl.la
LDADD += $(top_builddir)/crypto/libcrypto.la
LDADD += $(top_builddir)/tls/libtls.la
LDADD += $(abs_top_builddir)/ssl/libssl.la
LDADD += $(abs_top_builddir)/crypto/libcrypto.la
LDADD += $(abs_top_builddir)/tls/libtls.la
TEST_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh

View File

@ -25,6 +25,9 @@ if (BUILD_SHARED)
add_library(tls-objects OBJECT ${TLS_SRC})
add_library(tls STATIC $<TARGET_OBJECTS:tls-objects>)
add_library(tls-shared SHARED $<TARGET_OBJECTS:tls-objects>)
if (MSVC)
target_link_libraries(tls-shared ssl-shared crypto-shared Ws2_32.lib)
endif()
set_target_properties(tls-shared PROPERTIES OUTPUT_NAME tls)
set_target_properties(tls-shared PROPERTIES VERSION ${TLS_VERSION}
SOVERSION ${TLS_MAJOR_VERSION})

View File

@ -6,7 +6,9 @@ EXTRA_DIST = VERSION
EXTRA_DIST += CMakeLists.txt
libtls_la_LDFLAGS = -version-info @LIBTLS_VERSION@ -no-undefined
libtls_la_LIBADD = ../crypto/libcrypto.la ../ssl/libssl.la $(PLATFORM_LDADD)
libtls_la_LIBADD = $(abs_top_builddir)/ssl/libssl.la
libtls_la_LIBADD += $(abs_top_builddir)/crypto/libcrypto.la
libtls_la_LIBADD += $(PLATFORM_LDADD)
libtls_la_CPPFLAGS = $(AM_CPPFLAGS)
if OPENSSLDIR_DEFINED