2005-09-26 13:28:27 +08:00
dnl OpenVPN -- An application to securely tunnel IP networks
dnl over a single UDP port, with support for SSL/TLS-based
dnl session authentication and key exchange,
dnl packet encryption, packet authentication, and
dnl packet compression.
dnl
2018-01-31 22:03:14 +08:00
dnl Copyright (C) 2002-2018 OpenVPN Inc <sales@openvpn.net>
2012-03-01 04:11:56 +08:00
dnl Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com>
2005-09-26 13:28:27 +08:00
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
2017-03-29 17:36:48 +08:00
dnl You should have received a copy of the GNU General Public License along
dnl with this program; if not, write to the Free Software Foundation, Inc.,
dnl 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2005-09-26 13:28:27 +08:00
dnl Process this file with autoconf to produce a configure script.
2012-03-01 04:11:56 +08:00
AC_PREREQ(2.59)
2005-09-26 13:28:27 +08:00
2007-04-22 06:19:48 +08:00
m4_include(version.m4)
2012-03-01 04:11:56 +08:00
AC_INIT([PRODUCT_NAME], [PRODUCT_VERSION], [PRODUCT_BUGREPORT], [PRODUCT_TARNAME])
m4_include(compat.m4)
2012-03-01 04:12:00 +08:00
AC_DEFINE([OPENVPN_VERSION_RESOURCE], [PRODUCT_VERSION_RESOURCE], [Version in windows resource format])
2015-07-10 21:22:27 +08:00
AC_SUBST([OPENVPN_VERSION_MAJOR], [PRODUCT_VERSION_MAJOR], [OpenVPN major version])
AC_SUBST([OPENVPN_VERSION_MINOR], [PRODUCT_VERSION_MINOR], [OpenVPN minor version])
AC_SUBST([OPENVPN_VERSION_PATCH], [PRODUCT_VERSION_PATCH], [OpenVPN patch level - may be a string or integer])
2015-07-10 21:22:28 +08:00
AC_DEFINE([OPENVPN_VERSION_MAJOR], [PRODUCT_VERSION_MAJOR], [OpenVPN major version - integer])
AC_DEFINE([OPENVPN_VERSION_MINOR], [PRODUCT_VERSION_MINOR], [OpenVPN minor version - integer])
AC_DEFINE([OPENVPN_VERSION_PATCH], ["PRODUCT_VERSION_PATCH"], [OpenVPN patch level - may be a string or integer])
2012-03-01 04:12:00 +08:00
2012-03-01 04:11:56 +08:00
AC_CONFIG_AUX_DIR([.])
2017-01-27 16:49:27 +08:00
AC_CONFIG_HEADERS([config.h include/openvpn-plugin.h])
2012-03-01 04:11:59 +08:00
AC_CONFIG_SRCDIR([src/openvpn/syshead.h])
2012-03-01 04:11:52 +08:00
AC_CONFIG_MACRO_DIR([m4])
2015-06-02 03:04:47 +08:00
dnl Initialize automake. automake < 1.12 didn't have serial-tests and
dnl gives an error if it sees this, but for automake >= 1.13
dnl serial-tests is required so we have to include it. Solution is to
dnl test for the version of automake (by running an external command)
dnl and provide it if necessary. Note we have to do this entirely using
dnl m4 macros since automake queries this macro by running
dnl 'autoconf --trace ...'.
m4_define([serial_tests], [
m4_esyscmd([automake --version |
head -1 |
awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
])
])
AM_INIT_AUTOMAKE(foreign serial_tests) dnl NB: Do not [quote] this parameter.
2012-03-01 04:11:56 +08:00
AC_CANONICAL_HOST
AC_USE_SYSTEM_EXTENSIONS
2005-09-26 13:28:27 +08:00
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[lzo],
2012-03-24 15:58:37 +08:00
[AS_HELP_STRING([--disable-lzo], [disable LZO compression support @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
2012-03-24 15:58:37 +08:00
[enable_lzo="yes"]
2011-03-10 08:04:39 +08:00
)
2014-01-02 05:57:58 +08:00
AC_ARG_ENABLE(lz4,
[ --disable-lz4 Disable LZ4 compression support],
[enable_lz4="$enableval"],
[enable_lz4="yes"]
)
2012-09-18 14:33:34 +08:00
AC_ARG_ENABLE(comp-stub,
[ --enable-comp-stub Don't compile compression support but still allow limited interoperability with compression-enabled peers],
[enable_comp_stub="$enableval"],
[enable_comp_stub="no"]
2005-09-26 13:28:27 +08:00
)
2014-06-09 00:16:12 +08:00
AC_ARG_ENABLE(
[ofb-cfb],
2014-11-25 02:09:38 +08:00
[AS_HELP_STRING([--disable-ofb-cfb], [disable support for OFB and CFB cipher modes @<:@default=yes@:>@])],
2014-06-09 00:16:12 +08:00
,
[enable_crypto_ofb_cfb="yes"]
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[x509-alt-username],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--enable-x509-alt-username], [enable the --x509-username-field feature @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_x509_alt_username="no"]
2005-09-26 13:28:27 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[plugins],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--disable-plugins], [disable plug-in support @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_plugins="yes"]
2010-02-16 06:15:44 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[management],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--disable-management], [disable management server support @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_management="yes"]
2005-10-13 16:38:41 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[pkcs11],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--enable-pkcs11], [enable pkcs11 support @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
2012-03-01 04:12:07 +08:00
[enable_pkcs11="no"]
2005-09-26 13:28:27 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[fragment],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_fragment="yes"]
2005-10-15 16:44:02 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[multihome],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--disable-multihome], [disable multi-homed UDP server support (--multihome) @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_multihome="yes"]
2006-02-17 02:12:24 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[port-share],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--disable-port-share], [disable TCP server port-share support (--port-share) @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_port_share="yes"]
2005-09-26 13:28:27 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[debug],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--disable-debug], [disable debugging support (disable gremlin and verb 7+ messages) @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_debug="yes"]
2005-09-26 13:28:27 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[small],
2014-11-25 02:09:38 +08:00
[AS_HELP_STRING([--enable-small], [enable smaller executable size (disable OCC, usage message, and verb 4 parm list) @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_small="no"]
2005-09-26 13:28:27 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[iproute2],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_iproute2="no"]
2009-08-25 03:13:52 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[def-auth],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--disable-def-auth], [disable deferred authentication @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_def_auth="yes"]
2009-08-25 03:13:52 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[pf],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--disable-pf], [disable internal packet filter @<:@default=yes@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_pf="yes"]
2005-09-26 13:28:27 +08:00
)
2012-05-15 06:42:03 +08:00
AC_ARG_ENABLE(
[plugin-auth-pam],
2012-06-26 22:03:26 +08:00
[AS_HELP_STRING([--disable-plugin-auth-pam], [disable auth-pam plugin @<:@default=platform specific@:>@])],
2012-05-15 06:42:03 +08:00
,
2012-06-26 22:03:26 +08:00
[
case "$host" in
*-*-openbsd*) enable_plugin_auth_pam="no";;
*-mingw*) enable_plugin_auth_pam="no";;
*) enable_plugin_auth_pam="yes";;
esac
]
2012-05-15 06:42:03 +08:00
)
AC_ARG_ENABLE(
[plugin-down-root],
2012-06-26 22:03:26 +08:00
[AS_HELP_STRING([--disable-plugin-down-root], [disable down-root plugin @<:@default=platform specific@:>@])],
,
[
case "$host" in
*-mingw*) enable_plugin_down_root="no";;
*) enable_plugin_down_root="yes";;
esac
]
2012-05-15 06:42:03 +08:00
)
AC_ARG_ENABLE(
[pam-dlopen],
[AS_HELP_STRING([--enable-pam-dlopen], [dlopen libpam @<:@default=no@:>@])],
,
[enable_pam_dlopen="no"]
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[strict],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--enable-strict], [enable strict compiler warnings (debugging option) @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_strict="no"]
2005-09-26 13:28:27 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[pedantic],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--enable-pedantic], [enable pedantic compiler warnings, will not generate a working executable (debugging option) @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_pedantic="no"]
2005-09-26 13:28:27 +08:00
)
2014-05-29 18:39:07 +08:00
AC_ARG_ENABLE(
[werror],
2017-08-19 15:52:09 +08:00
[AS_HELP_STRING([--enable-werror], [promote compiler warnings to errors, will cause builds to fail if the compiler issues warnings (debugging option) @<:@default=no@:>@])],
2014-05-29 18:39:07 +08:00
,
[enable_werror="no"]
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[strict-options],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--enable-strict-options], [enable strict options check between peers (debugging option) @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_strict_options="no"]
2005-09-26 13:28:27 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[selinux],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--enable-selinux], [enable SELinux support @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_selinux="no"]
2009-09-05 07:50:35 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_ENABLE(
[systemd],
2019-01-24 04:17:17 +08:00
[AS_HELP_STRING([--enable-systemd], [enable systemd support @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
,
[enable_systemd="no"]
2011-10-31 22:51:53 +08:00
)
2015-10-11 00:04:25 +08:00
AC_ARG_ENABLE(
[async-push],
2016-12-14 20:23:30 +08:00
[AS_HELP_STRING([--enable-async-push], [enable async-push support for plugins providing deferred authentication @<:@default=no@:>@])],
2016-12-07 06:10:51 +08:00
,
2015-10-11 00:04:25 +08:00
[enable_async_push="no"]
)
2012-05-05 16:01:17 +08:00
AC_ARG_WITH(
[special-build],
[AS_HELP_STRING([--with-special-build=STRING], [specify special build string])],
[test -n "${withval}" && AC_DEFINE_UNQUOTED([CONFIGURE_SPECIAL_BUILD], ["${withval}"], [special build string])]
)
2012-03-01 04:11:56 +08:00
AC_ARG_WITH(
[mem-check],
2012-03-01 04:12:11 +08:00
[AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=no|dmalloc|valgrind|ssl @<:@default=no@:>@])],
2012-03-01 04:11:56 +08:00
[
case "${withval}" in
dmalloc|valgrind|ssl|no) ;;
*) AC_MSG_ERROR([bad value ${withval} for --mem-check]) ;;
esac
],
[with_mem_check="no"]
2005-09-26 13:28:27 +08:00
)
2012-03-01 04:11:56 +08:00
AC_ARG_WITH(
2012-03-01 04:12:10 +08:00
[crypto-library],
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
[AS_HELP_STRING([--with-crypto-library=library], [build with the given crypto library, TYPE=openssl|mbedtls @<:@default=openssl@:>@])],
2012-03-01 04:11:56 +08:00
[
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
case "${withval}" in
openssl|mbedtls) ;;
2012-03-01 04:12:10 +08:00
*) AC_MSG_ERROR([bad value ${withval} for --with-crypto-library]) ;;
2012-03-01 04:11:56 +08:00
esac
],
2012-03-01 04:12:10 +08:00
[with_crypto_library="openssl"]
2011-06-24 14:37:33 +08:00
)
2017-01-26 04:19:47 +08:00
AC_ARG_VAR([PLUGINDIR], [Path of plug-in directory @<:@default=LIBDIR/openvpn/plugins@:>@])
if test -n "${PLUGINDIR}"; then
plugindir="${PLUGINDIR}"
else
plugindir="\${libdir}/openvpn/plugins"
fi
2012-05-15 06:42:03 +08:00
2012-05-05 14:49:00 +08:00
AC_DEFINE_UNQUOTED([TARGET_ALIAS], ["${host}"], [A string representing our host])
2018-12-19 13:01:17 +08:00
AM_CONDITIONAL([TARGET_LINUX], [false])
2010-03-12 00:28:41 +08:00
case "$host" in
2012-03-01 04:11:56 +08:00
*-*-linux*)
AC_DEFINE([TARGET_LINUX], [1], [Are we running on Linux?])
2018-12-19 13:01:17 +08:00
AM_CONDITIONAL([TARGET_LINUX], [true])
2012-03-01 04:11:56 +08:00
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["L"], [Target prefix])
2018-12-19 13:01:13 +08:00
have_sitnl="yes"
2012-03-01 04:11:56 +08:00
;;
*-*-solaris*)
AC_DEFINE([TARGET_SOLARIS], [1], [Are we running on Solaris?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["S"], [Target prefix])
2016-10-10 15:39:31 +08:00
CPPFLAGS="$CPPFLAGS -D_XPG4_2"
2019-10-09 20:00:43 +08:00
test -x /bin/bash && SHELL="/bin/bash"
2012-03-01 04:11:56 +08:00
;;
*-*-openbsd*)
AC_DEFINE([TARGET_OPENBSD], [1], [Are we running on OpenBSD?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["O"], [Target prefix])
;;
*-*-freebsd*)
AC_DEFINE([TARGET_FREEBSD], [1], [Are we running on FreeBSD?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["F"], [Target prefix])
;;
*-*-netbsd*)
AC_DEFINE([TARGET_NETBSD], [1], [Are we running NetBSD?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["N"], [Target prefix])
;;
*-*-darwin*)
AC_DEFINE([TARGET_DARWIN], [1], [Are we running on Mac OS X?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["M"], [Target prefix])
2012-06-02 23:31:49 +08:00
have_tap_header="yes"
2016-09-17 17:00:35 +08:00
ac_cv_type_struct_in_pktinfo=no
2012-03-01 04:11:56 +08:00
;;
*-mingw*)
AC_DEFINE([TARGET_WIN32], [1], [Are we running WIN32?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["W"], [Target prefix])
2012-03-01 04:12:12 +08:00
CPPFLAGS="${CPPFLAGS} -DWIN32_LEAN_AND_MEAN"
2015-09-11 23:33:47 +08:00
CPPFLAGS="${CPPFLAGS} -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA"
2012-03-01 04:11:56 +08:00
WIN32=yes
;;
*-*-dragonfly*)
AC_DEFINE([TARGET_DRAGONFLY], [1], [Are we running on DragonFlyBSD?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["D"], [Target prefix])
;;
2014-06-10 22:04:30 +08:00
*-aix*)
AC_DEFINE([TARGET_AIX], [1], [Are we running AIX?])
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["A"], [Target prefix])
ROUTE="/usr/sbin/route"
have_tap_header="yes"
ac_cv_header_net_if_h="no" # exists, but breaks things
;;
2012-03-01 04:11:56 +08:00
*)
AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
2012-06-02 23:31:49 +08:00
have_tap_header="yes"
2012-03-01 04:11:56 +08:00
;;
2005-09-26 13:28:27 +08:00
esac
2012-03-01 04:11:56 +08:00
PKG_PROG_PKG_CONFIG
AC_PROG_CPP
2005-09-26 13:28:27 +08:00
AC_PROG_INSTALL
2012-03-01 04:11:56 +08:00
AC_PROG_LN_S
2012-05-05 14:39:42 +08:00
AC_PROG_SED
2012-03-01 04:11:56 +08:00
AC_PROG_MAKE_SET
2005-09-26 13:28:27 +08:00
2012-03-01 04:12:01 +08:00
AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility])
AC_ARG_VAR([ROUTE], [full path to route utility])
AC_ARG_VAR([IPROUTE], [full path to ip utility])
AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests
AC_ARG_VAR([MAN2HTML], [path to man2html utility])
2012-05-05 14:39:42 +08:00
AC_ARG_VAR([GIT], [path to git utility])
2014-07-04 04:24:05 +08:00
AC_ARG_VAR([SYSTEMD_ASK_PASSWORD], [path to systemd-ask-password utility])
2017-01-24 22:39:46 +08:00
AC_ARG_VAR([SYSTEMD_UNIT_DIR], [Path of systemd unit directory @<:@default=LIBDIR/systemd/system@:>@])
2017-01-24 22:39:47 +08:00
AC_ARG_VAR([TMPFILES_DIR], [Path of tmpfiles directory @<:@default=LIBDIR/tmpfiles.d@:>@])
2012-03-01 04:12:01 +08:00
AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
2014-07-04 04:24:05 +08:00
AC_PATH_PROGS([SYSTEMD_ASK_PASSWORD], [systemd-ask-password],, [$PATH:/usr/local/bin:/usr/bin:/bin])
2012-03-01 04:12:01 +08:00
AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests
AC_CHECK_PROGS([MAN2HTML], [man2html])
2012-05-05 14:39:42 +08:00
AC_CHECK_PROGS([GIT], [git]) # optional
2012-03-01 04:12:01 +08:00
AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
2014-07-04 04:24:05 +08:00
AC_DEFINE_UNQUOTED([SYSTEMD_ASK_PASSWORD_PATH], ["$SYSTEMD_ASK_PASSWORD"], [Path to systemd-ask-password tool])
2012-03-01 04:12:01 +08:00
2016-11-14 02:03:23 +08:00
# Set -std=c99 unless user already specified a -std=
case "${CFLAGS}" in
*-std=*) ;;
*) CFLAGS="${CFLAGS} -std=c99" ;;
esac
2012-03-01 04:12:00 +08:00
#
# Libtool
#
ifdef(
[LT_INIT],
[
LT_INIT([win32-dll])
LT_LANG([Windows Resource])
],
[
AC_LIBTOOL_WIN32_DLL
AC_LIBTOOL_RC
AC_PROG_LIBTOOL
]
)
2005-09-26 13:28:27 +08:00
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
2012-03-01 04:11:56 +08:00
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_SIGNAL
2005-09-26 13:28:27 +08:00
AX_CPP_VARARG_MACRO_ISO
AX_CPP_VARARG_MACRO_GCC
2012-03-01 04:11:55 +08:00
AX_TYPE_SOCKLEN_T
2005-09-26 13:28:27 +08:00
AX_EMPTY_ARRAY
2012-03-01 04:11:56 +08:00
AC_CHECK_SIZEOF([unsigned int])
AC_CHECK_SIZEOF([unsigned long])
AC_CHECK_HEADERS([ \
2016-11-20 15:47:40 +08:00
stdio.h stdarg.h limits.h \
2012-03-01 04:11:56 +08:00
time.h errno.h fcntl.h io.h direct.h \
ctype.h sys/types.h sys/socket.h \
2012-03-01 04:12:02 +08:00
signal.h unistd.h dlfcn.h \
2012-03-01 04:11:56 +08:00
netinet/in.h netinet/in_systm.h \
netinet/tcp.h arpa/inet.h netdb.h \
windows.h winsock2.h ws2tcpip.h \
2015-12-30 05:02:37 +08:00
versionhelpers.h \
2012-03-01 04:11:56 +08:00
])
2012-03-01 04:12:04 +08:00
AC_CHECK_HEADERS([ \
2012-04-12 14:50:12 +08:00
sys/time.h sys/ioctl.h sys/stat.h \
2012-05-12 17:02:18 +08:00
sys/mman.h sys/file.h sys/wait.h \
2012-03-27 05:26:36 +08:00
unistd.h signal.h libgen.h stropts.h \
2012-03-01 04:12:04 +08:00
syslog.h pwd.h grp.h \
2012-03-27 05:26:36 +08:00
sys/sockio.h sys/uio.h linux/sockios.h \
2019-04-04 06:57:40 +08:00
linux/types.h poll.h sys/epoll.h err.h \
2012-03-01 04:12:04 +08:00
])
2005-09-26 13:28:27 +08:00
2012-03-01 04:11:56 +08:00
SOCKET_INCLUDES="
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
2016-09-17 03:02:42 +08:00
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
2012-03-01 04:11:56 +08:00
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_WINDOWS_H
#include <windows.h>
#endif
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
2012-03-27 05:26:35 +08:00
#ifdef HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
2012-04-09 03:22:09 +08:00
#ifdef HAVE_NETINET_IP_H
#include <netinet/ip.h>
#endif
2012-03-01 04:11:56 +08:00
"
2008-05-13 04:31:43 +08:00
2012-03-01 04:12:04 +08:00
AC_CHECK_HEADERS(
2015-05-16 21:59:50 +08:00
[net/if.h netinet/ip.h resolv.h sys/un.h net/if_utun.h sys/kern_control.h],
2012-03-01 04:11:56 +08:00
,
,
2012-03-01 04:12:04 +08:00
[[${SOCKET_INCLUDES}]]
2012-03-01 04:11:56 +08:00
)
AC_CHECK_TYPES(
2005-09-26 13:28:27 +08:00
[in_addr_t],
2012-03-01 04:11:56 +08:00
,
[AC_DEFINE([in_addr_t], [uint32_t], [Workaround missing in_addr_t])],
[[${SOCKET_INCLUDES}]]
)
2016-11-13 23:55:35 +08:00
AC_CHECK_TYPES(
[in_port_t],
,
[AC_DEFINE([in_port_t], [uint16_t], [Workaround missing in_port_t])],
[[${SOCKET_INCLUDES}]]
)
2005-09-26 13:28:27 +08:00
AC_CHECK_TYPE(
[struct iphdr],
2012-04-08 01:39:26 +08:00
[AC_DEFINE([HAVE_IPHDR], [1], [struct iphdr needed for IPv6 support])],
2012-03-01 04:11:56 +08:00
,
[[${SOCKET_INCLUDES}]]
)
2005-09-26 13:28:27 +08:00
AC_CHECK_TYPE(
[struct sock_extended_err],
2012-04-08 01:39:26 +08:00
[AC_DEFINE([HAVE_SOCK_EXTENDED_ERR], [1], [struct sock_extended_err needed for extended socket error support])],
2012-03-01 04:11:56 +08:00
,
[[${SOCKET_INCLUDES}]]
)
2005-09-26 13:28:27 +08:00
AC_CHECK_TYPE(
[struct msghdr],
2012-04-08 01:39:26 +08:00
[AC_DEFINE([HAVE_MSGHDR], [1], [struct msghdr needed for extended socket error support])],
2012-03-01 04:11:56 +08:00
,
[[${SOCKET_INCLUDES}]]
)
2005-09-26 13:28:27 +08:00
AC_CHECK_TYPE(
[struct cmsghdr],
2012-04-08 01:39:26 +08:00
[AC_DEFINE([HAVE_CMSGHDR], [1], [struct cmsghdr needed for extended socket error support])],
2012-03-01 04:11:56 +08:00
,
[[${SOCKET_INCLUDES}]]
)
2005-10-15 16:44:02 +08:00
AC_CHECK_TYPE(
[struct in_pktinfo],
2012-04-08 01:39:26 +08:00
[AC_DEFINE([HAVE_IN_PKTINFO], [1], [struct in_pktinfo needed for IP_PKTINFO support])],
2012-03-01 04:11:56 +08:00
,
[[${SOCKET_INCLUDES}]]
)
2014-01-17 23:30:37 +08:00
AC_CHECK_TYPE(
[sa_family_t],
[AC_DEFINE([HAVE_SA_FAMILY_T], [1], [sa_family_t, needed to hold AF_* info])],
,
[[${SOCKET_INCLUDES}]]
)
2016-09-17 03:02:42 +08:00
AC_CHECK_MEMBER(
[struct in_pktinfo.ipi_spec_dst],
[AC_DEFINE([HAVE_IPI_SPEC_DST], [1], [struct in_pktinfo.ipi_spec_dst needed for IP_PKTINFO support])],
,
[[${SOCKET_INCLUDES}]]
)
2012-03-01 04:11:56 +08:00
AC_CHECK_TYPE(
[struct sockaddr_in6],
,
[AC_MSG_ERROR([struct sockaddr_in6 not found, needed for ipv6 transport support.])],
[[${SOCKET_INCLUDES}]]
)
2012-03-01 04:12:04 +08:00
AC_CHECK_DECLS(
[SO_MARK],
,
,
[[${SOCKET_INCLUDES}]]
)
2016-11-14 02:03:23 +08:00
AC_CHECKING([anonymous union support])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
struct mystruct {
union {
int m1;
char m2;
};
};
]],
[[
struct mystruct s;
s.m1 = 1; s.m2 = 2;
]]
)],
[
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_ANONYMOUS_UNION_SUPPORT], [], [Compiler supports anonymous unions])
],
[AC_MSG_RESULT([no])]
)
2012-03-01 04:11:56 +08:00
2017-01-19 04:42:52 +08:00
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--wrap=exit"
AC_MSG_CHECKING([linker supports --wrap])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
void exit(int);
void __real_exit(int);
void __wrap_exit(int i) {
__real_exit(i);
}
]],
[[
exit(0);
]]
)],
[
AC_MSG_RESULT([yes])
have_ld_wrap_support=yes
],
[AC_MSG_RESULT([no])],
)
LDFLAGS="$saved_LDFLAGS"
2012-03-01 04:12:04 +08:00
dnl We emulate signals in Windows
AC_CHECK_DECLS(
[SIGHUP],
2012-03-01 04:11:56 +08:00
,
2012-03-01 04:12:04 +08:00
[AC_DEFINE([SIGHUP], [1], [SIGHUP replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
2012-03-01 04:11:56 +08:00
)
2012-03-01 04:12:04 +08:00
AC_CHECK_DECLS(
[SIGINT],
,
[AC_DEFINE([SIGINT], [2], [SIGINT replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
AC_CHECK_DECLS(
[SIGUSR1],
,
[AC_DEFINE([SIGUSR1], [10], [SIGUSR1 replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
AC_CHECK_DECLS(
[SIGUSR2],
,
[AC_DEFINE([SIGUSR2], [12], [SIGUSR2 replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
AC_CHECK_DECLS(
[SIGTERM],
,
[AC_DEFINE([SIGTERM], [15], [SIGTERM replacement])],
[[
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
]]
)
AC_FUNC_FORK
2012-03-01 04:11:56 +08:00
AC_CHECK_FUNCS([ \
daemon chroot getpwnam setuid nice system getpid dup dup2 \
2017-07-20 19:39:00 +08:00
getpass syslog openlog mlockall getgrnam setgid \
2012-03-01 04:11:56 +08:00
setgroups stat flock readv writev time gettimeofday \
2012-03-01 04:12:04 +08:00
ctime memset vsnprintf strdup \
2012-03-01 04:11:56 +08:00
setsid chdir putenv getpeername unlink \
chsize ftruncate execve getpeereid umask basename dirname access \
2020-02-17 22:43:36 +08:00
epoll_create strsep \
2012-03-01 04:11:56 +08:00
])
2012-03-24 15:58:34 +08:00
AC_CHECK_LIB(
[dl],
[dlopen],
[DL_LIBS="-ldl"]
)
AC_SUBST([DL_LIBS])
AC_CHECK_LIB(
[nsl],
[inet_ntoa],
[SOCKETS_LIBS="${SOCKETS_LIBS} -lnsl"]
)
AC_CHECK_LIB(
[socket],
[socket],
[SOCKETS_LIBS="${SOCKETS_LIBS} -lsocket"]
)
AC_CHECK_LIB(
[resolv],
[gethostbyname],
[SOCKETS_LIBS="${SOCKETS_LIBS} -lresolv"]
)
AC_SUBST([SOCKETS_LIBS])
old_LIBS="${LIBS}"
LIBS="${LIBS} ${SOCKETS_LIBS}"
2015-09-23 04:31:24 +08:00
AC_CHECK_FUNCS([sendmsg recvmsg])
2008-08-06 04:34:43 +08:00
# Windows use stdcall for winsock so we cannot auto detect these
2012-03-01 04:11:56 +08:00
m4_define(
[SOCKET_FUNCS],
[socket recv recvfrom send sendto listen dnl
accept connect bind select gethostbyname inet_ntoa]dnl
)
m4_define(
[SOCKET_OPT_FUNCS],
[setsockopt getsockopt getsockname poll]dnl
)
2008-05-13 04:31:43 +08:00
if test "${WIN32}" = "yes"; then
2015-09-23 04:31:24 +08:00
# normal autoconf function checking does not find inet_ntop/inet_pton
# because they need to include the actual header file and link ws2_32.dll
LIBS="${LIBS} -lws2_32"
AC_MSG_CHECKING([for MinGW inet_ntop()/inet_pton()])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <ws2tcpip.h>
]],
[[
int r = (int) inet_ntop (0, NULL, NULL, 0);
r += inet_pton(AF_INET, NULL, NULL);
return r;
]]
)],
[AC_MSG_RESULT([OK])
AC_DEFINE([HAVE_INET_NTOP],[1],[MinGW inet_ntop])
AC_DEFINE([HAVE_INET_PTON],[1],[MinGW inet_pton])
],
[AC_MSG_RESULT([not found])]
)
2012-03-01 04:11:56 +08:00
m4_foreach(
[F],
m4_split(SOCKET_FUNCS SOCKET_OPT_FUNCS),
m4_define([UF], [[m4_join([_], [HAVE], m4_toupper(F))]])
AC_DEFINE([UF], [1], [Win32 builtin])
)
2008-05-13 04:31:43 +08:00
else
2015-09-23 04:31:24 +08:00
AC_CHECK_FUNCS([inet_ntop inet_pton])
2012-03-01 04:11:56 +08:00
AC_CHECK_FUNCS(
SOCKET_FUNCS,
,
[AC_MSG_ERROR([Required library function not found])]
)
AC_CHECK_FUNCS(SOCKET_OPT_FUNCS)
fi
2012-03-24 15:58:34 +08:00
LIBS="${old_LIBS}"
2012-03-01 04:12:03 +08:00
2015-04-28 03:27:21 +08:00
# we assume res_init() always exist, but need to find out *where*...
AC_SEARCH_LIBS(__res_init, resolv bind, ,
AC_SEARCH_LIBS(res_9_init, resolv bind, ,
AC_SEARCH_LIBS(res_init, resolv bind, , )))
2012-03-27 05:26:36 +08:00
AC_ARG_VAR([TAP_CFLAGS], [C compiler flags for tap])
old_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${TAP_CFLAGS}"
AC_CHECK_HEADERS(
[ \
net/if_tun.h net/tun/if_tun.h \
linux/if_tun.h \
tap-windows.h \
],
[have_tap_header="yes"]
)
2012-04-09 03:21:47 +08:00
AC_CHECK_DECLS(
[TUNSETPERSIST],
[AC_DEFINE([ENABLE_FEATURE_TUN_PERSIST], [1], [We have persist tun capability])],
,
[[
#ifdef HAVE_LINUX_IF_TUN_H
#include <linux/if_tun.h>
#endif
]]
)
2012-03-27 05:26:36 +08:00
CFLAGS="${old_CFLAGS}"
test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found])
2012-03-01 04:12:05 +08:00
AC_CHECK_LIB(
[selinux],
[setcon],
[SELINUX_LIBS="-lselinux"]
)
AC_SUBST([SELINUX_LIBS])
2012-05-15 06:42:03 +08:00
AC_ARG_VAR([LIBPAM_CFLAGS], [C compiler flags for libpam])
AC_ARG_VAR([LIBPAM_LIBS], [linker flags for libpam])
if test -z "${LIBPAM_LIBS}"; then
AC_CHECK_LIB(
[pam],
[pam_start],
[LIBPAM_LIBS="-lpam"]
)
fi
2012-03-01 04:11:56 +08:00
case "${with_mem_check}" in
valgrind)
2014-01-16 00:36:04 +08:00
AC_CHECK_HEADERS(
2012-03-01 04:11:56 +08:00
[valgrind/memcheck.h],
[
CFLAGS="${CFLAGS} -g -fno-inline"
AC_DEFINE(
[USE_VALGRIND],
[1],
[Use valgrind memory debugging library]
)
],
[AC_MSG_ERROR([valgrind headers not found.])]
)
;;
dmalloc)
2014-01-16 00:36:04 +08:00
AC_CHECK_HEADERS(
2012-03-01 04:11:56 +08:00
[dmalloc.h],
[AC_CHECK_LIB(
[dmalloc],
[malloc],
[
2012-03-01 04:11:57 +08:00
LIBS="${LIBS} -ldmalloc"
2012-03-01 04:11:56 +08:00
AC_DEFINE(
[DMALLOC],
[1],
[Use dmalloc memory debugging library]
)
],
[AC_MSG_ERROR([dmalloc library not found.])]
)],
[AC_MSG_ERROR([dmalloc headers not found.])]
)
;;
ssl)
AC_CHECK_LIB(
[ssl],
[CRYPTO_mem_ctrl],
[
AC_DEFINE(
[CRYPTO_MDEBUG],
[1],
[Use memory debugging function in OpenSSL]
)
AC_MSG_NOTICE([NOTE: OpenSSL library must be compiled with CRYPTO_MDEBUG])
],
[AC_MSG_ERROR([Memory Debugging function in OpenSSL library not found.])]
)
;;
esac
2005-09-26 13:28:27 +08:00
2013-03-22 16:54:25 +08:00
PKG_CHECK_MODULES(
[PKCS11_HELPER],
2013-11-12 06:36:06 +08:00
[libpkcs11-helper-1 >= 1.11],
2013-03-22 16:54:25 +08:00
[have_pkcs11_helper="yes"],
[]
)
2017-12-03 20:49:52 +08:00
if test "${with_crypto_library}" = "openssl"; then
2016-01-10 22:37:19 +08:00
AC_ARG_VAR([OPENSSL_CFLAGS], [C compiler flags for OpenSSL])
AC_ARG_VAR([OPENSSL_LIBS], [linker flags for OpenSSL])
if test -z "${OPENSSL_CFLAGS}" -a -z "${OPENSSL_LIBS}"; then
# if the user did not explicitly specify flags, try to autodetect
PKG_CHECK_MODULES(
[OPENSSL],
2017-04-24 22:39:10 +08:00
[openssl >= 1.0.1],
[have_openssl="yes"],
[] # If this fails, we will do another test next
2016-01-10 22:37:19 +08:00
)
OPENSSL_LIBS=${OPENSSL_LIBS:--lssl -lcrypto}
fi
2012-03-01 04:12:10 +08:00
saved_CFLAGS="${CFLAGS}"
saved_LIBS="${LIBS}"
2016-01-10 22:37:19 +08:00
CFLAGS="${CFLAGS} ${OPENSSL_CFLAGS}"
LIBS="${LIBS} ${OPENSSL_LIBS}"
2017-04-24 22:39:10 +08:00
# If pkgconfig check failed or OPENSSL_CFLAGS/OPENSSL_LIBS env vars
# are used, check the version directly in the OpenSSL include file
if test "${have_openssl}" != "yes"; then
AC_MSG_CHECKING([additionally if OpenSSL is available and version >= 1.0.1])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <openssl/opensslv.h>
]],
[[
/* Version encoding: MNNFFPPS - see opensslv.h for details */
#if OPENSSL_VERSION_NUMBER < 0x10001000L
#error OpenSSL too old
#endif
]]
)],
[AC_MSG_RESULT([ok])],
[AC_MSG_ERROR([OpenSSL version too old])]
)
fi
2016-01-10 22:37:19 +08:00
AC_CHECK_FUNCS([SSL_CTX_new EVP_CIPHER_CTX_set_key_length],
,
[AC_MSG_ERROR([openssl check failed])]
)
2012-03-01 04:12:10 +08:00
have_openssl_engine="yes"
AC_CHECK_FUNCS(
[ \
ENGINE_load_builtin_engines \
ENGINE_register_all_complete \
ENGINE_cleanup \
],
,
[have_openssl_engine="no"; break]
)
2017-10-29 23:34:48 +08:00
if test "${have_openssl_engine}" = "no"; then
AC_CHECK_DECL( [ENGINE_cleanup], [have_openssl_engine="yes"],,
[[
#include <openssl/engine.h>
]]
)
fi
2016-01-10 22:37:19 +08:00
if test "${have_openssl_engine}" = "yes"; then
AC_DEFINE([HAVE_OPENSSL_ENGINE], [1], [OpenSSL engine support available])
fi
2012-03-01 04:12:10 +08:00
Add AEAD cipher support (GCM)
Add Authenticated Encryption with Additional Data (AEAD) support for
ciphers, which removes the need for a separate HMAC step. The MAC is
integrated into the cipher and the MAC tag is prepended to the payload.
This patch is inspired by the patch originally submitted by Kenny Root
on the openvpn-devel mailinglist, but does a number things differently:
* Don't support XTS (makes no sense for VPN)
* Don't support CCM (needs extra code to make it actually work)
* Don't force the user to specify "auth none" (that would break
tls-auth)
* Add support for PolarSSL (and change internal API for this)
* Update openvpn frame size ('link mtu') calculation for AEAD modes
* Use the HMAC key as an implicit part of the IV to save 8 bytes per
data channel network packet.
* Also authenticate the opcode/peer-id as AD in P_DATA_V2 packets.
By using the negotiated HMAC key as an implicit part of the IV for
AEAD-mode ciphers in TLS mode, we can save (at least) 8 bytes on each
packet sent. This is particularly interesting for connections which
transfer many small packets, such as remote desktop or voip connections.
The current AEAD-mode ciphers (for now GCM) are based on CTR-mode cipher
operation, which requires the IV to be unique (but does not require
unpredictability).
IV uniqueness is guaranteed by using a combination of at least 64-bits
of the HMAC key (unique per TLS session), and a 32-bit packet counter.
The last 32-bit word of the 128-bit cipher block is not part of the IV,
but is used as a block counter.
AEAD cipher mode is not available for static key mode, since IV
uniqueness is harder the guarantee over sessions, and I believe
supporting AEAD in static key mode too is not worth the extra
complexity. Modern setups should simply use TLS mode.
OpenSSL 1.0.1-1.0.1c will not work with AEAD mode, because those
versions have an unnecessary check that fails to update the cipher if
the tag was not already set. 1.0.1d, which fixes that, was released in
February 2013. People should have updated, and distros should have
backported the fix by now.
Changes in v2:
* Remove extra code that was just for making OpenSSL 1.0.1-1.0.1c work
in AEAD mode.
* Do not make AEAD support configurable in ./configure.
* Get rid of '12' magic constant in openvpn_encrypt_aead().
* Update manpage to explain that --auth is ignored for the data channel
when using an AEAD cipher.
* Move setting the IV in AEAD cipher modes to the IV generation code.
This is a more natural place and now we can pull iv[] into the IV
generation scope.
* Read packet ID directly from packet buffer instead of from iv buffer,
to remove the need for an extra buffer.
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <CAA1AbxL_S4umZr5Nd0VTvUvXEHjoWmji18GqM6FgmWqntOKqaA@mail.gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11162
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2015-10-24 22:44:09 +08:00
have_crypto_aead_modes="yes"
2020-01-21 16:08:28 +08:00
AC_CHECK_FUNC(
Add AEAD cipher support (GCM)
Add Authenticated Encryption with Additional Data (AEAD) support for
ciphers, which removes the need for a separate HMAC step. The MAC is
integrated into the cipher and the MAC tag is prepended to the payload.
This patch is inspired by the patch originally submitted by Kenny Root
on the openvpn-devel mailinglist, but does a number things differently:
* Don't support XTS (makes no sense for VPN)
* Don't support CCM (needs extra code to make it actually work)
* Don't force the user to specify "auth none" (that would break
tls-auth)
* Add support for PolarSSL (and change internal API for this)
* Update openvpn frame size ('link mtu') calculation for AEAD modes
* Use the HMAC key as an implicit part of the IV to save 8 bytes per
data channel network packet.
* Also authenticate the opcode/peer-id as AD in P_DATA_V2 packets.
By using the negotiated HMAC key as an implicit part of the IV for
AEAD-mode ciphers in TLS mode, we can save (at least) 8 bytes on each
packet sent. This is particularly interesting for connections which
transfer many small packets, such as remote desktop or voip connections.
The current AEAD-mode ciphers (for now GCM) are based on CTR-mode cipher
operation, which requires the IV to be unique (but does not require
unpredictability).
IV uniqueness is guaranteed by using a combination of at least 64-bits
of the HMAC key (unique per TLS session), and a 32-bit packet counter.
The last 32-bit word of the 128-bit cipher block is not part of the IV,
but is used as a block counter.
AEAD cipher mode is not available for static key mode, since IV
uniqueness is harder the guarantee over sessions, and I believe
supporting AEAD in static key mode too is not worth the extra
complexity. Modern setups should simply use TLS mode.
OpenSSL 1.0.1-1.0.1c will not work with AEAD mode, because those
versions have an unnecessary check that fails to update the cipher if
the tag was not already set. 1.0.1d, which fixes that, was released in
February 2013. People should have updated, and distros should have
backported the fix by now.
Changes in v2:
* Remove extra code that was just for making OpenSSL 1.0.1-1.0.1c work
in AEAD mode.
* Do not make AEAD support configurable in ./configure.
* Get rid of '12' magic constant in openvpn_encrypt_aead().
* Update manpage to explain that --auth is ignored for the data channel
when using an AEAD cipher.
* Move setting the IV in AEAD cipher modes to the IV generation code.
This is a more natural place and now we can pull iv[] into the IV
generation scope.
* Read packet ID directly from packet buffer instead of from iv buffer,
to remove the need for an extra buffer.
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <CAA1AbxL_S4umZr5Nd0VTvUvXEHjoWmji18GqM6FgmWqntOKqaA@mail.gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11162
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2015-10-24 22:44:09 +08:00
[EVP_aes_256_gcm],
,
2020-01-21 16:08:28 +08:00
[have_crypto_aead_modes="no"]
Add AEAD cipher support (GCM)
Add Authenticated Encryption with Additional Data (AEAD) support for
ciphers, which removes the need for a separate HMAC step. The MAC is
integrated into the cipher and the MAC tag is prepended to the payload.
This patch is inspired by the patch originally submitted by Kenny Root
on the openvpn-devel mailinglist, but does a number things differently:
* Don't support XTS (makes no sense for VPN)
* Don't support CCM (needs extra code to make it actually work)
* Don't force the user to specify "auth none" (that would break
tls-auth)
* Add support for PolarSSL (and change internal API for this)
* Update openvpn frame size ('link mtu') calculation for AEAD modes
* Use the HMAC key as an implicit part of the IV to save 8 bytes per
data channel network packet.
* Also authenticate the opcode/peer-id as AD in P_DATA_V2 packets.
By using the negotiated HMAC key as an implicit part of the IV for
AEAD-mode ciphers in TLS mode, we can save (at least) 8 bytes on each
packet sent. This is particularly interesting for connections which
transfer many small packets, such as remote desktop or voip connections.
The current AEAD-mode ciphers (for now GCM) are based on CTR-mode cipher
operation, which requires the IV to be unique (but does not require
unpredictability).
IV uniqueness is guaranteed by using a combination of at least 64-bits
of the HMAC key (unique per TLS session), and a 32-bit packet counter.
The last 32-bit word of the 128-bit cipher block is not part of the IV,
but is used as a block counter.
AEAD cipher mode is not available for static key mode, since IV
uniqueness is harder the guarantee over sessions, and I believe
supporting AEAD in static key mode too is not worth the extra
complexity. Modern setups should simply use TLS mode.
OpenSSL 1.0.1-1.0.1c will not work with AEAD mode, because those
versions have an unnecessary check that fails to update the cipher if
the tag was not already set. 1.0.1d, which fixes that, was released in
February 2013. People should have updated, and distros should have
backported the fix by now.
Changes in v2:
* Remove extra code that was just for making OpenSSL 1.0.1-1.0.1c work
in AEAD mode.
* Do not make AEAD support configurable in ./configure.
* Get rid of '12' magic constant in openvpn_encrypt_aead().
* Update manpage to explain that --auth is ignored for the data channel
when using an AEAD cipher.
* Move setting the IV in AEAD cipher modes to the IV generation code.
This is a more natural place and now we can pull iv[] into the IV
generation scope.
* Read packet ID directly from packet buffer instead of from iv buffer,
to remove the need for an extra buffer.
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <CAA1AbxL_S4umZr5Nd0VTvUvXEHjoWmji18GqM6FgmWqntOKqaA@mail.gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11162
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2015-10-24 22:44:09 +08:00
)
2020-01-20 19:55:18 +08:00
have_export_keying_material="yes"
2020-01-21 16:08:28 +08:00
AC_CHECK_FUNC(
2020-01-20 19:55:18 +08:00
[SSL_export_keying_material],
,
2020-01-21 16:08:28 +08:00
[have_export_keying_material="no"]
2020-01-20 19:55:18 +08:00
)
2017-02-18 06:00:40 +08:00
AC_CHECK_FUNCS(
[ \
2017-06-12 21:43:29 +08:00
HMAC_CTX_new \
HMAC_CTX_free \
HMAC_CTX_reset \
2017-06-12 21:43:27 +08:00
EVP_MD_CTX_new \
EVP_MD_CTX_free \
EVP_MD_CTX_reset \
2019-07-24 23:29:34 +08:00
EVP_CIPHER_CTX_reset \
2017-11-26 23:04:00 +08:00
OpenSSL_version \
2017-02-18 06:00:40 +08:00
SSL_CTX_get_default_passwd_cb \
SSL_CTX_get_default_passwd_cb_userdata \
2017-11-20 05:57:56 +08:00
SSL_CTX_set_security_level \
2019-07-24 23:29:34 +08:00
X509_get0_notBefore \
X509_get0_notAfter \
2017-06-12 21:43:23 +08:00
X509_get0_pubkey \
2017-02-18 06:00:41 +08:00
X509_STORE_get0_objects \
2017-02-18 06:00:42 +08:00
X509_OBJECT_free \
X509_OBJECT_get_type \
2017-06-12 21:43:24 +08:00
EVP_PKEY_id \
EVP_PKEY_get0_RSA \
EVP_PKEY_get0_DSA \
2017-07-24 00:45:36 +08:00
EVP_PKEY_get0_EC_KEY \
2017-06-12 21:43:25 +08:00
RSA_set_flags \
RSA_bits \
RSA_get0_key \
RSA_set0_key \
2017-06-12 21:43:26 +08:00
DSA_get0_pqg \
DSA_bits \
2017-02-23 22:35:56 +08:00
RSA_meth_new \
RSA_meth_free \
RSA_meth_set_pub_enc \
RSA_meth_set_pub_dec \
RSA_meth_set_priv_enc \
RSA_meth_set_priv_dec \
RSA_meth_set_init \
2018-10-05 20:23:30 +08:00
RSA_meth_set_sign \
2017-02-23 22:35:56 +08:00
RSA_meth_set_finish \
RSA_meth_set0_app_data \
2018-01-15 03:04:22 +08:00
RSA_meth_get0_app_data \
2017-07-24 00:45:36 +08:00
EC_GROUP_order_bits
2017-02-23 18:35:38 +08:00
]
2017-02-18 06:00:40 +08:00
)
2012-03-01 04:12:10 +08:00
CFLAGS="${saved_CFLAGS}"
LIBS="${saved_LIBS}"
2016-01-10 22:37:19 +08:00
AC_DEFINE([ENABLE_CRYPTO_OPENSSL], [1], [Use OpenSSL library])
CRYPTO_CFLAGS="${OPENSSL_CFLAGS}"
CRYPTO_LIBS="${OPENSSL_LIBS}"
2017-12-03 20:49:52 +08:00
elif test "${with_crypto_library}" = "mbedtls"; then
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
AC_ARG_VAR([MBEDTLS_CFLAGS], [C compiler flags for mbedtls])
AC_ARG_VAR([MBEDTLS_LIBS], [linker flags for mbedtls])
2016-01-10 22:37:19 +08:00
2016-01-19 04:49:40 +08:00
saved_CFLAGS="${CFLAGS}"
saved_LIBS="${LIBS}"
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
if test -z "${MBEDTLS_CFLAGS}" -a -z "${MBEDTLS_LIBS}"; then
2016-05-02 02:23:06 +08:00
# if the user did not explicitly specify flags, try to autodetect
2016-05-05 19:48:16 +08:00
LIBS="${LIBS} -lmbedtls -lmbedx509 -lmbedcrypto"
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
AC_CHECK_LIB(
[mbedtls],
[mbedtls_ssl_init],
2016-05-05 19:48:16 +08:00
[MBEDTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"],
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
[AC_MSG_ERROR([Could not find mbed TLS.])],
2016-01-10 22:37:19 +08:00
[${PKCS11_HELPER_LIBS}]
)
fi
2012-03-01 04:12:10 +08:00
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
CFLAGS="${MBEDTLS_CFLAGS} ${PKCS11_HELPER_CFLAGS} ${CFLAGS}"
LIBS="${MBEDTLS_LIBS} ${PKCS11_HELPER_LIBS} ${LIBS}"
2016-01-19 04:49:40 +08:00
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
AC_MSG_CHECKING([mbedtls version])
2012-05-21 19:04:14 +08:00
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
#include <mbedtls/version.h>
2012-05-21 19:04:14 +08:00
]],
[[
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
#if MBEDTLS_VERSION_NUMBER < 0x02000000 || MBEDTLS_VERSION_NUMBER >= 0x03000000
2013-03-22 16:54:25 +08:00
#error invalid version
2012-05-21 19:04:14 +08:00
#endif
]]
)],
[AC_MSG_RESULT([ok])],
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
[AC_MSG_ERROR([mbed TLS 2.y.z required])]
2012-05-21 19:04:14 +08:00
)
2013-03-22 16:54:25 +08:00
Add AEAD cipher support (GCM)
Add Authenticated Encryption with Additional Data (AEAD) support for
ciphers, which removes the need for a separate HMAC step. The MAC is
integrated into the cipher and the MAC tag is prepended to the payload.
This patch is inspired by the patch originally submitted by Kenny Root
on the openvpn-devel mailinglist, but does a number things differently:
* Don't support XTS (makes no sense for VPN)
* Don't support CCM (needs extra code to make it actually work)
* Don't force the user to specify "auth none" (that would break
tls-auth)
* Add support for PolarSSL (and change internal API for this)
* Update openvpn frame size ('link mtu') calculation for AEAD modes
* Use the HMAC key as an implicit part of the IV to save 8 bytes per
data channel network packet.
* Also authenticate the opcode/peer-id as AD in P_DATA_V2 packets.
By using the negotiated HMAC key as an implicit part of the IV for
AEAD-mode ciphers in TLS mode, we can save (at least) 8 bytes on each
packet sent. This is particularly interesting for connections which
transfer many small packets, such as remote desktop or voip connections.
The current AEAD-mode ciphers (for now GCM) are based on CTR-mode cipher
operation, which requires the IV to be unique (but does not require
unpredictability).
IV uniqueness is guaranteed by using a combination of at least 64-bits
of the HMAC key (unique per TLS session), and a 32-bit packet counter.
The last 32-bit word of the 128-bit cipher block is not part of the IV,
but is used as a block counter.
AEAD cipher mode is not available for static key mode, since IV
uniqueness is harder the guarantee over sessions, and I believe
supporting AEAD in static key mode too is not worth the extra
complexity. Modern setups should simply use TLS mode.
OpenSSL 1.0.1-1.0.1c will not work with AEAD mode, because those
versions have an unnecessary check that fails to update the cipher if
the tag was not already set. 1.0.1d, which fixes that, was released in
February 2013. People should have updated, and distros should have
backported the fix by now.
Changes in v2:
* Remove extra code that was just for making OpenSSL 1.0.1-1.0.1c work
in AEAD mode.
* Do not make AEAD support configurable in ./configure.
* Get rid of '12' magic constant in openvpn_encrypt_aead().
* Update manpage to explain that --auth is ignored for the data channel
when using an AEAD cipher.
* Move setting the IV in AEAD cipher modes to the IV generation code.
This is a more natural place and now we can pull iv[] into the IV
generation scope.
* Read packet ID directly from packet buffer instead of from iv buffer,
to remove the need for an extra buffer.
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <CAA1AbxL_S4umZr5Nd0VTvUvXEHjoWmji18GqM6FgmWqntOKqaA@mail.gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11162
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2015-10-24 22:44:09 +08:00
have_crypto_aead_modes="yes"
AC_CHECK_FUNCS(
[ \
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
mbedtls_cipher_write_tag \
mbedtls_cipher_check_tag \
Add AEAD cipher support (GCM)
Add Authenticated Encryption with Additional Data (AEAD) support for
ciphers, which removes the need for a separate HMAC step. The MAC is
integrated into the cipher and the MAC tag is prepended to the payload.
This patch is inspired by the patch originally submitted by Kenny Root
on the openvpn-devel mailinglist, but does a number things differently:
* Don't support XTS (makes no sense for VPN)
* Don't support CCM (needs extra code to make it actually work)
* Don't force the user to specify "auth none" (that would break
tls-auth)
* Add support for PolarSSL (and change internal API for this)
* Update openvpn frame size ('link mtu') calculation for AEAD modes
* Use the HMAC key as an implicit part of the IV to save 8 bytes per
data channel network packet.
* Also authenticate the opcode/peer-id as AD in P_DATA_V2 packets.
By using the negotiated HMAC key as an implicit part of the IV for
AEAD-mode ciphers in TLS mode, we can save (at least) 8 bytes on each
packet sent. This is particularly interesting for connections which
transfer many small packets, such as remote desktop or voip connections.
The current AEAD-mode ciphers (for now GCM) are based on CTR-mode cipher
operation, which requires the IV to be unique (but does not require
unpredictability).
IV uniqueness is guaranteed by using a combination of at least 64-bits
of the HMAC key (unique per TLS session), and a 32-bit packet counter.
The last 32-bit word of the 128-bit cipher block is not part of the IV,
but is used as a block counter.
AEAD cipher mode is not available for static key mode, since IV
uniqueness is harder the guarantee over sessions, and I believe
supporting AEAD in static key mode too is not worth the extra
complexity. Modern setups should simply use TLS mode.
OpenSSL 1.0.1-1.0.1c will not work with AEAD mode, because those
versions have an unnecessary check that fails to update the cipher if
the tag was not already set. 1.0.1d, which fixes that, was released in
February 2013. People should have updated, and distros should have
backported the fix by now.
Changes in v2:
* Remove extra code that was just for making OpenSSL 1.0.1-1.0.1c work
in AEAD mode.
* Do not make AEAD support configurable in ./configure.
* Get rid of '12' magic constant in openvpn_encrypt_aead().
* Update manpage to explain that --auth is ignored for the data channel
when using an AEAD cipher.
* Move setting the IV in AEAD cipher modes to the IV generation code.
This is a more natural place and now we can pull iv[] into the IV
generation scope.
* Read packet ID directly from packet buffer instead of from iv buffer,
to remove the need for an extra buffer.
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <CAA1AbxL_S4umZr5Nd0VTvUvXEHjoWmji18GqM6FgmWqntOKqaA@mail.gmail.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11162
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2015-10-24 22:44:09 +08:00
],
,
[have_crypto_aead_modes="no"; break]
)
2020-01-20 19:55:18 +08:00
have_export_keying_material="yes"
2020-01-21 16:08:28 +08:00
AC_CHECK_FUNC(
2020-01-20 19:55:18 +08:00
[mbedtls_ssl_conf_export_keys_ext_cb],
,
2020-01-21 16:08:28 +08:00
[have_export_keying_material="no"]
2020-01-20 19:55:18 +08:00
)
2016-01-10 22:37:19 +08:00
CFLAGS="${saved_CFLAGS}"
LIBS="${saved_LIBS}"
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
AC_DEFINE([ENABLE_CRYPTO_MBEDTLS], [1], [Use mbed TLS library])
CRYPTO_CFLAGS="${MBEDTLS_CFLAGS}"
CRYPTO_LIBS="${MBEDTLS_LIBS}"
2017-12-03 20:49:52 +08:00
else
2016-01-10 22:37:19 +08:00
AC_MSG_ERROR([Invalid crypto library: ${with_crypto_library}])
2012-05-21 19:04:14 +08:00
fi
2012-03-01 04:12:09 +08:00
AC_ARG_VAR([LZO_CFLAGS], [C compiler flags for lzo])
AC_ARG_VAR([LZO_LIBS], [linker flags for lzo])
have_lzo="yes"
if test -z "${LZO_LIBS}"; then
AC_CHECK_LIB(
[lzo2],
[lzo1x_1_15_compress],
[LZO_LIBS="-llzo2"],
[AC_CHECK_LIB(
[lzo],
[lzo1x_1_15_compress],
[LZO_LIBS="-llzo"],
[have_lzo="no"]
)]
)
fi
if test "${have_lzo}" = "yes"; then
saved_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${LZO_CFLAGS}"
AC_CHECK_HEADERS(
[lzo/lzoutil.h],
,
[AC_CHECK_HEADERS(
[lzoutil.h],
,
[AC_MSG_ERROR([lzoutil.h is missing])]
)]
)
AC_CHECK_HEADERS(
[lzo/lzo1x.h],
,
[AC_CHECK_HEADERS(
[lzo1x.h],
,
[AC_MSG_ERROR([lzo1x.h is missing])]
)]
)
CFLAGS="${saved_CFLAGS}"
2005-09-26 13:28:27 +08:00
fi
2014-01-02 05:57:58 +08:00
dnl
dnl check for LZ4 library
dnl
AC_ARG_VAR([LZ4_CFLAGS], [C compiler flags for lz4])
AC_ARG_VAR([LZ4_LIBS], [linker flags for lz4])
if test "$enable_lz4" = "yes" && test "$enable_comp_stub" = "no"; then
2017-09-08 01:20:04 +08:00
if test -z "${LZ4_CFLAGS}" -a -z "${LZ4_LIBS}"; then
# if the user did not explicitly specify flags, try to autodetect
PKG_CHECK_MODULES([LZ4],
2017-10-03 00:18:12 +08:00
[liblz4 >= 1.7.1 liblz4 < 100],
2017-09-08 01:20:04 +08:00
[have_lz4="yes"],
2017-10-03 03:07:32 +08:00
[LZ4_LIBS="-llz4"] # If this fails, we will do another test next.
# We also add set LZ4_LIBS otherwise the
# linker will not know about the lz4 library
2017-09-08 01:20:04 +08:00
)
fi
saved_CFLAGS="${CFLAGS}"
saved_LIBS="${LIBS}"
CFLAGS="${CFLAGS} ${LZ4_CFLAGS}"
LIBS="${LIBS} ${LZ4_LIBS}"
# If pkgconfig check failed or LZ4_CFLAGS/LZ4_LIBS env vars
# are used, check the version directly in the LZ4 include file
if test "${have_lz4}" != "yes"; then
AC_CHECK_HEADERS([lz4.h],
[have_lz4h="yes"],
[])
if test "${have_lz4h}" = "yes" ; then
AC_MSG_CHECKING([additionally if system LZ4 version >= 1.7.1])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <lz4.h>
]],
[[
/* Version encoding: MMNNPP (Major miNor Patch) - see lz4.h for details */
#if LZ4_VERSION_NUMBER < 10701L
#error LZ4 is too old
#endif
]]
)],
[
AC_MSG_RESULT([ok])
have_lz4="yes"
],
[AC_MSG_RESULT([system LZ4 library is too old])]
)
fi
fi
2014-01-02 05:57:58 +08:00
2017-10-03 00:18:12 +08:00
# Double check we have a few needed functions
if test "${have_lz4}" = "yes" ; then
2017-09-08 01:20:04 +08:00
AC_CHECK_LIB([lz4],
2017-10-03 00:18:12 +08:00
[LZ4_compress_default],
[],
[have_lz4="no"])
AC_CHECK_LIB([lz4],
[LZ4_decompress_safe],
[],
2017-09-08 01:20:04 +08:00
[have_lz4="no"])
2014-01-02 05:57:58 +08:00
fi
2017-09-08 01:20:04 +08:00
if test "${have_lz4}" != "yes" ; then
2017-10-03 00:18:12 +08:00
AC_MSG_RESULT([ usable LZ4 library or header not found, using version in src/compat/compat-lz4.*])
2014-01-02 05:57:59 +08:00
AC_DEFINE([NEED_COMPAT_LZ4], [1], [use copy of LZ4 source in compat/])
LZ4_LIBS=""
2014-01-02 05:57:58 +08:00
fi
OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}"
OPTIONAL_LZ4_LIBS="${LZ4_LIBS}"
2017-09-08 01:20:04 +08:00
AC_DEFINE(ENABLE_LZ4, [1], [Enable LZ4 compression library])
2014-01-02 05:57:58 +08:00
CFLAGS="${saved_CFLAGS}"
2017-09-08 01:20:04 +08:00
LIBS="${saved_LIBS}"
2014-01-02 05:57:58 +08:00
fi
2014-10-04 01:16:07 +08:00
dnl
dnl Check for systemd
dnl
2016-08-12 18:57:25 +08:00
AM_CONDITIONAL([ENABLE_SYSTEMD], [test "${enable_systemd}" = "yes"])
2014-10-04 01:16:07 +08:00
if test "$enable_systemd" = "yes" ; then
PKG_CHECK_MODULES([libsystemd], [systemd libsystemd],
[],
[PKG_CHECK_MODULES([libsystemd], [libsystemd-daemon])]
)
2016-08-11 22:33:55 +08:00
PKG_CHECK_EXISTS( [libsystemd > 216],
[AC_DEFINE([SYSTEMD_NEWER_THAN_216], [1],
[systemd is newer than v216])]
)
2014-10-04 01:16:07 +08:00
AC_CHECK_HEADERS(systemd/sd-daemon.h,
,
[
AC_MSG_ERROR([systemd development headers not found.])
])
saved_LIBS="${LIBS}"
LIBS="${LIBS} ${libsystemd_LIBS}"
AC_CHECK_FUNCS([sd_booted], [], [AC_MSG_ERROR([systemd library is missing sd_booted()])])
OPTIONAL_SYSTEMD_LIBS="${libsystemd_LIBS}"
AC_DEFINE(ENABLE_SYSTEMD, 1, [Enable systemd integration])
LIBS="${saved_LIBS}"
2017-01-24 22:39:46 +08:00
if test -n "${SYSTEMD_UNIT_DIR}"; then
systemdunitdir="${SYSTEMD_UNIT_DIR}"
else
systemdunitdir="\${libdir}/systemd/system"
fi
2017-01-24 22:39:47 +08:00
if test -n "${TMPFILES_DIR}"; then
tmpfilesdir="${TMPFILES_DIR}"
else
tmpfilesdir="\${libdir}/tmpfiles.d"
fi
2014-10-04 01:16:07 +08:00
fi
2014-01-02 05:57:58 +08:00
2012-09-18 14:33:34 +08:00
2012-05-05 14:39:42 +08:00
AC_MSG_CHECKING([git checkout])
GIT_CHECKOUT="no"
if test -n "${GIT}" -a -d "${srcdir}/.git"; then
AC_DEFINE([HAVE_CONFIG_VERSION_H], [1], [extra version available in config-version.h])
GIT_CHECKOUT="yes"
fi
AC_MSG_RESULT([${GIT_CHECKOUT}])
2012-03-01 04:11:56 +08:00
if test -n "${SP_PLATFORM_WINDOWS}"; then
AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['\\\\'], [Path separator]) #"
AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["\\\\"], [Path separator]) #"
else
AC_DEFINE_UNQUOTED([PATH_SEPARATOR], ['/'], [Path separator])
AC_DEFINE_UNQUOTED([PATH_SEPARATOR_STR], ["/"], [Path separator])
fi
dnl enable --x509-username-field feature if requested
if test "${enable_x509_alt_username}" = "yes"; then
Migrate to mbed TLS 2.x
PolarSSL / mbed TLS 1.3 is going end-of-life by 2016-12-31, so let's move
the master branch on to the 2.x series.
This patch purges all references to polarssl, except for file names and
some comments referring to 1.2 and earlier, which were never released as
'mbed TLS'. A separate patch for the file names follows, so the real
changes are easier to spot without git-fu.
This patch intends to not change any behaviour.
The vast majority of this patch is just renaming functions and structs.
There are some small changes in the implementation:
* In ssl_polarssl.c: the debug callback prototype changed, so our
implementation changed a bit too.
* in ssl_polarssl.c: the old polarssl ssl_context is now split into a
mbedtls_ssl_config and mbedtls_ssl_context. The intention is that
mbedtls_ssl_config is shared among connections, and mbedtls_ssl_context
contains the per-connection state. That doesn't work for us, because
we use per-connection verify callback data, while the verify callback
is registered on mbed_tls_config. Therefore we still need to init a
mbed_tls_config struct for each connection.
* in ssl_polarssl.c: the mbed bio handling changed, so our
implementation changed a bit too.
* in ssl_polarssl.c and ssl_verify_polarssl.c: the mbedtls x509 parse
functions now fail if we don't provide a NUL-terminated string, so use
strlen()+1 as the length argument to include the terminating NUL.
I tested this patch to work with:
* 'make check' (with 2.0.0 and 2.2.1, other tests just with 2.2.1)
* static key mode
* TLS mode with PEM key file
* TLS mode with password protected PEM key file
* TLS mode with management-external-key
* TLS mode with PKCS#11
* TLS mode with inline ca/key/cert/dh
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1460918143-408-1-git-send-email-steffan@karger.me>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11458
Signed-off-by: Gert Doering <gert@greenie.muc.de>
2016-04-18 02:35:42 +08:00
if test "${with_crypto_library}" = "mbedtls" ; then
AC_MSG_ERROR([mbed TLS does not support the --x509-username-field feature])
2012-03-01 04:11:56 +08:00
fi
AC_DEFINE([ENABLE_X509ALTUSERNAME], [1], [Enable --x509-username-field feature])
fi
test "${ac_cv_header_sys_uio_h}" = "yes" && AC_DEFINE([HAVE_IOVEC], [1], [struct iovec needed for IPv6 support])
test "${enable_management}" = "yes" && AC_DEFINE([ENABLE_MANAGEMENT], [1], [Enable management server capability])
test "${enable_multihome}" = "yes" && AC_DEFINE([ENABLE_MULTIHOME], [1], [Enable multi-homed UDP server capability])
test "${enable_debug}" = "yes" && AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging support])
test "${enable_small}" = "yes" && AC_DEFINE([ENABLE_SMALL], [1], [Enable smaller executable size])
test "${enable_fragment}" = "yes" && AC_DEFINE([ENABLE_FRAGMENT], [1], [Enable internal fragmentation support])
test "${enable_port_share}" = "yes" && AC_DEFINE([ENABLE_PORT_SHARE], [1], [Enable TCP Server port sharing])
test "${enable_def_auth}" = "yes" && AC_DEFINE([ENABLE_DEF_AUTH], [1], [Enable deferred authentication])
test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal packet filter])
test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers])
2012-03-01 04:12:01 +08:00
2017-12-03 20:49:52 +08:00
test "${enable_crypto_ofb_cfb}" = "yes" && AC_DEFINE([ENABLE_OFB_CFB_MODE], [1], [Enable OFB and CFB cipher modes])
test "${have_crypto_aead_modes}" = "yes" && AC_DEFINE([HAVE_AEAD_CIPHER_MODES], [1], [Use crypto library])
2020-01-20 19:55:18 +08:00
if test "${have_export_keying_material}" = "yes"; then
AC_DEFINE(
[HAVE_EXPORT_KEYING_MATERIAL], [1],
[Crypto library supports keying material exporter]
)
fi
2017-12-03 20:49:52 +08:00
OPTIONAL_CRYPTO_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${CRYPTO_CFLAGS}"
OPTIONAL_CRYPTO_LIBS="${OPTIONAL_CRYPTO_LIBS} ${CRYPTO_LIBS}"
2012-03-01 04:12:10 +08:00
2012-03-01 04:12:02 +08:00
if test "${enable_plugins}" = "yes"; then
OPTIONAL_DL_LIBS="${DL_LIBS}"
2013-06-07 18:15:30 +08:00
AC_DEFINE([ENABLE_PLUGIN], [1], [Enable plug-in support])
2012-05-15 06:42:03 +08:00
else
enable_plugin_auth_pam="no"
enable_plugin_down_root="no"
2012-03-01 04:12:02 +08:00
fi
2019-06-16 07:02:12 +08:00
AM_CONDITIONAL([HAVE_SITNL], [false])
2012-03-01 04:12:01 +08:00
if test "${enable_iproute2}" = "yes"; then
test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing])
AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
2018-12-19 13:01:13 +08:00
else if test "${have_sitnl}" = "yes"; then
AC_DEFINE([ENABLE_SITNL], [1], [enable sitnl support])
2019-06-16 07:02:12 +08:00
AM_CONDITIONAL([HAVE_SITNL], [true])
2018-12-19 13:01:13 +08:00
else if test "${WIN32}" != "yes" -a "${have_sitnl}" != "yes"; then
test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing])
test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing])
fi
fi
2012-03-01 04:12:01 +08:00
fi
2012-03-01 04:11:56 +08:00
2012-03-01 04:12:05 +08:00
if test "${enable_selinux}" = "yes"; then
test -z "${SELINUX_LIBS}" && AC_MSG_ERROR([libselinux required but missing])
OPTIONAL_SELINUX_LIBS="${SELINUX_LIBS}"
AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
fi
2012-03-01 04:12:09 +08:00
if test "${enable_lzo}" = "yes"; then
test "${have_lzo}" != "yes" && AC_MSG_ERROR([lzo enabled but missing])
OPTIONAL_LZO_CFLAGS="${LZO_CFLAGS}"
OPTIONAL_LZO_LIBS="${LZO_LIBS}"
AC_DEFINE([ENABLE_LZO], [1], [Enable LZO compression library])
fi
2012-09-18 14:33:34 +08:00
if test "${enable_comp_stub}" = "yes"; then
test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and lzo enabled (use --disable-lzo)])
2014-01-02 05:57:58 +08:00
test "${enable_lz4}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and LZ4 enabled (use --disable-lz4)])
2012-09-18 14:33:34 +08:00
AC_DEFINE([ENABLE_COMP_STUB], [1], [Enable compression stub capability])
2012-03-01 04:12:08 +08:00
fi
2012-03-01 04:12:07 +08:00
if test "${enable_pkcs11}" = "yes"; then
test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
OPTIONAL_PKCS11_HELPER_CFLAGS="${PKCS11_HELPER_CFLAGS}"
OPTIONAL_PKCS11_HELPER_LIBS="${PKCS11_HELPER_LIBS}"
AC_DEFINE([ENABLE_PKCS11], [1], [Enable PKCS11])
2014-12-11 21:03:35 +08:00
PKG_CHECK_MODULES(
[P11KIT],
[p11-kit-1],
[proxy_module="`$PKG_CONFIG --variable=proxy_module p11-kit-1`"
AC_DEFINE_UNQUOTED([DEFAULT_PKCS11_MODULE], "${proxy_module}", [p11-kit proxy])],
[]
)
2012-03-01 04:12:07 +08:00
fi
2019-11-20 01:03:43 +08:00
# When testing a compiler option, we add -Werror to force
# an error when the option is unsupported. This is not
# required for gcc, but some compilers such as clang needs it.
2018-02-21 04:25:08 +08:00
AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [
old_cflags="$CFLAGS"
2019-11-20 01:03:43 +08:00
CFLAGS="$1 -Werror $CFLAGS"
AC_MSG_CHECKING([whether the compiler accepts $1])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])]; CFLAGS="$1 $old_cflags",
2018-02-21 04:25:08 +08:00
[AC_MSG_RESULT([no]); CFLAGS="$old_cflags"])]
2018-02-01 23:45:21 +08:00
)
2018-02-21 04:25:08 +08:00
2019-11-10 18:03:23 +08:00
ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-stringop-truncation])
2018-02-21 04:25:08 +08:00
ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-unused-function])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-unused-parameter])
ACL_CHECK_ADD_COMPILE_FLAGS([-Wall])
2018-02-01 23:45:21 +08:00
2012-03-01 04:11:56 +08:00
if test "${enable_pedantic}" = "yes"; then
enable_strict="yes"
2012-03-29 02:43:15 +08:00
CFLAGS="${CFLAGS} -pedantic"
Drop gnu89/c89 support, switch to c99
Previously, we would use the compiler's default C version, which defaults
to gnu89 for GCC < 5, gnu11 for GCC > 5, and c11 for clang, but might even
differ per distro.
One of the reasons to accept the gnu89 default of GCC < 4.9, was that MSVC
didn't support c99. But in MSVC 2015, MS finanally fixed that.
Having to support c89 in the codebase occasionally forces us to write less
readable code, for example by forcing all declaration to be at the starting
of a block (which includes 'for loop initial declarations').
Let's be clear about what standard we obey, and stop punishing ourselves
with c89/gnu89. Let's switch the master branch to c99.
v2: don't try to detect pedantic mode based on __STRICT_ANSI__, since that
will be defined when using -std=c99.
v3: only set -std=c99 if there is no -std= already present in CFLAGS
Signed-off-by: Steffan Karger <steffan@karger.me>
Acked-by: David Sommerseth <davids@openvpn.net>
Message-Id: 1472760870-11769-1-git-send-email-steffan@karger.me
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg00194.html
Signed-off-by: David Sommerseth <davids@openvpn.net>
2016-09-02 04:14:30 +08:00
AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode])
2012-03-01 04:11:56 +08:00
fi
if test "${enable_strict}" = "yes"; then
2018-02-01 23:45:21 +08:00
CFLAGS="${CFLAGS} -Wsign-compare -Wuninitialized"
2009-09-05 07:50:35 +08:00
fi
2014-05-29 18:39:07 +08:00
if test "${enable_werror}" = "yes"; then
CFLAGS="${CFLAGS} -Werror"
fi
2009-09-05 07:50:35 +08:00
2012-03-01 04:12:01 +08:00
if test "${WIN32}" = "yes"; then
test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
fi
2012-05-15 06:42:03 +08:00
if test "${enable_plugin_auth_pam}" = "yes"; then
PLUGIN_AUTH_PAM_CFLAGS="${LIBPAM_CFLAGS}"
if test "${enable_pam_dlopen}" = "yes"; then
AC_DEFINE([USE_PAM_DLOPEN], [1], [dlopen libpam])
PLUGIN_AUTH_PAM_LIBS="${DL_LIBS}"
else
test -z "${LIBPAM_LIBS}" && AC_MSG_ERROR([libpam required but missing])
PLUGIN_AUTH_PAM_LIBS="${LIBPAM_LIBS}"
fi
fi
2015-10-11 00:04:25 +08:00
if test "${enable_async_push}" = "yes"; then
2020-03-14 13:29:06 +08:00
case "$host" in
*-*-freebsd*)
PKG_CHECK_MODULES(
[OPTIONAL_INOTIFY],
[libinotify],
[
AC_DEFINE([HAVE_SYS_INOTIFY_H])
AC_DEFINE([ENABLE_ASYNC_PUSH], [1], [Enable async push])
]
)
;;
*)
AC_CHECK_HEADERS(
[sys/inotify.h],
AC_DEFINE([ENABLE_ASYNC_PUSH], [1], [Enable async push]),
AC_MSG_ERROR([inotify.h not found.])
)
;;
esac
2015-10-11 00:04:25 +08:00
fi
2012-03-01 04:11:58 +08:00
CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
2012-03-01 04:11:50 +08:00
TAP_WIN_COMPONENT_ID="PRODUCT_TAP_WIN_COMPONENT_ID"
TAP_WIN_MIN_MAJOR="PRODUCT_TAP_WIN_MIN_MAJOR"
TAP_WIN_MIN_MINOR="PRODUCT_TAP_WIN_MIN_MINOR"
AC_DEFINE_UNQUOTED([TAP_WIN_COMPONENT_ID], ["${TAP_WIN_COMPONENT_ID}"], [The tap-windows id])
AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MAJOR], [${TAP_WIN_MIN_MAJOR}], [The tap-windows version number is required for OpenVPN])
AC_DEFINE_UNQUOTED([TAP_WIN_MIN_MINOR], [${TAP_WIN_MIN_MINOR}], [The tap-windows version number is required for OpenVPN])
AC_SUBST([TAP_WIN_COMPONENT_ID])
AC_SUBST([TAP_WIN_MIN_MAJOR])
AC_SUBST([TAP_WIN_MIN_MINOR])
2008-05-13 04:31:43 +08:00
2012-03-01 04:12:02 +08:00
AC_SUBST([OPTIONAL_DL_LIBS])
2012-03-01 04:12:05 +08:00
AC_SUBST([OPTIONAL_SELINUX_LIBS])
2012-03-01 04:12:10 +08:00
AC_SUBST([OPTIONAL_CRYPTO_CFLAGS])
AC_SUBST([OPTIONAL_CRYPTO_LIBS])
2012-03-01 04:12:09 +08:00
AC_SUBST([OPTIONAL_LZO_CFLAGS])
AC_SUBST([OPTIONAL_LZO_LIBS])
2014-01-02 05:57:58 +08:00
AC_SUBST([OPTIONAL_LZ4_CFLAGS])
AC_SUBST([OPTIONAL_LZ4_LIBS])
2014-10-04 01:16:07 +08:00
AC_SUBST([OPTIONAL_SYSTEMD_LIBS])
2012-03-01 04:12:07 +08:00
AC_SUBST([OPTIONAL_PKCS11_HELPER_CFLAGS])
AC_SUBST([OPTIONAL_PKCS11_HELPER_LIBS])
2020-03-14 13:29:06 +08:00
AC_SUBST([OPTIONAL_INOTIFY_CFLAGS])
AC_SUBST([OPTIONAL_INOTIFY_LIBS])
2012-03-01 04:12:02 +08:00
2012-05-15 06:42:03 +08:00
AC_SUBST([PLUGIN_AUTH_PAM_CFLAGS])
AC_SUBST([PLUGIN_AUTH_PAM_LIBS])
2012-03-01 04:11:56 +08:00
AM_CONDITIONAL([WIN32], [test "${WIN32}" = "yes"])
2012-05-05 14:39:42 +08:00
AM_CONDITIONAL([GIT_CHECKOUT], [test "${GIT_CHECKOUT}" = "yes"])
2012-05-15 06:42:03 +08:00
AM_CONDITIONAL([ENABLE_PLUGIN_AUTH_PAM], [test "${enable_plugin_auth_pam}" = "yes"])
AM_CONDITIONAL([ENABLE_PLUGIN_DOWN_ROOT], [test "${enable_plugin_down_root}" = "yes"])
2017-01-19 04:42:52 +08:00
AM_CONDITIONAL([HAVE_LD_WRAP_SUPPORT], [test "${have_ld_wrap_support}" = "yes"])
2020-06-23 07:23:19 +08:00
AM_CONDITIONAL([OPENSSL_ENGINE], [test "${have_openssl_engine}" = "yes"])
2008-05-13 04:31:43 +08:00
2012-03-01 04:12:21 +08:00
sampledir="\$(docdir)/sample"
2012-05-15 06:42:03 +08:00
AC_SUBST([plugindir])
2012-03-01 04:12:21 +08:00
AC_SUBST([sampledir])
2017-01-24 22:39:46 +08:00
AC_SUBST([systemdunitdir])
2017-01-24 22:39:47 +08:00
AC_SUBST([tmpfilesdir])
2017-01-24 22:39:46 +08:00
2019-06-24 02:32:10 +08:00
AC_ARG_ENABLE(
[unit-tests],
[AS_HELP_STRING([--disable-unit-tests],
[Disables building and running the unit tests suite])],
[],
[enable_unit_tests="yes"]
)
# Check if cmocka is available - needed for unit testing
PKG_CHECK_MODULES(
[CMOCKA], [cmocka],
[have_cmocka="yes"],
[AC_MSG_WARN([cmocka.pc not found on the system. Unit tests disabled])]
)
AM_CONDITIONAL([ENABLE_UNITTESTS], [test "${enable_unit_tests}" = "yes" -a "${have_cmocka}" = "yes" ])
AC_SUBST([ENABLE_UNITTESTS])
2019-06-02 18:18:31 +08:00
TEST_LDFLAGS="${OPTIONAL_CRYPTO_LIBS} ${OPTIONAL_PKCS11_HELPER_LIBS}"
2019-06-24 02:32:10 +08:00
TEST_LDFLAGS="${TEST_LDFLAGS} ${OPTIONAL_LZO_LIBS} ${CMOCKA_LIBS}"
2019-06-02 18:18:31 +08:00
TEST_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${OPTIONAL_PKCS11_HELPER_CFLAGS}"
TEST_CFLAGS="${TEST_CFLAGS} ${OPTIONAL_LZO_CFLAGS}"
2019-06-24 02:32:10 +08:00
TEST_CFLAGS="${TEST_CFLAGS} -I\$(top_srcdir)/include ${CMOCKA_CFLAGS}"
2016-05-26 01:57:55 +08:00
AC_SUBST([TEST_LDFLAGS])
AC_SUBST([TEST_CFLAGS])
2012-03-01 04:11:56 +08:00
AC_CONFIG_FILES([
2012-03-01 04:12:20 +08:00
version.sh
2008-05-13 04:31:43 +08:00
Makefile
2012-03-01 04:12:00 +08:00
build/Makefile
2012-03-01 04:12:12 +08:00
build/msvc/Makefile
build/msvc/msvc-generate/Makefile
2012-03-01 04:11:59 +08:00
distro/Makefile
2017-01-24 22:39:46 +08:00
distro/systemd/Makefile
2017-11-08 20:12:54 +08:00
doc/Makefile
doc/doxygen/Makefile
doc/doxygen/openvpn.doxyfile
2012-03-01 04:11:59 +08:00
include/Makefile
src/Makefile
2012-03-01 04:12:14 +08:00
src/compat/Makefile
2012-03-01 04:11:59 +08:00
src/openvpn/Makefile
2018-10-11 03:23:37 +08:00
src/openvpnmsica/Makefile
2012-03-01 04:11:59 +08:00
src/openvpnserv/Makefile
2012-05-15 06:42:03 +08:00
src/plugins/Makefile
src/plugins/auth-pam/Makefile
src/plugins/down-root/Makefile
2018-10-11 03:23:37 +08:00
src/tapctl/Makefile
2012-03-01 04:11:59 +08:00
tests/Makefile
2016-05-26 01:57:55 +08:00
tests/unit_tests/Makefile
tests/unit_tests/example_test/Makefile
2016-10-29 00:42:37 +08:00
tests/unit_tests/openvpn/Makefile
2016-11-15 03:43:23 +08:00
tests/unit_tests/plugins/Makefile
tests/unit_tests/plugins/auth-pam/Makefile
2020-06-23 07:23:19 +08:00
tests/unit_tests/engine-key/Makefile
2012-03-01 04:11:59 +08:00
sample/Makefile
2008-05-13 04:31:43 +08:00
])
2012-03-01 04:11:59 +08:00
AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh])
2012-03-01 04:11:56 +08:00
AC_OUTPUT