Upstream version 3.7.1

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFkxwUS95KUdnZKtW/iLG/YMTXUUFAlhDRxEACgkQ/iLG/YMT
 XUXoQw/9FiX2sXat6O6caWBDuevFMKxNcgAI4/6VXywP6EK6NrYXF4dlGSyFTPxS
 eoKBolc9VARkYR8/6EF4nyUaEr9g7Y0AwAlYBkWvvA5Q+VcizaEX7DTFM8YMB29q
 H6cSp2ug29lmcqZHsba+uUjYJZIabwNjv9qywany7q8WdcYZCDhgffUIFhbYrwu3
 lSjs6g3pGdoqD6Do04cNmoP9AbUM+qoFZCIjlhNI3NTfkxCvG0a+ucOuXR2kIT3u
 giFsUVi3cFbJmpsbekQmISqKKKdR+2WsklEvizPJmW4lERHg+azoCkWdYQMPLzfK
 H9jNq57ANtfWjbQwnrlGl/FSLuls5Lt/J3INQ8CTMlV7PawvHEAuwkOrKMyCXdIR
 cwbfbDEwgYrqS8TaUod/yoyKesVIN68pgin8TJusK+bzl93rzYVMLSZDUHl/twc6
 dzHX4aic41pKxSPLku3ptioMQFLVJKD/IuwI/JqJHirYLsUdppcOkReYUk7+Qrjz
 D74eXGn2VYdHefiPpK3qk/zxnqyFPCGzaKh3A6n5haS37I65IOesyXzuC65AHnIC
 Sj8g5RezDgV32GWPHEk9QWmYTcVyXy943RbBVSsoKjd/oovUQVs5Wzfi6pzvYcP5
 FLtP99hHoUeMLiReuKi4jOmLIrFH8YjJaS5Lh0CLt+3WEz4QViM=
 =klgL
 -----END PGP SIGNATURE-----

Merge tag 'upstream/3.7.1'

Upstream version 3.7.1

# gpg: Signature made Sa 03 Dez 2016 23:28:33 CET
# gpg:                using RSA key 164C70512F7929476764AB56FE22C6FD83135D45
# gpg: Good signature from "Felix Geyer <felix@fobos.de>" [ultimate]
# gpg:                 aka "Felix Geyer <debfx-pkg@fobos.de>" [ultimate]
# gpg:                 aka "Felix Geyer <debfx@kubuntu.org>" [ultimate]
# gpg:                 aka "Felix Geyer <debfx@fobos.de>" [ultimate]
# gpg:                 aka "Felix Geyer <debfx@ubuntu.com>" [ultimate]
# gpg:                 aka "Felix Geyer <felix.geyer@fobos.de>" [ultimate]
# gpg:                 aka "Felix Geyer <fgeyer@debian.org>" [ultimate]
# Primary key fingerprint: 164C 7051 2F79 2947 6764  AB56 FE22 C6FD 8313 5D45
ci/unstable
Felix Geyer 8 years ago
commit fea1626102

@ -1,7 +1,7 @@
Visual Studio 15 Visual Studio 15 2017
---------------- ---------------------
Generates Visual Studio 15 project files. Generates Visual Studio 15 (VS 2017) project files.
The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
to specify a target platform name (architecture). to specify a target platform name (architecture).
@ -9,8 +9,8 @@ to specify a target platform name (architecture).
For compatibility with CMake versions prior to 3.1, one may specify For compatibility with CMake versions prior to 3.1, one may specify
a target platform name optionally at the end of this generator name: a target platform name optionally at the end of this generator name:
``Visual Studio 15 Win64`` ``Visual Studio 15 2017 Win64``
Specify target platform ``x64``. Specify target platform ``x64``.
``Visual Studio 15 ARM`` ``Visual Studio 15 2017 ARM``
Specify target platform ``ARM``. Specify target platform ``ARM``.

@ -82,7 +82,7 @@ Visual Studio Generators
/generator/Visual Studio 11 2012 /generator/Visual Studio 11 2012
/generator/Visual Studio 12 2013 /generator/Visual Studio 12 2013
/generator/Visual Studio 14 2015 /generator/Visual Studio 14 2015
/generator/Visual Studio 15 /generator/Visual Studio 15 2017
Other Generators Other Generators
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^

@ -387,7 +387,7 @@ Configure use of an Android NDK with the following variables:
:variable:`CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION` :variable:`CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION`
Set to the version of the NDK toolchain to be selected as the compiler. Set to the version of the NDK toolchain to be selected as the compiler.
If not specified, the latest available GCC toolchain will be used. If not specified, the default will be the latest available GCC toolchain.
:variable:`CMAKE_ANDROID_STL_TYPE` :variable:`CMAKE_ANDROID_STL_TYPE`
Set to specify which C++ standard library to use. If not specified, Set to specify which C++ standard library to use. If not specified,

@ -148,6 +148,7 @@ Variables that Change Behavior
/variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME /variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME
/variable/CMAKE_INSTALL_MESSAGE /variable/CMAKE_INSTALL_MESSAGE
/variable/CMAKE_INSTALL_PREFIX /variable/CMAKE_INSTALL_PREFIX
/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
/variable/CMAKE_LIBRARY_PATH /variable/CMAKE_LIBRARY_PATH
/variable/CMAKE_MFC_FLAG /variable/CMAKE_MFC_FLAG
/variable/CMAKE_MODULE_PATH /variable/CMAKE_MODULE_PATH
@ -241,6 +242,7 @@ Variables that Control the Build
/variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES /variable/CMAKE_ANDROID_NATIVE_LIB_DEPENDENCIES
/variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES /variable/CMAKE_ANDROID_NATIVE_LIB_DIRECTORIES
/variable/CMAKE_ANDROID_NDK /variable/CMAKE_ANDROID_NDK
/variable/CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG
/variable/CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION /variable/CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION
/variable/CMAKE_ANDROID_PROCESS_MAX /variable/CMAKE_ANDROID_PROCESS_MAX
/variable/CMAKE_ANDROID_PROGUARD /variable/CMAKE_ANDROID_PROGUARD
@ -350,6 +352,7 @@ Variables for Languages
/variable/CMAKE_Fortran_MODDIR_FLAG /variable/CMAKE_Fortran_MODDIR_FLAG
/variable/CMAKE_Fortran_MODOUT_FLAG /variable/CMAKE_Fortran_MODOUT_FLAG
/variable/CMAKE_INTERNAL_PLATFORM_ABI /variable/CMAKE_INTERNAL_PLATFORM_ABI
/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_MACHINE
/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX /variable/CMAKE_LANG_ANDROID_TOOLCHAIN_PREFIX
/variable/CMAKE_LANG_ANDROID_TOOLCHAIN_SUFFIX /variable/CMAKE_LANG_ANDROID_TOOLCHAIN_SUFFIX
/variable/CMAKE_LANG_ARCHIVE_APPEND /variable/CMAKE_LANG_ARCHIVE_APPEND

@ -31,9 +31,9 @@ Generators
This is equivalent to ``cd sub/dir; make {test,install,package}`` This is equivalent to ``cd sub/dir; make {test,install,package}``
with :ref:`Makefile Generators`. with :ref:`Makefile Generators`.
* The :generator:`Visual Studio 15` generator was added. This is * The :generator:`Visual Studio 15 2017` generator was added. This is
experimental and based on Preview 4 because this version of VS experimental and based on "Visual Studio 2017 RC" because this version
has not been released. of VS has not been released.
* :ref:`Visual Studio Generators` for VS 2010 and above learned to * :ref:`Visual Studio Generators` for VS 2010 and above learned to
place ``.natvis`` source files into VS project files properly. place ``.natvis`` source files into VS project files properly.

@ -0,0 +1,6 @@
CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG
------------------------------------
When :ref:`Cross Compiling for Android with the NDK`, this variable
provides the NDK's "host tag" used to construct the path to prebuilt
toolchains that run on the host.

@ -11,3 +11,6 @@ as the compiler. The variable must be set to one of these forms:
A toolchain of the requested version will be selected automatically to A toolchain of the requested version will be selected automatically to
match the ABI named in the :variable:`CMAKE_ANDROID_ARCH_ABI` variable. match the ABI named in the :variable:`CMAKE_ANDROID_ARCH_ABI` variable.
If not specified, the default will be a value that selects the latest
available GCC toolchain.

@ -6,6 +6,8 @@ Install directory used by :command:`install`.
If ``make install`` is invoked or ``INSTALL`` is built, this directory is If ``make install`` is invoked or ``INSTALL`` is built, this directory is
prepended onto all install directories. This variable defaults to prepended onto all install directories. This variable defaults to
``/usr/local`` on UNIX and ``c:/Program Files/${PROJECT_NAME}`` on Windows. ``/usr/local`` on UNIX and ``c:/Program Files/${PROJECT_NAME}`` on Windows.
See :variable:`CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT` for how a
project might choose its own default.
On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the
whole installation. ``DESTDIR`` means DESTination DIRectory. It is whole installation. ``DESTDIR`` means DESTination DIRectory. It is

@ -0,0 +1,14 @@
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
-------------------------------------------
CMake sets this variable to a ``TRUE`` value when the
:variable:`CMAKE_INSTALL_PREFIX` has just been initialized to
its default value, typically on the first run of CMake within
a new build tree. This can be used by project code to change
the default without overriding a user-provided value:
.. code-block:: cmake
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/my/default" CACHE PATH "..." FORCE)
endif()

@ -0,0 +1,9 @@
CMAKE_<LANG>_ANDROID_TOOLCHAIN_MACHINE
--------------------------------------
When :ref:`Cross Compiling for Android` this variable contains the
toolchain binutils machine name (e.g. ``gcc -dumpmachine``). The
binutils typically have a ``<machine>-`` prefix on their name.
See also :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_PREFIX`
and :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX`.

@ -4,7 +4,8 @@ CMAKE_<LANG>_ANDROID_TOOLCHAIN_PREFIX
When :ref:`Cross Compiling for Android` this variable contains the absolute When :ref:`Cross Compiling for Android` this variable contains the absolute
path prefixing the toolchain GNU compiler and its binutils. path prefixing the toolchain GNU compiler and its binutils.
See also :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX`. See also :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX`
and :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_MACHINE`.
For example, the path to the linker is:: For example, the path to the linker is::

@ -4,4 +4,5 @@ CMAKE_<LANG>_ANDROID_TOOLCHAIN_SUFFIX
When :ref:`Cross Compiling for Android` this variable contains the When :ref:`Cross Compiling for Android` this variable contains the
host platform suffix of the toolchain GNU compiler and its binutils. host platform suffix of the toolchain GNU compiler and its binutils.
See also :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_PREFIX`. See also :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_PREFIX`
and :variable:`CMAKE_<LANG>_ANDROID_TOOLCHAIN_MACHINE`.

@ -28,6 +28,7 @@ macro(__compiler_armcc lang)
set(CMAKE_${lang}_OUTPUT_EXTENSION ".o") set(CMAKE_${lang}_OUTPUT_EXTENSION ".o")
set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1) set(CMAKE_${lang}_OUTPUT_EXTENSION_REPLACE 1)
set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG "--via=")
set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map") set(CMAKE_${lang}_LINK_EXECUTABLE "<CMAKE_LINKER> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS> -o <TARGET> --list <TARGET_BASE>.map")
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>") set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <TARGET> <LINK_FLAGS> <OBJECTS>")

@ -228,7 +228,7 @@ if(BISON_EXECUTABLE)
list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}") list(APPEND BISON_TARGET_outputs "${BISON_TARGET_output_header}")
add_custom_command(OUTPUT ${BISON_TARGET_outputs} add_custom_command(OUTPUT ${BISON_TARGET_outputs}
${BISON_TARGET_verbose_file} ${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput} COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} ${BisonInput}
VERBATIM VERBATIM
DEPENDS ${BisonInput} DEPENDS ${BisonInput}

@ -52,6 +52,7 @@ unset(_ANDROID_CONFIG_MK_PATTERNS)
# Find the newest toolchain version matching the ABI. # Find the newest toolchain version matching the ABI.
set(_ANDROID_TOOL_NAME "") set(_ANDROID_TOOL_NAME "")
set(_ANDROID_TOOL_VERS 0) set(_ANDROID_TOOL_VERS 0)
set(_ANDROID_TOOL_VERS_NDK "")
set(_ANDROID_TOOL_SETUP_MK "") set(_ANDROID_TOOL_SETUP_MK "")
foreach(config_mk IN LISTS _ANDROID_CONFIG_MKS) foreach(config_mk IN LISTS _ANDROID_CONFIG_MKS)
# Check that the toolchain matches the ABI. # Check that the toolchain matches the ABI.
@ -62,18 +63,21 @@ foreach(config_mk IN LISTS _ANDROID_CONFIG_MKS)
unset(_ANDROID_TOOL_ABIS) unset(_ANDROID_TOOL_ABIS)
# Check the version. # Check the version.
if("${config_mk}" MATCHES [[/([^/]+-(clang)?([0-9]\.[0-9]|))/config.mk$]]) if("${config_mk}" MATCHES [[/([^/]+-((clang)?([0-9]\.[0-9]|)))/config.mk$]])
set(_ANDROID_CUR_NAME "${CMAKE_MATCH_1}") set(_ANDROID_CUR_NAME "${CMAKE_MATCH_1}")
set(_ANDROID_CUR_VERS "${CMAKE_MATCH_3}") set(_ANDROID_CUR_VERS "${CMAKE_MATCH_4}")
set(_ANDROID_CUR_VERS_NDK "${CMAKE_MATCH_2}")
if(_ANDROID_TOOL_VERS STREQUAL "") if(_ANDROID_TOOL_VERS STREQUAL "")
# already the latest possible # already the latest possible
elseif(_ANDROID_CUR_VERS STREQUAL "" OR _ANDROID_CUR_VERS VERSION_GREATER _ANDROID_TOOL_VERS) elseif(_ANDROID_CUR_VERS STREQUAL "" OR _ANDROID_CUR_VERS VERSION_GREATER _ANDROID_TOOL_VERS)
set(_ANDROID_TOOL_NAME "${_ANDROID_CUR_NAME}") set(_ANDROID_TOOL_NAME "${_ANDROID_CUR_NAME}")
set(_ANDROID_TOOL_VERS "${_ANDROID_CUR_VERS}") set(_ANDROID_TOOL_VERS "${_ANDROID_CUR_VERS}")
set(_ANDROID_TOOL_VERS_NDK "${_ANDROID_CUR_VERS_NDK}")
string(REPLACE "/config.mk" "/setup.mk" _ANDROID_TOOL_SETUP_MK "${config_mk}") string(REPLACE "/config.mk" "/setup.mk" _ANDROID_TOOL_SETUP_MK "${config_mk}")
endif() endif()
unset(_ANDROID_CUR_TOOL) unset(_ANDROID_CUR_TOOL)
unset(_ANDROID_CUR_VERS) unset(_ANDROID_CUR_VERS)
unset(_ANDROID_CUR_VERS_NDK)
endif() endif()
endforeach() endforeach()
@ -206,10 +210,17 @@ endif()
# Help CMakeFindBinUtils locate things. # Help CMakeFindBinUtils locate things.
set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}") set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}")
set(_ANDROID_TOOL_NDK_TOOLCHAIN_HOST_TAG "${_ANDROID_HOST_DIR}")
set(_ANDROID_TOOL_NDK_TOOLCHAIN_VERSION "${_ANDROID_TOOL_VERS_NDK}")
# _ANDROID_TOOL_PREFIX should now match `gcc -dumpmachine`.
string(REGEX REPLACE "-$" "" _ANDROID_TOOL_C_TOOLCHAIN_MACHINE "${_ANDROID_TOOL_PREFIX}")
set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "${_ANDROID_TOOL_VERS}") set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "${_ANDROID_TOOL_VERS}")
set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/${_ANDROID_TOOL_PREFIX}") set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_NDK}/toolchains/${_ANDROID_TOOL_NAME}/prebuilt/${_ANDROID_HOST_DIR}/bin/${_ANDROID_TOOL_PREFIX}")
set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}") set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_MACHINE "${_ANDROID_TOOL_C_TOOLCHAIN_MACHINE}")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "${_ANDROID_TOOL_C_TOOLCHAIN_VERSION}") set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "${_ANDROID_TOOL_C_TOOLCHAIN_VERSION}")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}") set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}") set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
@ -231,6 +242,7 @@ endif()
if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG) if(CMAKE_ANDROID_NDK_TOOLCHAIN_DEBUG)
message(STATUS "_ANDROID_TOOL_NAME=${_ANDROID_TOOL_NAME}") message(STATUS "_ANDROID_TOOL_NAME=${_ANDROID_TOOL_NAME}")
message(STATUS "_ANDROID_TOOL_VERS=${_ANDROID_TOOL_VERS}") message(STATUS "_ANDROID_TOOL_VERS=${_ANDROID_TOOL_VERS}")
message(STATUS "_ANDROID_TOOL_VERS_NDK=${_ANDROID_TOOL_VERS_NDK}")
message(STATUS "_ANDROID_TOOL_PREFIX=${_ANDROID_TOOL_PREFIX}") message(STATUS "_ANDROID_TOOL_PREFIX=${_ANDROID_TOOL_PREFIX}")
message(STATUS "_ANDROID_TOOL_CLANG_NAME=${_ANDROID_TOOL_CLANG_NAME}") message(STATUS "_ANDROID_TOOL_CLANG_NAME=${_ANDROID_TOOL_CLANG_NAME}")
message(STATUS "_ANDROID_TOOL_CLANG_VERS=${_ANDROID_TOOL_CLANG_VERS}") message(STATUS "_ANDROID_TOOL_CLANG_VERS=${_ANDROID_TOOL_CLANG_VERS}")
@ -239,6 +251,7 @@ endif()
unset(_ANDROID_TOOL_NAME) unset(_ANDROID_TOOL_NAME)
unset(_ANDROID_TOOL_VERS) unset(_ANDROID_TOOL_VERS)
unset(_ANDROID_TOOL_VERS_NDK)
unset(_ANDROID_TOOL_PREFIX) unset(_ANDROID_TOOL_PREFIX)
unset(_ANDROID_TOOL_CLANG_NAME) unset(_ANDROID_TOOL_CLANG_NAME)
unset(_ANDROID_TOOL_CLANG_VERS) unset(_ANDROID_TOOL_CLANG_VERS)

@ -22,6 +22,9 @@ endif()
# Help CMakeFindBinUtils locate things. # Help CMakeFindBinUtils locate things.
set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}") set(_CMAKE_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_PREFIX}")
# _ANDROID_TOOL_PREFIX should now match `gcc -dumpmachine`.
string(REGEX REPLACE "-$" "" _ANDROID_TOOL_C_TOOLCHAIN_MACHINE "${_ANDROID_TOOL_PREFIX}")
execute_process( execute_process(
COMMAND "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}gcc${_ANDROID_HOST_EXT}" -dumpversion COMMAND "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}gcc${_ANDROID_HOST_EXT}" -dumpversion
OUTPUT_VARIABLE _gcc_version OUTPUT_VARIABLE _gcc_version
@ -42,6 +45,7 @@ endif()
set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}") set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/${_ANDROID_TOOL_PREFIX}")
set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}") set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "${_ANDROID_HOST_EXT}")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_MACHINE "${_ANDROID_TOOL_C_TOOLCHAIN_MACHINE}")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "${_ANDROID_TOOL_C_TOOLCHAIN_VERSION}") set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "${_ANDROID_TOOL_C_TOOLCHAIN_VERSION}")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}") set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "${_ANDROID_TOOL_C_TOOLCHAIN_PREFIX}")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}") set(_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX "${_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX}")
@ -57,3 +61,6 @@ else()
set(_ANDROID_TOOL_CXX_COMPILER "${_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX}g++${_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX}") set(_ANDROID_TOOL_CXX_COMPILER "${_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX}g++${_ANDROID_TOOL_CXX_TOOLCHAIN_SUFFIX}")
set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "") set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
endif() endif()
set(_ANDROID_TOOL_NDK_TOOLCHAIN_HOST_TAG "")
set(_ANDROID_TOOL_NDK_TOOLCHAIN_VERSION "")

@ -40,12 +40,16 @@ if(CMAKE_ANDROID_NDK)
elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN) elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
include(Platform/Android/Determine-Compiler-Standalone) include(Platform/Android/Determine-Compiler-Standalone)
else() else()
set(_ANDROID_TOOL_NDK_TOOLCHAIN_HOST_TAG "")
set(_ANDROID_TOOL_NDK_TOOLCHAIN_VERSION "")
set(_ANDROID_TOOL_C_COMPILER "") set(_ANDROID_TOOL_C_COMPILER "")
set(_ANDROID_TOOL_C_TOOLCHAIN_MACHINE "")
set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "") set(_ANDROID_TOOL_C_TOOLCHAIN_VERSION "")
set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "") set(_ANDROID_TOOL_C_COMPILER_EXTERNAL_TOOLCHAIN "")
set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "") set(_ANDROID_TOOL_C_TOOLCHAIN_PREFIX "")
set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "") set(_ANDROID_TOOL_C_TOOLCHAIN_SUFFIX "")
set(_ANDROID_TOOL_CXX_COMPILER "") set(_ANDROID_TOOL_CXX_COMPILER "")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_MACHINE "")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "") set(_ANDROID_TOOL_CXX_TOOLCHAIN_VERSION "")
set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "") set(_ANDROID_TOOL_CXX_COMPILER_EXTERNAL_TOOLCHAIN "")
set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "") set(_ANDROID_TOOL_CXX_TOOLCHAIN_PREFIX "")
@ -61,6 +65,9 @@ macro(__android_determine_compiler lang)
# Save the Android-specific information in CMake${lang}Compiler.cmake. # Save the Android-specific information in CMake${lang}Compiler.cmake.
set(CMAKE_${lang}_COMPILER_CUSTOM_CODE " set(CMAKE_${lang}_COMPILER_CUSTOM_CODE "
set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG \"${_ANDROID_TOOL_NDK_TOOLCHAIN_HOST_TAG}\")
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION \"${_ANDROID_TOOL_NDK_TOOLCHAIN_VERSION}\")
set(CMAKE_${lang}_ANDROID_TOOLCHAIN_MACHINE \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_MACHINE}\")
set(CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_VERSION}\") set(CMAKE_${lang}_ANDROID_TOOLCHAIN_VERSION \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_VERSION}\")
set(CMAKE_${lang}_COMPILER_EXTERNAL_TOOLCHAIN \"${_ANDROID_TOOL_${lang}_COMPILER_EXTERNAL_TOOLCHAIN}\") set(CMAKE_${lang}_COMPILER_EXTERNAL_TOOLCHAIN \"${_ANDROID_TOOL_${lang}_COMPILER_EXTERNAL_TOOLCHAIN}\")
set(CMAKE_${lang}_ANDROID_TOOLCHAIN_PREFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_PREFIX}\") set(CMAKE_${lang}_ANDROID_TOOLCHAIN_PREFIX \"${_ANDROID_TOOL_${lang}_TOOLCHAIN_PREFIX}\")

@ -1,5 +1,5 @@
# CMake version number components. # CMake version number components.
set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 7) set(CMake_VERSION_MINOR 7)
set(CMake_VERSION_PATCH 0) set(CMake_VERSION_PATCH 1)
#set(CMake_VERSION_RC 0) #set(CMake_VERSION_RC 0)

@ -288,7 +288,7 @@ void on_directory_change(uv_fs_event_t* handle, const char* filename,
{ {
const cmIBaseWatcher* const watcher = const cmIBaseWatcher* const watcher =
static_cast<const cmIBaseWatcher*>(handle->data); static_cast<const cmIBaseWatcher*>(handle->data);
const std::string pathSegment(filename); const std::string pathSegment(filename ? filename : "");
watcher->Trigger(pathSegment, events, status); watcher->Trigger(pathSegment, events, status);
} }

@ -6,16 +6,19 @@
#include "cmLocalVisualStudio10Generator.h" #include "cmLocalVisualStudio10Generator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
static const char vs15generatorName[] = "Visual Studio 15"; static const char vs15generatorName[] = "Visual Studio 15 2017";
// Map generator name without year to name with year. // Map generator name without year to name with year.
static const char* cmVS15GenName(const std::string& name, std::string& genName) static const char* cmVS15GenName(const std::string& name, std::string& genName)
{ {
if (strncmp(name.c_str(), vs15generatorName, if (strncmp(name.c_str(), vs15generatorName,
sizeof(vs15generatorName) - 1) != 0) { sizeof(vs15generatorName) - 6) != 0) {
return 0; return 0;
} }
const char* p = name.c_str() + sizeof(vs15generatorName) - 1; const char* p = name.c_str() + sizeof(vs15generatorName) - 6;
if (cmHasLiteralPrefix(p, " 2017")) {
p += 5;
}
genName = std::string(vs15generatorName) + p; genName = std::string(vs15generatorName) + p;
return p; return p;
} }
@ -50,7 +53,7 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry) const virtual void GetDocumentation(cmDocumentationEntry& entry) const
{ {
entry.Name = std::string(vs15generatorName) + " [arch]"; entry.Name = std::string(vs15generatorName) + " [arch]";
entry.Brief = "Generates Visual Studio 15 project files. " entry.Brief = "Generates Visual Studio 2017 project files. "
"Optional [arch] can be \"Win64\" or \"ARM\"."; "Optional [arch] can be \"Win64\" or \"ARM\".";
} }
@ -79,7 +82,7 @@ cmGlobalVisualStudio15Generator::cmGlobalVisualStudio15Generator(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\15.0\\Setup\\VC;" "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\15.0\\Setup\\VC;"
"ProductDir", "ProductDir",
vc15Express, cmSystemTools::KeyWOW64_32); vc15Express, cmSystemTools::KeyWOW64_32);
this->DefaultPlatformToolset = "v140"; this->DefaultPlatformToolset = "v141";
this->Version = VS15; this->Version = VS15;
} }

@ -1894,40 +1894,24 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); BuildObjectListOrString dirs(this, this->XcodeVersion >= 30);
BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30);
std::vector<std::string> includes;
this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C",
configName);
std::set<std::string> emitted; std::set<std::string> emitted;
emitted.insert("/System/Library/Frameworks"); emitted.insert("/System/Library/Frameworks");
if (this->XcodeVersion < 60) { for (std::vector<std::string>::iterator i = includes.begin();
std::vector<std::string> includes; i != includes.end(); ++i) {
this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, "C", if (this->NameResolvesToFramework(*i)) {
configName); std::string frameworkDir = *i;
for (std::vector<std::string>::iterator i = includes.begin(); frameworkDir += "/../";
i != includes.end(); ++i) { frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
if (this->NameResolvesToFramework(*i)) { if (emitted.insert(frameworkDir).second) {
std::string frameworkDir = *i; fdirs.Add(this->XCodeEscapePath(frameworkDir));
frameworkDir += "/../";
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
if (emitted.insert(frameworkDir).second) {
fdirs.Add(this->XCodeEscapePath(frameworkDir));
}
} else {
std::string incpath = this->XCodeEscapePath(*i);
dirs.Add(incpath);
}
}
} else {
for (std::set<std::string>::iterator li = languages.begin();
li != languages.end(); ++li) {
std::vector<std::string> includes;
this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt, *li,
configName);
std::string includeFlags = this->CurrentLocalGenerator->GetIncludeFlags(
includes, gtgt, *li, true, false, configName);
std::string& flags = cflags[*li];
if (!includeFlags.empty()) {
flags += " " + includeFlags;
} }
} else {
std::string incpath = this->XCodeEscapePath(*i);
dirs.Add(incpath);
} }
} }
// Add framework search paths needed for linking. // Add framework search paths needed for linking.

@ -381,25 +381,9 @@ bool cmServerProtocol1_0::DoActivate(const cmServerRequest& request,
return false; return false;
} }
const std::string fullGeneratorName = this->GeneratorInfo =
cmExternalMakefileProjectGenerator::CreateFullGeneratorName( GeneratorInformation(generator, extraGenerator, toolset, platform,
generator, extraGenerator); sourceDirectory, buildDirectory);
cm->SetGeneratorToolset(toolset);
cm->SetGeneratorPlatform(platform);
cmGlobalGenerator* gg = cm->CreateGlobalGenerator(fullGeneratorName);
if (!gg) {
setErrorMessage(
errorMessage,
std::string("Could not set up the requested combination of \"") +
kGENERATOR_KEY + "\" and \"" + kEXTRA_GENERATOR_KEY + "\"");
return false;
}
cm->SetGlobalGenerator(gg);
cm->SetHomeDirectory(sourceDirectory);
cm->SetHomeOutputDirectory(buildDirectory);
this->m_State = STATE_ACTIVE; this->m_State = STATE_ACTIVE;
return true; return true;
@ -931,6 +915,13 @@ cmServerResponse cmServerProtocol1_0::ProcessConfigure(
FileMonitor()->StopMonitoring(); FileMonitor()->StopMonitoring();
std::string errorMessage;
cmake* cm = this->CMakeInstance();
this->GeneratorInfo.SetupGenerator(cm, &errorMessage);
if (!errorMessage.empty()) {
return request.ReportError(errorMessage);
}
// Make sure the types of cacheArguments matches (if given): // Make sure the types of cacheArguments matches (if given):
std::vector<std::string> cacheArgs; std::vector<std::string> cacheArgs;
bool cacheArgumentsError = false; bool cacheArgumentsError = false;
@ -955,15 +946,13 @@ cmServerResponse cmServerProtocol1_0::ProcessConfigure(
"cacheArguments must be unset, a string or an array of strings."); "cacheArguments must be unset, a string or an array of strings.");
} }
cmake* cm = this->CMakeInstance();
std::string sourceDir = cm->GetHomeDirectory(); std::string sourceDir = cm->GetHomeDirectory();
const std::string buildDir = cm->GetHomeOutputDirectory(); const std::string buildDir = cm->GetHomeOutputDirectory();
cmGlobalGenerator* gg = cm->GetGlobalGenerator(); cmGlobalGenerator* gg = cm->GetGlobalGenerator();
if (buildDir.empty()) { if (buildDir.empty()) {
return request.ReportError( return request.ReportError("No build directory set via Handshake.");
"No build directory set via setGlobalSettings.");
} }
if (cm->LoadCache(buildDir)) { if (cm->LoadCache(buildDir)) {
@ -1038,14 +1027,12 @@ cmServerResponse cmServerProtocol1_0::ProcessGlobalSettings(
obj[kWARN_UNUSED_CLI_KEY] = cm->GetWarnUnusedCli(); obj[kWARN_UNUSED_CLI_KEY] = cm->GetWarnUnusedCli();
obj[kCHECK_SYSTEM_VARS_KEY] = cm->GetCheckSystemVars(); obj[kCHECK_SYSTEM_VARS_KEY] = cm->GetCheckSystemVars();
obj[kSOURCE_DIRECTORY_KEY] = cm->GetHomeDirectory(); obj[kSOURCE_DIRECTORY_KEY] = this->GeneratorInfo.SourceDirectory;
obj[kBUILD_DIRECTORY_KEY] = cm->GetHomeOutputDirectory(); obj[kBUILD_DIRECTORY_KEY] = this->GeneratorInfo.BuildDirectory;
// Currently used generator: // Currently used generator:
cmGlobalGenerator* gen = cm->GetGlobalGenerator(); obj[kGENERATOR_KEY] = this->GeneratorInfo.GeneratorName;
obj[kGENERATOR_KEY] = gen ? gen->GetName() : std::string(); obj[kEXTRA_GENERATOR_KEY] = this->GeneratorInfo.ExtraGeneratorName;
obj[kEXTRA_GENERATOR_KEY] =
gen ? gen->GetExtraGeneratorName() : std::string();
return request.Reply(obj); return request.Reply(obj);
} }
@ -1109,3 +1096,41 @@ cmServerResponse cmServerProtocol1_0::ProcessFileSystemWatchers(
return request.Reply(result); return request.Reply(result);
} }
cmServerProtocol1_0::GeneratorInformation::GeneratorInformation(
const std::string& generatorName, const std::string& extraGeneratorName,
const std::string& toolset, const std::string& platform,
const std::string& sourceDirectory, const std::string& buildDirectory)
: GeneratorName(generatorName)
, ExtraGeneratorName(extraGeneratorName)
, Toolset(toolset)
, Platform(platform)
, SourceDirectory(sourceDirectory)
, BuildDirectory(buildDirectory)
{
}
void cmServerProtocol1_0::GeneratorInformation::SetupGenerator(
cmake* cm, std::string* errorMessage)
{
const std::string fullGeneratorName =
cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
GeneratorName, ExtraGeneratorName);
cm->SetHomeDirectory(SourceDirectory);
cm->SetHomeOutputDirectory(BuildDirectory);
cmGlobalGenerator* gg = cm->CreateGlobalGenerator(fullGeneratorName);
if (!gg) {
setErrorMessage(
errorMessage,
std::string("Could not set up the requested combination of \"") +
kGENERATOR_KEY + "\" and \"" + kEXTRA_GENERATOR_KEY + "\"");
return;
}
cm->SetGlobalGenerator(gg);
cm->SetGeneratorToolset(Toolset);
cm->SetGeneratorPlatform(Platform);
}

@ -131,4 +131,28 @@ private:
State m_State = STATE_INACTIVE; State m_State = STATE_INACTIVE;
bool m_isDirty = false; bool m_isDirty = false;
struct GeneratorInformation
{
public:
GeneratorInformation() = default;
GeneratorInformation(const std::string& generatorName,
const std::string& extraGeneratorName,
const std::string& toolset,
const std::string& platform,
const std::string& sourceDirectory,
const std::string& buildDirectory);
void SetupGenerator(cmake* cm, std::string* errorMessage);
std::string GeneratorName;
std::string ExtraGeneratorName;
std::string Toolset;
std::string Platform;
std::string SourceDirectory;
std::string BuildDirectory;
};
GeneratorInformation GeneratorInfo;
}; };

@ -1334,7 +1334,7 @@ int cmake::ActualConfigure()
{ "11.0", "Visual Studio 11 2012" }, { "11.0", "Visual Studio 11 2012" },
{ "12.0", "Visual Studio 12 2013" }, { "12.0", "Visual Studio 12 2013" },
{ "14.0", "Visual Studio 14 2015" }, { "14.0", "Visual Studio 14 2015" },
{ "15.0", "Visual Studio 15" }, { "15.0", "Visual Studio 15 2017" },
{ 0, 0 } { 0, 0 }
}; };
for (int i = 0; version[i].MSVersion != 0; i++) { for (int i = 0; version[i].MSVersion != 0; i++) {

@ -3,9 +3,7 @@ project(IncludeDirectories)
if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4) if (((CMAKE_C_COMPILER_ID STREQUAL GNU AND CMAKE_C_COMPILER_VERSION VERSION_GREATER 4.4)
OR CMAKE_C_COMPILER_ID STREQUAL Clang OR CMAKE_C_COMPILER_ID STREQUAL AppleClang) OR CMAKE_C_COMPILER_ID STREQUAL Clang OR CMAKE_C_COMPILER_ID STREQUAL AppleClang)
AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" AND (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja"))
OR CMAKE_GENERATOR STREQUAL "Ninja"
OR (CMAKE_GENERATOR STREQUAL "Xcode" AND NOT XCODE_VERSION VERSION_LESS 6.0)))
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test) check_cxx_compiler_flag(-Wunused-variable run_sys_includes_test)
if(run_sys_includes_test) if(run_sys_includes_test)

@ -15,17 +15,10 @@ target_include_directories(upstream SYSTEM PUBLIC
) )
add_library(config_specific INTERFACE) add_library(config_specific INTERFACE)
if(CMAKE_GENERATOR STREQUAL "Xcode") set(testConfig ${CMAKE_BUILD_TYPE})
# CMAKE_BUILD_TYPE does not work here for multi-config generators target_include_directories(config_specific SYSTEM INTERFACE
target_include_directories(config_specific SYSTEM INTERFACE "$<$<CONFIG:${testConfig}>:${CMAKE_CURRENT_SOURCE_DIR}/config_specific>"
"${CMAKE_CURRENT_SOURCE_DIR}/config_specific" )
)
else()
set(testConfig ${CMAKE_BUILD_TYPE})
target_include_directories(config_specific SYSTEM INTERFACE
"$<$<CONFIG:${testConfig}>:${CMAKE_CURRENT_SOURCE_DIR}/config_specific>"
)
endif()
add_library(consumer consumer.cpp) add_library(consumer consumer.cpp)
target_link_libraries(consumer upstream config_specific) target_link_libraries(consumer upstream config_specific)

@ -22,8 +22,23 @@ string(APPEND CMAKE_CXX_FLAGS " -Werror -Wno-attributes")
string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-no-undefined") string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-no-undefined")
if(CMAKE_ANDROID_NDK) if(CMAKE_ANDROID_NDK)
if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "clang") if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
message(SEND_ERROR "CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION is not set!")
elseif(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "^clang")
add_definitions(-DCOMPILER_IS_CLANG) add_definitions(-DCOMPILER_IS_CLANG)
elseif(NOT "${CMAKE_C_COMPILER}" MATCHES "toolchains/[^/]+-${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}/prebuilt")
message(SEND_ERROR "CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION is\n"
" ${CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION}\n"
"which does not appear in CMAKE_C_COMPILER:\n"
" ${CMAKE_C_COMPILER}")
endif()
if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG)
message(SEND_ERROR "CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG is not set!")
elseif(NOT "${CMAKE_C_COMPILER}" MATCHES "prebuilt/${CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG}/bin")
message(SEND_ERROR "CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG is\n"
" ${CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG}\n"
"which does not appear in CMAKE_C_COMPILER:\n"
" ${CMAKE_C_COMPILER}")
endif() endif()
elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN) elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
execute_process( execute_process(
@ -37,6 +52,23 @@ elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
endif() endif()
endif() endif()
execute_process(
COMMAND "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}" -dumpmachine
OUTPUT_VARIABLE _out OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _err
RESULT_VARIABLE _res
)
if(NOT _res EQUAL 0)
message(SEND_ERROR "Failed to run 'gcc -dumpmachine':\n ${_res}")
endif()
if(NOT _out STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}")
message(SEND_ERROR "'gcc -dumpmachine' produced:\n"
" ${_out}\n"
"which is not equal to CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n"
" ${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
)
endif()
if(CMAKE_ANDROID_STL_TYPE STREQUAL "none") if(CMAKE_ANDROID_STL_TYPE STREQUAL "none")
add_definitions(-DSTL_NONE) add_definitions(-DSTL_NONE)
elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "system") elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "system")

Binary file not shown.

@ -38,6 +38,8 @@ SET(libarchive_SOURCES
archive_hmac.c archive_hmac.c
archive_hmac_private.h archive_hmac_private.h
archive_match.c archive_match.c
archive_openssl_evp_private.h
archive_openssl_hmac_private.h
archive_options.c archive_options.c
archive_options_private.h archive_options_private.h
archive_pack_dev.h archive_pack_dev.h

@ -302,6 +302,7 @@ aes_ctr_release(archive_crypto_ctx *ctx)
static int static int
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
{ {
ctx->ctx = EVP_CIPHER_CTX_new();
switch (key_len) { switch (key_len) {
case 16: ctx->type = EVP_aes_128_ecb(); break; case 16: ctx->type = EVP_aes_128_ecb(); break;
@ -314,7 +315,7 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
memcpy(ctx->key, key, key_len); memcpy(ctx->key, key, key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce)); memset(ctx->nonce, 0, sizeof(ctx->nonce));
ctx->encr_pos = AES_BLOCK_SIZE; ctx->encr_pos = AES_BLOCK_SIZE;
EVP_CIPHER_CTX_init(&ctx->ctx); EVP_CIPHER_CTX_init(ctx->ctx);
return 0; return 0;
} }
@ -324,10 +325,10 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
int outl = 0; int outl = 0;
int r; int r;
r = EVP_EncryptInit_ex(&ctx->ctx, ctx->type, NULL, ctx->key, NULL); r = EVP_EncryptInit_ex(ctx->ctx, ctx->type, NULL, ctx->key, NULL);
if (r == 0) if (r == 0)
return -1; return -1;
r = EVP_EncryptUpdate(&ctx->ctx, ctx->encr_buf, &outl, ctx->nonce, r = EVP_EncryptUpdate(ctx->ctx, ctx->encr_buf, &outl, ctx->nonce,
AES_BLOCK_SIZE); AES_BLOCK_SIZE);
if (r == 0 || outl != AES_BLOCK_SIZE) if (r == 0 || outl != AES_BLOCK_SIZE)
return -1; return -1;
@ -337,7 +338,7 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
static int static int
aes_ctr_release(archive_crypto_ctx *ctx) aes_ctr_release(archive_crypto_ctx *ctx)
{ {
EVP_CIPHER_CTX_cleanup(&ctx->ctx); EVP_CIPHER_CTX_free(ctx->ctx);
memset(ctx->key, 0, ctx->key_len); memset(ctx->key, 0, ctx->key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce)); memset(ctx->nonce, 0, sizeof(ctx->nonce));
return 0; return 0;

@ -99,12 +99,12 @@ typedef struct {
} archive_crypto_ctx; } archive_crypto_ctx;
#elif defined(HAVE_LIBCRYPTO) #elif defined(HAVE_LIBCRYPTO)
#include <openssl/evp.h> #include "archive_openssl_evp_private.h"
#define AES_BLOCK_SIZE 16 #define AES_BLOCK_SIZE 16
#define AES_MAX_KEY_SIZE 32 #define AES_MAX_KEY_SIZE 32
typedef struct { typedef struct {
EVP_CIPHER_CTX ctx; EVP_CIPHER_CTX *ctx;
const EVP_CIPHER *type; const EVP_CIPHER *type;
uint8_t key[AES_MAX_KEY_SIZE]; uint8_t key[AES_MAX_KEY_SIZE];
unsigned key_len; unsigned key_len;

@ -207,7 +207,9 @@ __archive_nettle_md5final(archive_md5_ctx *ctx, void *md)
static int static int
__archive_openssl_md5init(archive_md5_ctx *ctx) __archive_openssl_md5init(archive_md5_ctx *ctx)
{ {
EVP_DigestInit(ctx, EVP_md5()); if ((*ctx = EVP_MD_CTX_new()) == NULL)
return (ARCHIVE_FAILED);
EVP_DigestInit(*ctx, EVP_md5());
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -215,7 +217,7 @@ static int
__archive_openssl_md5update(archive_md5_ctx *ctx, const void *indata, __archive_openssl_md5update(archive_md5_ctx *ctx, const void *indata,
size_t insize) size_t insize)
{ {
EVP_DigestUpdate(ctx, indata, insize); EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -226,8 +228,11 @@ __archive_openssl_md5final(archive_md5_ctx *ctx, void *md)
* this is meant to cope with that. Real fix is probably to fix * this is meant to cope with that. Real fix is probably to fix
* archive_write_set_format_xar.c * archive_write_set_format_xar.c
*/ */
if (ctx->digest) if (*ctx) {
EVP_DigestFinal(ctx, md, NULL); EVP_DigestFinal(*ctx, md, NULL);
EVP_MD_CTX_free(*ctx);
*ctx = NULL;
}
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -359,7 +364,9 @@ __archive_nettle_ripemd160final(archive_rmd160_ctx *ctx, void *md)
static int static int
__archive_openssl_ripemd160init(archive_rmd160_ctx *ctx) __archive_openssl_ripemd160init(archive_rmd160_ctx *ctx)
{ {
EVP_DigestInit(ctx, EVP_ripemd160()); if ((*ctx = EVP_MD_CTX_new()) == NULL)
return (ARCHIVE_FAILED);
EVP_DigestInit(*ctx, EVP_ripemd160());
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -367,14 +374,18 @@ static int
__archive_openssl_ripemd160update(archive_rmd160_ctx *ctx, const void *indata, __archive_openssl_ripemd160update(archive_rmd160_ctx *ctx, const void *indata,
size_t insize) size_t insize)
{ {
EVP_DigestUpdate(ctx, indata, insize); EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
static int static int
__archive_openssl_ripemd160final(archive_rmd160_ctx *ctx, void *md) __archive_openssl_ripemd160final(archive_rmd160_ctx *ctx, void *md)
{ {
EVP_DigestFinal(ctx, md, NULL); if (*ctx) {
EVP_DigestFinal(*ctx, md, NULL);
EVP_MD_CTX_free(*ctx);
*ctx = NULL;
}
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -509,7 +520,9 @@ __archive_nettle_sha1final(archive_sha1_ctx *ctx, void *md)
static int static int
__archive_openssl_sha1init(archive_sha1_ctx *ctx) __archive_openssl_sha1init(archive_sha1_ctx *ctx)
{ {
EVP_DigestInit(ctx, EVP_sha1()); if ((*ctx = EVP_MD_CTX_new()) == NULL)
return (ARCHIVE_FAILED);
EVP_DigestInit(*ctx, EVP_sha1());
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -517,7 +530,7 @@ static int
__archive_openssl_sha1update(archive_sha1_ctx *ctx, const void *indata, __archive_openssl_sha1update(archive_sha1_ctx *ctx, const void *indata,
size_t insize) size_t insize)
{ {
EVP_DigestUpdate(ctx, indata, insize); EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -528,8 +541,11 @@ __archive_openssl_sha1final(archive_sha1_ctx *ctx, void *md)
* this is meant to cope with that. Real fix is probably to fix * this is meant to cope with that. Real fix is probably to fix
* archive_write_set_format_xar.c * archive_write_set_format_xar.c
*/ */
if (ctx->digest) if (*ctx) {
EVP_DigestFinal(ctx, md, NULL); EVP_DigestFinal(*ctx, md, NULL);
EVP_MD_CTX_free(*ctx);
*ctx = NULL;
}
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -733,7 +749,9 @@ __archive_nettle_sha256final(archive_sha256_ctx *ctx, void *md)
static int static int
__archive_openssl_sha256init(archive_sha256_ctx *ctx) __archive_openssl_sha256init(archive_sha256_ctx *ctx)
{ {
EVP_DigestInit(ctx, EVP_sha256()); if ((*ctx = EVP_MD_CTX_new()) == NULL)
return (ARCHIVE_FAILED);
EVP_DigestInit(*ctx, EVP_sha256());
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -741,14 +759,18 @@ static int
__archive_openssl_sha256update(archive_sha256_ctx *ctx, const void *indata, __archive_openssl_sha256update(archive_sha256_ctx *ctx, const void *indata,
size_t insize) size_t insize)
{ {
EVP_DigestUpdate(ctx, indata, insize); EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
static int static int
__archive_openssl_sha256final(archive_sha256_ctx *ctx, void *md) __archive_openssl_sha256final(archive_sha256_ctx *ctx, void *md)
{ {
EVP_DigestFinal(ctx, md, NULL); if (*ctx) {
EVP_DigestFinal(*ctx, md, NULL);
EVP_MD_CTX_free(*ctx);
*ctx = NULL;
}
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -928,7 +950,9 @@ __archive_nettle_sha384final(archive_sha384_ctx *ctx, void *md)
static int static int
__archive_openssl_sha384init(archive_sha384_ctx *ctx) __archive_openssl_sha384init(archive_sha384_ctx *ctx)
{ {
EVP_DigestInit(ctx, EVP_sha384()); if ((*ctx = EVP_MD_CTX_new()) == NULL)
return (ARCHIVE_FAILED);
EVP_DigestInit(*ctx, EVP_sha384());
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -936,14 +960,18 @@ static int
__archive_openssl_sha384update(archive_sha384_ctx *ctx, const void *indata, __archive_openssl_sha384update(archive_sha384_ctx *ctx, const void *indata,
size_t insize) size_t insize)
{ {
EVP_DigestUpdate(ctx, indata, insize); EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
static int static int
__archive_openssl_sha384final(archive_sha384_ctx *ctx, void *md) __archive_openssl_sha384final(archive_sha384_ctx *ctx, void *md)
{ {
EVP_DigestFinal(ctx, md, NULL); if (*ctx) {
EVP_DigestFinal(*ctx, md, NULL);
EVP_MD_CTX_free(*ctx);
*ctx = NULL;
}
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -1147,7 +1175,9 @@ __archive_nettle_sha512final(archive_sha512_ctx *ctx, void *md)
static int static int
__archive_openssl_sha512init(archive_sha512_ctx *ctx) __archive_openssl_sha512init(archive_sha512_ctx *ctx)
{ {
EVP_DigestInit(ctx, EVP_sha512()); if ((*ctx = EVP_MD_CTX_new()) == NULL)
return (ARCHIVE_FAILED);
EVP_DigestInit(*ctx, EVP_sha512());
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
@ -1155,14 +1185,18 @@ static int
__archive_openssl_sha512update(archive_sha512_ctx *ctx, const void *indata, __archive_openssl_sha512update(archive_sha512_ctx *ctx, const void *indata,
size_t insize) size_t insize)
{ {
EVP_DigestUpdate(ctx, indata, insize); EVP_DigestUpdate(*ctx, indata, insize);
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }
static int static int
__archive_openssl_sha512final(archive_sha512_ctx *ctx, void *md) __archive_openssl_sha512final(archive_sha512_ctx *ctx, void *md)
{ {
EVP_DigestFinal(ctx, md, NULL); if (*ctx) {
EVP_DigestFinal(*ctx, md, NULL);
EVP_MD_CTX_free(*ctx);
*ctx = NULL;
}
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }

@ -134,7 +134,7 @@
defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\ defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\
defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) defined(ARCHIVE_CRYPTO_SHA512_OPENSSL)
#define ARCHIVE_CRYPTO_OPENSSL 1 #define ARCHIVE_CRYPTO_OPENSSL 1
#include <openssl/evp.h> #include "archive_openssl_evp_private.h"
#endif #endif
/* Windows crypto headers */ /* Windows crypto headers */
@ -161,7 +161,7 @@ typedef CC_MD5_CTX archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_NETTLE) #elif defined(ARCHIVE_CRYPTO_MD5_NETTLE)
typedef struct md5_ctx archive_md5_ctx; typedef struct md5_ctx archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_OPENSSL) #elif defined(ARCHIVE_CRYPTO_MD5_OPENSSL)
typedef EVP_MD_CTX archive_md5_ctx; typedef EVP_MD_CTX *archive_md5_ctx;
#elif defined(ARCHIVE_CRYPTO_MD5_WIN) #elif defined(ARCHIVE_CRYPTO_MD5_WIN)
typedef Digest_CTX archive_md5_ctx; typedef Digest_CTX archive_md5_ctx;
#else #else
@ -175,7 +175,7 @@ typedef RIPEMD160_CTX archive_rmd160_ctx;
#elif defined(ARCHIVE_CRYPTO_RMD160_NETTLE) #elif defined(ARCHIVE_CRYPTO_RMD160_NETTLE)
typedef struct ripemd160_ctx archive_rmd160_ctx; typedef struct ripemd160_ctx archive_rmd160_ctx;
#elif defined(ARCHIVE_CRYPTO_RMD160_OPENSSL) #elif defined(ARCHIVE_CRYPTO_RMD160_OPENSSL)
typedef EVP_MD_CTX archive_rmd160_ctx; typedef EVP_MD_CTX *archive_rmd160_ctx;
#else #else
typedef unsigned char archive_rmd160_ctx; typedef unsigned char archive_rmd160_ctx;
#endif #endif
@ -189,7 +189,7 @@ typedef CC_SHA1_CTX archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_NETTLE) #elif defined(ARCHIVE_CRYPTO_SHA1_NETTLE)
typedef struct sha1_ctx archive_sha1_ctx; typedef struct sha1_ctx archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_OPENSSL) #elif defined(ARCHIVE_CRYPTO_SHA1_OPENSSL)
typedef EVP_MD_CTX archive_sha1_ctx; typedef EVP_MD_CTX *archive_sha1_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA1_WIN) #elif defined(ARCHIVE_CRYPTO_SHA1_WIN)
typedef Digest_CTX archive_sha1_ctx; typedef Digest_CTX archive_sha1_ctx;
#else #else
@ -209,7 +209,7 @@ typedef CC_SHA256_CTX archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_NETTLE) #elif defined(ARCHIVE_CRYPTO_SHA256_NETTLE)
typedef struct sha256_ctx archive_sha256_ctx; typedef struct sha256_ctx archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_OPENSSL) #elif defined(ARCHIVE_CRYPTO_SHA256_OPENSSL)
typedef EVP_MD_CTX archive_sha256_ctx; typedef EVP_MD_CTX *archive_sha256_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA256_WIN) #elif defined(ARCHIVE_CRYPTO_SHA256_WIN)
typedef Digest_CTX archive_sha256_ctx; typedef Digest_CTX archive_sha256_ctx;
#else #else
@ -227,7 +227,7 @@ typedef CC_SHA512_CTX archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_NETTLE) #elif defined(ARCHIVE_CRYPTO_SHA384_NETTLE)
typedef struct sha384_ctx archive_sha384_ctx; typedef struct sha384_ctx archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) #elif defined(ARCHIVE_CRYPTO_SHA384_OPENSSL)
typedef EVP_MD_CTX archive_sha384_ctx; typedef EVP_MD_CTX *archive_sha384_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA384_WIN) #elif defined(ARCHIVE_CRYPTO_SHA384_WIN)
typedef Digest_CTX archive_sha384_ctx; typedef Digest_CTX archive_sha384_ctx;
#else #else
@ -247,7 +247,7 @@ typedef CC_SHA512_CTX archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_NETTLE) #elif defined(ARCHIVE_CRYPTO_SHA512_NETTLE)
typedef struct sha512_ctx archive_sha512_ctx; typedef struct sha512_ctx archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) #elif defined(ARCHIVE_CRYPTO_SHA512_OPENSSL)
typedef EVP_MD_CTX archive_sha512_ctx; typedef EVP_MD_CTX *archive_sha512_ctx;
#elif defined(ARCHIVE_CRYPTO_SHA512_WIN) #elif defined(ARCHIVE_CRYPTO_SHA512_WIN)
typedef Digest_CTX archive_sha512_ctx; typedef Digest_CTX archive_sha512_ctx;
#else #else

@ -176,8 +176,10 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
static int static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{ {
HMAC_CTX_init(ctx); *ctx = HMAC_CTX_new();
HMAC_Init(ctx, key, key_len, EVP_sha1()); if (*ctx == NULL)
return -1;
HMAC_Init_ex(*ctx, key, key_len, EVP_sha1(), NULL);
return 0; return 0;
} }
@ -185,22 +187,22 @@ static void
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data, __hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
size_t data_len) size_t data_len)
{ {
HMAC_Update(ctx, data, data_len); HMAC_Update(*ctx, data, data_len);
} }
static void static void
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len) __hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
{ {
unsigned int len = (unsigned int)*out_len; unsigned int len = (unsigned int)*out_len;
HMAC_Final(ctx, out, &len); HMAC_Final(*ctx, out, &len);
*out_len = len; *out_len = len;
} }
static void static void
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
{ {
HMAC_CTX_cleanup(ctx); HMAC_CTX_free(*ctx);
memset(ctx, 0, sizeof(*ctx)); *ctx = NULL;
} }
#else #else

@ -70,9 +70,9 @@ typedef struct {
typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx; typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx;
#elif defined(HAVE_LIBCRYPTO) #elif defined(HAVE_LIBCRYPTO)
#include <openssl/hmac.h> #include "archive_openssl_hmac_private.h"
typedef HMAC_CTX archive_hmac_sha1_ctx; typedef HMAC_CTX* archive_hmac_sha1_ctx;
#else #else

@ -0,0 +1,51 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
#define ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
#include <openssl/evp.h>
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */
static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
{
EVP_MD_CTX *ctx = (EVP_MD_CTX *)malloc(sizeof(EVP_MD_CTX));
if (ctx != NULL) {
memset(ctx, 0, sizeof(*ctx));
}
return ctx;
}
static inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
{
EVP_MD_CTX_cleanup(ctx);
memset(ctx, 0, sizeof(*ctx));
free(ctx);
}
#endif
#endif

@ -0,0 +1,52 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
#define ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
#include <openssl/hmac.h>
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memset */
static inline HMAC_CTX *HMAC_CTX_new(void)
{
HMAC_CTX *ctx = (HMAC_CTX *)malloc(sizeof(HMAC_CTX));
if (ctx != NULL) {
memset(ctx, 0, sizeof(*ctx));
HMAC_CTX_init(ctx);
}
return ctx;
}
static inline void HMAC_CTX_free(HMAC_CTX *ctx)
{
HMAC_CTX_cleanup(ctx);
memset(ctx, 0, sizeof(*ctx));
free(ctx);
}
#endif
#endif
Loading…
Cancel
Save