Update to CryptoPP 8.6. This fixes a rare bug where CryptoPP 8.5 encrypts data wrongly, see https://github.com/weidai11/cryptopp/issues/1069

This commit is contained in:
Sebastian Messmer 2021-12-09 10:37:35 +01:00
parent 69370a5d15
commit afd6f0d317
184 changed files with 14744 additions and 2404 deletions

View File

@ -2,6 +2,7 @@ Version 0.11.1 (unreleased)
---------------
Bugfix:
* Fix building of the range-v3 dependency. The conan remote URL for this dependency changed and we have to use the new URL. See https://github.com/cryfs/cryfs/issues/398
* Update to CryptoPP 8.6. This fixes a rare bug where CryptoPP 8.5 encrypts data wrongly, see https://github.com/weidai11/cryptopp/issues/1069
Version 0.11.0
---------------

5
vendor/README vendored
View File

@ -1,8 +1,7 @@
This directory contains external projects, taken from the following locations:
googletest: https://github.com/google/googletest/commit/eaf9a3fd77869cf95befb87455a2e2a2e85044ff
- changed: In googletest/cmake/internal_utils.cmake, add cmake_policy(SET CMP0069 NEW) to silence a warning
cryptopp: https://github.com/weidai11/cryptopp/tree/CRYPTOPP_8_5_0
- changed: added CMakeLists.txt and cryptopp-config.cmake from https://github.com/noloader/cryptopp-cmake/tree/CRYPTOPP_8_5_0
cryptopp: https://github.com/weidai11/cryptopp/releases/tag/CRYPTOPP_8_6_0
- changed: added CMakeLists.txt and cryptopp-config.cmake from https://github.com/noloader/cryptopp-cmake/tree/675367754bf4bf2284910dcec24d068472c97990
- changed: In CMakeLists.txt, rename BUILD_TESTING to CRYPTOPP_BUILD_TESTING so it doesn't clash with our BUILD_TESTING
- changed: In CMakeLists.txt, add cmake_policy(SET CMP0069 NEW) to silence a warning
- changed: In .gitignore, remove *.cxx entry so we don't miss checking in the test files, see https://github.com/noloader/cryptopp-cmake/issues/66

View File

@ -8,78 +8,9 @@ target_include_directories(cryptopp SYSTEM INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
target_compile_definitions(cryptopp INTERFACE $<$<CONFIG:Debug>:CRYPTOPP_DEBUG>) # add to all targets depending on this
add_compile_options($<$<CONFIG:Debug>:-DCRYPTOPP_DEBUG>) # add to stuff built in subdirectories (like the actual library)
if(NOT DISABLE_OPENMP)
find_package(OpenMP)
if (OPENMP_FOUND OR OPENMP_CXX_FOUND)
message(STATUS "Found libomp without any special flags")
endif()
# If OpenMP wasn't found, try if we can find it in the default Macports location
if((NOT OPENMP_FOUND) AND (NOT OPENMP_CXX_FOUND) AND EXISTS "/opt/local/lib/libomp/libomp.dylib") # older cmake uses OPENMP_FOUND, newer cmake also sets OPENMP_CXX_FOUND, homebrew installations seem only to get the latter set.
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/opt/local/include/libomp/")
set(OpenMP_CXX_LIB_NAMES omp)
set(OpenMP_omp_LIBRARY /opt/local/lib/libomp/libomp.dylib)
find_package(OpenMP)
if (OPENMP_FOUND OR OPENMP_CXX_FOUND)
message(STATUS "Found libomp in macports default location.")
else()
message(FATAL_ERROR "Didn't find libomp. Tried macports default location but also didn't find it.")
endif()
endif()
# If OpenMP wasn't found, try if we can find it in the default Homebrew location
if((NOT OPENMP_FOUND) AND (NOT OPENMP_CXX_FOUND) AND EXISTS "/usr/local/opt/libomp/lib/libomp.dylib")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include")
set(OpenMP_CXX_LIB_NAMES omp)
set(OpenMP_omp_LIBRARY /usr/local/opt/libomp/lib/libomp.dylib)
find_package(OpenMP)
if (OPENMP_FOUND OR OPENMP_CXX_FOUND)
message(STATUS "Found libomp in homebrew default location.")
else()
message(FATAL_ERROR "Didn't find libomp. Tried homebrew default location but also didn't find it.")
endif()
endif()
set(Additional_OpenMP_Libraries_Workaround "")
# Workaround because older cmake on apple doesn't support FindOpenMP
if((NOT OPENMP_FOUND) AND (NOT OPENMP_CXX_FOUND))
if((APPLE AND ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
AND ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0") AND (CMAKE_VERSION VERSION_LESS "3.12.0")))
message(STATUS "Applying workaround for OSX OpenMP with old cmake that doesn't have FindOpenMP")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp")
set(Additional_OpenMP_Libraries_Workaround "-lomp")
else()
message(FATAL_ERROR "Did not find OpenMP. Build with -DDISABLE_OPENMP=ON if you want to allow this and are willing to take the performance hit.")
endif()
endif()
if(NOT TARGET OpenMP::OpenMP_CXX)
# We're on cmake < 3.9, handle behavior of the old FindOpenMP implementation
message(STATUS "Applying workaround for old CMake that doesn't define FindOpenMP using targets")
add_library(OpenMP_TARGET INTERFACE)
add_library(OpenMP::OpenMP_CXX ALIAS OpenMP_TARGET)
target_compile_options(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS}) # add to all targets depending on this
find_package(Threads REQUIRED)
target_link_libraries(OpenMP_TARGET INTERFACE Threads::Threads)
target_link_libraries(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS} ${Additional_OpenMP_Libraries_Workaround})
endif()
target_link_libraries(cryptopp INTERFACE ${OpenMP_CXX_FLAGS}) # Workaround for Ubuntu 18.04 that otherwise doesn't set -fopenmp for linking
target_link_libraries(cryptopp INTERFACE OpenMP::OpenMP_CXX)
# also add these flags to the third party Crypto++ build setup that is built in a subdirectory
message(STATUS "OpenMP flags: ${OpenMP_CXX_FLAGS}")
string(REPLACE " " ";" REPLACED_FLAGS ${OpenMP_CXX_FLAGS})
add_compile_options(${REPLACED_FLAGS})
else()
message(WARNING "OpenMP is disabled. This can cause degraded performance.")
if (NOT DISABLE_OPENMP)
set(USE_OPENMP ON CACHE BOOL "")
endif()
set(CRYPTOPP_BUILD_TESTING OFF CACHE BOOL "")
set(BUILD_DOCUMENTATION OFF CACHE BOOL "")
set(BUILD_SHARED OFF CACHE BOOL "")

View File

@ -3,7 +3,7 @@
# Allows you to use test.cxx and
# avoid getting in the way of things
####################################
#*.cxx
*.cxx
####################
## Crypto++ specific

View File

@ -12,10 +12,10 @@
# SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
# # error "The CMAKE_C_COMPILER is set to a C++ compiler"
if(NOT DEFINED cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING)
set(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING 1)
if(NOT DEFINED cryptopp_DISPLAY_CMAKE_SUPPORT_WARNING)
set(cryptopp_DISPLAY_CMAKE_SUPPORT_WARNING 1)
endif()
if(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING)
if(cryptopp_DISPLAY_CMAKE_SUPPORT_WARNING)
message( STATUS
"*************************************************************************\n"
"The Crypto++ library does not officially support CMake. CMake support is a\n"
@ -28,17 +28,19 @@ endif()
# Print useful information
message( STATUS "CMake version ${CMAKE_VERSION}" )
message( STATUS "System ${CMAKE_SYSTEM_NAME}" )
message( STATUS "Processor ${CMAKE_SYSTEM_PROCESSOR}" )
cmake_minimum_required(VERSION 2.8.6)
cmake_policy(SET CMP0069 NEW)
if (${CMAKE_VERSION} VERSION_LESS "3.0.0")
project(cryptopp)
set(cryptopp_VERSION_MAJOR 8)
set(cryptopp_VERSION_MINOR 5)
set(cryptopp_VERSION_MINOR 6)
set(cryptopp_VERSION_PATCH 0)
else ()
cmake_policy(SET CMP0048 NEW)
project(cryptopp VERSION 8.3.0)
project(cryptopp VERSION 8.6.0)
if (NOT ${CMAKE_VERSION} VERSION_LESS "3.1.0")
cmake_policy(SET CMP0054 NEW)
endif ()
@ -61,10 +63,10 @@ endif ()
include(GNUInstallDirs)
include(CheckCXXCompilerFlag)
# We now carry around test programs. test_cxx.cxx is the default C++ one.
# We now carry around test programs. test_cxx.cpp is the default C++ one.
# Also see https://github.com/weidai11/cryptopp/issues/741.
set(TEST_PROG_DIR ${SRC_DIR}/TestPrograms)
set(TEST_CXX_FILE ${TEST_PROG_DIR}/test_cxx.cxx)
set(TEST_CXX_FILE ${TEST_PROG_DIR}/test_cxx.cpp)
#============================================================================
# Settable options
@ -76,14 +78,36 @@ option(CRYPTOPP_BUILD_TESTING "Build library tests" ON)
option(BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
option(USE_INTERMEDIATE_OBJECTS_TARGET "Use a common intermediate objects target for the static and shared library targets" ON)
# These are IA-32 options. TODO: Add ARM A-32, Aarch64 and Power8 options.
if (${CMAKE_VERSION} VERSION_GREATER "3.1")
option(USE_OPENMP "Enable OpenMP to parallelize some of the algorithms. Note that this isn't always faster, see https://www.cryptopp.com/wiki/OpenMP" OFF)
endif()
# These are IA-32 options.
option(DISABLE_ASM "Disable ASM" OFF)
option(DISABLE_SSSE3 "Disable SSSE3" OFF)
option(DISABLE_SSE4 "Disable SSE4" OFF)
option(DISABLE_AESNI "Disable AES-NI" OFF)
option(DISABLE_CLMUL "Disable CLMUL" OFF)
option(DISABLE_SHA "Disable SHA" OFF)
option(DISABLE_AVX "Disable AVX" OFF)
option(DISABLE_AVX2 "Disable AVX2" OFF)
# These are ARM A-32 options
option(DISABLE_ARM_NEON "Disable NEON" OFF)
# These are Aarch64 options
option(DISABLE_ARM_AES "Disable ASIMD" OFF)
option(DISABLE_ARM_AES "Disable AES" OFF)
option(DISABLE_ARM_PMULL "Disable PMULL" OFF)
option(DISABLE_ARM_SHA "Disable SHA" OFF)
# These are PowerPC options
option(DISABLE_ALTIVEC "Disable Altivec" OFF)
option(DISABLE_POWER7 "Disable POWER7" OFF)
option(DISABLE_POWER8 "Disable POWER8" OFF)
option(DISABLE_POWER9 "Disable POWER9" OFF)
set(CRYPTOPP_DATA_DIR "" CACHE PATH "Crypto++ test data directory")
#============================================================================
@ -94,14 +118,16 @@ set(CRYPTOPP_COMPILE_DEFINITIONS)
set(CRYPTOPP_COMPILE_OPTIONS)
# Stop hiding the damn output...
# set(CMAKE_VERBOSE_MAKEFILE on)
# set(CMAKE_VERBOSE_MAKEFILE ON)
# Stop CMake complaining...
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(MACOSX_RPATH FALSE)
endif()
# Always 1 ahead in Master. Also see http://groups.google.com/forum/#!topic/cryptopp-users/SFhqLDTQPG4
set(LIB_VER ${cryptopp_VERSION_MAJOR}${cryptopp_VERSION_MINOR}${cryptopp_VERSION_PATCH})
# Don't use RPATH's. The resulting binary could fail a security audit.
set(CMAKE_MACOSX_RPATH 0)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
list(APPEND CRYPTOPP_COMPILE_OPTIONS -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180)
endif ()
@ -137,6 +163,21 @@ endif ()
if (DISABLE_SHA)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SHA)
endif ()
if (DISABLE_ARM_NEON)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ARM_NEON)
endif ()
if (DISABLE_ARM_ASIMD)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ARM_ASIMD)
endif ()
if (DISABLE_ARM_AES)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ARM_AES)
endif ()
if (DISABLE_ARM_PMULL)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ARM_PMULL)
endif ()
if (DISABLE_ARM_SHA)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ARM_SHA)
endif ()
if (DISABLE_ALTIVEC)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ALTIVEC)
endif ()
@ -295,12 +336,12 @@ function(DumpMachine output pattern)
endfunction(DumpMachine)
# Thansk to Anonimal for MinGW; see http://github.com/weidai11/cryptopp/issues/466
# Thanks to Anonimal for MinGW; see http://github.com/weidai11/cryptopp/issues/466
DumpMachine(CRYPTOPP_AMD64 "(x86_64|AMD64|amd64)")
DumpMachine(CRYPTOPP_I386 "^i.86$")
DumpMachine(CRYPTOPP_MINGW32 "^mingw32")
DumpMachine(CRYPTOPP_MINGW64 "(w64-mingw32)|(mingw64)")
DumpMachine(CRYPTOPP_ARMV8 "(armv8|aarch32|aarch64)")
DumpMachine(CRYPTOPP_MINGW64 "(w64-mingw32|mingw64)")
DumpMachine(CRYPTOPP_ARMV8 "(armv8|arm64|aarch32|aarch64)")
DumpMachine(CRYPTOPP_ARM32 "(arm|armhf|arm7l|eabihf)")
DumpMachine(CRYPTOPP_PPC32 "^(powerpc|ppc)")
DumpMachine(CRYPTOPP_PPC64 "^ppc64")
@ -549,30 +590,44 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
if (CRYPTOPP_AMD64 OR CRYPTOPP_I386)
# For Darwin and a GCC port compiler, we need to check for -Wa,-q first. -Wa,-q
# is a GCC option, and it tells GCC to use the Clang Integrated Assembler. We
# need LLVM's assembler because GAS is too old on Apple platforms. GAS will
# not assemble modern ISA, like AVX or AVX2.
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
CheckCompileLinkOption("-Wa,-q" CRYPTOPP_IA32_WAQ
"${TEST_PROG_DIR}/test_x86_sse2.cpp")
if (CRYPTOPP_IA32_WAQ)
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-Wa,-q")
endif ()
endif ()
# Now we can move on to normal feature testing.
CheckCompileLinkOption("-msse2" CRYPTOPP_IA32_SSE2
"${TEST_PROG_DIR}/test_x86_sse2.cxx")
"${TEST_PROG_DIR}/test_x86_sse2.cpp")
CheckCompileLinkOption("-mssse3" CRYPTOPP_IA32_SSSE3
"${TEST_PROG_DIR}/test_x86_ssse3.cxx")
"${TEST_PROG_DIR}/test_x86_ssse3.cpp")
CheckCompileLinkOption("-msse4.1" CRYPTOPP_IA32_SSE41
"${TEST_PROG_DIR}/test_x86_sse41.cxx")
"${TEST_PROG_DIR}/test_x86_sse41.cpp")
CheckCompileLinkOption("-msse4.2" CRYPTOPP_IA32_SSE42
"${TEST_PROG_DIR}/test_x86_sse42.cxx")
"${TEST_PROG_DIR}/test_x86_sse42.cpp")
CheckCompileLinkOption("-mssse3 -mpclmul" CRYPTOPP_IA32_CLMUL
"${TEST_PROG_DIR}/test_x86_clmul.cxx")
"${TEST_PROG_DIR}/test_x86_clmul.cpp")
CheckCompileLinkOption("-msse4.1 -maes" CRYPTOPP_IA32_AES
"${TEST_PROG_DIR}/test_x86_aes.cxx")
"${TEST_PROG_DIR}/test_x86_aes.cpp")
CheckCompileLinkOption("-mavx" CRYPTOPP_IA32_AVX
"${TEST_PROG_DIR}/test_x86_avx.cxx")
"${TEST_PROG_DIR}/test_x86_avx.cpp")
CheckCompileLinkOption("-mavx2" CRYPTOPP_IA32_AVX2
"${TEST_PROG_DIR}/test_x86_avx2.cxx")
"${TEST_PROG_DIR}/test_x86_avx2.cpp")
CheckCompileLinkOption("-msse4.2 -msha" CRYPTOPP_IA32_SHA
"${TEST_PROG_DIR}/test_x86_sha.cxx")
if (EXISTS "${TEST_PROG_DIR}/test_asm_mixed.cxx")
"${TEST_PROG_DIR}/test_x86_sha.cpp")
if (EXISTS "${TEST_PROG_DIR}/test_asm_mixed.cpp")
CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM
"${TEST_PROG_DIR}/test_asm_mixed.cxx")
"${TEST_PROG_DIR}/test_asm_mixed.cpp")
else ()
CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM
"${TEST_PROG_DIR}/test_mixed_asm.cxx")
"${TEST_PROG_DIR}/test_mixed_asm.cpp")
endif ()
# https://github.com/weidai11/cryptopp/issues/756
@ -594,6 +649,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3")
set_source_files_properties(${SRC_DIR}/keccak_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3")
set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3")
set_source_files_properties(${SRC_DIR}/lsh256_sse.cpp PROPERTIES COMPILE_FLAGS "-mssse3")
set_source_files_properties(${SRC_DIR}/lsh512_sse.cpp PROPERTIES COMPILE_FLAGS "-mssse3")
set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3")
set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3")
if (NOT CRYPTOPP_IA32_SSE41 AND NOT DISABLE_SSE4)
@ -627,6 +684,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AVX2")
elseif (CRYPTOPP_IA32_AVX2 AND NOT DISABLE_AVX2)
set_source_files_properties(${SRC_DIR}/chacha_avx.cpp PROPERTIES COMPILE_FLAGS "-mavx2")
set_source_files_properties(${SRC_DIR}/lsh256_avx.cpp PROPERTIES COMPILE_FLAGS "-mavx2")
set_source_files_properties(${SRC_DIR}/lsh512_avx.cpp PROPERTIES COMPILE_FLAGS "-mavx2")
endif ()
if (NOT CRYPTOPP_IA32_SHA AND NOT DISABLE_SHA)
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SHANI")
@ -641,7 +700,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
# This checks for <arm_acle.h>
CheckCompileLinkOption("-march=armv8-a" CRYPTOPP_ARM_ACLE_HEADER
"${TEST_PROG_DIR}/test_arm_acle_header.cxx")
"${TEST_PROG_DIR}/test_arm_acle_header.cpp")
# Use <arm_acle.h> if available
if (CRYPTOPP_ARM_NEON_HEADER)
@ -664,9 +723,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
set_source_files_properties(${SRC_DIR}/neon_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
else ()
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ARM_ASIMD")
endif ()
if (CRYPTOPP_ARMV8A_CRC)
set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crc")
else ()
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ARM_CRC32")
endif ()
if (CRYPTOPP_ARMV8A_CRYPTO)
set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
@ -674,21 +737,25 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
else ()
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ARM_AES")
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ARM_PMULL")
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ARM_SHA")
endif ()
elseif (CRYPTOPP_ARM32)
# This checks for <arm_neon.h>
CheckCompileLinkOption("-march=armv7-a -mfpu=neon" CRYPTOPP_ARM_NEON_HEADER
"${TEST_PROG_DIR}/test_arm_neon_header.cxx")
"${TEST_PROG_DIR}/test_arm_neon_header.cpp")
# Use <arm_neon.h> if available
if (CRYPTOPP_ARM_NEON_HEADER)
CheckCompileLinkOption("-march=armv7-a -mfpu=neon -DCRYPTOPP_ARM_NEON_HEADER=1" CRYPTOPP_ARMV7A_NEON
"${TEST_PROG_DIR}/test_arm_neon.cxx")
"${TEST_PROG_DIR}/test_arm_neon.cpp")
else ()
CheckCompileLinkOption("-march=armv7-a -mfpu=neon" CRYPTOPP_ARMV7A_NEON
"${TEST_PROG_DIR}/test_arm_neon.cxx")
"${TEST_PROG_DIR}/test_arm_neon.cpp")
endif ()
if (CRYPTOPP_ARMV7A_NEON)
@ -732,7 +799,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/sm4_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
else ()
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_ARM_NEON_AVAILABLE=0")
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ARM_NEON")
endif ()
elseif (CRYPTOPP_PPC32 OR CRYPTOPP_PPC64)
@ -757,13 +824,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
endif ()
CheckCompileLinkOption("${CRYPTOPP_ALTIVEC_FLAGS}" PPC_ALTIVEC_FLAG
"${TEST_PROG_DIR}/test_ppc_altivec.cxx")
"${TEST_PROG_DIR}/test_ppc_altivec.cpp")
# Hack for XLC. Find the lowest PWR architecture.
if (CMAKE_CXX_COMPILER MATCHES "xlC")
if (NOT PPC_ALTIVEC_FLAG)
CheckCompileLinkOption("${CRYPTOPP_POWER4_FLAGS}" PPC_POWER4_FLAG
"${TEST_PROG_DIR}/test_ppc_altivec.cxx")
"${TEST_PROG_DIR}/test_ppc_altivec.cpp")
if (PPC_POWER4_FLAG)
set(PPC_ALTIVEC_FLAG 1)
set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER4_FLAGS}")
@ -771,7 +838,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
endif ()
if (NOT PPC_ALTIVEC_FLAG)
CheckCompileLinkOption("${CRYPTOPP_POWER5_FLAGS}" PPC_POWER5_FLAG
"${TEST_PROG_DIR}/test_ppc_altivec.cxx")
"${TEST_PROG_DIR}/test_ppc_altivec.cpp")
if (PPC_POWER5_FLAG)
set(PPC_ALTIVEC_FLAG 1)
set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER5_FLAGS}")
@ -779,7 +846,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
endif ()
if (NOT PPC_ALTIVEC_FLAG)
CheckCompileLinkOption("${CRYPTOPP_POWER6_FLAGS}" PPC_POWER6_FLAG
"${TEST_PROG_DIR}/test_ppc_altivec.cxx")
"${TEST_PROG_DIR}/test_ppc_altivec.cpp")
if (PPC_POWER6_FLAG)
set(PPC_ALTIVEC_FLAG 1)
set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER6_FLAGS}")
@ -789,23 +856,23 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
# Hack for XLC and GCC. Find the right combination for PWR7 and the VSX unit.
CheckCompileLinkOption("${CRYPTOPP_POWER7_VSX_FLAGS}" PPC_POWER7_FLAG
"${TEST_PROG_DIR}/test_ppc_power7.cxx")
"${TEST_PROG_DIR}/test_ppc_power7.cpp")
if (PPC_POWER7_FLAG)
set (CRYPTOPP_POWER7_FLAGS "${CRYPTOPP_POWER7_VSX_FLAGS}")
else ()
CheckCompileLinkOption("${CRYPTOPP_POWER7_PWR_FLAGS}" PPC_POWER7_FLAG
"${TEST_PROG_DIR}/test_ppc_power7.cxx")
"${TEST_PROG_DIR}/test_ppc_power7.cpp")
if (PPC_POWER7_FLAG)
set (CRYPTOPP_POWER7_FLAGS "${CRYPTOPP_POWER7_PWR_FLAGS}")
endif ()
endif ()
CheckCompileLinkOption("${CRYPTOPP_POWER8_FLAGS}" PPC_POWER8_FLAG
"${TEST_PROG_DIR}/test_ppc_power8.cxx")
"${TEST_PROG_DIR}/test_ppc_power8.cpp")
# Disable POWER9 due to https://github.com/weidai11/cryptopp/issues/986.
#CheckCompileLinkOption("${CRYPTOPP_POWER9_FLAGS}" PPC_POWER9_FLAG
# "${TEST_PROG_DIR}/test_ppc_power9.cxx")
# "${TEST_PROG_DIR}/test_ppc_power9.cpp")
#if (PPC_POWER9_FLAG AND NOT DISABLE_POWER9)
# set_source_files_properties(${SRC_DIR}/ppc_power9.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER9_FLAGS})
@ -863,23 +930,23 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
if (CRYPTOPP_AMD64 OR CRYPTOPP_I386)
CheckCompileLinkOption("-xarch=sse2" CRYPTOPP_IA32_SSE2
"${TEST_PROG_DIR}/test_x86_sse2.cxx")
"${TEST_PROG_DIR}/test_x86_sse2.cpp")
CheckCompileLinkOption("-xarch=ssse3" CRYPTOPP_IA32_SSSE3
"${TEST_PROG_DIR}/test_x86_ssse3.cxx")
"${TEST_PROG_DIR}/test_x86_ssse3.cpp")
CheckCompileLinkOption("-xarch=sse4_1" CRYPTOPP_IA32_SSE41
"${TEST_PROG_DIR}/test_x86_sse41.cxx")
"${TEST_PROG_DIR}/test_x86_sse41.cpp")
CheckCompileLinkOption("-xarch=sse4_2" CRYPTOPP_IA32_SSE42
"${TEST_PROG_DIR}/test_x86_sse42.cxx")
"${TEST_PROG_DIR}/test_x86_sse42.cpp")
CheckCompileLinkOption("-xarch=aes" CRYPTOPP_IA32_CLMUL
"${TEST_PROG_DIR}/test_x86_clmul.cxx")
"${TEST_PROG_DIR}/test_x86_clmul.cpp")
CheckCompileLinkOption("-xarch=aes" CRYPTOPP_IA32_AES
"${TEST_PROG_DIR}/test_x86_aes.cxx")
"${TEST_PROG_DIR}/test_x86_aes.cpp")
CheckCompileLinkOption("-xarch=avx" CRYPTOPP_IA32_AVX
"${TEST_PROG_DIR}/test_x86_avx.cxx")
"${TEST_PROG_DIR}/test_x86_avx.cpp")
CheckCompileLinkOption("-xarch=avx2" CRYPTOPP_IA32_AVX2
"${TEST_PROG_DIR}/test_x86_avx2.cxx")
"${TEST_PROG_DIR}/test_x86_avx2.cpp")
CheckCompileLinkOption("-xarch=sha" CRYPTOPP_IA32_SHA
"${TEST_PROG_DIR}/test_x86_sha.cxx")
"${TEST_PROG_DIR}/test_x86_sha.cpp")
# Each -xarch=XXX options must be added to LDFLAGS if the option is used during a compile.
set(XARCH_LDFLAGS "")
@ -1054,6 +1121,80 @@ if (BUILD_SHARED)
target_link_libraries(cryptopp-shared ${CMAKE_THREAD_LIBS_INIT})
endif ()
#============================================================================
# Setup OpenMP
#============================================================================
if (${CMAKE_VERSION} VERSION_GREATER "3.1" AND USE_OPENMP)
find_package(OpenMP)
if (OPENMP_FOUND OR OPENMP_CXX_FOUND)
message(STATUS "OpenMP: Found libomp without any special flags")
endif()
# If OpenMP wasn't found, try if we can find it in the default Macports location
if((NOT OPENMP_FOUND) AND (NOT OPENMP_CXX_FOUND) AND EXISTS "/opt/local/lib/libomp/libomp.dylib") # older cmake uses OPENMP_FOUND, newer cmake also sets OPENMP_CXX_FOUND, homebrew installations seem only to get the latter set.
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/opt/local/include/libomp/")
set(OpenMP_CXX_LIB_NAMES omp)
set(OpenMP_omp_LIBRARY /opt/local/lib/libomp/libomp.dylib)
find_package(OpenMP)
if (OPENMP_FOUND OR OPENMP_CXX_FOUND)
message(STATUS "OpenMP: Found libomp in macports default location.")
else()
message(FATAL_ERROR "OpenMP: Didn't find libomp. Tried macports default location but also didn't find it.")
endif()
endif()
# If OpenMP wasn't found, try if we can find it in the default Homebrew location
if((NOT OPENMP_FOUND) AND (NOT OPENMP_CXX_FOUND) AND EXISTS "/usr/local/opt/libomp/lib/libomp.dylib")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include")
set(OpenMP_CXX_LIB_NAMES omp)
set(OpenMP_omp_LIBRARY /usr/local/opt/libomp/lib/libomp.dylib)
find_package(OpenMP)
if (OPENMP_FOUND OR OPENMP_CXX_FOUND)
message(STATUS "OpenMP: Found libomp in homebrew default location.")
else()
message(FATAL_ERROR "OpenMP: Didn't find libomp. Tried homebrew default location but also didn't find it.")
endif()
endif()
set(Additional_OpenMP_Libraries_Workaround "")
# Workaround because older cmake on apple doesn't support FindOpenMP
if((NOT OPENMP_FOUND) AND (NOT OPENMP_CXX_FOUND))
if((APPLE AND ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
AND ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0") AND (CMAKE_VERSION VERSION_LESS "3.12.0")))
message(STATUS "OpenMP: Applying workaround for OSX OpenMP with old cmake that doesn't have FindOpenMP")
set(OpenMP_CXX_FLAGS "-Xclang -fopenmp")
set(Additional_OpenMP_Libraries_Workaround "-lomp")
else()
message(FATAL_ERROR "OpenMP: Did not find OpenMP. Build without USE_OPENMP if you want to allow this.")
endif()
endif()
if(NOT TARGET OpenMP::OpenMP_CXX)
# We're on cmake < 3.9, handle behavior of the old FindOpenMP implementation
message(STATUS "OpenMP: Applying workaround for old CMake that doesn't define FindOpenMP using targets")
add_library(OpenMP_TARGET INTERFACE)
add_library(OpenMP::OpenMP_CXX ALIAS OpenMP_TARGET)
target_compile_options(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS}) # add to all targets depending on this
find_package(Threads REQUIRED)
target_link_libraries(OpenMP_TARGET INTERFACE Threads::Threads)
target_link_libraries(OpenMP_TARGET INTERFACE ${OpenMP_CXX_FLAGS} ${Additional_OpenMP_Libraries_Workaround})
endif()
if (BUILD_STATIC)
target_link_libraries(cryptopp-static ${OpenMP_CXX_FLAGS}) # Workaround for Ubuntu 18.04 that otherwise doesn't set -fopenmp for linking
target_link_libraries(cryptopp-static OpenMP::OpenMP_CXX)
endif()
if (BUILD_SHARED)
target_link_libraries(cryptopp-shared ${OpenMP_CXX_FLAGS}) # Workaround for Ubuntu 18.04 that otherwise doesn't set -fopenmp for linking
target_link_libraries(cryptopp-shared OpenMP::OpenMP_CXX)
endif()
endif()
#============================================================================
# Tests
#============================================================================
@ -1170,7 +1311,7 @@ elseif (CRYPTOPP_PPC64)
message(STATUS "Platform: PowerPC-64")
elseif (CRYPTOPP_MINGW32)
message(STATUS "Platform: MinGW-32")
elseif (CRYPTOPP_MINGW32)
elseif (CRYPTOPP_MINGW64)
message(STATUS "Platform: MinGW-64")
endif ()
if (CRYPTOPP_ARMV7A_NEON)

View File

@ -38,7 +38,7 @@ PROJECT_NAME = Crypto++
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 8.5
PROJECT_NUMBER = 8.6
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@ -204,6 +204,13 @@ lubyrack.h
lea.cpp
lea_simd.cpp
lea.h
lsh256.cpp
lsh256_sse.cpp
lsh256_avx.cpp
lsh512.cpp
lsh512_sse.cpp
lsh512_avx.cpp
lsh.h
luc.cpp
luc.h
mars.cpp
@ -525,6 +532,10 @@ TestVectors/hmac.txt
TestVectors/kalyna.txt
TestVectors/keccak.txt
TestVectors/lea.txt
TestVectors/lsh.txt
TestVectors/lsh256.txt
TestVectors/lsh512.txt
TestVectors/lsh512_256.txt
TestVectors/mars.txt
TestVectors/nr.txt
TestVectors/panama.txt
@ -572,68 +583,68 @@ TestVectors/wake.txt
TestVectors/whrlpool.txt
TestVectors/xchacha.txt
TestVectors/xts.txt
TestPrograms/test_32bit.cxx
TestPrograms/test_64bit.cxx
TestPrograms/test_arm_acle_header.cxx
TestPrograms/test_arm_aes.cxx
TestPrograms/test_arm_asimd.cxx
TestPrograms/test_arm_crc.cxx
TestPrograms/test_arm_neon.cxx
TestPrograms/test_arm_neon_header.cxx
TestPrograms/test_arm_pmull.cxx
TestPrograms/test_arm_sha1.cxx
TestPrograms/test_arm_sha256.cxx
TestPrograms/test_arm_sha3.cxx
TestPrograms/test_arm_sha512.cxx
TestPrograms/test_arm_sm3.cxx
TestPrograms/test_arm_sm4.cxx
TestPrograms/test_asm_mixed.cxx
TestPrograms/test_cxx11_alignas.cxx
TestPrograms/test_cxx11_alignof.cxx
TestPrograms/test_cxx11_assert.cxx
TestPrograms/test_cxx11_atomic.cxx
TestPrograms/test_cxx11_auto.cxx
TestPrograms/test_cxx11_constexpr.cxx
TestPrograms/test_cxx11.cxx
TestPrograms/test_cxx11_deletefn.cxx
TestPrograms/test_cxx11_staticinit.cxx
TestPrograms/test_cxx11_enumtype.cxx
TestPrograms/test_cxx11_initializer.cxx
TestPrograms/test_cxx11_lambda.cxx
TestPrograms/test_cxx11_noexcept.cxx
TestPrograms/test_cxx11_nullptr.cxx
TestPrograms/test_cxx11_sync.cxx
TestPrograms/test_cxx11_vartemplates.cxx
TestPrograms/test_cxx14.cxx
TestPrograms/test_cxx17_assert.cxx
TestPrograms/test_cxx17.cxx
TestPrograms/test_cxx17_exceptions.cxx
TestPrograms/test_cxx98_exception.cxx
TestPrograms/test_cxx.cxx
TestPrograms/test_glibc.cxx
TestPrograms/test_newlib.cxx
TestPrograms/test_ppc_aes.cxx
TestPrograms/test_ppc_altivec.cxx
TestPrograms/test_ppc_power7.cxx
TestPrograms/test_ppc_power8.cxx
TestPrograms/test_ppc_power9.cxx
TestPrograms/test_ppc_sha.cxx
TestPrograms/test_ppc_vmull.cxx
TestPrograms/test_pthreads.cxx
TestPrograms/test_x86_aes.cxx
TestPrograms/test_x86_avx2.cxx
TestPrograms/test_x86_avx512.cxx
TestPrograms/test_x86_avx.cxx
TestPrograms/test_x86_clmul.cxx
TestPrograms/test_x86_cpuid.cxx
TestPrograms/test_x86_rdrand.cxx
TestPrograms/test_x86_rdseed.cxx
TestPrograms/test_x86_sha.cxx
TestPrograms/test_x86_sse2.cxx
TestPrograms/test_x86_sse3.cxx
TestPrograms/test_x86_sse41.cxx
TestPrograms/test_x86_sse42.cxx
TestPrograms/test_x86_ssse3.cxx
TestPrograms/test_x86_via_aes.cxx
TestPrograms/test_x86_via_rng.cxx
TestPrograms/test_x86_via_sha.cxx
TestPrograms/test_32bit.cpp
TestPrograms/test_64bit.cpp
TestPrograms/test_arm_acle_header.cpp
TestPrograms/test_arm_aes.cpp
TestPrograms/test_arm_asimd.cpp
TestPrograms/test_arm_crc.cpp
TestPrograms/test_arm_neon.cpp
TestPrograms/test_arm_neon_header.cpp
TestPrograms/test_arm_pmull.cpp
TestPrograms/test_arm_sha1.cpp
TestPrograms/test_arm_sha256.cpp
TestPrograms/test_arm_sha3.cpp
TestPrograms/test_arm_sha512.cpp
TestPrograms/test_arm_sm3.cpp
TestPrograms/test_arm_sm4.cpp
TestPrograms/test_asm_mixed.cpp
TestPrograms/test_cxx11_alignas.cpp
TestPrograms/test_cxx11_alignof.cpp
TestPrograms/test_cxx11_assert.cpp
TestPrograms/test_cxx11_atomic.cpp
TestPrograms/test_cxx11_auto.cpp
TestPrograms/test_cxx11_constexpr.cpp
TestPrograms/test_cxx11.cpp
TestPrograms/test_cxx11_deletefn.cpp
TestPrograms/test_cxx11_staticinit.cpp
TestPrograms/test_cxx11_enumtype.cpp
TestPrograms/test_cxx11_initializer.cpp
TestPrograms/test_cxx11_lambda.cpp
TestPrograms/test_cxx11_noexcept.cpp
TestPrograms/test_cxx11_nullptr.cpp
TestPrograms/test_cxx11_sync.cpp
TestPrograms/test_cxx11_vartemplates.cpp
TestPrograms/test_cxx14.cpp
TestPrograms/test_cxx17_assert.cpp
TestPrograms/test_cxx17.cpp
TestPrograms/test_cxx17_exceptions.cpp
TestPrograms/test_cxx98_exception.cpp
TestPrograms/test_cxx.cpp
TestPrograms/test_glibc.cpp
TestPrograms/test_newlib.cpp
TestPrograms/test_ppc_aes.cpp
TestPrograms/test_ppc_altivec.cpp
TestPrograms/test_ppc_power7.cpp
TestPrograms/test_ppc_power8.cpp
TestPrograms/test_ppc_power9.cpp
TestPrograms/test_ppc_sha.cpp
TestPrograms/test_ppc_vmull.cpp
TestPrograms/test_pthreads.cpp
TestPrograms/test_x86_aes.cpp
TestPrograms/test_x86_avx2.cpp
TestPrograms/test_x86_avx512.cpp
TestPrograms/test_x86_avx.cpp
TestPrograms/test_x86_clmul.cpp
TestPrograms/test_x86_cpuid.cpp
TestPrograms/test_x86_rdrand.cpp
TestPrograms/test_x86_rdseed.cpp
TestPrograms/test_x86_sha.cpp
TestPrograms/test_x86_sse2.cpp
TestPrograms/test_x86_sse3.cpp
TestPrograms/test_x86_sse41.cpp
TestPrograms/test_x86_sse42.cpp
TestPrograms/test_x86_ssse3.cpp
TestPrograms/test_x86_via_aes.cpp
TestPrograms/test_x86_via_rng.cpp
TestPrograms/test_x86_via_sha.cpp

View File

@ -86,15 +86,6 @@ XLC_COMPILER := $(shell $(CXX) -qversion 2>/dev/null |$(GREP) -i -c "IBM XL")
CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c -E '(llvm|clang)')
INTEL_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c '\(icc\)')
# Various Port compilers on OS X
MACPORTS_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c "macports")
HOMEBREW_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c "homebrew")
ifeq ($(IS_DARWIN),1)
ifneq ($(MACPORTS_COMPILER)$(HOMEBREW_COMPILER),00)
OSXPORT_COMPILER := 1
endif
endif
# Enable shared object versioning for Linux and Solaris
HAS_SOLIB_VERSION ?= 0
ifneq ($(IS_LINUX)$(IS_HURD)$(IS_SUN),000)
@ -106,14 +97,6 @@ ifeq ($(wildcard adhoc.cpp),)
$(shell cp adhoc.cpp.proto adhoc.cpp)
endif
# Tell MacPorts and Homebrew GCC to use Clang integrated assembler (only on Intel-based Macs)
# http://github.com/weidai11/cryptopp/issues/190
ifeq ($(GCC_COMPILER)$(OSXPORT_COMPILER)$(IS_PPC32)$(IS_PPC64),1100)
ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -Wa,-q
endif
endif
# Hack to skip CPU feature tests for some recipes
DETECT_FEATURES ?= 1
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),-DCRYPTOPP_DISABLE_ASM)
@ -122,26 +105,29 @@ else ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
DETECT_FEATURES := 0
else ifeq ($(findstring distclean,$(MAKECMDGOALS)),distclean)
DETECT_FEATURES := 0
else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim)
else ifeq ($(findstring trim,$(MAKECMDGOALS)),trim)
DETECT_FEATURES := 0
else ifeq ($(findstring zip,$(MAKECMDGOALS)),zip)
DETECT_FEATURES := 0
endif
# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed
# because it requires -O1 or higher, but we use -O0 to tame the optimizer.
ifeq ($(DETECT_FEATURES),1)
TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS))
ifneq ($(strip $(TCXXFLAGS)),)
$(info Using testing flags: $(TCXXFLAGS))
endif
#TPROG = TestPrograms/test_cxx.cxx
#$(info Testing compile... )
#$(info $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 1>/dev/null))
# Always print testing flags since some tests always happen, like 64-bit.
TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CPPFLAGS) $(CXXFLAGS))
ifneq ($(strip $(TCXXFLAGS)),)
$(info Using testing flags: $(TCXXFLAGS))
endif
# TCOMMAND is used for just about all tests. Make will lazy-evaluate
# the variables when executed by $(shell $(TCOMMAND) ...).
TCOMMAND = $(CXX) $(TCXXFLAGS) $(TEXTRA) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT)
# Fixup AIX
ifeq ($(IS_AIX),1)
TPROG = TestPrograms/test_64bit.cxx
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_64bit.cpp
TOPT =
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
IS_PPC64=1
else
@ -149,15 +135,8 @@ ifeq ($(IS_AIX),1)
endif
endif
# libc++ is LLVM's standard C++ library. If we add libc++
# here then all user programs must use it too. The open
# question is, which choice is easier on users?
ifneq ($(IS_DARWIN),0)
CXX ?= c++
# CRYPTOPP_CXXFLAGS += -stdlib=libc++
AR = libtool
ARFLAGS = -static -o
endif
# Uncomment for debugging
# $(info Here's what we found... IS_X86: $(IS_X86), IS_X64: $(IS_X64), IS_ARM32: $(IS_ARM32), IS_ARMV8: $(IS_ARMV8))
###########################################################
##### General Variables #####
@ -188,31 +167,31 @@ endif
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
ifeq ($(PREFIX),)
PREFIX = /usr/local
PC_PREFIX = /usr/local
PREFIX = /usr/local
PC_PREFIX = /usr/local
else
PC_PREFIX = $(PREFIX)
PC_PREFIX = $(PREFIX)
endif
ifeq ($(LIBDIR),)
LIBDIR := $(PREFIX)/lib
PC_LIBDIR = $${prefix}/lib
LIBDIR := $(PREFIX)/lib
PC_LIBDIR = $${prefix}/lib
else
PC_LIBDIR = $(LIBDIR)
PC_LIBDIR = $(LIBDIR)
endif
ifeq ($(DATADIR),)
DATADIR := $(PREFIX)/share
PC_DATADIR = $${prefix}/share
DATADIR := $(PREFIX)/share
PC_DATADIR = $${prefix}/share
else
PC_DATADIR = $(DATADIR)
PC_DATADIR = $(DATADIR)
endif
ifeq ($(INCLUDEDIR),)
INCLUDEDIR := $(PREFIX)/include
PC_INCLUDEDIR = $${prefix}/include
INCLUDEDIR := $(PREFIX)/include
PC_INCLUDEDIR = $${prefix}/include
else
PC_INCLUDEDIR = $(INCLUDEDIR)
PC_INCLUDEDIR = $(INCLUDEDIR)
endif
ifeq ($(BINDIR),)
BINDIR := $(PREFIX)/bin
BINDIR := $(PREFIX)/bin
endif
# We honor ARFLAGS, but the "v" option used by default causes a noisy make
@ -235,8 +214,9 @@ endif # _WIN32_WINNT
endif # IS_MINGW
# Newlib needs _XOPEN_SOURCE=600 for signals
TPROG = TestPrograms/test_newlib.cxx
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_newlib.cpp
TOPT =
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ifeq ($(findstring -D_XOPEN_SOURCE,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -D_XOPEN_SOURCE=600
@ -274,159 +254,194 @@ ifeq ($(DETECT_FEATURES),1)
SHANI_FLAG = -msha
endif
TPROG = TestPrograms/test_x86_sse2.cxx
# Tell MacPorts and Homebrew GCC to use Clang integrated assembler
# Intel-based Macs. http://github.com/weidai11/cryptopp/issues/190
ifneq ($(IS_DARWIN),0)
ifeq ($(findstring -Wa,-q,$(CXXFLAGS)),)
TPROG = TestPrograms/test_cxx.cpp
TOPT = -Wa,-q
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
TEXTRA += -Wa,-q
CRYPTOPP_CXXFLAGS += -Wa,-q
endif
endif
endif
TPROG = TestPrograms/test_x86_sse2.cpp
TOPT = $(SSE2_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_FLAG = $(SSE2_FLAG)
SUN_LDFLAGS += $(SSE2_FLAG)
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
SSE2_FLAG =
endif
TPROG = TestPrograms/test_x86_ssse3.cxx
TOPT = $(SSSE3_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(SSSE3_FLAG)
CHAM_FLAG = $(SSSE3_FLAG)
KECCAK_FLAG = $(SSSE3_FLAG)
LEA_FLAG = $(SSSE3_FLAG)
SIMON128_FLAG = $(SSSE3_FLAG)
SPECK128_FLAG = $(SSSE3_FLAG)
SUN_LDFLAGS += $(SSSE3_FLAG)
else
SSSE3_FLAG =
endif
TPROG = TestPrograms/test_x86_sse41.cxx
TOPT = $(SSE41_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
BLAKE2B_FLAG = $(SSE41_FLAG)
BLAKE2S_FLAG = $(SSE41_FLAG)
SUN_LDFLAGS += $(SSE41_FLAG)
else
SSE41_FLAG =
endif
TPROG = TestPrograms/test_x86_sse42.cxx
TOPT = $(SSE42_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRC_FLAG = $(SSE42_FLAG)
SUN_LDFLAGS += $(SSE42_FLAG)
else
SSE42_FLAG =
endif
TPROG = TestPrograms/test_x86_clmul.cxx
TOPT = $(CLMUL_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG)
GF2N_FLAG = $(CLMUL_FLAG)
SUN_LDFLAGS += $(CLMUL_FLAG)
else
CLMUL_FLAG =
endif
TPROG = TestPrograms/test_x86_aes.cxx
TOPT = $(AESNI_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG)
SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG)
SUN_LDFLAGS += $(AESNI_FLAG)
else
AESNI_FLAG =
endif
TPROG = TestPrograms/test_x86_avx.cxx
TOPT = $(AVX_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
# XXX_FLAG = $(AVX_FLAG)
SUN_LDFLAGS += $(AVX_FLAG)
else
AVX_FLAG =
endif
TPROG = TestPrograms/test_x86_avx2.cxx
TOPT = $(AVX2_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_AVX2_FLAG = $(AVX2_FLAG)
SUN_LDFLAGS += $(AVX2_FLAG)
else
AVX2_FLAG =
endif
TPROG = TestPrograms/test_x86_sha.cxx
TOPT = $(SHANI_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG)
SUN_LDFLAGS += $(SHANI_FLAG)
else
SHANI_FLAG =
endif
ifeq ($(SUN_COMPILER),1)
CRYPTOPP_LDFLAGS += $(SUN_LDFLAGS)
endif
ifeq ($(SSE2_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
else ifeq ($(SSE3_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3
else ifeq ($(SSSE3_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
else ifeq ($(SSE41_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
else ifeq ($(SSE42_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
endif
ifneq ($(SSE42_FLAG),)
# Need SSE2 or higher for these tests
ifneq ($(SSE2_FLAG),)
# Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL.
# test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0'
ifeq ($(CLMUL_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL
endif
ifeq ($(AESNI_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
TPROG = TestPrograms/test_x86_ssse3.cpp
TOPT = $(SSSE3_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(SSSE3_FLAG)
CHAM_FLAG = $(SSSE3_FLAG)
KECCAK_FLAG = $(SSSE3_FLAG)
LEA_FLAG = $(SSSE3_FLAG)
LSH256_FLAG = $(SSSE3_FLAG)
LSH512_FLAG = $(SSSE3_FLAG)
SIMON128_FLAG = $(SSSE3_FLAG)
SPECK128_FLAG = $(SSSE3_FLAG)
SUN_LDFLAGS += $(SSSE3_FLAG)
else
SSSE3_FLAG =
endif
ifeq ($(AVX_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX
else ifeq ($(AVX2_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2
else ifeq ($(SHANI_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI
# The first Apple MacBooks were Core2's with SSE4.1
ifneq ($(IS_DARWIN),0)
# Add SSE2 algo's here as required
# They get a free upgrade
endif
endif
# Drop to SSE2 if available
ifeq ($(GCM_FLAG),)
ifneq ($(SSE2_FLAG),)
TPROG = TestPrograms/test_x86_sse41.cpp
TOPT = $(SSE41_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
BLAKE2B_FLAG = $(SSE41_FLAG)
BLAKE2S_FLAG = $(SSE41_FLAG)
SUN_LDFLAGS += $(SSE41_FLAG)
else
SSE41_FLAG =
endif
TPROG = TestPrograms/test_x86_sse42.cpp
TOPT = $(SSE42_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRC_FLAG = $(SSE42_FLAG)
SUN_LDFLAGS += $(SSE42_FLAG)
else
SSE42_FLAG =
endif
TPROG = TestPrograms/test_x86_clmul.cpp
TOPT = $(CLMUL_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG)
GF2N_FLAG = $(CLMUL_FLAG)
SUN_LDFLAGS += $(CLMUL_FLAG)
else
CLMUL_FLAG =
endif
TPROG = TestPrograms/test_x86_aes.cpp
TOPT = $(AESNI_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG)
SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG)
SUN_LDFLAGS += $(AESNI_FLAG)
else
AESNI_FLAG =
endif
TPROG = TestPrograms/test_x86_avx.cpp
TOPT = $(AVX_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
# XXX_FLAG = $(AVX_FLAG)
SUN_LDFLAGS += $(AVX_FLAG)
else
AVX_FLAG =
endif
TPROG = TestPrograms/test_x86_avx2.cpp
TOPT = $(AVX2_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_AVX2_FLAG = $(AVX2_FLAG)
LSH256_AVX2_FLAG = $(AVX2_FLAG)
LSH512_AVX2_FLAG = $(AVX2_FLAG)
SUN_LDFLAGS += $(AVX2_FLAG)
else
AVX2_FLAG =
endif
TPROG = TestPrograms/test_x86_sha.cpp
TOPT = $(SHANI_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG)
SUN_LDFLAGS += $(SHANI_FLAG)
else
SHANI_FLAG =
endif
ifeq ($(SUN_COMPILER),1)
CRYPTOPP_LDFLAGS += $(SUN_LDFLAGS)
endif
ifeq ($(SSE3_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3
else ifeq ($(SSSE3_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
else ifeq ($(SSE41_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
else ifeq ($(SSE42_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
endif
ifneq ($(SSE42_FLAG),)
# Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL.
# test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0'
ifeq ($(CLMUL_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL
endif
ifeq ($(AESNI_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
endif
ifeq ($(AVX_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX
else ifeq ($(AVX2_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2
endif
# SHANI independent of AVX per GH #1045
ifeq ($(SHANI_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI
endif
endif
# Drop to SSE2 if available
ifeq ($(GCM_FLAG),)
GCM_FLAG = $(SSE2_FLAG)
endif
# Most Clang cannot handle mixed asm with positional arguments, where the
# body is Intel style with no prefix and the templates are AT&T style.
# Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
# CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all
# Clang compilers. This test will need to be re-enabled if Clang fixes it.
#TPROG = TestPrograms/test_asm_mixed.cpp
#TOPT =
#HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
#ifneq ($(strip $(HAVE_OPT)),0)
# CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
#endif
# SSE2_FLAGS
endif
# Most Clang cannot handle mixed asm with positional arguments, where the
# body is Intel style with no prefix and the templates are AT&T style.
# Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
# CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all
# Clang compilers. This test will need to be re-enabled if Clang fixes it.
#TPROG = TestPrograms/test_asm_mixed.cxx
#HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
#ifneq ($(strip $(HAVE_OPT)),0)
# CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
#endif
# DETECT_FEATURES
endif
@ -461,32 +476,37 @@ ifneq ($(IS_ARM32),0)
ifeq ($(DETECT_FEATURES),1)
# Clang needs an option to include <arm_neon.h>
TPROG = TestPrograms/test_arm_neon_header.cxx
TOPT = -march=armv7-a -mfpu=neon
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_neon_header.cpp
TOPT = -DCRYPTOPP_ARM_NEON_HEADER=1 -march=armv7-a -mfpu=neon
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
TEXTRA += -DCRYPTOPP_ARM_NEON_HEADER=1
endif
TPROG = TestPrograms/test_arm_neon.cxx
TPROG = TestPrograms/test_arm_neon.cpp
TOPT = -march=armv7-a -mfpu=neon
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
NEON_FLAG = -march=armv7-a -mfpu=neon
ARIA_FLAG = -march=armv7-a -mfpu=neon
AES_FLAG = -march=armv7-a -mfpu=neon
CRC_FLAG = -march=armv7-a -mfpu=neon
GCM_FLAG = -march=armv7-a -mfpu=neon
BLAKE2B_FLAG = -march=armv7-a -mfpu=neon
BLAKE2S_FLAG = -march=armv7-a -mfpu=neon
CHACHA_FLAG = -march=armv7-a -mfpu=neon
CHAM_FLAG = -march=armv7-a -mfpu=neon
LEA_FLAG = -march=armv7-a -mfpu=neon
SHA_FLAG = -march=armv7-a -mfpu=neon
SIMON128_FLAG = -march=armv7-a -mfpu=neon
SPECK128_FLAG = -march=armv7-a -mfpu=neon
SM4_FLAG = -march=armv7-a -mfpu=neon
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
NEON_FLAG =
endif
ifeq ($(NEON_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
@ -502,23 +522,23 @@ endif
ifneq ($(IS_ARMV8),0)
ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_arm_neon_header.cxx
TOPT =
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_neon_header.cpp
TOPT = -DCRYPTOPP_ARM_NEON_HEADER=1
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
TEXTRA += -DCRYPTOPP_ARM_NEON_HEADER=1
endif
TPROG = TestPrograms/test_arm_acle_header.cxx
TOPT = -march=armv8-a
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_acle_header.cpp
TOPT = -DCRYPTOPP_ARM_ACLE_HEADER=1 -march=armv8-a
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
THEADER += -DCRYPTOPP_ARM_ACLE_HEADER=1
TEXTRA += -DCRYPTOPP_ARM_ACLE_HEADER=1
endif
TPROG = TestPrograms/test_arm_asimd.cxx
TPROG = TestPrograms/test_arm_asimd.cpp
TOPT = -march=armv8-a
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ASIMD_FLAG = -march=armv8-a
ARIA_FLAG = -march=armv8-a
@ -532,31 +552,39 @@ ifeq ($(DETECT_FEATURES),1)
SPECK128_FLAG = -march=armv8-a
SM4_FLAG = -march=armv8-a
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
ASIMD_FLAG =
endif
ifeq ($(ASIMD_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
ifneq ($(ASIMD_FLAG),)
TPROG = TestPrograms/test_arm_crc.cxx
TPROG = TestPrograms/test_arm_crc.cpp
TOPT = -march=armv8-a+crc
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRC_FLAG = -march=armv8-a+crc
else
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_CRC32
endif
TPROG = TestPrograms/test_arm_aes.cxx
TPROG = TestPrograms/test_arm_aes.cpp
TOPT = -march=armv8-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = -march=armv8-a+crypto
else
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_AES
endif
TPROG = TestPrograms/test_arm_pmull.cxx
TPROG = TestPrograms/test_arm_pmull.cpp
TOPT = -march=armv8-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = -march=armv8-a+crypto
GF2N_FLAG = -march=armv8-a+crypto
@ -564,49 +592,49 @@ ifeq ($(DETECT_FEATURES),1)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_PMULL
endif
TPROG = TestPrograms/test_arm_sha1.cxx
TPROG = TestPrograms/test_arm_sha1.cpp
TOPT = -march=armv8-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = -march=armv8-a+crypto
else
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA1
endif
TPROG = TestPrograms/test_arm_sha256.cxx
TPROG = TestPrograms/test_arm_sha256.cpp
TOPT = -march=armv8-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = -march=armv8-a+crypto
else
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA2
endif
TPROG = TestPrograms/test_arm_sm3.cxx
TOPT = -march=armv8.4-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_sm3.cpp
TOPT = -march=armv8.4-a+sm3
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SM3_FLAG = -march=armv8.4-a+crypto
SM4_FLAG = -march=armv8.4-a+crypto
SM3_FLAG = -march=armv8.4-a+sm3
SM4_FLAG = -march=armv8.4-a+sm3
else
#CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM3
#CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4
endif
TPROG = TestPrograms/test_arm_sha3.cxx
TOPT = -march=armv8.4-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_sha3.cpp
TOPT = -march=armv8.4-a+sha3
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA3_FLAG = -march=armv8.4-a+crypto
SHA3_FLAG = -march=armv8.4-a+sha3
else
#CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA3
endif
TPROG = TestPrograms/test_arm_sha512.cxx
TOPT = -march=armv8.4-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_sha512.cpp
TOPT = -march=armv8.4-a+sha512
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA512_FLAG = -march=armv8.4-a+crypto
SHA512_FLAG = -march=armv8.4-a+sha512
else
#CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA512
endif
@ -662,9 +690,9 @@ ifeq ($(DETECT_FEATURES),1)
# XLC with LLVM front-ends failed to define XLC defines.
#ifeq ($(findstring -qxlcompatmacros,$(CXXFLAGS)),)
# TPROG = TestPrograms/test_ppc_altivec.cxx
# TPROG = TestPrograms/test_ppc_altivec.cpp
# TOPT = -qxlcompatmacros
# HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
# HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
# ifeq ($(strip $(HAVE_OPT)),0)
# CRYPTOPP_CXXFLAGS += -qxlcompatmacros
# endif
@ -673,9 +701,9 @@ ifeq ($(DETECT_FEATURES),1)
#####################################################################
# Looking for a POWER9 option
#TPROG = TestPrograms/test_ppc_power9.cxx
#TPROG = TestPrograms/test_ppc_power9.cpp
#TOPT = $(POWER9_FLAG)
#HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
#HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
#ifeq ($(strip $(HAVE_OPT)),0)
# DARN_FLAG = $(POWER9_FLAG)
#else
@ -685,9 +713,9 @@ ifeq ($(DETECT_FEATURES),1)
#####################################################################
# Looking for a POWER8 option
TPROG = TestPrograms/test_ppc_power8.cxx
TPROG = TestPrograms/test_ppc_power8.cpp
TOPT = $(POWER8_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = $(POWER8_FLAG)
BLAKE2B_FLAG = $(POWER8_FLAG)
@ -707,15 +735,15 @@ ifeq ($(DETECT_FEATURES),1)
# GCC needs -mvsx for Power7 to enable 64-bit vector elements.
# XLC provides 64-bit vector elements without an option.
TPROG = TestPrograms/test_ppc_power7.cxx
TPROG = TestPrograms/test_ppc_power7.cpp
TOPT = $(POWER7_VSX_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
POWER7_FLAG = $(POWER7_VSX_FLAG)
else
TPROG = TestPrograms/test_ppc_power7.cxx
TPROG = TestPrograms/test_ppc_power7.cpp
TOPT = $(POWER7_PWR_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
POWER7_FLAG = $(POWER7_PWR_FLAG)
else
@ -726,12 +754,16 @@ ifeq ($(DETECT_FEATURES),1)
#####################################################################
# Looking for an Altivec option
TPROG = TestPrograms/test_ppc_altivec.cxx
TPROG = TestPrograms/test_ppc_altivec.cpp
TOPT = $(ALTIVEC_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ALTIVEC_FLAG := $(ALTIVEC_FLAG)
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
ALTIVEC_FLAG =
endif
@ -798,18 +830,18 @@ endif
ifeq ($(DETECT_FEATURES),1)
ifeq ($(XLC_COMPILER),1)
ifeq ($(findstring -qthreaded,$(CXXFLAGS)),)
TPROG = TestPrograms/test_pthreads.cxx
TPROG = TestPrograms/test_pthreads.cpp
TOPT = -qthreaded
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -qthreaded
endif # CRYPTOPP_CXXFLAGS
endif # qthreaded
else
ifeq ($(findstring -pthread,$(CXXFLAGS)),)
TPROG = TestPrograms/test_pthreads.cxx
TPROG = TestPrograms/test_pthreads.cpp
TOPT = -pthread
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -pthread
endif # CRYPTOPP_CXXFLAGS
@ -833,14 +865,32 @@ endif
# Disable IBM XL C++ "1500-036: (I) The NOSTRICT option (default at OPT(3))
# has the potential to alter the semantics of a program."
ifeq ($(XLC_COMPILER),1)
TPROG = TestPrograms/test_cxx.cxx
TPROG = TestPrograms/test_cxx.cpp
TOPT = -qsuppress=1500-036
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -qsuppress=1500-036
endif # -qsuppress
endif # IBM XL C++ compiler
# libc++ is LLVM's standard C++ library. If we add libc++
# here then all user programs must use it too. The open
# question is, which choice is easier on users?
ifneq ($(IS_DARWIN),0)
CXX ?= c++
# CRYPTOPP_CXXFLAGS += -stdlib=libc++
ifeq ($(findstring -fno-common,$(CXXFLAGS)),)
CRYPTOPP_CXXFLAGS += -fno-common
endif
IS_APPLE_LIBTOOL=$(shell libtool -V 2>&1 | $(GREP) -i -c 'Apple')
ifeq ($(IS_APPLE_LIBTOOL),1)
AR = libtool
else
AR = /usr/bin/libtool
endif
ARFLAGS = -static -o
endif
# Add -xregs=no%appl SPARC. SunCC should not use certain registers in library code.
# https://docs.oracle.com/cd/E18659_01/html/821-1383/bkamt.html
ifneq ($(IS_SPARC32)$(IS_SPARC64),00)
@ -910,9 +960,9 @@ ifeq ($(findstring native,$(MAKECMDGOALS)),native)
NATIVE_OPT =
# Try GCC and compatibles first
TPROG = TestPrograms/test_cxx.cxx
TPROG = TestPrograms/test_cxx.cpp
TOPT = -march=native
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
NATIVE_OPT = -march=native
endif # NATIVE_OPT
@ -920,7 +970,7 @@ ifeq ($(findstring native,$(MAKECMDGOALS)),native)
# And tune
ifeq ($(NATIVE_OPT),)
TOPT = -mtune=native
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
NATIVE_OPT = -mtune=native
endif # NATIVE_OPT
@ -929,7 +979,7 @@ ifeq ($(findstring native,$(MAKECMDGOALS)),native)
# Try SunCC next
ifeq ($(NATIVE_OPT),)
TOPT = -native
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
NATIVE_OPT = -native
endif # NATIVE_OPT
@ -1021,8 +1071,9 @@ endif # Valgrind
# Debug testing on GNU systems. Triggered by -DDEBUG.
# Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
TPROG = TestPrograms/test_cxx.cxx
USING_GLIBCXX := $(shell $(CXX)$(CXXFLAGS) -E $(TPROG) -o $(TOUT) 2>&1 | $(GREP) -i -c "__GLIBCXX__")
TPROG = TestPrograms/test_cxx.cpp
TOPT =
USING_GLIBCXX := $(shell $(CXX)$(CXXFLAGS) -E $(TPROG) -c 2>&1 | $(GREP) -i -c "__GLIBCXX__")
ifneq ($(USING_GLIBCXX),0)
ifeq ($(HAS_NEWLIB),0)
ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
@ -1032,9 +1083,9 @@ ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
endif # USING_GLIBCXX
ifeq ($(XLC_COMPILER),1)
TPROG = TestPrograms/test_cxx.cxx
TPROG = TestPrograms/test_cxx.cpp
TOPT = -qheapdebug -qro
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRYPTOPP_CXXFLAGS += -qheapdebug -qro
endif # CRYPTOPP_CXXFLAGS
@ -1285,7 +1336,7 @@ clean:
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(CLEAN_OBJS) rdrand-*.o
@-$(RM) libcryptopp.a libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a
@-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX) libcryptopp.so$(SOLIB_VERSION_SUFFIX)
@-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct et
@-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.dat ct et
@-$(RM) *.la *.lo *.gcov *.gcno *.gcda *.stackdump core core-*
@-$(RM) /tmp/adhoc.exe
@-$(RM) -r /tmp/cryptopp_test/
@ -1313,6 +1364,7 @@ android-clean:
.PHONY: distclean
distclean: clean autotools-clean cmake-clean android-clean
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
-$(RM) cryptest_all.info cryptest_debug.info cryptest_noasm.info cryptest_base.info cryptest.info cryptest_release.info
@-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~
@-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
@-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)
@ -1447,14 +1499,14 @@ cryptopp.pc libcryptopp.pc:
@echo '' >> libcryptopp.pc
@echo 'Name: Crypto++' >> libcryptopp.pc
@echo 'Description: Crypto++ cryptographic library' >> libcryptopp.pc
@echo 'Version: 8.5' >> libcryptopp.pc
@echo 'Version: 8.6' >> libcryptopp.pc
@echo 'URL: https://cryptopp.com/' >> libcryptopp.pc
@echo '' >> libcryptopp.pc
@echo 'Cflags: -I$${includedir}' >> libcryptopp.pc
@echo 'Libs: -L$${libdir} -lcryptopp' >> libcryptopp.pc
# This recipe prepares the distro files
TEXT_FILES := *.h *.cpp *.S GNUmakefile GNUmakefile-cross License.txt Readme.txt Install.txt Filelist.txt Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx
TEXT_FILES := *.h *.cpp *.S GNUmakefile GNUmakefile-cross License.txt Readme.txt Install.txt Filelist.txt Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestPrograms/*.cpp
EXEC_FILES := TestScripts/*.sh TestScripts/*.cmd
EXEC_DIRS := TestData/ TestVectors/ TestScripts/ TestPrograms/
@ -1467,22 +1519,22 @@ trim:
ifneq ($(IS_DARWIN),0)
$(SED) -i '' -e's/[[:space:]]*$$//' *.supp *.txt .*.yml *.h *.cpp *.asm *.S
$(SED) -i '' -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross
$(SED) -i '' -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.*
$(SED) -i '' -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cpp TestScripts/*.*
make convert
else
$(SED) -i -e's/[[:space:]]*$$//' *.supp *.txt .*.yml *.h *.cpp *.asm *.S
$(SED) -i -e's/[[:space:]]*$$//' *.sln *.vcxproj *.filters GNUmakefile GNUmakefile-cross
$(SED) -i -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cxx TestScripts/*.*
$(SED) -i -e's/[[:space:]]*$$//' TestData/*.dat TestVectors/*.txt TestPrograms/*.cpp TestScripts/*.*
make convert
endif
.PHONY: convert
convert:
@-$(CHMOD) u=rwx,go=rx $(EXEC_DIRS)
@-$(CHMOD) u=rw,go=r $(TEXT_FILES) *.supp .*.yml *.asm *.zip TestVectors/*.txt TestData/*.dat TestPrograms/*.cxx
@-$(CHMOD) u=rwx,go=rx $(EXEC_FILES)
@-$(CHMOD) u=rw,go=r $(TEXT_FILES) *.supp .*.yml *.asm *.zip TestVectors/*.txt TestData/*.dat TestPrograms/*.cpp
@-$(CHMOD) u=rwx,go=rx $(EXEC_FILES) *.sh
-unix2dos --keepdate --quiet $(TEXT_FILES) .*.yml *.asm TestScripts/*.cmd TestScripts/*.txt TestScripts/*.cpp
-dos2unix --keepdate --quiet GNUmakefile GNUmakefile-cross *.S *.supp *.mapfile TestScripts/*.sh
-dos2unix --keepdate --quiet GNUmakefile GNUmakefile-cross *.sh *.S *.supp *.mapfile TestScripts/*.sh
ifneq ($(IS_DARWIN),0)
@-xattr -c *
endif
@ -1585,6 +1637,22 @@ keccak_simd.o : keccak_simd.cpp
lea_simd.o : lea_simd.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LEA_FLAG) -c) $<
# SSSE3 available
lsh256_sse.o : lsh256_sse.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LSH256_FLAG) -c) $<
# AVX2 available
lsh256_avx.o : lsh256_avx.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LSH256_AVX2_FLAG) -c) $<
# SSSE3 available
lsh512_sse.o : lsh512_sse.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LSH512_FLAG) -c) $<
# AVX2 available
lsh512_avx.o : lsh512_avx.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LSH512_AVX2_FLAG) -c) $<
# NEON available
neon_simd.o : neon_simd.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(NEON_FLAG) -c) $<
@ -1712,11 +1780,11 @@ endif
.PHONY: osx_warning
osx_warning:
ifeq ($(IS_DARWIN),1)
ifeq ($(IS_DARWIN)$(CLANG_COMPILER),11)
ifeq ($(findstring -stdlib=libc++,$(CRYPTOPP_CXXFLAGS)$(CXXFLAGS)),)
$(info )
$(info INFO: Crypto++ was built without LLVM's libc++. If you are using the library)
$(info INFO: with Xcode, then you should add -stdlib=libc++ to CXXFLAGS. It is)
$(info INFO: with modern Xcode, then you should add -stdlib=libc++ to CXXFLAGS. It is)
$(info INFO: already present in the makefile, and you only need to uncomment it.)
$(info )
endif

View File

@ -15,8 +15,9 @@ TOUT := $(strip $(TOUT))
LINK_LIBRARY ?= libcryptopp.a
LINK_LIBRARY_PATH ?= ./
# Default CXXFLAGS if none were provided
CXXFLAGS ?= -DNDEBUG -g2 -O3 -fPIC -pipe
# Default FLAGS if none were provided
CPPFLAGS ?= -DNDEBUG
CXXFLAGS ?= -g2 -O3 -fPIC -pipe
AR ?= ar
ARFLAGS ?= cr
@ -45,11 +46,11 @@ endif
IS_LINUX := $(shell echo $(MACHINEX) | $(GREP) -i -c "Linux")
# Can be used by Android and Embeeded cross-compiles. Disable by default because
# Can be used by Android and Embedded cross-compiles. Disable by default because
# Android and embedded users typically don't run this configuration.
HAS_SOLIB_VERSION ?= 0
# Formely adhoc.cpp was created from adhoc.cpp.proto when needed.
# Formerly adhoc.cpp was created from adhoc.cpp.proto when needed.
# This is now needed because ISA tests are performed using adhoc.cpp.
ifeq ($(wildcard adhoc.cpp),)
$(shell cp adhoc.cpp.proto adhoc.cpp)
@ -59,23 +60,21 @@ endif
##### General Variables #####
###########################################################
# Default prefix for make install
ifeq ($(PREFIX),)
PREFIX = /usr/local
endif
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
ifeq ($(DATADIR),)
DATADIR := $(PREFIX)/share
ifeq ($(PREFIX),)
PREFIX = /usr/local
endif
ifeq ($(LIBDIR),)
LIBDIR := $(PREFIX)/lib
LIBDIR := $(PREFIX)/lib
endif
ifeq ($(BINDIR),)
BINDIR := $(PREFIX)/bin
ifeq ($(DATADIR),)
DATADIR := $(PREFIX)/share
endif
ifeq ($(INCLUDEDIR),)
INCLUDEDIR := $(PREFIX)/include
INCLUDEDIR := $(PREFIX)/include
endif
ifeq ($(BINDIR),)
BINDIR := $(PREFIX)/bin
endif
# We honor ARFLAGS, but the "v" option used by default causes a noisy make
@ -83,11 +82,21 @@ ifeq ($(ARFLAGS),rv)
ARFLAGS = r
endif
# Sadly, we can't actually use GCC_PRAGMA_AWARE because of GCC bug 53431.
# Its a shame because GCC has so much to offer by the way of analysis.
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
ifneq ($(CLANG_COMPILER),0)
CXXFLAGS += -Wall
###########################################################
##### MacOS #####
###########################################################
# MacOS cross-compile configuration.
# See http://www.cryptopp.com/wiki/MacOS_(Command_Line).
ifeq ($(IS_MACOS),1)
# setenv-macos.sh sets CPPFLAGS, CXXFLAGS and LDFLAGS
IS_APPLE_LIBTOOL=$(shell libtool -V 2>&1 | $(GREP) -i -c 'Apple')
ifeq ($(IS_APPLE_LIBTOOL),1)
AR = libtool
else
AR = /usr/bin/libtool
endif
ARFLAGS = -static -o
endif
###########################################################
@ -97,9 +106,7 @@ endif
# iOS cross-compile configuration.
# See http://www.cryptopp.com/wiki/iOS_(Command_Line).
ifeq ($(IS_IOS),1)
CXXFLAGS += $(IOS_CXXFLAGS) -stdlib=libc++
CXXFLAGS += --sysroot "$(IOS_SYSROOT)"
# setenv-ios.sh sets CPPFLAGS, CXXFLAGS and LDFLAGS
AR = libtool
ARFLAGS = -static -o
endif
@ -111,18 +118,7 @@ endif
# Android cross-compile configuration.
# See http://www.cryptopp.com/wiki/Android_(Command_Line).
ifeq ($(IS_ANDROID),1)
CPPFLAGS += $(ANDROID_CPPFLAGS)
CPPFLAGS += -DANDROID
CXXFLAGS += $(ANDROID_CXXFLAGS)
CXXFLAGS += --sysroot=$(ANDROID_SYSROOT)
CXXFLAGS += -Wa,--noexecstack
# Aarch64 ld does not understand --warn-execstack
LDFLAGS += $(ANDROID_LDFLAGS)
LDFLAGS += -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
LDFLAGS += -Wl,--warn-shared-textrel -Wl,--warn-common
LDFLAGS += -Wl,--warn-unresolved-symbols
LDFLAGS += -Wl,--gc-sections -Wl,--fatal-warnings
# setenv-android.sh sets CPPFLAGS, CXXFLAGS and LDFLAGS
# Source files copied into PWD for Android cpu-features
# setenv-android.sh does the copying. Its a dirty compile.
@ -137,8 +133,7 @@ endif
# See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line)
# and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal).
ifeq ($(IS_ARM_EMBEDDED),1)
# CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-embedded.sh'
CXXFLAGS += $(ARM_EMBEDDED_FLAGS) --sysroot=$(ARM_EMBEDDED_SYSROOT)
# setenv-android.sh sets CPPFLAGS, CXXFLAGS and LDFLAGS
endif
###########################################################
@ -156,13 +151,14 @@ ifeq ($(HOSTX),)
endif
# This dance is because Clang reports the host architecture instead
# of the target architecture. Running Clang on an x86_64 machine with
# -arch arm64 yields x86_64 instead of aarch64 or arm64.
# of the target architecture for -dumpmachine. Running Clang on an
# x86_64 machine with -arch arm64 yields x86_64 instead of arm64.
ifeq ($(CLANG_COMPILER),1)
# The compiler is either GCC or Clang
IS_X86 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86')
IS_X64 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'x86_64|amd64')
IS_ARM32 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf')
IS_ARM32 := $(shell echo $(CXXFLAGS) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|armeabihf')
IS_ARMV8 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
else
IS_X86 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86')
@ -179,7 +175,8 @@ IS_X32 := 0
IS_PPC32 := 0
IS_PPC64 := 0
$(info Here's what we found... IS_X86: $(IS_X86), IS_X64: $(IS_X64), IS_ARM32: $(IS_ARM32), IS_ARMV8: $(IS_ARMV8))
# Uncomment for debugging
# $(info Here's what we found... IS_X86: $(IS_X86), IS_X64: $(IS_X64), IS_ARM32: $(IS_ARM32), IS_ARMV8: $(IS_ARMV8))
###########################################################
##### Test Program #####
@ -193,26 +190,23 @@ else ifeq ($(findstring clean,$(MAKECMDGOALS)),clean)
DETECT_FEATURES := 0
else ifeq ($(findstring distclean,$(MAKECMDGOALS)),distclean)
DETECT_FEATURES := 0
else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim)
else ifeq ($(findstring trim,$(MAKECMDGOALS)),trim)
DETECT_FEATURES := 0
else ifeq ($(IS_IOS),1)
else ifeq ($(findstring zip,$(MAKECMDGOALS)),zip)
DETECT_FEATURES := 0
endif
# Strip out -Wall, -Wextra and friends for feature testing. FORTIFY_SOURCE is removed
# because it requires -O1 or higher, but we use -O0 to tame the optimizer.
ifeq ($(DETECT_FEATURES),1)
TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS))
ifneq ($(strip $(TCXXFLAGS)),)
$(info Using testing flags: $(TCXXFLAGS))
endif
#TPROG = TestPrograms/test_cxx.cxx
#$(info Testing compile... )
#$(info $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 1>/dev/null))
# Always print testing flags since some tests always happen, like 64-bit.
TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CPPFLAGS) $(CXXFLAGS))
ifneq ($(strip $(TCXXFLAGS)),)
$(info Using testing flags: $(TCXXFLAGS))
endif
# For the previous messages
$(info )
# TCOMMAND is used for just about all tests. Make will lazy-evaluate
# the variables when executed by $(shell $(TCOMMAND) ...).
TCOMMAND = $(CXX) $(TCXXFLAGS) $(TEXTRA) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT)
###########################################################
##### X86/X32/X64 Options #####
@ -232,146 +226,167 @@ ifeq ($(DETECT_FEATURES),1)
AVX2_FLAG = -mavx2
SHANI_FLAG = -msha
TPROG = TestPrograms/test_x86_sse2.cxx
TPROG = TestPrograms/test_x86_sse2.cpp
TOPT = $(SSE2_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_FLAG = $(SSE2_FLAG)
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
SSE2_FLAG =
endif
TPROG = TestPrograms/test_x86_ssse3.cxx
TOPT = $(SSSE3_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(SSSE3_FLAG)
CHAM_FLAG = $(SSSE3_FLAG)
KECCAK_FLAG = $(SSSE3_FLAG)
LEA_FLAG = $(SSSE3_FLAG)
SIMON128_FLAG = $(SSSE3_FLAG)
SPECK128_FLAG = $(SSSE3_FLAG)
else
SSSE3_FLAG =
endif
TPROG = TestPrograms/test_x86_sse41.cxx
TOPT = $(SSE41_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
BLAKE2B_FLAG = $(SSE41_FLAG)
BLAKE2S_FLAG = $(SSE41_FLAG)
else
SSE41_FLAG =
endif
TPROG = TestPrograms/test_x86_sse42.cxx
TOPT = $(SSE42_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRC_FLAG = $(SSE42_FLAG)
else
SSE42_FLAG =
endif
TPROG = TestPrograms/test_x86_clmul.cxx
TOPT = $(CLMUL_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG)
GF2N_FLAG = $(CLMUL_FLAG)
else
CLMUL_FLAG =
endif
TPROG = TestPrograms/test_x86_aes.cxx
TOPT = $(AESNI_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG)
SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG)
else
AESNI_FLAG =
endif
TPROG = TestPrograms/test_x86_avx.cxx
TOPT = $(AVX_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
# XXX_FLAG = $(AVX_FLAG)
else
AVX_FLAG =
endif
TPROG = TestPrograms/test_x86_avx2.cxx
TOPT = $(AVX2_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_AVX2_FLAG = $(AVX2_FLAG)
else
AVX2_FLAG =
endif
TPROG = TestPrograms/test_x86_sha.cxx
TOPT = $(SHANI_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG)
else
SHANI_FLAG =
endif
ifeq ($(SSE2_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
else ifeq ($(SSE3_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3
else ifeq ($(SSSE3_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
else ifeq ($(SSE41_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
else ifeq ($(SSE42_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
endif
ifneq ($(SSE42_FLAG),)
# Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL.
# test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0'
ifeq ($(CLMUL_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL
endif
ifeq ($(AESNI_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
# Need SSE2 or higher for these tests
ifneq ($(SSE2_FLAG),)
TPROG = TestPrograms/test_x86_ssse3.cpp
TOPT = $(SSSE3_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(SSSE3_FLAG)
CHAM_FLAG = $(SSSE3_FLAG)
KECCAK_FLAG = $(SSSE3_FLAG)
LEA_FLAG = $(SSSE3_FLAG)
LSH256_FLAG = $(SSSE3_FLAG)
LSH512_FLAG = $(SSSE3_FLAG)
SIMON128_FLAG = $(SSSE3_FLAG)
SPECK128_FLAG = $(SSSE3_FLAG)
else
SSSE3_FLAG =
endif
ifeq ($(AVX_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_AVX
else ifeq ($(AVX2_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2
else ifeq ($(SHANI_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI
# The first Apple MacBooks were Core2's with SSE4.1
ifneq ($(IS_DARWIN),0)
# Add SSE2 algo's here as required
# They get a free upgrade
endif
endif
# Drop to SSE2 if available
ifeq ($(GCM_FLAG),)
ifneq ($(SSE2_FLAG),)
TPROG = TestPrograms/test_x86_sse41.cpp
TOPT = $(SSE41_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
BLAKE2B_FLAG = $(SSE41_FLAG)
BLAKE2S_FLAG = $(SSE41_FLAG)
else
SSE41_FLAG =
endif
TPROG = TestPrograms/test_x86_sse42.cpp
TOPT = $(SSE42_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRC_FLAG = $(SSE42_FLAG)
else
SSE42_FLAG =
endif
TPROG = TestPrograms/test_x86_clmul.cpp
TOPT = $(CLMUL_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
GCM_FLAG = $(SSSE3_FLAG) $(CLMUL_FLAG)
GF2N_FLAG = $(CLMUL_FLAG)
else
CLMUL_FLAG =
endif
TPROG = TestPrograms/test_x86_aes.cpp
TOPT = $(AESNI_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
AES_FLAG = $(SSE41_FLAG) $(AESNI_FLAG)
SM4_FLAG = $(SSSE3_FLAG) $(AESNI_FLAG)
else
AESNI_FLAG =
endif
TPROG = TestPrograms/test_x86_avx.cpp
TOPT = $(AVX_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
# XXX_FLAG = $(AVX_FLAG)
else
AVX_FLAG =
endif
TPROG = TestPrograms/test_x86_avx2.cpp
TOPT = $(AVX2_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_AVX2_FLAG = $(AVX2_FLAG)
LSH256_AVX2_FLAG = $(AVX2_FLAG)
LSH512_AVX2_FLAG = $(AVX2_FLAG)
else
AVX2_FLAG =
endif
TPROG = TestPrograms/test_x86_sha.cpp
TOPT = $(SHANI_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA_FLAG = $(SSE42_FLAG) $(SHANI_FLAG)
else
SHANI_FLAG =
endif
ifeq ($(SSE3_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE3
else ifeq ($(SSSE3_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
else ifeq ($(SSE41_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
else ifeq ($(SSE42_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_SSE4
endif
ifneq ($(SSE42_FLAG),)
# Unusual GCC/Clang on Macports. It assembles AES, but not CLMUL.
# test_x86_clmul.s:15: no such instruction: 'pclmulqdq $0, %xmm1,%xmm0'
ifeq ($(CLMUL_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_CLMUL
endif
ifeq ($(AESNI_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
endif
ifeq ($(AVX_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_AVX
else ifeq ($(AVX2_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_AVX2
endif
# SHANI independent of AVX per GH #1045
ifeq ($(SHANI_FLAG),)
CRYPTOPP_CXXFLAGS += -DCRYPTOPP_DISABLE_SHANI
endif
endif
# Drop to SSE2 if available
ifeq ($(GCM_FLAG),)
GCM_FLAG = $(SSE2_FLAG)
endif
# Most Clang cannot handle mixed asm with positional arguments, where the
# body is Intel style with no prefix and the templates are AT&T style.
# Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
# CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all
# Clang compilers. This test will need to be re-enabled if Clang fixes it.
#TPROG = TestPrograms/test_asm_mixed.cpp
#TOPT =
#HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
#ifneq ($(strip $(HAVE_OPT)),0)
# CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
#endif
# SSE2_FLAGS
endif
# Most Clang cannot handle mixed asm with positional arguments, where the
# body is Intel style with no prefix and the templates are AT&T style.
# Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
# CRYPTOPP_DISABLE_MIXED_ASM is now being added in config_asm.h for all
# Clang compilers. This test will need to be re-enabled if Clang fixes it.
#TPROG = TestPrograms/test_asm_mixed.cxx
#HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
#ifneq ($(strip $(HAVE_OPT)),0)
# CXXFLAGS += -DCRYPTOPP_DISABLE_MIXED_ASM
#endif
# DETECT_FEATURES
endif
@ -393,16 +408,16 @@ ifeq ($(DETECT_FEATURES),1)
endif
# Clang needs an option to include <arm_neon.h>
TPROG = TestPrograms/test_arm_neon_header.cxx
TOPT = $(NEON_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_neon_header.cpp
TOPT = -DCRYPTOPP_ARM_NEON_HEADER=1 $(NEON_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
TEXTRA += -DCRYPTOPP_ARM_NEON_HEADER=1
endif
TPROG = TestPrograms/test_arm_neon.cxx
TPROG = TestPrograms/test_arm_neon.cpp
TOPT = $(NEON_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(NEON_FLAG)
AES_FLAG = $(NEON_FLAG)
@ -418,7 +433,14 @@ ifeq ($(DETECT_FEATURES),1)
SPECK128_FLAG = $(NEON_FLAG)
SM4_FLAG = $(NEON_FLAG)
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
NEON_FLAG =
endif
ifeq ($(NEON_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
@ -435,11 +457,11 @@ ifneq ($(IS_ARMV8),0)
ifeq ($(DETECT_FEATURES),1)
ifeq ($(IS_IOS),1)
ASIMD_FLAG =
CRC_FLAG =
AES_FLAG =
PMUL_FLAG =
SHA_FLAG =
ASIMD_FLAG = -arch arm64
CRC_FLAG = -arch arm64
AES_FLAG = -arch arm64
PMUL_FLAG = -arch arm64
SHA_FLAG = -arch arm64
else
ASIMD_FLAG = -march=armv8-a
CRC_FLAG = -march=armv8-a+crc
@ -449,23 +471,23 @@ ifeq ($(DETECT_FEATURES),1)
SHA_FLAG = -march=armv8-a+crypto
endif
TPROG = TestPrograms/test_arm_neon_header.cxx
TOPT =
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_neon_header.cpp
TOPT = -DCRYPTOPP_ARM_NEON_HEADER=1
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
TEXTRA += -DCRYPTOPP_ARM_NEON_HEADER=1
endif
TPROG = TestPrograms/test_arm_acle_header.cxx
TOPT = $(ASIMD_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_acle_header.cpp
TOPT = -DCRYPTOPP_ARM_ACLE_HEADER=1 $(ASIMD_FLAG)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
THEADER += -DCRYPTOPP_ARM_ACLE_HEADER=1
TEXTRA += -DCRYPTOPP_ARM_ACLE_HEADER=1
endif
TPROG = TestPrograms/test_arm_asimd.cxx
TPROG = TestPrograms/test_arm_asimd.cpp
TOPT = $(ASIMD_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(ASIMD_FLAG)
BLAKE2B_FLAG = $(ASIMD_FLAG)
@ -478,73 +500,92 @@ ifeq ($(DETECT_FEATURES),1)
SPECK128_FLAG = $(ASIMD_FLAG)
SM4_FLAG = $(ASIMD_FLAG)
else
# Make does not have useful debugging facilities. Show the user
# what happened by compiling again without the pipe.
$(info Running make again to see what failed)
$(info $(shell $(TCOMMAND)))
ASIMD_FLAG =
endif
ifeq ($(ASIMD_FLAG),)
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
TPROG = TestPrograms/test_arm_crc.cxx
ifneq ($(ASIMD_FLAG),)
TPROG = TestPrograms/test_arm_crc.cpp
TOPT = $(CRC_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
CRC_FLAG =
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_CRC32
endif
TPROG = TestPrograms/test_arm_aes.cxx
TPROG = TestPrograms/test_arm_aes.cpp
TOPT = $(AES_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
AES_FLAG =
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_AES
endif
TPROG = TestPrograms/test_arm_pmull.cxx
TPROG = TestPrograms/test_arm_pmull.cpp
TOPT = $(PMULL_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
GCM_FLAG =
GF2N_FLAG =
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_PMULL
endif
TPROG = TestPrograms/test_arm_sha1.cxx
TPROG = TestPrograms/test_arm_sha1.cpp
TOPT = $(SHA_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
SHA_FLAG =
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA1
endif
TPROG = TestPrograms/test_arm_sha256.cxx
TPROG = TestPrograms/test_arm_sha256.cpp
TOPT = $(SHA_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
SHA_FLAG =
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA2
endif
TPROG = TestPrograms/test_arm_sm3.cxx
TOPT = -march=armv8.4-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_sm3.cpp
TOPT = -march=armv8.4-a+sm3
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SM3_FLAG = -march=armv8.4-a+crypto
SM4_FLAG = -march=armv8.4-a+crypto
SM3_FLAG = -march=armv8.4-a+sm3
SM4_FLAG = -march=armv8.4-a+sm3
else
#CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM3
#CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4
endif
TPROG = TestPrograms/test_arm_sha3.cxx
TOPT = -march=armv8.4-a+crypto
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
TPROG = TestPrograms/test_arm_sha3.cpp
TOPT = -march=armv8.4-a+sha3
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA3_FLAG = -march=armv8.4-a+crypto
SHA512_FLAG = -march=armv8.4-a+crypto
SHA3_FLAG = -march=armv8.4-a+sha3
else
#CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA3
#CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4
endif
TPROG = TestPrograms/test_arm_sha512.cpp
TOPT = -march=armv8.4-a+sha512
HAVE_OPT = $(shell $(TCOMMAND) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA512_FLAG = -march=armv8.4-a+sha512
else
#CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA512
endif
# ASIMD_FLAG
endif
# DETECT_FEATURES
endif
# IS_ARMV8
@ -740,7 +781,7 @@ clean:
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(CLEAN_OBJS) $(ANDROID_CPU_OBJ) rdrand-*.o
@-$(RM) libcryptopp.a libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a
@-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX) libcryptopp.so$(SOLIB_VERSION_SUFFIX)
@-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct et
@-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.dat ct et
@-$(RM) *.la *.lo *.gcov *.gcno *.gcda *.stackdump core core-*
@-$(RM) /tmp/adhoc.exe
@-$(RM) -r /tmp/cryptopp_test/
@ -769,6 +810,7 @@ android-clean:
.PHONY: distclean
distclean: clean autotools-clean cmake-clean android-clean
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
-$(RM) cryptest_all.info cryptest_debug.info cryptest_noasm.info cryptest_base.info cryptest.info cryptest_release.info
@-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~
@-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
@-$(RM) -r $(LIBOBJS:.o=.obj) $(TESTOBJS:.o=.obj)
@ -950,6 +992,22 @@ keccak_simd.o : keccak_simd.cpp
lea_simd.o : lea_simd.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LEA_FLAG) -c) $<
# SSSE3 available
lsh256_sse.o : lsh256_sse.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LSH256_FLAG) -c) $<
# AVX2 available
lsh256_avx.o : lsh256_avx.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LSH256_AVX2_FLAG) -c) $<
# SSSE3 available
lsh512_sse.o : lsh512_sse.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LSH512_FLAG) -c) $<
# AVX2 available
lsh512_avx.o : lsh512_avx.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LSH512_AVX2_FLAG) -c) $<
# NEON available
neon_simd.o : neon_simd.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(NEON_FLAG) -c) $<

View File

@ -541,4 +541,4 @@ last several releases.
- minor release, no recompile of programs required
- expanded community input and support
* 70 unique contributors as of this release
- port to Apple M1
- port to Apple M1 hardware

View File

@ -1,5 +1,5 @@
Crypto++: free C++ Class Library of Cryptographic Schemes
Version 8.5 - March 7, 2021
Version 8.6 - TBD
Crypto++ Library is a free C++ class library of cryptographic schemes.
Currently the library contains the following algorithms:
@ -28,9 +28,9 @@ Currently the library contains the following algorithms:
Poly1305, Poly1305 (IETF), SipHash, Two-Track-MAC,
VMAC
BLAKE2s, BLAKE2b, Keccack (F1600), SHA-1,
hash functions SHA-2 (224/256/384/512), SHA-3 (224/256/384/512),
SHAKE (128/256), SipHash, SM3, Tiger,
BLAKE2s, BLAKE2b, Keccack (F1600), LSH (256/512),
hash functions SHA-1, SHA-2 (224/256/384/512), SHA-3 (224/256),
SHA-3 (384/512), SHAKE (128/256), SipHash, SM3, Tiger,
RIPEMD (128/160/256/320), WHIRLPOOL
RSA, DSA, Deterministic DSA, ElGamal,
@ -76,8 +76,8 @@ Other features include:
* A high level interface for most of the above, using a filter/pipeline
metaphor
* benchmarks and validation testing
* x86, x64 (x86-64), x32 (ILP32), ARM-32, Aarch32, Aarch64 and Power8 in-core code
for the commonly used algorithms
* x86, x64 (x86-64), x32 (ILP32), ARM-32, Aarch32, Aarch64 and Power8
in-core code for the commonly used algorithms
+ run-time CPU feature detection and code selection
+ supports GCC-style and MSVC-style inline assembly, and MASM for x64
+ x86, x64 (x86-64), x32 provides MMX, SSE2, and SSE4 implementations
@ -128,9 +128,8 @@ cryptdll - This builds the DLL. Please note that if you wish to use Crypto++
dlltest - This builds a sample application that only uses the DLL.
The DLL used to provide FIPS validated cryptography. The library was moved
to the CMVP's <A HREF=
"http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140val-historical.htm">
Historical Validation List</A>. The library and the DLL are no longer considered
to the CMVP's [Historical Validation List](http://csrc.nist.gov/groups/STM/cmvp/documents/140-1/140val-historical.htm).
The library and the DLL are no longer considered
validated. You should no longer use the DLL.
To use the Crypto++ DLL in your application, #include "dll.h" before including
@ -213,14 +212,14 @@ to internal buffer attacks as "Microarchitectural Data Sampling" (MDS).
The library uses hardware instructions when possible for block ciphers, hashes
and other operations. The hardware acceleration remediates some timing
attacks. The library also uses cache-aware algoirthms and access patterns
attacks. The library also uses cache-aware algorithms and access patterns
to minimize leakage cache evictions.
Elliptic curves over binary fields are believed to leak information. The task is a
work in progress. We don't believe binary fields are used in production, so we feel it
is a low risk at the moment.
Crypto++ does not enagage Specter remediations at this time. The GCC options
Crypto++ does not engage Specter remediations at this time. The GCC options
for Specter are -mfunction-return=thunk and -mindirect-branch=thunk, and the
library uses them during testing. If you want the Specter workarounds then add
the GCC options to your CXXFLAGS when building the library.
@ -295,11 +294,36 @@ documentation is one of the highest returns on investment.
The items in this section comprise the most recent history. Please see History.txt
for the record back to Crypto++ 1.0.
8.6.0 - September 21, 2021
- minor release, recompile of programs required
- expanded community input and support
* 74 unique contributors as of this release
- fix ElGamal encryption
- fix ChaCha20 AVX2 implementation
- add octal and decimal literal prefix parsing to Integer
- add missing overload in ed25519Signer and ed25519Verifier
- make SHA-NI independent of AVX and AVX2
- fix OldRandomPool GenerateWord32
- use CPPFLAGS during feature testing
- fix compile on CentOS 5
- fix compile on FreeBSD
- fix feature testing on ARM A-32 and Aarch64
- enable inline ASM for CRC and PMULL on Apple M1
- fix Intel oneAPI compile
- rename test files with *.cpp extension
- fix GCC compile error due to missing _mm256_set_m128i
- add LSH-256 and LSH-512 hash functions
- add ECIES_P1363 for backwards compatibility
- fix AdditiveCipherTemplate<T> ProcessData
- remove CRYPTOPP_NO_CXX11 define
- add -fno-common for Darwin builds
- update documentation
8.5.0 - March 7, 2021
- minor release, no recompile of programs required
- expanded community input and support
* 70 unique contributors as of this release
- port to Apple M1
- port to Apple M1 hardware
8.4.0 - January 2, 2021
- minor release, recompile of programs required

View File

@ -1,11 +1,11 @@
// dump2def.cxx - Written and placed in public domain by Jeffrey Walton
// dump2def.cpp - Written and placed in public domain by Jeffrey Walton
// Create a module definitions file from a dumpbin file.
// dump2def can be used to create a list of exports from
// a static library. Then, the exports can used to build
// a dynamic link library with the same exports.
//
// If you wish to compile this source file using cl.exe, then:
// cl.exe /DNDEBUG /Oi /Oy /O2 /Zi /TP /GR /EHsc /MT dump2def.cxx
// cl.exe /DNDEBUG /Oi /Oy /O2 /Zi /TP /GR /EHsc /MT dump2def.cpp
//
// The intended workflow in Crypto++ is:
//

View File

@ -2,9 +2,6 @@
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{

View File

@ -0,0 +1,23 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#if (CRYPTOPP_ARM_ACLE_HEADER)
# include <stdint.h>
# include <arm_acle.h>
#endif
// Keep sync'd with arm_simd.h
#include "../arm_simd.h"
int main(int argc, char* argv[])
{
uint32_t w=0xffffffff;
w = CRC32B(w,w);
w = CRC32W(w,w);
w = CRC32CB(w,w);
w = CRC32CW(w,w);
return 0;
}

View File

@ -1,21 +0,0 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{
uint32_t w=0xffffffff;
w = __crc32w(w,w);
w = __crc32h(w,w);
w = __crc32b(w,w);
w = __crc32cw(w,w);
w = __crc32ch(w,w);
w = __crc32cb(w,w);
return 0;
}

View File

@ -2,9 +2,6 @@
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{

View File

@ -0,0 +1,26 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
// Keep sync'd with arm_simd.h
#include "../arm_simd.h"
int main(int argc, char* argv[])
{
// Linaro is missing a lot of pmull gear. Also see http://github.com/weidai11/cryptopp/issues/233.
const uint64_t wa1[]={0,0x9090909090909090}, wb1[]={0,0xb0b0b0b0b0b0b0b0};
const uint64x2_t a1=vld1q_u64(wa1), b1=vld1q_u64(wb1);
const uint8_t wa2[]={0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0},
wb2[]={0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,
0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0};
const uint8x16_t a2=vld1q_u8(wa2), b2=vld1q_u8(wb2);
const uint64x2_t r1 = PMULL_00(a1, b1);
const uint64x2_t r2 = PMULL_11(vreinterpretq_u64_u8(a2),
vreinterpretq_u64_u8(b2));
return 0;
}

View File

@ -1,20 +0,0 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{
const poly64_t a=0x60606060, b=0x90909090, c=0xb0b0b0b0;
const poly64x2_t d={0x60606060,0x90909090};
const poly8x16_t e={0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0,0xa0};
const poly128_t r1 = vmull_p64(a, b);
const poly128_t r2 = vmull_high_p64(d, d);
return 0;
}

View File

@ -2,9 +2,6 @@
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{

View File

@ -2,9 +2,6 @@
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{

View File

@ -0,0 +1,19 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
// Keep sync'd with arm_simd.h
#include "../arm_simd.h"
int main(int argc, char* argv[])
{
// SHA3 intrinsics are merely ARMv8.2 instructions.
// https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics
uint32x4_t x={0}, y={1}, z={2};
x=VEOR3(x,y,z);
x=VXAR(y,z,6);
x=VRAX1(y,z);
return 0;
}

View File

@ -1,27 +0,0 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{
// SM4 block cipher
uint32x4_t x;
x=vsm4ekeyq_u32(x,x);
x=vsm4eq_u32(x,x);
// SM3 hash
uint32x4_t y;
y=vsm3ss1q_u32(x,y,y);
y=vsm3tt1aq_u32(x,y,y,3);
y=vsm3tt1bq_u32(x,y,y,1);
y=vsm3tt2aq_u32(x,y,y,2);
y=vsm3tt2bq_u32(x,y,y,3);
y=vsm3partw1q_u32(x,y,y);
y=vsm3partw2q_u32(x,y,y);
return 0;
}

View File

@ -0,0 +1,17 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
int main(int argc, char* argv[])
{
// SHA512 hash
// https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SHA512
uint32x4_t w={0}, x={0}, y={0}, z={0};
w=vsha512hq_u64(x,y,z);
w=vsha512h2q_u64(x,y);
w=vsha512su0q_u64(x,y);
w=vsha512su1q_u64 (x,y,z);
return 0;
}

View File

@ -1,27 +0,0 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{
// SM4 block cipher
uint32x4_t x;
x=vsm4ekeyq_u32(x,x);
x=vsm4eq_u32(x,x);
// SM3 hash
uint32x4_t y;
y=vsm3ss1q_u32(x,y,y);
y=vsm3tt1aq_u32(x,y,y,3);
y=vsm3tt1bq_u32(x,y,y,1);
y=vsm3tt2aq_u32(x,y,y,2);
y=vsm3tt2bq_u32(x,y,y,3);
y=vsm3partw1q_u32(x,y,y);
y=vsm3partw2q_u32(x,y,y);
return 0;
}

View File

@ -2,13 +2,11 @@
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{
// SM3 hash
// https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SM3
uint32x4_t y;
y=vsm3ss1q_u32(x,y,y);
y=vsm3tt1aq_u32(x,y,y,3);

View File

@ -0,0 +1,15 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
int main(int argc, char* argv[])
{
// SM4 block cipher
// https://developer.arm.com/architectures/instruction-sets/simd-isas/neon/intrinsics?search=SM4
uint32x4_t x, y={1}, z={2};
x=vsm4ekeyq_u32(y,z);
x=vsm4eq_u32(y,z);
return 0;
}

View File

@ -1,16 +0,0 @@
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
#ifdef CRYPTOPP_ARM_ACLE_HEADER
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{
// SM4 block cipher
uint32x4_t x;
x=vsm4ekeyq_u32(x,x);
x=vsm4eq_u32(x,x);
return 0;
}

View File

@ -17,7 +17,7 @@
// XL C++ on AIX does not define VSX and does not
// provide an option to set it. We have to set it
// for the code below. This define must stay in
// sync with the define in test_ppc_power7.cxx.
// sync with the define in test_ppc_power7.cpp.
#if defined(_AIX) && defined(_ARCH_PWR7) && defined(__xlC__)
# define __VSX__ 1
#endif

View File

@ -17,7 +17,7 @@
// XL C++ on AIX does not define CRYPTO and does not
// provide an option to set it. We have to set it
// for the code below. This define must stay in
// sync with the define in test_ppc_power8.cxx
// sync with the define in test_ppc_power8.cpp
#if defined(_AIX) && defined(_ARCH_PWR8) && defined(__xlC__)
# define __CRYPTO__ 1
#endif

View File

@ -16,14 +16,14 @@
#
#############################################################################
sed 's|Library 8.4 API|Library 8.3 API|g' cryptlib.h > cryptlib.h.new
sed 's/Library 8.6 API/Library 8.5 API/g' cryptlib.h > cryptlib.h.new
mv cryptlib.h.new cryptlib.h
sed 's|= 8.4|= 8.3|g' Doxyfile > Doxyfile.new
sed 's/= 8.6/= 8.5/g' Doxyfile > Doxyfile.new
mv Doxyfile.new Doxyfile
sed 's|CRYPTOPP_MINOR 4|CRYPTOPP_MINOR 3|g' config_ver.h > config_ver.h.new
sed 's/CRYPTOPP_MINOR 6/CRYPTOPP_MINOR 5/g' config_ver.h > config_ver.h.new
mv config_ver.h.new config_ver.h
sed 's|CRYPTOPP_VERSION 840|CRYPTOPP_VERSION 830|g' config_ver.h > config_ver.h.new
sed 's/CRYPTOPP_VERSION 860/CRYPTOPP_VERSION 850/g' config_ver.h > config_ver.h.new
mv config_ver.h.new config_ver.h

View File

@ -53,9 +53,10 @@ elif [[ ! -w ./config_asm.h ]]; then
fi
TMPDIR="${TMPDIR:-$HOME/tmp}"
TPROG="${TPROG:-TestPrograms/test_cxx.cxx}"
TPROG="${TPROG:-TestPrograms/test_cxx.cpp}"
TOUT="${TOUT:-a.out}"
CC="${CC:-cc}"
CXX="${CXX:-c++}"
LD="${LD:-ld}"
CXXFLAGS="${CXXFLAGS:--DNDEBUG -g2 -O3}"
@ -216,12 +217,12 @@ then
# Shell redirection
{
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_x86_sse2.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_x86_sse2.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -ne 0 ]]; then
echo '#define CRYPTOPP_DISABLE_ASM 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_asm_sse2.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_asm_sse2.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_X86_ASM_AVAILABLE 1'
if [[ "${IS_X64}" -ne 0 ]]; then
@ -230,13 +231,13 @@ then
fi
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_x86_sse2.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_x86_sse2.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
have_sse2=1
echo '#define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE3_FLAG} TestPrograms/test_x86_sse3.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE3_FLAG} TestPrograms/test_x86_sse3.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
have_sse3=1
echo '#define CRYPTOPP_SSE3_AVAILABLE 1'
@ -245,7 +246,7 @@ then
echo '#define CRYPTOPP_DISABLE_SSE3 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSSE3_FLAG} TestPrograms/test_x86_ssse3.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSSE3_FLAG} TestPrograms/test_x86_ssse3.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse3" -ne 0 ]]; then
have_ssse3=1
echo '#define CRYPTOPP_SSSE3_ASM_AVAILABLE 1'
@ -255,7 +256,7 @@ then
echo '#define CRYPTOPP_DISABLE_SSSE3 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE41_FLAG} TestPrograms/test_x86_sse41.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE41_FLAG} TestPrograms/test_x86_sse41.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_ssse3" -ne 0 ]]; then
have_sse41=1
echo '#define CRYPTOPP_SSE41_AVAILABLE 1'
@ -265,7 +266,7 @@ then
echo '#define CRYPTOPP_DISABLE_SSE41 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE42_FLAG} TestPrograms/test_x86_sse42.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE42_FLAG} TestPrograms/test_x86_sse42.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse41" -ne 0 ]]; then
have_sse42=1
echo '#define CRYPTOPP_SSE42_AVAILABLE 1'
@ -278,42 +279,42 @@ then
########################################################
# AES, CLMUL, RDRAND, RDSEED, SHA and AVX tied to SSE4.2
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${CLMUL_FLAG} TestPrograms/test_x86_clmul.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${CLMUL_FLAG} TestPrograms/test_x86_clmul.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then
echo '#define CRYPTOPP_CLMUL_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_CLMUL 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AESNI_FLAG} TestPrograms/test_x86_aes.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AESNI_FLAG} TestPrograms/test_x86_aes.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then
echo '#define CRYPTOPP_AESNI_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_AESNI 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${RDRAND_FLAG} TestPrograms/test_x86_rdrand.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${RDRAND_FLAG} TestPrograms/test_x86_rdrand.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then
echo '#define CRYPTOPP_RDRAND_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_RDRAND 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${RDSEED_FLAG} TestPrograms/test_x86_rdseed.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${RDSEED_FLAG} TestPrograms/test_x86_rdseed.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then
echo '#define CRYPTOPP_RDSEED_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_RDSEED 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SHANI_FLAG} TestPrograms/test_x86_sha.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SHANI_FLAG} TestPrograms/test_x86_sha.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then
echo '#define CRYPTOPP_SHANI_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_SHANI 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AVX_FLAG} TestPrograms/test_x86_avx.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AVX_FLAG} TestPrograms/test_x86_avx.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then
have_avx=1
echo '#define CRYPTOPP_AVX_AVAILABLE 1'
@ -325,7 +326,7 @@ then
#####################
# AVX2 depends on AVX
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AVX2_FLAG} TestPrograms/test_x86_avx2.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AVX2_FLAG} TestPrograms/test_x86_avx2.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_avx" -ne 0 ]]; then
have_avx2=1
echo '#define CRYPTOPP_AVX2_AVAILABLE 1'
@ -335,7 +336,7 @@ then
fi
# No flags, requires inline ASM
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_rng.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_rng.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_PADLOCK_RNG_AVAILABLE 1'
else
@ -343,7 +344,7 @@ then
fi
# No flags, requires inline ASM
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_aes.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_aes.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_PADLOCK_AES_AVAILABLE 1'
else
@ -351,7 +352,7 @@ then
fi
# No flags, requires inline ASM
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_sha.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_sha.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_PADLOCK_SHA_AVAILABLE 1'
else
@ -359,7 +360,7 @@ then
fi
# Clang workaround
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_asm_mixed.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_asm_mixed.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -ne 0 ]]; then
echo '#define CRYPTOPP_DISABLE_MIXED_ASM 1'
fi
@ -379,6 +380,13 @@ then
echo '#endif'
fi
echo ''
echo '// Clang intrinsic casts, http://bugs.llvm.org/show_bug.cgi?id=20670'
echo '#define M128_CAST(x) ((__m128i *)(void *)(x))'
echo '#define CONST_M128_CAST(x) ((const __m128i *)(const void *)(x))'
echo '#define M256_CAST(x) ((__m256i *)(void *)(x))'
echo '#define CONST_M256_CAST(x) ((const __m256i *)(const void *)(x))'
} >> config_asm.h.new
fi
@ -404,20 +412,20 @@ then
# Shell redirection
{
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${NEON_FLAG} TestPrograms/test_arm_neon_header.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${NEON_FLAG} TestPrograms/test_arm_neon_header.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_NEON_HEADER 1'
HDRFLAGS="-DCRYPTOPP_ARM_NEON_HEADER=1"
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV7_FLAG} TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV7_FLAG} TestPrograms/test_cxx.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_ARMV7_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_ARMV7 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${NEON_FLAG} TestPrograms/test_arm_neon.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${NEON_FLAG} TestPrograms/test_arm_neon.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_NEON_AVAILABLE 1'
else
@ -425,23 +433,23 @@ then
fi
# Cryptogams is special. Attempt to compile the actual source files
# TestPrograms/test_cxx.cxx is needed for main().
CXX_RESULT=$(${CXX} ${CXXFLAGS} aes_armv4.S TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w)
# TestPrograms/test_cxx.cpp is needed for main().
CXX_RESULT=$(${CXX} ${CXXFLAGS} aes_armv4.S TestPrograms/test_cxx.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOGAMS_ARM_AES 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} sha1_armv4.S TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} sha1_armv4.S TestPrograms/test_cxx.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOGAMS_ARM_SHA1 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} sha256_armv4.S TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} sha256_armv4.S TestPrograms/test_cxx.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOGAMS_ARM_SHA256 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} sha512_armv4.S TestPrograms/test_cxx.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} sha512_armv4.S TestPrograms/test_cxx.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOGAMS_ARM_SHA512 1'
fi
@ -472,19 +480,19 @@ then
# Shell redirection
{
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_arm_neon_header.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_arm_neon_header.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_NEON_HEADER 1'
HDRFLAGS="-DCRYPTOPP_ARM_NEON_HEADER=1"
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_acle_header.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_acle_header.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_ACLE_HEADER 1'
HDRFLAGS="${HDRFLAGS} -DCRYPTOPP_ARM_ACLE_HEADER=1"
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_neon.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_neon.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_NEON_AVAILABLE 1'
else
@ -492,35 +500,35 @@ then
fi
# This should be an unneeded test. ASIMD on Aarch64 is NEON on A32 and T32
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_asimd.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} TestPrograms/test_arm_asimd.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_ASIMD_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_ASIMD 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRC_FLAG} TestPrograms/test_arm_crc.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRC_FLAG} TestPrograms/test_arm_crc.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_CRC32_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_CRC32 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_aes.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_aes.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_AES_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_AES 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_pmull.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_pmull.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_PMULL_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_PMULL 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_sha1.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_sha1.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_SHA_AVAILABLE 1'
echo '#define CRYPTOPP_ARM_SHA1_AVAILABLE 1'
@ -529,35 +537,35 @@ then
echo '#define CRYPTOPP_DISABLE_ARM_SHA1 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_sha256.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV81_CRYPTO_FLAG} TestPrograms/test_arm_sha256.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_SHA2_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_SHA2 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sha3.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sha3.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_SHA3_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_SHA3 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sha512.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sha512.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_SHA512_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_SHA512 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sm3.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sm3.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_SM3_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_SM3 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sm4.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${HDRFLAGS} ${ARMV84_CRYPTO_FLAG} TestPrograms/test_arm_sm4.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_SM4_AVAILABLE 1'
else
@ -595,7 +603,7 @@ then
# Shell redirection
{
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${ALTIVEC_FLAG} TestPrograms/test_ppc_altivec.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${ALTIVEC_FLAG} TestPrograms/test_ppc_altivec.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
have_altivec=1
echo '#define CRYPTOPP_ALTIVEC_AVAILABLE 1'
@ -604,7 +612,7 @@ then
echo '#define CRYPTOPP_DISABLE_ALTIVEC 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER7_PWR_FLAG} TestPrograms/test_ppc_power7.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER7_PWR_FLAG} TestPrograms/test_ppc_power7.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_altivec" -ne 0 ]]; then
have_power7=1
echo '#define CRYPTOPP_POWER7_AVAILABLE 1'
@ -613,7 +621,7 @@ then
echo '#define CRYPTOPP_DISABLE_POWER7 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_power8.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_power8.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_power7" -ne 0 ]]; then
have_power8=1
echo '#define CRYPTOPP_POWER8_AVAILABLE 1'
@ -622,7 +630,7 @@ then
echo '#define CRYPTOPP_DISABLE_POWER8 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER9_FLAG} TestPrograms/test_ppc_power9.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER9_FLAG} TestPrograms/test_ppc_power9.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then
have_power9=1
echo '#define CRYPTOPP_POWER9_AVAILABLE 1'
@ -631,21 +639,21 @@ then
echo '#define CRYPTOPP_DISABLE_POWER9 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_aes.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_aes.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then
echo '#define CRYPTOPP_POWER8_AES_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_POWER8_AES 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_vmull.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_vmull.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then
echo '#define CRYPTOPP_POWER8_VMULL_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_POWER8_VMULL 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_sha.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_sha.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then
echo '#define CRYPTOPP_POWER8_SHA_AVAILABLE 1'
else
@ -696,7 +704,7 @@ rm -f config_cxx.h.new
echo '// ***************** C++98 and C++03 ********************'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx98_exception.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx98_exception.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '// Ancient Crypto++ define, dating back to C++98.'
echo '#define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE 1'
@ -711,11 +719,11 @@ rm -f config_cxx.h.new
echo '// ***************** C++11 and above ********************'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11 1'
else
echo '// test_cxx11.cxx returned non-zero result'
echo '// test_cxx11.cpp returned non-zero result'
echo '// #define CRYPTOPP_CXX11 1'
fi
@ -723,21 +731,21 @@ rm -f config_cxx.h.new
echo '#if defined(CRYPTOPP_CXX11)'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_atomic.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_atomic.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_ATOMIC 1'
else
echo '// #define CRYPTOPP_CXX11_ATOMIC 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_auto.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_auto.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_AUTO 1'
else
echo '// #define CRYPTOPP_CXX11_AUTO 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_sync.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_sync.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_SYNCHRONIZATION 1'
else
@ -745,7 +753,7 @@ rm -f config_cxx.h.new
fi
# CRYPTOPP_CXX11_DYNAMIC_INIT is old name
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_staticinit.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_staticinit.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_STATIC_INIT 1'
echo '#define CRYPTOPP_CXX11_DYNAMIC_INIT 1'
@ -754,70 +762,70 @@ rm -f config_cxx.h.new
echo '// #define CRYPTOPP_CXX11_DYNAMIC_INIT 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_deletefn.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_deletefn.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_DELETED_FUNCTIONS 1'
else
echo '// #define CRYPTOPP_CXX11_DELETED_FUNCTIONS 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_alignas.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_alignas.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_ALIGNAS 1'
else
echo '// #define CRYPTOPP_CXX11_ALIGNAS 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_alignof.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_alignof.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_ALIGNOF 1'
else
echo '// #define CRYPTOPP_CXX11_ALIGNOF 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_initializer.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_initializer.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_INITIALIZER_LIST 1'
else
echo '// #define CRYPTOPP_CXX11_INITIALIZER_LIST 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_lambda.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_lambda.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_LAMBDA 1'
else
echo '// #define CRYPTOPP_CXX11_LAMBDA 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_noexcept.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_noexcept.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_NOEXCEPT 1'
else
echo '// #define CRYPTOPP_CXX11_NOEXCEPT 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_vartemplates.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_vartemplates.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1'
else
echo '// #define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_constexpr.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_constexpr.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_CONSTEXPR 1'
else
echo '// #define CRYPTOPP_CXX11_CONSTEXPR 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_enumtype.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_enumtype.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_STRONG_ENUM 1'
else
echo '// #define CRYPTOPP_CXX11_STRONG_ENUM 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_nullptr.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_nullptr.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_NULLPTR 1'
else
@ -825,7 +833,7 @@ rm -f config_cxx.h.new
fi
# 2-argument static assert
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_assert.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_assert.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_ASSERT 1'
else
@ -839,11 +847,11 @@ rm -f config_cxx.h.new
echo '// ***************** C++14 and above ********************'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx14.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx14.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX14 1'
else
echo '// test_cxx14.cxx returned non-zero result'
echo '// test_cxx14.cpp returned non-zero result'
echo '// #define CRYPTOPP_CXX14 1'
fi
@ -858,11 +866,11 @@ rm -f config_cxx.h.new
echo '// ***************** C++17 and above ********************'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX17 1'
else
echo '// test_cxx17.cxx returned non-zero result'
echo '// test_cxx17.cpp returned non-zero result'
echo '// #define CRYPTOPP_CXX17 1'
fi
@ -871,14 +879,14 @@ rm -f config_cxx.h.new
echo ''
# 1-argument static assert
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17_assert.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17_assert.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX17_ASSERT 1'
else
echo '// #define CRYPTOPP_CXX17_ASSERT 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17_exceptions.cxx -o ${TOUT} 2>&1 | wc -w)
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17_exceptions.cpp -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX17_UNCAUGHT_EXCEPTIONS 1'
else

View File

@ -5,7 +5,7 @@
# This script tests the cryptopp-android-mk gear using ndk-build. The
# source files include Application.mk and Android.mk.
#
# Written and placed in public domain by Jeffrey Walton.
# Written and placed in public domain by Jeffrey Walton and Uri Blumenthal.
#
# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2)
# licensed under the Boost Software License 1.0, while the individual files
@ -62,7 +62,18 @@ rm -rf "${TMPDIR}/build.log" 2>/dev/null
#############################################################################
files=(Android.mk Application.mk make_neon.sh test_shared.hxx test_shared.cxx)
# Prepare the environment
unset CXX CPPFLAGS CXXFLAGS LDFLAGS
unset ANDROID_CPPFLAGS ANDROID_CXXFLAGS ANDROID_LDFLAGS ANDROID_SYSROOT
if [[ -e TestScripts/setenv-android.sh ]]; then
cp TestScripts/setenv-android.sh .
chmod u+x setenv-android.sh
fi
#############################################################################
files=(Android.mk Application.mk test_shared.hxx test_shared.cxx)
for file in "${files[@]}"; do
echo "Downloading $file"
@ -76,18 +87,6 @@ for file in "${files[@]}"; do
sleep 1
done
# Fix permissions and quarantine
chmod u=rwx,go=rx make_neon.sh
if [[ "${IS_DARWIN}" -ne 0 ]] && [[ $(command -v xattr 2>/dev/null) ]]; then
echo "Removing make_neon.sh quarantine"
xattr -d "com.apple.quarantine" make_neon.sh &>/dev/null
fi
# Fix missing *neon files
echo "Adding NEON files for armeabi-v7a"
bash make_neon.sh
#############################################################################
# Paydirt

View File

@ -4,7 +4,7 @@
#
# This script tests Android cross-compiles using setenv-android.sh script.
#
# Written and placed in public domain by Jeffrey Walton.
# Written and placed in public domain by Jeffrey Walton and Uri Blumenthal.
#
# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2)
# licensed under the Boost Software License 1.0, while the individual files
@ -61,6 +61,17 @@ rm -rf "${TMPDIR}/build.log" 2>/dev/null
#############################################################################
# Prepare the environment
unset CXX CPPFLAGS CXXFLAGS LDFLAGS
unset ANDROID_CPPFLAGS ANDROID_CXXFLAGS ANDROID_LDFLAGS ANDROID_SYSROOT
if [[ -e TestScripts/setenv-android.sh ]]; then
cp TestScripts/setenv-android.sh .
chmod u+x setenv-android.sh
fi
#############################################################################
PLATFORMS=(armv7a aarch64 x86 x86_64)
for platform in "${PLATFORMS[@]}"
@ -100,6 +111,116 @@ do
echo "${platform} ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test code generation
if [[ "${platform}" == "armv7a" ]]
then
# Test NEON code generation
count=$(${OBJDUMP} --disassemble aria_simd.o 2>&1 | grep -c -E 'vld|vst|vshl|vshr|veor')
if [[ "${count}" -gt 64 ]]
then
echo "${platform} : NEON ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : NEON ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
elif [[ "${platform}" == "aarch64" ]]
then
# Test ASIMD code generation
count=$(${OBJDUMP} --disassemble aria_simd.o 2>&1 | grep -c -E 'vld|vst|vshl|vshr|veor')
if [[ "${count}" -gt 64 ]]
then
echo "${platform} : ASIMD ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : ASIMD ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test AES code generation
count=$(${OBJDUMP} --disassemble rijndael_simd.o 2>&1 | grep -c -E 'aese|aesd|aesmc|aesimc')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : AES ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : AES ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test PMULL code generation
count=$(${OBJDUMP} --disassemble gcm_simd.o 2>&1 | grep -c -E 'pmull|pmull2')
if [[ "${count}" -gt 16 ]]
then
echo "${platform} : PMULL ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : PMULL ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test SHA1 code generation
count=$(${OBJDUMP} --disassemble sha_simd.o 2>&1 | grep -c -E 'sha1c|sha1m|sha1p|sha1h|sha1su0|sha1su1')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : SHA1 ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : SHA1 ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test SHA2 code generation
count=$(${OBJDUMP} --disassemble sha_simd.o | grep -c -E 'sha256h|sha256su0|sha256su1')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : SHA2 ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : SHA2 ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
elif [[ "${platform}" == "x86" || "${platform}" == "x86_64" ]]
then
# Test AES code generation
count=$(${OBJDUMP} --disassemble rijndael_simd.o 2>&1 | grep -c -E 'aesenc|aesdec|aesenclast|aesdeclast|aesimc')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : AES ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : AES ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test CLMUL code generation
count=$(${OBJDUMP} --disassemble gcm_simd.o 2>&1 | grep -c -E 'pclmulqdq|pclmullqlq|pclmullqhq|vpclmulqdq')
if [[ "${count}" -gt 16 ]]
then
echo "${platform} : CLMUL ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : CLMUL ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test SHA1 code generation
count=$(${OBJDUMP} --disassemble sha_simd.o 2>&1 | grep -c -E 'sha1rnds4|sha1nexte|sha1msg1|sha1msg2')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : SHA1 ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : SHA1 ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test SHA2 code generation
count=$(${OBJDUMP} --disassemble sha_simd.o | grep -c -E 'sha256rnds2|sha256msg1|sha256msg2')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : SHA2 ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : SHA2 ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
fi
)
done

View File

@ -0,0 +1,149 @@
#!/usr/bin/env bash
if ! command -v gcov > /dev/null; then
echo "Please install gcov"
exit 1
fi
if ! command -v lcov > /dev/null; then
echo "Please install lcov"
exit 1
fi
# Default make jobs
MAKE_JOBS=${MAKE_JOBS:-4}
# Default temp directory
if [ -z "${TMPDIR}" ];
then
if [ -d "${HOME}/tmp" ]; then
TMPDIR="${HOME}/tmp"
else
TMPDIR="/tmp"
fi
fi
DEBUG_CXXFLAGS="-DDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
NOASM_CXXFLAGS="-DNDEBUG -DCRYPTOPP_DISABLE_ASM -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
RELEASE_CXXFLAGS="-DNDEBUG -DCRYPTOPP_COVERAGE=1 -g3 -O1 -coverage"
# Clean old artifacts
rm -rf TestCoverage/ >/dev/null
make distclean >/dev/null
echo "**************************************************"
echo "***** Baseline build *****"
echo "**************************************************"
# The man page says to run a baseline, but the cryptest_base recipe
# breaks things. Zeroing the counters seems to be the best we can do.
if lcov --base-directory . --directory . --zerocounters;
then
echo
echo "Baseline zero counters ok"
echo
else
echo
echo "Baseline zero counters failed"
echo
fi
#make clean > /dev/null
#if ! make -j "${MAKE_JOBS}";
#then
# echo "Baseline build failed"
# exit 1
#fi
# Run test programs
#./cryptest.exe v
#./cryptest.exe tv all
# Create a baseline
#lcov --base-directory . --directory . -i -c -o cryptest_base.info
echo "**************************************************"
echo "***** Debug build *****"
echo "**************************************************"
make clean > /dev/null
if ! CXXFLAGS="${DEBUG_CXXFLAGS}" make -j "${MAKE_JOBS}";
then
echo "Debug build failed"
exit 1
fi
# Run test programs
./cryptest.exe v
./cryptest.exe tv all
# Gather data
lcov --base-directory . --directory . -c -o cryptest_debug.info
echo "**************************************************"
echo "***** No ASM build *****"
echo "**************************************************"
make clean > /dev/null
if ! CXXFLAGS="${NOASM_CXXFLAGS}" make -j "${MAKE_JOBS}";
then
echo "No ASM build failed"
exit 1
fi
# Run test programs
./cryptest.exe v
./cryptest.exe tv all
# Gather data
lcov --base-directory . --directory . -c -o cryptest_noasm.info
echo "**************************************************"
echo "***** Release build *****"
echo "**************************************************"
make clean > /dev/null
if ! CXXFLAGS="${RELEASE_CXXFLAGS}" make -j "${MAKE_JOBS}";
then
echo "Release build failed"
exit 1
fi
# Run test programs
./cryptest.exe v
./cryptest.exe tv all
./cryptest.exe b 0.5
# Gather data
lcov --base-directory . --directory . -c -o cryptest_release.info
echo "**************************************************"
echo "***** HTML processing *****"
echo "**************************************************"
if [ ! -e cryptest_debug.info ]; then
echo "WARN: cryptest_debug.info does not exist"
fi
if [ ! -e cryptest_noasm.info ]; then
echo "WARN: cryptest_noasm.info does not exist"
fi
if [ ! -e cryptest_release.info ]; then
echo "WARN: cryptest_release.info does not exist"
fi
# The man page says to run a baseline, but the cryptest_base recipe
# breaks things. Zeroing the counters seems to be the best we can do.
# --add-tracefile cryptest_base.info
lcov --add-tracefile cryptest_debug.info \
--add-tracefile cryptest_noasm.info \
--add-tracefile cryptest_release.info \
--output-file cryptest_all.info
lcov --remove cryptest_all.info \
'/usr/*' '*/adhoc*.*' '*/dlltest*.*' '*/fipstest*.*' '*/fips140*.*' '*/test*.*' \
--output-file cryptest.info
genhtml -o TestCoverage/ -t "Crypto++ test coverage" --num-spaces 4 cryptest.info
exit 0

View File

@ -4,7 +4,7 @@
#
# This script tests the cryptopp-ios gear.
#
# Written and placed in public domain by Jeffrey Walton.
# Written and placed in public domain by Jeffrey Walton and Uri Blumenthal.
#
# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2)
# licensed under the Boost Software License 1.0, while the individual files
@ -35,6 +35,17 @@ rm -rf "${TMPDIR}/build.log" 2>/dev/null
#############################################################################
# Prepare the environment
unset CXX CPPFLAGS CXXFLAGS LDFLAGS
unset IOS_CPPFLAGS IOS_CXXFLAGS IOS_LDFLAGS IOS_SYSROOT
if [[ -e TestScripts/setenv-ios.sh ]]; then
cp TestScripts/setenv-ios.sh .
chmod u+x setenv-ios.sh
fi
#############################################################################
# Hack a Bash data structure...
PLATFORMS=()
PLATFORMS+=("iPhoneOS:armv7")
@ -43,6 +54,7 @@ PLATFORMS+=("AppleTVOS:armv7")
PLATFORMS+=("AppleTVOS:arm64")
PLATFORMS+=("WatchOS:armv7")
PLATFORMS+=("WatchOS:arm64")
PLATFORMS+=("WatchOS:arm64_32")
PLATFORMS+=("iPhoneSimulator:i386")
PLATFORMS+=("iPhoneSimulator:x86_64")
PLATFORMS+=("AppleTVSimulator:i386")
@ -83,6 +95,7 @@ do
# run in subshell to not keep any envars
(
source ./setenv-ios.sh
if make -k -j "${MAKE_JOBS}" -f GNUmakefile-cross static dynamic cryptest.exe;
then
echo "${platform} ==> SUCCESS" >> "${TMPDIR}/build.log"
@ -90,6 +103,74 @@ do
echo "${platform} ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test code generation
if [[ "${cpu}" == "armv7" ]]
then
# Test NEON code generation
count=$(otool -tV aria_simd.o 2>&1 | grep -c -E 'vld|vst|vshl|vshr|veor')
if [[ "${count}" -gt 64 ]]
then
echo "${platform} : NEON ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : NEON ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
elif [[ "${cpu}" == "arm64" ]]
then
# Test ASIMD code generation
count=$(otool -tV aria_simd.o 2>&1 | grep -c -E 'ldr[[:space:]]*q|str[[:space:]]*q|shl.4|shr.4|eor.16')
if [[ "${count}" -gt 64 ]]
then
echo "${platform} : ASIMD ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : ASIMD ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test AES code generation
count=$(otool -tV rijndael_simd.o 2>&1 | grep -c -E 'aese|aesd|aesmc|aesimc')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : AES ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : AES ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test PMULL code generation
count=$(otool -tV gcm_simd.o 2>&1 | grep -c -E 'pmull|pmull2')
if [[ "${count}" -gt 16 ]]
then
echo "${platform} : PMULL ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : PMULL ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test SHA1 code generation
count=$(otool -tV sha_simd.o 2>&1 | grep -c -E 'sha1c|sha1m|sha1p|sha1h|sha1su0|sha1su1')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : SHA1 ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : SHA1 ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
# Test SHA2 code generation
count=$(otool -tV sha_simd.o | grep -c -E 'sha256h|sha256su0|sha256su1')
if [[ "${count}" -gt 32 ]]
then
echo "${platform} : SHA2 ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} : SHA2 ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
fi
)
done

View File

@ -35,7 +35,7 @@ if [[ "$IS_DARWIN" -ne 0 ]]; then
fi
# Fixup for Solaris and BSDs
if [[ ! -z $(command -v gmake) ]]; then
if command -v gmake 2>/dev/null; then
MAKE=gmake
else
MAKE=make
@ -43,15 +43,15 @@ fi
#############################################################################
if [[ -z $(command -v "$MAKE") ]]; then
if ! command -v "${MAKE}" 2>/dev/null; then
echo "Cannot find $MAKE. Things may fail."
fi
if [[ -z $(command -v curl) ]]; then
if ! command -v curl 2>/dev/null; then
echo "Cannot find cURL. Things may fail."
fi
if [[ -z $(command -v openssl) ]]; then
if ! command -v openssl 2>/dev/null; then
echo "Cannot find openssl. Things may fail."
fi

View File

@ -12,8 +12,6 @@
# licensed under the Boost Software License 1.0, while the individual files
# in the compilation are all public domain.
#
# See http://www.cryptopp.com/wiki/Android.mk_(Command_Line) for more details
#
#############################################################################
#############################################################################
@ -23,7 +21,7 @@ OLD_VERSION_TAG=CRYPTOPP_8_3_0
NEW_VERSION_TAG=master
#############################################################################
# If local repo is dirty, then promt first
# If local repo is dirty, then prompt first
DIRTY=$(git diff --shortstat 2> /dev/null | tail -1)
if [[ ! -z "$DIRTY" ]]; then
@ -108,8 +106,8 @@ CLANG_COMPILER=$("${CXX}" --version 2>&1 | "${GREP}" -i -c "clang")
#############################################################################
# CPU is logical count, memory is in MiB. Low resource boards have
# fewer than 4 cores and 1GB or less memory. We use this to
# determine if we can build in parallel without an OOM kill.
# fewer than 4 cores and 1GB or less memory. We use this to
# determine if we can build in parallel without an OOM kill.
CPU_COUNT=1
MEM_SIZE=512
@ -127,7 +125,7 @@ elif [[ "$IS_SOLARIS" -ne "0" ]]; then
fi
# Some ARM devboards cannot use 'make -j N', even with multiple cores and RAM
# An 8-core Cubietruck Plus with 2GB RAM experiences OOM kills with '-j 2'.
# An 8-core Cubietruck Plus with 2GB RAM experiences OOM kills with '-j 2'.
HAVE_SWAP=1
if [[ "$IS_LINUX" -ne "0" ]]; then
if [[ -e "/proc/meminfo" ]]; then

View File

@ -51,7 +51,7 @@ if [[ (-z "$INSTALL_RESULTS") ]]; then
fi
if [[ -z "$test_prog" ]]; then
test_prog="TestPrograms/test_cxx.cxx"
test_prog="TestPrograms/test_cxx.cpp"
fi
# Remove previous test results
@ -79,12 +79,12 @@ TEST_LIST=()
############################################
# Setup tools and platforms
GREP=grep
SED=sed
AWK=awk
MAKE=make
GREP="grep"
SED="sed"
AWK="awk"
MAKE="make"
DISASS=objdump
DISASS="objdump"
DISASSARGS=("--disassemble")
# Fixup, Solaris and friends
@ -136,6 +136,13 @@ IS_S390=$("$GREP" -i -c "s390" <<< "$THIS_MACHINE")
IS_SPARC=$("$GREP" -i -c "sparc" <<< "$THIS_MACHINE")
IS_X32=0
# Fixup
if [[ "$IS_AIX" -ne 0 ]]; then
THIS_MACHINE="$(prtconf | "$GREP" -i "Processor Type" | head -n 1 | cut -f 2 -d ':')"
IS_PPC32=$("$GREP" -i -c -E "(Power|PPC)" <<< "$THIS_MACHINE")
IS_PPC64=$("$GREP" -i -c -E "(Power64|PPC64)" <<< "$THIS_MACHINE")
fi
# Fixup
if [[ "$IS_PPC64" -ne 0 ]]; then
IS_PPC32=0
@ -158,6 +165,12 @@ if [[ "$IS_DARWIN" -ne 0 ]]; then
DISASSARGS=("-tV")
fi
# Fixup
if [[ "$IS_AIX" -ne 0 ]]; then
DISASS=dis
DISASSARGS=()
fi
# CPU features and flags
if [[ ("$IS_X86" -ne 0 || "$IS_X64" -ne 0) ]]; then
if [[ ("$IS_DARWIN" -ne 0) ]]; then
@ -165,9 +178,9 @@ if [[ ("$IS_X86" -ne 0 || "$IS_X64" -ne 0) ]]; then
elif [[ ("$IS_SOLARIS" -ne 0) ]]; then
X86_CPU_FLAGS=$(isainfo -v 2>/dev/null)
elif [[ ("$IS_FREEBSD" -ne 0) ]]; then
X86_CPU_FLAGS=$(grep Features /var/run/dmesg.boot)
X86_CPU_FLAGS=$("$GREP" Features /var/run/dmesg.boot)
elif [[ ("$IS_DRAGONFLY" -ne 0) ]]; then
X86_CPU_FLAGS=$(dmesg | grep Features)
X86_CPU_FLAGS=$(dmesg | "$GREP" Features)
elif [[ ("$IS_HURD" -ne 0) ]]; then
: # Do nothing... cpuid is not helpful at the moment
else
@ -176,9 +189,49 @@ if [[ ("$IS_X86" -ne 0 || "$IS_X64" -ne 0) ]]; then
elif [[ ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0) ]]; then
if [[ ("$IS_DARWIN" -ne 0) ]]; then
ARM_CPU_FLAGS="$(sysctl machdep.cpu.features 2>&1 | cut -f 2 -d ':')"
# Apple M1 hardware
if [[ $(sysctl hw.optional.arm64 2>&1 | "$GREP" -i 'hw.optional.arm64: 1') ]]; then
ARM_CPU_FLAGS="asimd crc32 aes pmull sha1 sha2"
fi
if [[ $(sysctl hw.optional.armv8_2_sha3 2>&1 | "$GREP" -i 'hw.optional.armv8_2_sha3: 1') ]]; then
ARM_CPU_FLAGS+=" sha3"
fi
if [[ $(sysctl hw.optional.armv8_2_sha512 2>&1 | "$GREP" -i 'hw.optional.armv8_2_sha512: 1') ]]; then
ARM_CPU_FLAGS+=" sha512"
fi
else
ARM_CPU_FLAGS="$($AWK '{IGNORECASE=1}{if ($1 == "Features"){print;exit}}' < /proc/cpuinfo | cut -f 2 -d ':')"
fi
elif [[ ("$IS_PPC32" -ne 0 || "$IS_PPC64" -ne 0) ]]; then
if [[ ("$IS_DARWIN" -ne 0) ]]; then
PPC_CPU_FLAGS="$(sysctl -a 2>&1 | "$GREP" machdep.cpu.features | cut -f 2 -d ':')"
# PowerMac
if [[ $(sysctl hw.optional.altivec 2>&1 | "$GREP" -i 'hw.optional.altivec: 1') ]]; then
PPC_CPU_FLAGS+=" altivec"
fi
elif [[ ("$IS_AIX" -ne 0) ]]; then
CPUINFO="$(prtconf | "$GREP" -i "Processor Type" | head -n 1 | cut -f 2 -d ':')"
if echo -n "$CPUINFO" | "$GREP" -q -i -c "power9"; then
PPC_CPU_FLAGS="power9 power8 power7 altivec"
elif echo -n "$CPUINFO" | "$GREP" -q -i -c "power8"; then
PPC_CPU_FLAGS="power8 power7 altivec"
elif echo -n "$CPUINFO" | "$GREP" -q -i -c "power7"; then
PPC_CPU_FLAGS="power7 altivec"
elif echo -n "$CPUINFO" | "$GREP" -q -i -c "altivec"; then
PPC_CPU_FLAGS="altivec"
fi
else
CPUINFO="$(cat /proc/cpuinfo | grep "cpu" | head -n 1 | cut -f 2 -d ':')"
if echo -n "$CPUINFO" | "$GREP" -q -i -c "power9"; then
PPC_CPU_FLAGS="power9 power8 power7 altivec"
elif echo -n "$CPUINFO" | "$GREP" -q -i -c "power8"; then
PPC_CPU_FLAGS="power8 power7 altivec"
elif echo -n "$CPUINFO" | "$GREP" -q -i -c "power7"; then
PPC_CPU_FLAGS="power7 altivec"
elif echo -n "$CPUINFO" | "$GREP" -q -i -c "altivec"; then
PPC_CPU_FLAGS="altivec"
fi
fi
fi
for ARG in "$@"
@ -704,48 +757,77 @@ fi
if [[ ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0) ]]; then
if [[ (-z "$HAVE_ARMV7A" && "$IS_ARM32" -ne 0) ]]; then
HAVE_ARMV7A=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'neon')
HAVE_ARMV7A=$("$GREP" -i -c 'neon' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARMV7A" -gt 0) ]]; then HAVE_ARMV7A=1; fi
fi
if [[ (-z "$HAVE_ARMV8A" && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; then
HAVE_ARMV8A=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c -E '(asimd|crc|crypto)')
if [[ ("$HAVE_ARMV8A" -gt 0) ]]; then HAVE_ARMV8A=1; fi
if [[ (-z "$HAVE_ARMV8" && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; then
HAVE_ARMV8=$("$GREP" -i -c -E '(asimd|crc|crypto)' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARMV8" -gt 0) ]]; then HAVE_ARMV8=1; fi
fi
if [[ (-z "$HAVE_ARM_VFPV3") ]]; then
HAVE_ARM_VFPV3=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpv3')
HAVE_ARM_VFPV3=$("$GREP" -i -c 'vfpv3' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_VFPV3" -gt 0) ]]; then HAVE_ARM_VFPV3=1; fi
fi
if [[ (-z "$HAVE_ARM_VFPV4") ]]; then
HAVE_ARM_VFPV4=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpv4')
HAVE_ARM_VFPV4=$("$GREP" -i -c 'vfpv4' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_VFPV4" -gt 0) ]]; then HAVE_ARM_VFPV4=1; fi
fi
if [[ (-z "$HAVE_ARM_VFPV5") ]]; then
HAVE_ARM_VFPV5=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'fpv5')
HAVE_ARM_VFPV5=$("$GREP" -i -c 'fpv5' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_VFPV5" -gt 0) ]]; then HAVE_ARM_VFPV5=1; fi
fi
if [[ (-z "$HAVE_ARM_VFPD32") ]]; then
HAVE_ARM_VFPD32=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'vfpd32')
HAVE_ARM_VFPD32=$("$GREP" -i -c 'vfpd32' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_VFPD32" -gt 0) ]]; then HAVE_ARM_VFPD32=1; fi
fi
if [[ (-z "$HAVE_ARM_NEON") ]]; then
HAVE_ARM_NEON=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'neon')
HAVE_ARM_NEON=$("$GREP" -i -c 'neon' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_NEON" -gt 0) ]]; then HAVE_ARM_NEON=1; fi
fi
if [[ (-z "$HAVE_ARM_CRC") ]]; then
HAVE_ARM_CRC=$("$GREP" -i -c 'crc32' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_CRC" -gt 0) ]]; then HAVE_ARM_CRC=1; fi
fi
if [[ (-z "$HAVE_ARM_CRYPTO") ]]; then
HAVE_ARM_CRYPTO=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c -E '(aes|pmull|sha1|sha2)')
HAVE_ARM_CRYPTO=$("$GREP" -i -c -E '(aes|pmull|sha1|sha2)' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_CRYPTO" -gt 0) ]]; then HAVE_ARM_CRYPTO=1; fi
fi
if [[ (-z "$HAVE_ARM_CRC") ]]; then
HAVE_ARM_CRC=$(echo -n "$ARM_CPU_FLAGS" | "$GREP" -i -c 'crc32')
if [[ ("$HAVE_ARM_CRC" -gt 0) ]]; then HAVE_ARM_CRC=1; fi
if [[ (-z "$HAVE_ARM_SHA3") ]]; then
HAVE_ARM_SHA3=$("$GREP" -i -c 'sha3' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_SHA3" -gt 0) ]]; then HAVE_ARM_SHA3=1; fi
fi
if [[ (-z "$HAVE_ARM_SHA512") ]]; then
HAVE_ARM_SHA512=$("$GREP" -i -c 'sha512' <<< "$ARM_CPU_FLAGS")
if [[ ("$HAVE_ARM_SHA512" -gt 0) ]]; then HAVE_ARM_SHA512=1; fi
fi
fi
if [[ ("$IS_PPC32" -ne 0 || "$IS_PPC64" -ne 0) ]]; then
if [[ (-z "$HAVE_PPC_ALTIVEC") ]]; then
HAVE_PPC_ALTIVEC=$("$GREP" -i -c 'altivec' <<< "$PPC_CPU_FLAGS")
if [[ ("$HAVE_PPC_ALTIVEC" -gt 0) ]]; then HAVE_PPC_ALTIVEC=1; fi
fi
if [[ (-z "$HAVE_PPC_POWER7") ]]; then
HAVE_PPC_POWER7=$("$GREP" -i -c -E 'pwr7|power7' <<< "$PPC_CPU_FLAGS")
if [[ ("$HAVE_PPC_POWER7" -gt 0) ]]; then HAVE_PPC_POWER7=1; fi
fi
if [[ (-z "$HAVE_PPC_POWER8") ]]; then
HAVE_PPC_POWER8=$("$GREP" -i -c -E 'pwr8|power8' <<< "$PPC_CPU_FLAGS")
if [[ ("$HAVE_PPC_POWER8" -gt 0) ]]; then HAVE_PPC_POWER8=1; fi
fi
if [[ (-z "$HAVE_PPC_POWER9") ]]; then
HAVE_PPC_POWER9=$("$GREP" -i -c -E 'pwr9|power9' <<< "$PPC_CPU_FLAGS")
if [[ ("$HAVE_PPC_POWER9" -gt 0) ]]; then HAVE_PPC_POWER9=1; fi
fi
fi
@ -810,28 +892,6 @@ if [[ (-z "$WANT_BENCHMARKS") ]]; then
WANT_BENCHMARKS=1
fi
# IBM XL C/C++ compiler fixups. Not sure why it fails to return non-0 on failure...
if [[ "$XLC_COMPILER" -ne 0 ]]; then
HAVE_CXX03=0
HAVE_GNU03=0
HAVE_CXX11=0
HAVE_GNU11=0
HAVE_CXX14=0
HAVE_GNU14=0
HAVE_CXX17=0
HAVE_GNU17=0
HAVE_CXX20=0
HAVE_GNU20=0
HAVE_OMP=0
HAVE_CET=0
HAVE_REPTOLINE=0
HAVE_ASAN=0
HAVE_BSAN=0
HAVE_UBSAN=0
HAVE_ANALYZER=0
HAVE_LDGOLD=0
fi
############################################
# System information
@ -862,8 +922,8 @@ elif [[ "$IS_ARM32" -ne 0 ]]; then
fi
if [[ "$HAVE_ARMV7A" -ne 0 ]]; then
echo "HAVE_ARMV7A: $HAVE_ARMV7A" | tee -a "$TEST_RESULTS"
elif [[ "$HAVE_ARMV8A" -ne 0 ]]; then
echo "HAVE_ARMV8A: $HAVE_ARMV8A" | tee -a "$TEST_RESULTS"
elif [[ "$HAVE_ARMV8" -ne 0 ]]; then
echo "HAVE_ARMV8: $HAVE_ARMV8" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_ARM_NEON" -ne 0 ]]; then
echo "HAVE_ARM_NEON: $HAVE_ARM_NEON" | tee -a "$TEST_RESULTS"
@ -883,6 +943,24 @@ fi
if [[ "$HAVE_ARM_CRYPTO" -ne 0 ]]; then
echo "HAVE_ARM_CRYPTO: $HAVE_ARM_CRYPTO" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_ARM_SHA3" -ne 0 ]]; then
echo "HAVE_ARM_SHA3: $HAVE_ARM_SHA3" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_ARM_SHA512" -ne 0 ]]; then
echo "HAVE_ARM_SHA512: $HAVE_ARM_SHA512" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_PPC_ALTIVEC" -ne 0 ]]; then
echo "HAVE_PPC_ALTIVEC: $HAVE_PPC_ALTIVEC" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_PPC_POWER7" -ne 0 ]]; then
echo "HAVE_PPC_POWER7: $HAVE_PPC_POWER7" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_PPC_POWER8" -ne 0 ]]; then
echo "HAVE_PPC_POWER8: $HAVE_PPC_POWER8" | tee -a "$TEST_RESULTS"
fi
if [[ "$HAVE_PPC_POWER9" -ne 0 ]]; then
echo "HAVE_PPC_POWER9: $HAVE_PPC_POWER9" | tee -a "$TEST_RESULTS"
fi
if [[ "$IS_X32" -ne 0 ]]; then
echo "IS_X32: $IS_X32" | tee -a "$TEST_RESULTS"
@ -1004,6 +1082,10 @@ if [[ "$IS_DARWIN" -ne 0 ]]; then
CPU_FREQ="$(sysctl -a 2>&1 | $GREP "hw.cpufrequency" | $AWK '{print int($2); exit;}')"
CPU_FREQ="$(echo "$CPU_FREQ" | $AWK '{print int($0/1024/1024/1024)}')"
fi
if [[ (-z "$CPU_FREQ") || ("$CPU_FREQ" -eq 0) ]]; then
CPU_FREQ="$(sysctl -a 2>&1 | $GREP "hw.tbfrequency" | $AWK '{print int($2); exit;}')"
CPU_FREQ="$(echo "$CPU_FREQ" | $AWK '{print int($0/10/1024/1024)}')"
fi
fi
# Some ARM devboards cannot use 'make -j N', even with multiple cores and RAM
@ -1503,41 +1585,41 @@ if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; the
FAILED=0
DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null)
if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0) ]]; then
# ARIA::UncheckedKeySet: 4 ldr q{N}
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'ldr[[:space:]]*q')
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'ldr[[:space:]]*q|ldp[[:space:]]*q')
if [[ ("$COUNT" -lt 4) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON load instructions" | tee -a "$TEST_RESULTS"
fi
else # ARMv7
# ARIA::UncheckedKeySet: 4 vld1.32 {d1,d2}
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vld1.32[[:space:]]*{')
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vld1.32[[:space:]]*')
if [[ ("$COUNT" -lt 4) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON load instructions" | tee -a "$TEST_RESULTS"
fi
fi
if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0) ]]; then
# ARIA::UncheckedKeySet: 17 str q{N}
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'str[[:space:]]*q')
if [[ ("$COUNT" -lt 16) ]]; then
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'str[[:space:]]*q|stp[[:space:]]*q')
if [[ ("$COUNT" -lt 8) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS"
fi
else
# ARIA::UncheckedKeySet: 17 vstr1.32 {d1,d2}
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vst1.32[[:space:]]*{')
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vst1.32[[:space:]]*')
if [[ ("$COUNT" -lt 16) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS"
fi
fi
if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0) ]]; then
# ARIA::UncheckedKeySet: 17 shl v{N}
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'shl[[:space:]]*v')
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'shl[[:space:]]*v|shl.4s')
if [[ ("$COUNT" -lt 16) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON shift left instructions" | tee -a "$TEST_RESULTS"
@ -1547,29 +1629,29 @@ if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; the
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vshl')
if [[ ("$COUNT" -lt 16) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS"
echo "ERROR: failed to generate NEON shift left instructions" | tee -a "$TEST_RESULTS"
fi
fi
if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0) ]]; then
# ARIA::UncheckedKeySet: 17 shr v{N}
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'shr[[:space:]]*v')
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'shr[[:space:]]*v|shr.4s')
if [[ ("$COUNT" -lt 16) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON shift left instructions" | tee -a "$TEST_RESULTS"
echo "ERROR: failed to generate NEON shift right instructions" | tee -a "$TEST_RESULTS"
fi
else
# ARIA::UncheckedKeySet: 17 vshr
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'vshr')
if [[ ("$COUNT" -lt 16) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON store instructions" | tee -a "$TEST_RESULTS"
echo "ERROR: failed to generate NEON shift right instructions" | tee -a "$TEST_RESULTS"
fi
fi
if [[ ("$HAVE_ARMV8A" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0) ]]; then
# ARIA::UncheckedKeySet: 12 ext v{N}
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'ext[[:space:]]*v')
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c -E 'ext[[:space:]]*v|ext.*v')
if [[ ("$COUNT" -lt 12) ]]; then
FAILED=1
echo "ERROR: failed to generate NEON extract instructions" | tee -a "$TEST_RESULTS"
@ -1596,7 +1678,7 @@ if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; the
ARM_CRC32=1
fi
if [[ ("$HAVE_ARMV8A" -ne 0 && "$ARM_CRC32" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0 && "$ARM_CRC32" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: ARM CRC32 code generation" | tee -a "$TEST_RESULTS"
@ -1648,7 +1730,7 @@ if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; the
ARM_PMULL=1
fi
if [[ ("$HAVE_ARMV8A" -ne 0 && "$ARM_PMULL" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0 && "$ARM_PMULL" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: ARM carryless multiply code generation" | tee -a "$TEST_RESULTS"
@ -1688,13 +1770,13 @@ if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; the
ARM_AES=1
fi
if [[ ("$HAVE_ARMV8A" -ne 0 && "$ARM_AES" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0 && "$ARM_AES" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: ARM AES generation" | tee -a "$TEST_RESULTS"
echo "Testing: ARM AES code generation" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("ARM AES generation")
TEST_LIST+=("ARM AES code generation")
OBJFILE=rijndael_simd.o; rm -f "$OBJFILE" 2>/dev/null
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
@ -1737,16 +1819,17 @@ if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; the
"$CXX" -march=armv8-a+crypto "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
ARM_SHA=1
ARM_SHA1=1
ARM_SHA2=1
fi
if [[ ("$HAVE_ARMV8A" -ne 0 && "$ARM_SHA" -ne 0) ]]; then
if [[ ("$HAVE_ARMV8" -ne 0 && "$ARM_SHA1" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: ARM SHA generation" | tee -a "$TEST_RESULTS"
echo "Testing: ARM SHA1 code generation" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("ARM SHA generation")
TEST_LIST+=("ARM SHA1 code generation")
OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
@ -1791,6 +1874,27 @@ if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; the
echo "ERROR: failed to generate sha1su1 instruction" | tee -a "$TEST_RESULTS"
fi
if [[ ("$FAILED" -eq 0) ]]; then
echo "Verified sha1c, sha1m, sha1p, sha1su0, sha1su1 machine instructions" | tee -a "$TEST_RESULTS"
fi
fi
if [[ ("$HAVE_ARMV8" -ne 0 && "$ARM_SHA2" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: ARM SHA2 code generation" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("ARM SHA2 code generation")
OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
COUNT=0
FAILED=0
DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null)
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -v sha256h2 | "$GREP" -i -c sha256h)
if [[ ("$COUNT" -eq 0) ]]; then
FAILED=1
@ -1816,7 +1920,7 @@ if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_ARM32" -ne 0 || "$IS_ARM64" -ne 0)) ]]; the
fi
if [[ ("$FAILED" -eq 0) ]]; then
echo "Verified sha1c, sha1m, sha1p, sha1su0, sha1su1, sha256h, sha256h2, sha256su0, sha256su1 machine instructions" | tee -a "$TEST_RESULTS"
echo "Verified sha256h, sha256h2, sha256su0, sha256su1 machine instructions" | tee -a "$TEST_RESULTS"
fi
fi
fi
@ -1833,27 +1937,25 @@ if [[ ("$HAVE_DISASS" -ne 0 && "$GCC_4_8_OR_ABOVE" -ne 0 && ("$IS_PPC32" -ne 0 |
"$CXX" -mcpu=power8 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
PPC_AES=1
PPC_AES_FLAGS="-mcpu=power8"
fi
fi
if [[ ("$PPC_AES" -eq 0) ]]; then
"$CXX" -qarch=pwr8 -qaltivec "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
PPC_AES=1
PPC_AES_FLAGS="-qarch=pwr8 -qaltivec"
fi
fi
if [[ ("$PPC_AES" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Power8 AES generation" | tee -a "$TEST_RESULTS"
echo "Testing: Power8 AES code generation" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("Power8 AES generation")
TEST_LIST+=("Power8 AES code generation")
OBJFILE=rijndael_simd.o; rm -f "$OBJFILE" 2>/dev/null
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_AES_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
COUNT=0
FAILED=0
@ -1884,7 +1986,7 @@ if [[ ("$HAVE_DISASS" -ne 0 && "$GCC_4_8_OR_ABOVE" -ne 0 && ("$IS_PPC32" -ne 0 |
fi
if [[ ("$FAILED" -eq 0) ]]; then
echo "Verified vcipher, vcipherlast,vncipher, vncipherlast machine instructions" | tee -a "$TEST_RESULTS"
echo "Verified vcipher, vcipherlast, vncipher, vncipherlast machine instructions" | tee -a "$TEST_RESULTS"
fi
fi
@ -1896,27 +1998,25 @@ if [[ ("$HAVE_DISASS" -ne 0 && "$GCC_4_8_OR_ABOVE" -ne 0 && ("$IS_PPC32" -ne 0 |
"$CXX" -mcpu=power8 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
PPC_SHA=1
PPC_SHA_FLAGS="-mcpu=power8"
fi
fi
if [[ ("$PPC_SHA" -eq 0) ]]; then
"$CXX" -qarch=pwr8 -qaltivec "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
PPC_SHA=1
PPC_SHA_FLAGS="-qarch=pwr8 -qaltivec"
fi
fi
if [[ ("$PPC_SHA" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Power8 SHA generation" | tee -a "$TEST_RESULTS"
echo "Testing: Power8 SHA code generation" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("Power8 SHA generation")
TEST_LIST+=("Power8 SHA code generation")
OBJFILE=sha_simd.o; rm -f "$OBJFILE" 2>/dev/null
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_SHA_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
COUNT=0
FAILED=0
@ -1947,27 +2047,25 @@ if [[ ("$HAVE_DISASS" -ne 0 && "$GCC_4_8_OR_ABOVE" -ne 0 && ("$IS_PPC32" -ne 0 |
"$CXX" -mcpu=power8 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
PPC_VMULL=1
PPC_VMULL_FLAGS="-mcpu=power8"
fi
fi
if [[ ("$PPC_VMULL" -eq 0) ]]; then
"$CXX" -qarch=pwr8 "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
PPC_VMULL=1
PPC_VMULL_FLAGS="-qarch=pwr8"
fi
fi
if [[ ("$PPC_VMULL" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Power8 carryless multiply generation" | tee -a "$TEST_RESULTS"
echo "Testing: Power8 carryless multiply code generation" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("Power8 carryless multiply generation")
TEST_LIST+=("Power8 carryless multiply code generation")
OBJFILE=gcm_simd.o; rm -f "$OBJFILE" 2>/dev/null
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS $PPC_VMULL_FLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
COUNT=0
FAILED=0
@ -1985,9 +2083,82 @@ if [[ ("$HAVE_DISASS" -ne 0 && "$GCC_4_8_OR_ABOVE" -ne 0 && ("$IS_PPC32" -ne 0 |
fi
fi
############################################
# Altivec generation tests
if [[ ("$HAVE_DISASS" -ne 0 && ("$IS_PPC32" -ne 0 || "$IS_PPC64" -ne 0)) ]]; then
############################################
# Altivec
PPC_ALTIVEC=0
if [[ ("$PPC_ALTIVEC" -eq 0) ]]; then
"$CXX" -maltivec "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
PPC_ALTIVEC=1
fi
fi
if [[ ("$PPC_ALTIVEC" -eq 0) ]]; then
"$CXX" -qarch=altivec "$test_prog" -o "${TMPDIR}/test.exe" &>/dev/null
if [[ "$?" -eq 0 ]]; then
PPC_ALTIVEC=1
fi
fi
if [[ ("$PPC_ALTIVEC" -ne 0) ]]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Altivec code generation" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("Altivec code generation")
OBJFILE=speck128_simd.o; rm -f "$OBJFILE" 2>/dev/null
CXX="$CXX" CXXFLAGS="$RELEASE_CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" $OBJFILE 2>&1 | tee -a "$TEST_RESULTS"
COUNT=0
FAILED=0
DISASS_TEXT=$("$DISASS" "${DISASSARGS[@]}" "$OBJFILE" 2>/dev/null)
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c lvx)
if [[ ("$COUNT" -lt 8) ]]; then
FAILED=1
echo "ERROR: failed to generate lvx instruction" | tee -a "$TEST_RESULTS"
fi
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c stvx)
if [[ ("$COUNT" -lt 8) ]]; then
FAILED=1
echo "ERROR: failed to generate stvx instruction" | tee -a "$TEST_RESULTS"
fi
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vsldoi)
if [[ ("$COUNT" -lt 8) ]]; then
FAILED=1
echo "ERROR: failed to generate vsldoi instruction" | tee -a "$TEST_RESULTS"
fi
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vxor)
if [[ ("$COUNT" -lt 8) ]]; then
FAILED=1
echo "ERROR: failed to generate vxor instruction" | tee -a "$TEST_RESULTS"
fi
COUNT=$(echo -n "$DISASS_TEXT" | "$GREP" -i -c vperm)
if [[ ("$COUNT" -lt 8) ]]; then
FAILED=1
echo "ERROR: failed to generate vperm instruction" | tee -a "$TEST_RESULTS"
fi
if [[ ("$FAILED" -eq 0) ]]; then
echo "Verified vxl, stvx, vsldoi, vxor, vperm instructions" | tee -a "$TEST_RESULTS"
fi
fi
fi
############################################
# Default CXXFLAGS
if true; then
############################################
# Debug build
echo
@ -2712,67 +2883,6 @@ if true; then
fi
fi
############################################
# Debug build, CRYPTOPP_NO_CXX11
if [[ "$HAVE_CXX11" -ne 0 ]] || [[ "$HAVE_GNU11" -ne 0 ]]; then
############################################
# Debug build
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Debug, CRYPTOPP_NO_CXX11" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("Debug, CRYPTOPP_NO_CXX11")
"$MAKE" clean &>/dev/null
rm -f "${TMPDIR}/test.exe" &>/dev/null
CXXFLAGS="$DEBUG_CXXFLAGS -DCRYPTOPP_NO_CXX11=1"
CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
fi
fi
############################################
# Release build
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Release, CRYPTOPP_NO_CXX11" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("Release, CRYPTOPP_NO_CXX11")
"$MAKE" clean &>/dev/null
rm -f "${TMPDIR}/test.exe" &>/dev/null
CXXFLAGS="$RELEASE_CXXFLAGS -DCRYPTOPP_NO_CXX11=1"
CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
fi
fi
fi
############################################
# c++03 debug and release build
if [[ "$HAVE_CXX03" -ne 0 ]]; then
@ -4285,7 +4395,7 @@ fi
############################################
# Control-flow Enforcement Technology (CET), c++03
if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_CET" -ne 0) ]]; then
if [[ ("$HAVE_CXX03" -ne 0 && "$HAVE_CET" -ne 0) ]]; then
############################################
# Debug build, CET, c++03
@ -4346,7 +4456,7 @@ fi
############################################
# Specter, c++03
if [[ ("$HAVE_CXX11" -ne 0 && "$HAVE_REPTOLINE" -ne 0) ]]; then
if [[ ("$HAVE_CXX03" -ne 0 && "$HAVE_REPTOLINE" -ne 0) ]]; then
############################################
# Debug build, Specter, c++03
@ -7178,7 +7288,7 @@ if [[ ("$IS_CYGWIN" -eq 0) && ("$IS_MINGW" -eq 0) ]]; then
else
OLD_DIR=$(pwd)
"$MAKE" "${MAKEARGS[@]}" install PREFIX="$INSTALL_DIR" 2>&1 | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS"
cd "$INSTALL_DIR/bin"
cd "$INSTALL_DIR/bin" || exit
echo
echo "************************************" | tee -a "$TEST_RESULTS" "$INSTALL_RESULTS"
@ -7219,7 +7329,7 @@ if [[ ("$IS_CYGWIN" -eq 0) && ("$IS_MINGW" -eq 0) ]]; then
fi
# Restore original PWD
cd "$OLD_DIR"
cd "$OLD_DIR" || exit
fi
fi
@ -7265,6 +7375,83 @@ if [[ ("$IS_CYGWIN" -eq 0 && "$IS_MINGW" -eq 0) ]]; then
fi
fi
############################################
# Test latest zip with unzip -a
if true; then
major=8; minor=5; rev=0
base="cryptopp${major}${minor}${rev}"
filename="${base}.zip"
url="https://cryptopp.com/${filename}"
rm -rf "${base}" 2>/dev/null
if wget -q -O ${filename} "${url}";
then
unzip -aoq "${filename}" -d "${base}"
cd "${base}" || exit 1
############################################
# Debug build
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Latest zip, unzip -a, Debug" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("Latest zip, unzip -a, Debug CXXFLAGS")
"$MAKE" clean &>/dev/null
rm -f "${TMPDIR}/test.exe" &>/dev/null
CXXFLAGS="$DEBUG_CXXFLAGS"
CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
fi
fi
############################################
# Release build
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Latest zip, unzip -a, Release" | tee -a "$TEST_RESULTS"
echo
TEST_LIST+=("Latest zip, unzip -a, Release CXXFLAGS")
"$MAKE" clean &>/dev/null
rm -f "${TMPDIR}/test.exe" &>/dev/null
CXXFLAGS="$RELEASE_CXXFLAGS"
CXX="$CXX" CXXFLAGS="$CXXFLAGS" "$MAKE" "${MAKEARGS[@]}" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS"
else
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS"
fi
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
if [[ ("${PIPESTATUS[0]}" -ne 0) ]]; then
echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS"
fi
echo
fi
cd ../ || exit 1
rm -rf "${base}"
fi
fi
#############################################
#############################################
################ END TESTING ################

View File

@ -7,6 +7,7 @@
# Based upon OpenSSL's setenv-android.sh by TH, JW, and SM.
# Heavily modified by JWW for Crypto++.
# Modified by Skycoder42 Android NDK-r19 and above.
# Modified some more by JW and UB.
#
# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2)
# licensed under the Boost Software License 1.0, while the individual files
@ -68,20 +69,53 @@ if [ -z "${ANDROID_CPU}" ]; then
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
DEF_CPPFLAGS="-DNDEBUG"
DEF_CFLAGS="-Wall -g2 -O3 -fPIC"
DEF_CXXFLAGS="-Wall -g2 -O3 -fPIC"
DEF_LDFLAGS=""
#########################################
##### Clear old options #####
#########################################
unset IS_IOS
unset IS_MACOS
unset IS_ANDROID
unset IS_ARM_EMBEDDED
unset ANDROID_CPPFLAGS
unset ANDROID_CFLAGS
unset ANDROID_CXXFLAGS
unset ANDROID_LDFLAGS
unset ANDROID_SYSROOT
#####################################################################
#########################################
##### Small Fixups, if needed #####
#########################################
ANDROID_CPU=$(tr '[:upper:]' '[:lower:]' <<< "${ANDROID_CPU}")
if [[ "$ANDROID_CPU" == "amd64" || "$ANDROID_CPU" == "x86_64" ]] ; then
ANDROID_CPU=x86_64
fi
if [[ "$ANDROID_CPU" == "i386" || "$ANDROID_CPU" == "i686" ]] ; then
ANDROID_CPU=i686
fi
if [[ "$ANDROID_CPU" == "armv7"* || "$ANDROID_CPU" == "armeabi"* ]] ; then
ANDROID_CPU=armeabi-v7a
fi
if [[ "$ANDROID_CPU" == "aarch64" || "$ANDROID_CPU" == "arm64"* || "$ANDROID_CPU" == "armv8"* ]] ; then
ANDROID_CPU=arm64-v8a
fi
echo "Configuring for $ANDROID_SDK ($ANDROID_CPU)"
########################################
##### Environment #####
########################################
# ANDROID_NDK_ROOT should always be set by the user (even when not running this script)
# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77.
@ -156,14 +190,13 @@ fi
#####################################################################
THE_ARCH=$(tr '[:upper:]' '[:lower:]' <<< "${ANDROID_CPU}")
# https://developer.android.com/ndk/guides/abis.html and
# https://developer.android.com/ndk/guides/cpp-support.
# Since NDK r16 the only STL available is libc++, so we
# add -std=c++11 -stdlib=libc++ to CXXFLAGS. This is
# consistent with Android.mk and 'APP_STL := c++_shared'.
case "$THE_ARCH" in
case "$ANDROID_CPU" in
armv7*|armeabi*)
CC="armv7a-linux-androideabi${ANDROID_API}-clang"
CXX="armv7a-linux-androideabi${ANDROID_API}-clang++"
@ -172,16 +205,24 @@ case "$THE_ARCH" in
AR="arm-linux-androideabi-ar"
RANLIB="arm-linux-androideabi-ranlib"
STRIP="arm-linux-androideabi-strip"
OBJDUMP="arm-linux-androideabi-objdump"
# You may need this on older NDKs
# ANDROID_CPPFLAGS="-D__ANDROID__=${ANDROID_API}"
# Android NDK r19 and r20 no longer use -mfloat-abi=softfp. Add it as required.
ANDROID_CXXFLAGS="-target armv7-none-linux-androideabi${ANDROID_API} -std=c++11 -stdlib=libc++"
ANDROID_CFLAGS="-target armv7-none-linux-androideabi${ANDROID_API}"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -march=armv7-a -mthumb"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -fno-addrsig -fno-experimental-isel"
ANDROID_CXXFLAGS="-target armv7-none-linux-androideabi${ANDROID_API}"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -march=armv7-a -mthumb"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fno-addrsig -fno-experimental-isel"
;;
armv8*|aarch64|arm64*)
CC="aarch64-linux-android${ANDROID_API}-clang"
CXX="aarch64-linux-android${ANDROID_API}-clang++"
@ -190,15 +231,21 @@ case "$THE_ARCH" in
AR="aarch64-linux-android-ar"
RANLIB="aarch64-linux-android-ranlib"
STRIP="aarch64-linux-android-strip"
OBJDUMP="aarch64-linux-android-objdump"
# You may need this on older NDKs
# ANDROID_CPPFLAGS="-D__ANDROID__=${ANDROID_API}"
ANDROID_CFLAGS="-target aarch64-none-linux-android${ANDROID_API}"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -fno-addrsig -fno-experimental-isel"
ANDROID_CXXFLAGS="-target aarch64-none-linux-android${ANDROID_API}"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fno-addrsig -fno-experimental-isel"
;;
i686|x86)
CC="i686-linux-android${ANDROID_API}-clang"
CXX="i686-linux-android${ANDROID_API}-clang++"
@ -207,16 +254,23 @@ case "$THE_ARCH" in
AR="i686-linux-android-ar"
RANLIB="i686-linux-android-ranlib"
STRIP="i686-linux-android-strip"
OBJDUMP="i686-linux-android-objdump"
# You may need this on older NDKs
# ANDROID_CPPFLAGS="-D__ANDROID__=${ANDROID_API}"
ANDROID_CFLAGS="-target i686-none-linux-android${ANDROID_API}"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -mtune=intel -mssse3 -mfpmath=sse"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -fno-addrsig -fno-experimental-isel"
ANDROID_CXXFLAGS="-target i686-none-linux-android${ANDROID_API}"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -mtune=intel -mssse3 -mfpmath=sse"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fno-addrsig -fno-experimental-isel"
;;
x86_64|x64)
CC="x86_64-linux-android${ANDROID_API}-clang"
CXX="x86_64-linux-android${ANDROID_API}-clang++"
@ -225,13 +279,19 @@ case "$THE_ARCH" in
AR="x86_64-linux-android-ar"
RANLIB="x86_64-linux-android-ranlib"
STRIP="x86_64-linux-android-strip"
OBJDUMP="x86_64-linux-android-objdump"
# You may need this on older NDKs
# ANDROID_CPPFLAGS="-D__ANDROID__=${ANDROID_API}"
ANDROID_CFLAGS="-target x86_64-none-linux-android${ANDROID_API}"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -march=x86-64 -msse4.2 -mpopcnt -mtune=intel"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti"
ANDROID_CFLAGS="${ANDROID_CFLAGS} -fno-addrsig -fno-experimental-isel"
ANDROID_CXXFLAGS="-target x86_64-none-linux-android${ANDROID_API}"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -march=x86-64 -msse4.2 -mpopcnt -mtune=intel"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -std=c++11 -stdlib=libc++"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fstack-protector-strong -funwind-tables -fexceptions -frtti"
ANDROID_CXXFLAGS="${ANDROID_CXXFLAGS} -fno-addrsig -fno-experimental-isel"
;;
@ -241,18 +301,22 @@ case "$THE_ARCH" in
;;
esac
echo "Configuring for Android API ${ANDROID_API} ($ANDROID_CPU)"
#####################################################################
# GNUmakefile-cross and Autotools expect these to be set.
# They are also used in the tests below.
export IS_ANDROID=1
# Common to all builds
export CPP CC CXX LD AS AR RANLIB STRIP
export ANDROID_CPPFLAGS ANDROID_CXXFLAGS ANDROID_LDFLAGS
export ANDROID_API ANDROID_CPU ANDROID_SYSROOT
ANDROID_CPPFLAGS="${DEF_CPPFLAGS} ${ANDROID_CPPFLAGS} -DANDROID"
ANDROID_CFLAGS="${DEF_CFLAGS} ${ANDROID_CFLAGS} -Wa,--noexecstack"
ANDROID_CXXFLAGS="${DEF_CXXFLAGS} ${ANDROID_CXXFLAGS} -Wa,--noexecstack"
ANDROID_LDFLAGS="${DEF_LDFLAGS}"
# Do NOT use ANDROID_SYSROOT_INC or ANDROID_SYSROOT_LD
# https://github.com/android/ndk/issues/894#issuecomment-470837964
# Aarch64 ld does not understand --warn-execstack
ANDROID_LDFLAGS="${ANDROID_LDFLAGS} -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now"
ANDROID_LDFLAGS="${ANDROID_LDFLAGS} -Wl,--warn-shared-textrel -Wl,--warn-common"
ANDROID_LDFLAGS="${ANDROID_LDFLAGS} -Wl,--warn-unresolved-symbols"
ANDROID_LDFLAGS="${ANDROID_LDFLAGS} -Wl,--gc-sections -Wl,--fatal-warnings"
#####################################################################
@ -339,14 +403,15 @@ if [ "$VERBOSE" -gt 0 ]; then
echo "ANDROID_TOOLCHAIN: ${ANDROID_TOOLCHAIN}"
echo "ANDROID_API: ${ANDROID_API}"
echo "ANDROID_CPU: ${ANDROID_CPU}"
echo "ANDROID_SYSROOT: ${ANDROID_SYSROOT}"
if [ -n "${ANDROID_CPPFLAGS}" ]; then
echo "ANDROID_CPPFLAGS: ${ANDROID_CPPFLAGS}"
fi
echo "ANDROID_CFLAGS: ${ANDROID_CFLAGS}"
echo "ANDROID_CXXFLAGS: ${ANDROID_CXXFLAGS}"
if [ -n "${ANDROID_LDFLAGS}" ]; then
echo "ANDROID_LDFLAGS: ${ANDROID_LDFLAGS}"
fi
echo "ANDROID_SYSROOT: ${ANDROID_SYSROOT}"
if [ -e "cpu-features.h" ] && [ -e "cpu-features.c" ]; then
echo "CPU FEATURES: cpu-features.h and cpu-features.c are present"
fi
@ -354,6 +419,31 @@ fi
#####################################################################
# GNUmakefile-cross and Autotools expect these to be set.
# Note: prior to Crypto++ 8.6, CPPFLAGS, CXXFLAGS and LDFLAGS were not
# exported. At Crypto++ 8.6 CPPFLAGS, CXXFLAGS and LDFLAGS were exported.
export IS_ANDROID=1
export CPP CC CXX LD AS AR RANLIB STRIP OBJDUMP
# Do NOT use ANDROID_SYSROOT_INC or ANDROID_SYSROOT_LD
# https://github.com/android/ndk/issues/894#issuecomment-470837964
CPPFLAGS="${ANDROID_CPPFLAGS} -isysroot ${ANDROID_SYSROOT}"
CFLAGS="${ANDROID_CFLAGS}"
CXXFLAGS="${ANDROID_CXXFLAGS}"
LDFLAGS="${ANDROID_LDFLAGS} --sysroot ${ANDROID_SYSROOT}"
# Trim whitespace as needed
CPPFLAGS=$(echo "${CPPFLAGS}" | awk '{$1=$1;print}')
CFLAGS=$(echo "${CFLAGS}" | awk '{$1=$1;print}')
CXXFLAGS=$(echo "${CXXFLAGS}" | awk '{$1=$1;print}')
LDFLAGS=$(echo "${LDFLAGS}" | awk '{$1=$1;print}')
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
#####################################################################
echo
echo "*******************************************************************************"
echo "It looks the the environment is set correctly. Your next step is build"

View File

@ -19,19 +19,37 @@ if [ "$0" = "${BASH_SOURCE[0]}" ]; then
echo "setenv-embedded.sh is usually sourced, but not this time."
fi
# Unset old options
DEF_CPPFLAGS="-DNDEBUG"
DEF_CFLAGS="-Wall -g2 -O3 -fPIC"
DEF_CXXFLAGS="-Wall -g2 -O3 -fPIC"
DEF_LDFLAGS=""
unset IS_CROSS_COMPILE
#########################################
##### Clear old options #####
#########################################
unset IS_IOS
unset IS_MACOS
unset IS_ANDROID
unset IS_ARM_EMBEDDED
unset ARM_EMBEDDED_CPPFLAGS
unset ARM_EMBEDDED_CFLAGS
unset ARM_EMBEDDED_HEADERS
unset ARM_EMBEDDED_CXX_HEADERS
unset ARM_EMBEDDED_CXXFLAGS
unset ARM_EMBEDDED_LDFLAGS
unset ARM_EMBEDDED_SYSROOT
########################################
##### Environment #####
########################################
if [ -z "${ARM_EMBEDDED_TOOLCHAIN-}" ]; then
ARM_EMBEDDED_TOOLCHAIN="/usr/bin"
fi
if [ ! -d "$ARM_EMBEDDED_TOOLCHAIN" ]; then
if [ ! -d "${ARM_EMBEDDED_TOOLCHAIN}" ]; then
echo "ARM_EMBEDDED_TOOLCHAIN is not valid"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
@ -42,14 +60,14 @@ fi
# Ubuntu
TOOL_PREFIX="arm-linux-gnueabi"
export CPP="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-cpp"
export CC="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-gcc"
export CXX="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-g++"
export LD="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-ld"
export AR="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-ar"
export AS="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-as"
export RANLIB="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-ranlib"
# export RANLIB="$ARM_EMBEDDED_TOOLCHAIN/$TOOL_PREFIX-gcc-ranlib-4.7"
CPP="${ARM_EMBEDDED_TOOLCHAIN}/${TOOL_PREFIX}-cpp"
CC="${ARM_EMBEDDED_TOOLCHAIN}/${TOOL_PREFIX}-gcc"
CXX="${ARM_EMBEDDED_TOOLCHAIN}/${TOOL_PREFIX}-g++"
LD="${ARM_EMBEDDED_TOOLCHAIN}/${TOOL_PREFIX}-ld"
AR="${ARM_EMBEDDED_TOOLCHAIN}/${TOOL_PREFIX}-ar"
AS="${ARM_EMBEDDED_TOOLCHAIN}/${TOOL_PREFIX}-as"
RANLIB="${ARM_EMBEDDED_TOOLCHAIN}/${TOOL_PREFIX}-ranlib"
OBJDUMP="${ARM_EMBEDDED_TOOLCHAIN}/${TOOL_PREFIX}-objdump"
# Test a few of the tools
if [ ! -e "$CPP" ]; then
@ -87,16 +105,11 @@ if [ ! -e "$LD" ]; then
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# The Crypto++ Makefile uses these to disable host settings like
# IS_LINUX or IS_DARWIN, and incorporate settings for ARM_EMBEDDED
export IS_ARM_EMBEDDED=1
# GNUmakefile-cross uses these to to set CXXFLAGS for ARM_EMBEDDED
if [ -z "$ARM_EMBEDDED_SYSROOT" ]; then
export ARM_EMBEDDED_SYSROOT="/usr/arm-linux-gnueabi"
if [ -z "${ARM_EMBEDDED_SYSROOT}" ]; then
ARM_EMBEDDED_SYSROOT="/usr/arm-linux-gnueabi"
fi
if [ ! -d "$ARM_EMBEDDED_SYSROOT" ]; then
if [ ! -d "${ARM_EMBEDDED_SYSROOT}" ]; then
echo "ERROR: ARM_EMBEDDED_SYSROOT is not valid"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
@ -104,40 +117,63 @@ fi
# Fix C++ header paths for Ubuntu
# ARM_EMBEDDED_TOOLCHAIN_VERSION="4.7.3"
ARM_EMBEDDED_TOOLCHAIN_VERSION="5.4.0"
ARM_EMBEDDED_CXX_HEADERS="$ARM_EMBEDDED_SYSROOT/include/c++/$ARM_EMBEDDED_TOOLCHAIN_VERSION"
ARM_EMBEDDED_CXX_HEADERS="${ARM_EMBEDDED_SYSROOT}/include/c++/${ARM_EMBEDDED_TOOLCHAIN_VERSION}"
if [ ! -d "$ARM_EMBEDDED_CXX_HEADERS" ]; then
if [ ! -d "${ARM_EMBEDDED_CXX_HEADERS}" ]; then
echo "ERROR: ARM_EMBEDDED_CXX_HEADERS is not valid"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
if [ ! -d "$ARM_EMBEDDED_CXX_HEADERS/arm-linux-gnueabi" ]; then
if [ ! -d "${ARM_EMBEDDED_CXX_HEADERS}/arm-linux-gnueabi" ]; then
echo "ERROR: ARM_EMBEDDED_CXX_HEADERS is not valid"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Finally, the flags...
# export ARM_EMBEDDED_FLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -Wl,--fix-cortex-a8 -I$ARM_EMBEDDED_CXX_HEADERS -I$ARM_EMBEDDED_CXX_HEADERS/arm-linux-gnueabi"
# Add additional flags below, like -mcpu=cortex-m3.
if [ -z "$ARM_EMBEDDED_FLAGS" ]; then
export ARM_EMBEDDED_FLAGS="-I$ARM_EMBEDDED_CXX_HEADERS -I$ARM_EMBEDDED_CXX_HEADERS/arm-linux-gnueabi"
if [ -z "${ARM_EMBEDDED_HEADERS}" ]; then
ARM_EMBEDDED_HEADERS="-I\"${ARM_EMBEDDED_CXX_HEADERS}\" -I\"${ARM_EMBEDDED_CXX_HEADERS}/arm-linux-gnueabi\""
fi
# And print stuff to wow the user...
#####################################################################
VERBOSE=${VERBOSE:-1}
if [ "$VERBOSE" -gt 0 ]; then
echo "CPP: $CPP"
echo "CXX: $CXX"
echo "AR: $AR"
echo "LD: $LD"
echo "RANLIB: $RANLIB"
echo "ARM_EMBEDDED_TOOLCHAIN: $ARM_EMBEDDED_TOOLCHAIN"
echo "ARM_EMBEDDED_CXX_HEADERS: $ARM_EMBEDDED_CXX_HEADERS"
echo "ARM_EMBEDDED_FLAGS: $ARM_EMBEDDED_FLAGS"
echo "ARM_EMBEDDED_SYSROOT: $ARM_EMBEDDED_SYSROOT"
echo "ARM_EMBEDDED_TOOLCHAIN: ${ARM_EMBEDDED_TOOLCHAIN}"
if [[ -n "${ARM_EMBEDDED_CPPFLAGS}" ]]; then
echo "ARM_EMBEDDED_CPPFLAGS: ${ARM_EMBEDDED_CPPFLAGS}"
fi
echo "ARM_EMBEDDED_CFLAGS: ${ARM_EMBEDDED_CFLAGS}"
echo "ARM_EMBEDDED_CXXFLAGS: ${ARM_EMBEDDED_CXXFLAGS}"
if [[ -n "${ARM_EMBEDDED_LDFLAGS}" ]]; then
echo "ARM_EMBEDDED_LDFLAGS: ${ARM_EMBEDDED_LDFLAGS}"
fi
echo "ARM_EMBEDDED_SYSROOT: ${ARM_EMBEDDED_SYSROOT}"
fi
#####################################################################
# GNUmakefile-cross and Autotools expect these to be set.
# Note: prior to Crypto++ 8.6, CPPFLAGS, CXXFLAGS and LDFLAGS were not
# exported. At Crypto++ 8.6 CPPFLAGS, CXXFLAGS and LDFLAGS were exported.
export IS_ARM_EMBEDDED=1
export CPP CC CXX LD AS AR RANLIB STRIP OBJDUMP
CPPFLAGS="${DEF_CPPFLAGS} ${ARM_EMBEDDED_CPPFLAGS} ${ARM_EMBEDDED_HEADERS} -isysroot ${ARM_EMBEDDED_SYSROOT}"
CFLAGS="${DEF_CFLAGS} ${ARM_EMBEDDED_CFLAGS}"
CXXFLAGS="${DEF_CXXFLAGS} ${ARM_EMBEDDED_CXXFLAGS}"
LDFLAGS="${DEF_LDFLAGS} ${ARM_EMBEDDED_LDFLAGS} --sysroot ${ARM_EMBEDDED_SYSROOT}"
# Trim whitespace as needed
CPPFLAGS=$(echo "${CPPFLAGS}" | awk '{$1=$1;print}')
CFLAGS=$(echo "${CFLAGS}" | awk '{$1=$1;print}')
CXXFLAGS=$(echo "${CXXFLAGS}" | awk '{$1=$1;print}')
LDFLAGS=$(echo "${LDFLAGS}" | awk '{$1=$1;print}')
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
#####################################################################
echo
echo "*******************************************************************************"
echo "It looks the the environment is set correctly. Your next step is build"

View File

@ -6,11 +6,18 @@
#
# Based upon OpenSSL's setenv-android.sh by TH, JW, and SM.
# Heavily modified by JWW for Crypto++.
# Modified some more by JW and UB.
#
# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2)
# licensed under the Boost Software License 1.0, while the individual files
# in the compilation are all public domain.
#
# cpp is set to Apple's cpp. Actually, cpp is merely on-path so Apple's cpp
# is used. But Apple's cpp is sufficiently different from GNU's cpp and causes
# Autotools a lot of trouble because Autotools tests are predicated on GNU cpp.
# If your Autotools project results in "configure:6560: error: C preprocessor
# cpp fails sanity check", then file a bug report with Autotools.
#
# See http://www.cryptopp.com/wiki/iOS_(Command_Line) for more details
#############################################################################
@ -55,51 +62,81 @@ then
printf "Using positional arg, IOS_CPU=%s\n" "${IOS_CPU}"
fi
if [ -z "$IOS_SDK" ]; then
if [ -z "${IOS_SDK}" ]; then
echo "IOS_SDK is not set. Please set it"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
if [ -z "$IOS_CPU" ]; then
if [ -z "${IOS_CPU}" ]; then
echo "IOS_CPU is not set. Please set it"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
DEF_CPPFLAGS="-DNDEBUG"
DEF_CFLAGS="-Wall -g2 -O3 -fPIC"
DEF_CXXFLAGS="-Wall -g2 -O3 -fPIC"
DEF_LDFLAGS=""
#########################################
##### Clear old options #####
#########################################
unset IS_IOS
unset IS_MACOS
unset IS_ANDROID
unset IS_ARM_EMBEDDED
unset IOS_CPPFLAGS
unset IOS_CFLAGS
unset IOS_CXXFLAGS
unset IOS_LDFLAGS
unset IOS_SYSROOT
#########################################
##### Small Fixups, if needed #####
#########################################
if [[ "$IOS_SDK" == "iPhone" ]]; then
IOS_CPU=$(tr '[:upper:]' '[:lower:]' <<< "${IOS_CPU}")
ALT_SDK=$(tr '[:upper:]' '[:lower:]' <<< "${IOS_SDK}")
if [[ "${IOS_SDK}" == "iPhone" ]]; then
IOS_SDK=iPhoneOS
elif [[ "$ALT_SDK" == "iphone" || "$ALT_SDK" == "iphoneos" ]]; then
IOS_SDK=iPhoneOS
fi
if [[ "$IOS_SDK" == "iPhoneOSSimulator" ]]; then
if [[ "${IOS_SDK}" == "iPhoneSimulator" || "${IOS_SDK}" == "iPhoneOSSimulator" ]]; then
IOS_SDK=iPhoneSimulator
elif [[ "$ALT_SDK" == "iphonesimulator" || "$ALT_SDK" == "iphoneossimulator" ]]; then
IOS_SDK=iPhoneSimulator
fi
if [[ "$IOS_SDK" == "TV" || "$IOS_SDK" == "AppleTV" ]]; then
if [[ "${IOS_SDK}" == "TV" || "${IOS_SDK}" == "AppleTV" ]]; then
IOS_SDK=AppleTVOS
elif [[ "$ALT_SDK" == "tv" || "$ALT_SDK" == "appletv" || "$ALT_SDK" == "appletvos" ]]; then
IOS_SDK=AppleTVOS
fi
if [[ "$IOS_SDK" == "Watch" || "$IOS_SDK" == "AppleWatch" ]]; then
if [[ "${IOS_SDK}" == "Watch" || "${IOS_SDK}" == "AppleWatch" ]]; then
IOS_SDK=WatchOS
elif [[ "$ALT_SDK" == "watch" || "$ALT_SDK" == "applewatch" || "$ALT_SDK" == "applewatchos" ]]; then
IOS_SDK=WatchOS
fi
if [[ "$IOS_CPU" == "aarch64" || "$IOS_CPU" == "arm64"* || "$IOS_CPU" == "armv8"* ]] ; then
if [[ "${IOS_CPU}" == "amd64" || "${IOS_CPU}" == "x86_64" ]] ; then
IOS_CPU=x86_64
fi
if [[ "${IOS_CPU}" == "i386" || "${IOS_CPU}" == "i586" || "${IOS_CPU}" == "i686" ]] ; then
IOS_CPU=i386
fi
if [[ "${IOS_CPU}" == "aarch64" || "${IOS_CPU}" == "arm64"* || "${IOS_CPU}" == "armv8"* ]] ; then
IOS_CPU=arm64
fi
echo "Configuring for ${IOS_SDK} (${IOS_CPU})"
########################################
##### Environment #####
########################################
@ -110,54 +147,57 @@ fi
# -miphoneos-version-min=5. However, Xcode 7 lacks
# AppleTVOS and WatchOS support.
# Also see https://github.com/rust-lang/rust/issues/48862
# and https://developer.apple.com/documentation/bundleresources/information_property_list/minimumosversion
# iPhones can be either 32-bit or 64-bit
if [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "armv7"* ]]; then
if [[ "${IOS_SDK}" == "iPhoneOS" && "${IOS_CPU}" == "armv7"* ]]; then
MIN_VER=-miphoneos-version-min=6
elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "arm64" ]]; then
elif [[ "${IOS_SDK}" == "iPhoneOS" && "${IOS_CPU}" == "arm64" ]]; then
MIN_VER=-miphoneos-version-min=6
# Fixups for convenience
elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "i386" ]]; then
elif [[ "${IOS_SDK}" == "iPhoneOS" && "${IOS_CPU}" == "i386" ]]; then
IOS_SDK=iPhoneSimulator
# MIN_VER=-miphoneos-version-min=6
MIN_VER=-miphonesimulator-version-min=6
elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "x86_64" ]]; then
elif [[ "${IOS_SDK}" == "iPhoneOS" && "${IOS_CPU}" == "x86_64" ]]; then
IOS_SDK=iPhoneSimulator
# MIN_VER=-miphoneos-version-min=6
MIN_VER=-miphonesimulator-version-min=6
# Simulator builds
elif [[ "$IOS_SDK" == "iPhoneSimulator" && "$IOS_CPU" == "i386" ]]; then
elif [[ "${IOS_SDK}" == "iPhoneSimulator" && "${IOS_CPU}" == "i386" ]]; then
MIN_VER=-miphonesimulator-version-min=6
elif [[ "$IOS_SDK" == "iPhoneSimulator" && "$IOS_CPU" == "x86_64" ]]; then
elif [[ "${IOS_SDK}" == "iPhoneSimulator" && "${IOS_CPU}" == "x86_64" ]]; then
MIN_VER=-miphonesimulator-version-min=6
# Apple TV can be 32-bit Intel (1st gen), 32-bit ARM (2nd, 3rd gen) or 64-bit ARM (4th gen)
elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "i386" ]]; then
elif [[ "${IOS_SDK}" == "AppleTVOS" && "${IOS_CPU}" == "i386" ]]; then
MIN_VER=-mappletvos-version-min=6
elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "armv7"* ]]; then
elif [[ "${IOS_SDK}" == "AppleTVOS" && "${IOS_CPU}" == "armv7"* ]]; then
MIN_VER=-mappletvos-version-min=6
elif [[ "$IOS_SDK" == "AppleTVOS" && "$IOS_CPU" == "arm64" ]]; then
elif [[ "${IOS_SDK}" == "AppleTVOS" && "${IOS_CPU}" == "arm64" ]]; then
MIN_VER=-mappletvos-version-min=6
# Simulator builds
elif [[ "$IOS_SDK" == "AppleTVSimulator" && "$IOS_CPU" == "i386" ]]; then
elif [[ "${IOS_SDK}" == "AppleTVSimulator" && "${IOS_CPU}" == "i386" ]]; then
MIN_VER=-mappletvsimulator-version-min=6
elif [[ "$IOS_SDK" == "AppleTVSimulator" && "$IOS_CPU" == "x86_64" ]]; then
elif [[ "${IOS_SDK}" == "AppleTVSimulator" && "${IOS_CPU}" == "x86_64" ]]; then
MIN_VER=-mappletvsimulator-version-min=6
# Watch can be either 32-bit or 64-bit ARM. TODO: figure out which
# -mwatchos-version-min=n is needed for arm64. 9 is not enough.
elif [[ "$IOS_SDK" == "WatchOS" && "$IOS_CPU" == "armv7"* ]]; then
elif [[ "${IOS_SDK}" == "WatchOS" && "${IOS_CPU}" == "armv7"* ]]; then
MIN_VER=-mwatchos-version-min=6
elif [[ "${IOS_SDK}" == "WatchOS" && "${IOS_CPU}" == "arm64" ]]; then
MIN_VER=-mwatchos-version-min=6
elif [[ "$IOS_SDK" == "WatchOS" && "$IOS_CPU" == "arm64" ]]; then
MIN_VER=-mwatchos-version-min=10
# Simulator builds. TODO: figure out which -watchos-version-min=n
# is needed for arm64. 6 compiles and links, but is it correct?
elif [[ "$IOS_SDK" == "WatchSimulator" && "$IOS_CPU" == "i386" ]]; then
elif [[ "${IOS_SDK}" == "WatchSimulator" && "${IOS_CPU}" == "i386" ]]; then
MIN_VER=-mwatchsimulator-version-min=6
elif [[ "$IOS_SDK" == "WatchSimulator" && "$IOS_CPU" == "x86_64" ]]; then
elif [[ "${IOS_SDK}" == "WatchSimulator" && "${IOS_CPU}" == "x86_64" ]]; then
MIN_VER=-mwatchsimulator-version-min=6
# And the final catch-all
@ -175,10 +215,10 @@ fi
if [ -n "$(command -v xcodebuild 2>/dev/null)" ]; then
# Output of xcodebuild is similar to "Xcode 6.2". The first cut gets
# the dotted decimal value. The second cut gets the major version.
XCODE_VERSION=$(xcodebuild -version 2>/dev/null | head -n 1 | cut -f2 -d" " | cut -f1 -d".")
if [ -z "$XCODE_VERSION" ]; then XCODE_VERSION=100; fi
XCODE_VERSION=$(xcodebuild -version 2>/dev/null | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '.')
if [ -z "${XCODE_VERSION}" ]; then XCODE_VERSION=100; fi
if [ "$XCODE_VERSION" -le 6 ]; then
if [ "${XCODE_VERSION}" -le 6 ]; then
MIN_VER="${MIN_VER//iphonesimulator/iphoneos}"
fi
fi
@ -191,28 +231,28 @@ if [ -z "${XCODE_DEVELOPER-}" ]; then
XCODE_DEVELOPER=$(xcode-select -print-path 2>/dev/null)
fi
if [ ! -d "$XCODE_DEVELOPER" ]; then
if [ ! -d "${XCODE_DEVELOPER}" ]; then
echo "ERROR: unable to find XCODE_DEVELOPER directory."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# XCODE_DEVELOPER_SDK is the SDK location.
XCODE_DEVELOPER_SDK="$XCODE_DEVELOPER/Platforms/$IOS_SDK.platform"
XCODE_DEVELOPER_SDK="${XCODE_DEVELOPER}/Platforms/$IOS_SDK.platform/Developer/SDKs"
if [ ! -d "$XCODE_DEVELOPER_SDK" ]; then
if [ ! -d "${XCODE_DEVELOPER_SDK}" ]; then
echo "ERROR: unable to find XCODE_DEVELOPER_SDK directory."
echo " Is the SDK supported by Xcode and installed?"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# XCODE_TOOLCHAIN is the location of the actual compiler tools.
if [ -d "$XCODE_DEVELOPER/Toolchains/XcodeDefault.xctoolchain/usr/bin/" ]; then
XCODE_TOOLCHAIN="$XCODE_DEVELOPER/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
elif [ -d "$XCODE_DEVELOPER_SDK/Developer/usr/bin/" ]; then
XCODE_TOOLCHAIN="$XCODE_DEVELOPER_SDK/Developer/usr/bin/"
if [ -d "${XCODE_DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/" ]; then
XCODE_TOOLCHAIN="${XCODE_DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
elif [ -d "${XCODE_DEVELOPER_SDK}/Developer/usr/bin/" ]; then
XCODE_TOOLCHAIN="${XCODE_DEVELOPER_SDK}/Developer/usr/bin/"
fi
if [ -z "$XCODE_TOOLCHAIN" ] || [ ! -d "$XCODE_TOOLCHAIN" ]; then
if [ ! -d "${XCODE_TOOLCHAIN}" ]; then
echo "ERROR: unable to find Xcode cross-compiler tools."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
@ -221,70 +261,77 @@ fi
# For example, remove 4.3, 6.2, and 6.1 if they are not installed. We go back to
# the 1.0 SDKs because Apple WatchOS uses low numbers, like 2.0 and 2.1.
XCODE_SDK=""
for i in $(seq -f "%.1f" 30.0 -0.1 1.0)
for i in $(seq 30 -1 5) # SDK major
do
if [ -d "$XCODE_DEVELOPER_SDK/Developer/SDKs/$IOS_SDK$i.sdk" ]; then
XCODE_SDK="$IOS_SDK$i.sdk"
break
fi
for j in $(seq 20 -1 0) # SDK minor
do
SDK_VER="$i.$j"
if [ -d "${XCODE_DEVELOPER_SDK}/${IOS_SDK}${SDK_VER}.sdk" ]; then
XCODE_SDK="${IOS_SDK}${SDK_VER}.sdk"
break 2
fi
done
done
# Error checking
if [ -z "$XCODE_SDK" ]; then
if [ -z "${XCODE_SDK}" ]; then
echo "ERROR: unable to find a SDK."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
IOS_CXXFLAGS="-arch $IOS_CPU $MIN_VER"
IOS_CFLAGS="-arch ${IOS_CPU} ${MIN_VER} -fno-common"
IOS_CXXFLAGS="-arch ${IOS_CPU} ${MIN_VER} -stdlib=libc++ -fno-common"
IOS_SYSROOT="${XCODE_DEVELOPER_SDK}/${XCODE_SDK}"
if [ ! -d "${IOS_SYSROOT}" ]; then
echo "ERROR: unable to find Xcode sysroot."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# The simulators need to disable ASM. They don't receive arch flags.
# https://github.com/weidai11/cryptopp/issues/635
if [[ "$IOS_SDK" == "iPhoneSimulator" || "$IOS_SDK" == "AppleTVSimulator" || "$IOS_SDK" == "WatchSimulator" ]]; then
IOS_CXXFLAGS="$IOS_CXXFLAGS -DCRYPTOPP_DISABLE_ASM"
if [[ "${IOS_SDK}" == *"Simulator" ]]; then
IOS_CPPFLAGS="$IOS_CPPFLAGS -DCRYPTOPP_DISABLE_ASM"
fi
echo "Configuring for $IOS_SDK ($IOS_CPU)"
IS_IOS=1
IOS_SYSROOT="$XCODE_DEVELOPER_SDK/Developer/SDKs/$XCODE_SDK"
#####################################################################
CPP=cpp; CC=clang; CXX=clang++; LD=ld
AS=as; AR=libtool; RANLIB=ranlib; STRIP=strip
CPP="cpp"; CC="clang"; CXX="clang++"; LD="ld"
AS="as"; AR="libtool"; RANLIB="ranlib"
STRIP="strip"; OBJDUMP="objdump"
# Error checking
if [ ! -e "$XCODE_TOOLCHAIN/$CC" ]; then
if [ ! -e "${XCODE_TOOLCHAIN}/$CC" ]; then
echo "ERROR: Failed to find iOS clang. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "$XCODE_TOOLCHAIN/$CXX" ]; then
if [ ! -e "${XCODE_TOOLCHAIN}/$CXX" ]; then
echo "ERROR: Failed to find iOS clang++. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "$XCODE_TOOLCHAIN/$RANLIB" ]; then
if [ ! -e "${XCODE_TOOLCHAIN}/$RANLIB" ]; then
echo "ERROR: Failed to find iOS ranlib. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "$XCODE_TOOLCHAIN/$AR" ]; then
if [ ! -e "${XCODE_TOOLCHAIN}/$AR" ]; then
echo "ERROR: Failed to find iOS ar. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "$XCODE_TOOLCHAIN/$AS" ]; then
if [ ! -e "${XCODE_TOOLCHAIN}/$AS" ]; then
echo "ERROR: Failed to find iOS as. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "$XCODE_TOOLCHAIN/$LD" ]; then
if [ ! -e "${XCODE_TOOLCHAIN}/$LD" ]; then
echo "ERROR: Failed to find iOS ld. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
@ -294,32 +341,52 @@ fi
# Add tools to head of path, if not present already
LENGTH=${#XCODE_TOOLCHAIN}
SUBSTR=${PATH:0:$LENGTH}
if [ "$SUBSTR" != "$XCODE_TOOLCHAIN" ]; then
export PATH="$XCODE_TOOLCHAIN:$PATH"
if [ "${SUBSTR}" != "${XCODE_TOOLCHAIN}" ]; then
export PATH="${XCODE_TOOLCHAIN}:${PATH}"
fi
#####################################################################
# GNUmakefile-cross and Autotools expect these to be set.
# They are also used in the tests below.
export IS_IOS=1
export CPP CC CXX LD AS AR RANLIB STRIP
export IOS_CXXFLAGS IOS_SDK IOS_CPU IOS_SYSROOT
#####################################################################
VERBOSE=${VERBOSE:-1}
if [ "$VERBOSE" -gt 0 ]; then
echo "XCODE_TOOLCHAIN: $XCODE_TOOLCHAIN"
echo "IOS_SDK: $IOS_SDK"
echo "IOS_CPU: $IOS_CPU"
echo "IOS_SYSROOT: $IOS_SYSROOT"
echo "IOS_CXXFLAGS: $IOS_CXXFLAGS"
echo "XCODE_TOOLCHAIN: ${XCODE_TOOLCHAIN}"
echo "IOS_SDK: ${IOS_SDK}"
echo "IOS_CPU: ${IOS_CPU}"
if [ -n "${IOS_CPPFLAGS}" ]; then
echo "IOS_CPPFLAGS: ${IOS_CPPFLAGS}"
fi
echo "IOS_CFLAGS: ${IOS_CFLAGS}"
echo "IOS_CXXFLAGS: ${IOS_CXXFLAGS}"
if [ -n "${IOS_LDFLAGS}" ]; then
echo "IOS_LDFLAGS: ${IOS_LDFLAGS}"
fi
echo "IOS_SYSROOT: ${IOS_SYSROOT}"
fi
#####################################################################
# GNUmakefile-cross and Autotools expect these to be set.
# Note: prior to Crypto++ 8.6, CPPFLAGS, CXXFLAGS and LDFLAGS were not
# exported. At Crypto++ 8.6 CPPFLAGS, CXXFLAGS and LDFLAGS were exported.
export IS_IOS=1
export CPP CC CXX LD AS AR RANLIB STRIP OBJDUMP
CPPFLAGS="${DEF_CPPFLAGS} ${IOS_CPPFLAGS} -isysroot ${IOS_SYSROOT}"
CFLAGS="${DEF_CFLAGS} ${IOS_CFLAGS}"
CXXFLAGS="${DEF_CXXFLAGS} ${IOS_CXXFLAGS}"
LDFLAGS="${DEF_LDFLAGS} ${IOS_LDFLAGS} --sysroot ${IOS_SYSROOT}"
# Trim whitespace as needed
CPPFLAGS=$(echo "${CPPFLAGS}" | awk '{$1=$1;print}')
CFLAGS=$(echo "${CFLAGS}" | awk '{$1=$1;print}')
CXXFLAGS=$(echo "${CXXFLAGS}" | awk '{$1=$1;print}')
LDFLAGS=$(echo "${LDFLAGS}" | awk '{$1=$1;print}')
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
#####################################################################
echo
echo "*******************************************************************************"
echo "It looks the the environment is set correctly. Your next step is build"

View File

@ -0,0 +1,422 @@
#!/usr/bin/env bash
#############################################################################
#
# This script sets the cross-compile environment for Xcode/MacOS.
#
# Based upon OpenSSL's setenv-android.sh by TH, JW, and SM.
# Heavily modified by JWW for Crypto++.
# Modified some more by JW and UB.
#
# Crypto++ Library is copyrighted as a compilation and (as of version 5.6.2)
# licensed under the Boost Software License 1.0, while the individual files
# in the compilation are all public domain.
#
# cpp is set to Apple's cpp. Actually, cpp is merely on-path so Apple's cpp
# is used. But Apple's cpp is sufficiently different from GNU's cpp and causes
# Autotools a lot of trouble because Autotools tests are predicated on GNU cpp.
# If your Autotools project results in "configure:6560: error: C preprocessor
# cpp fails sanity check", then file a bug report with Autotools.
#
# See http://www.cryptopp.com/wiki/MacOS_(Command_Line) for more details
#############################################################################
#########################################
##### Some validation #####
#########################################
# In the past we could mostly infer arch or cpu from the SDK (and mostly
# vice-versa). Nowadays we need the user to set it for us because Apple
# platforms have both 32-bit or 64-bit variations.
# cryptest-macos.sh may run this script without sourcing.
if [ "$0" = "${BASH_SOURCE[0]}" ]; then
echo "setenv-macos.sh is usually sourced, but not this time."
fi
# This is fixed since we are building for MacOS
MACOS_SDK=MacOSX
# This supports 'source setenv-macos.sh x86_64' and
# 'source setenv-macos.sh MACOS_CPU=arm64'
if [[ -n "$1" ]]
then
arg1=$(echo "$1" | cut -f 1 -d '=')
arg2=$(echo "$1" | cut -f 2 -d '=')
if [[ -n "${arg2}" ]]; then
MACOS_CPU="${arg2}"
else
MACOS_CPU="${arg1}"
fi
printf "Using positional arg, MACOS_CPU=%s\n" "${MACOS_CPU}"
fi
# Sane default. Use current machine.
if [ -z "$MACOS_CPU" ]; then
MACOS_CPU="$(uname -m 2>/dev/null)"
if [[ "$MACOS_CPU" == "Power"* ]] ; then
if sysctl -a 2>/dev/null | grep -q 'hw.cpu64bit_capable: 1'; then
MACOS_CPU="ppc64"
else
MACOS_CPU="ppc"
fi
fi
fi
if [ -z "$MACOS_CPU" ]; then
echo "MACOS_CPU is not set. Please set it"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
DEF_CPPFLAGS="-DNDEBUG"
DEF_CFLAGS="-Wall -g2 -O3 -fPIC"
DEF_CXXFLAGS="-Wall -g2 -O3 -fPIC"
DEF_LDFLAGS=""
#########################################
##### Clear old options #####
#########################################
unset IS_IOS
unset IS_MACOS
unset IS_ANDROID
unset IS_ARM_EMBEDDED
unset MACOS_CPPFLAGS
unset MACOS_CFLAGS
unset MACOS_CXXFLAGS
unset MACOS_LDFLAGS
unset MACOS_SYSROOT
#########################################
##### Small Fixups, if needed #####
#########################################
MACOS_CPU=$(tr '[:upper:]' '[:lower:]' <<< "${MACOS_CPU}")
# Old world Macs
if [[ "$MACOS_CPU" == "power macintosh" || "$MACOS_CPU" == "powerpc" ]] ; then
MACOS_CPU=ppc
fi
if [[ "$MACOS_CPU" == "ppc64" || "$MACOS_CPU" == "powerpc64" ]] ; then
MACOS_CPU=ppc64
fi
if [[ "$MACOS_CPU" == "386" || "$MACOS_CPU" == "i686" || "$MACOS_CPU" == "686" ]] ; then
MACOS_CPU=i386
fi
if [[ "$MACOS_CPU" == "amd64" || "$MACOS_CPU" == "x86_64" ]] ; then
MACOS_CPU=x86_64
fi
if [[ "$MACOS_CPU" == "aarch64" || "$MACOS_CPU" == "arm64"* || "$MACOS_CPU" == "armv8"* ]] ; then
MACOS_CPU=arm64
fi
echo "Configuring for $MACOS_SDK ($MACOS_CPU)"
########################################
##### Environment #####
########################################
# The flags below were tested with Xcode 8 on Travis. If
# you use downlevel versions of Xcode, then you can push
# xxx-version-min=n lower. For example, Xcode 7 can use
# -mmacosx-version-min=5. However, you cannot link
# against LLVM's libc++.
# Also see https://github.com/rust-lang/rust/issues/48862
# and https://developer.apple.com/documentation/bundleresources/information_property_list/minimumosversion
# PowerMacs and Intels can be either 32-bit or 64-bit
if [[ "$MACOS_CPU" == "ppc" ]]; then
MIN_VER="-mmacosx-version-min=10.4"
elif [[ "$MACOS_CPU" == "ppc64" ]]; then
MIN_VER="-mmacosx-version-min=10.4"
elif [[ "$MACOS_CPU" == "i386" ]]; then
MIN_VER="-mmacosx-version-min=10.7"
elif [[ "$MACOS_CPU" == "x86_64" ]]; then
MIN_VER="-mmacosx-version-min=10.7"
elif [[ "$MACOS_CPU" == "arm64" ]]; then
MIN_VER="-mmacosx-version-min=11.0"
# And the final catch-all
else
echo "MACOS_CPU is not valid. Please fix it"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# The first cut if MIN_VER gets the full version, like 10.7. The
# second cut gets the major or minor version
if echo "${MIN_VER}" | grep -q '.'; then
MAJOR_VER=$(echo "${MIN_VER}" | head -n 1 | cut -f 2 -d '=' | cut -f 1 -d '.')
MINOR_VER=$(echo "${MIN_VER}" | head -n 1 | cut -f 2 -d '=' | cut -f 2 -d '.')
else
MAJOR_VER=$(echo "${MIN_VER}" | head -n 1 | cut -f 2 -d '=' | cut -f 1 -d '.')
MINOR_VER=0
fi
# OS X 10.7 minimum required for LLVM and -stdlib=libc++
if [[ "${MAJOR_VER}" -eq 10 && "${MINOR_VER}" -ge 7 ]]; then
MACOS_STDLIB="-stdlib=libc++"
elif [[ "${MAJOR_VER}" -ge 11 ]]; then
MACOS_STDLIB="-stdlib=libc++"
fi
# Allow a user override? I think we should be doing this. The use case is:
# move /Applications/Xcode somewhere else for a side-by-side installation.
if [ -z "${XCODE_DEVELOPER-}" ]; then
XCODE_DEVELOPER=$(xcode-select -print-path 2>/dev/null)
fi
if [ ! -d "${XCODE_DEVELOPER}" ]; then
echo "ERROR: unable to find XCODE_DEVELOPER directory."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
if [[ "${XCODE_DEVELOPER}" == "/Developer"* ]]; then
ANTIQUE_XCODE=1
DEF_CFLAGS=$(echo "$DEF_CFLAGS" | sed 's/-Wall //g')
DEF_CXXFLAGS=$(echo "$DEF_CXXFLAGS" | sed 's/-Wall //g')
fi
# Command Line Tools show up here on a Mac-mini M1
if [[ "${XCODE_DEVELOPER}" == "/Library"* ]]; then
CLT_XCODE=1
fi
# XCODE_DEVELOPER_SDK is the SDK location.
if [[ "${ANTIQUE_XCODE}" == "1" ]]
then
if [[ -d "${XCODE_DEVELOPER}/SDKs" ]]; then
XCODE_DEVELOPER_SDK="${XCODE_DEVELOPER}/SDKs"
fi
if [ ! -d "${XCODE_DEVELOPER_SDK}" ]; then
echo "ERROR: unable to find XCODE_DEVELOPER_SDK directory."
echo " Is the SDK supported by Xcode and installed?"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
elif [[ "${CLT_XCODE}" == "1" ]]
then
if [[ -d "${XCODE_DEVELOPER}/SDKs" ]]; then
XCODE_DEVELOPER_SDK="${XCODE_DEVELOPER}/SDKs"
fi
if [ ! -d "${XCODE_DEVELOPER_SDK}" ]; then
echo "ERROR: unable to find XCODE_DEVELOPER_SDK directory."
echo " Is the SDK supported by Xcode and installed?"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
else
if [[ -d "${XCODE_DEVELOPER}/Platforms/${MACOS_SDK}.platform" ]]; then
XCODE_DEVELOPER_SDK="${XCODE_DEVELOPER}/Platforms/${MACOS_SDK}.platform/Developer/SDKs"
fi
fi
# XCODE_SDK is the SDK name/version being used - adjust the list as appropriate.
# For example, remove 4.3, 6.2, and 6.1 if they are not installed. We go back to
# the 1.0 SDKs because Apple WatchOS uses low numbers, like 2.0 and 2.1.
XCODE_SDK=""
if [[ "${ANTIQUE_XCODE}" == "1" ]]
then
for i in 10.7 10.6 10.5 10.4 10.3 10.2 10.0
do
if [ -d "${XCODE_DEVELOPER_SDK}/${MACOS_SDK}$i.sdk" ]; then
XCODE_SDK="${MACOS_SDK}$i.sdk"
break
fi
done
else
for i in $(seq 30 -1 5) # SDK major
do
for j in $(seq 20 -1 0) # SDK minor
do
SDK_VER="$i.$j"
if [ -d "${XCODE_DEVELOPER_SDK}/${MACOS_SDK}${SDK_VER}.sdk" ]; then
XCODE_SDK="${MACOS_SDK}${SDK_VER}.sdk"
break 2
fi
done
done
fi
# Error checking
if [ -z "${XCODE_SDK}" ]; then
echo "ERROR: unable to find a SDK."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# XCODE_DEVELOPER_SDK is the SDK location.
if [[ "${ANTIQUE_XCODE}" == "1" ]]
then
# XCODE_DEVELOPER_SDK for old Xcode is above
:
else
if [ ! -d "${XCODE_DEVELOPER_SDK}" ]; then
echo "ERROR: unable to find XCODE_DEVELOPER_SDK directory."
echo " Is the SDK supported by Xcode and installed?"
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
fi
# XCODE_TOOLCHAIN is the location of the actual compiler tools.
if [[ "${ANTIQUE_XCODE}" == "1" ]]
then
if [ -d "${XCODE_DEVELOPER}/usr/bin" ]; then
XCODE_TOOLCHAIN="${XCODE_DEVELOPER}/usr/bin"
fi
elif [[ "${CLT_XCODE}" == "1" ]]
then
if [ -d "${XCODE_DEVELOPER}/usr/bin" ]; then
XCODE_TOOLCHAIN="${XCODE_DEVELOPER}/usr/bin"
fi
else
if [ -d "${XCODE_DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/" ]; then
XCODE_TOOLCHAIN="${XCODE_DEVELOPER}/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
elif [ -d "${XCODE_DEVELOPER_SDK}/Developer/usr/bin/" ]; then
XCODE_TOOLCHAIN="${XCODE_DEVELOPER_SDK}/Developer/usr/bin/"
elif [ -d "${XCODE_DEVELOPER_SDK}/usr/bin/" ]; then
XCODE_TOOLCHAIN="${XCODE_DEVELOPER_SDK}/usr/bin/"
fi
fi
if [ ! -d "${XCODE_TOOLCHAIN}" ]; then
echo "ERROR: unable to find Xcode cross-compiler tools."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
MACOS_CFLAGS="-arch $MACOS_CPU $MIN_VER -fno-common"
MACOS_CXXFLAGS="-arch $MACOS_CPU $MIN_VER ${MACOS_STDLIB} -fno-common"
MACOS_SYSROOT="${XCODE_DEVELOPER_SDK}/${XCODE_SDK}"
if [ ! -d "${MACOS_SYSROOT}" ]; then
echo "ERROR: unable to find Xcode sysroot."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
#####################################################################
CPP="cpp"; CC="clang"; CXX="clang++"; LD="ld"
AS="as"; AR="libtool"; RANLIB="ranlib"
STRIP="strip"; OBJDUMP="objdump"
if [[ "${ANTIQUE_XCODE}" == "1" ]]
then
CC="gcc"; CXX="g++";
fi
# Error checking
if [ ! -e "${XCODE_TOOLCHAIN}/$CC" ]; then
echo "ERROR: Failed to find MacOS clang. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "${XCODE_TOOLCHAIN}/$CXX" ]; then
echo "ERROR: Failed to find MacOS clang++. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "${XCODE_TOOLCHAIN}/$RANLIB" ]; then
echo "ERROR: Failed to find MacOS ranlib. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "${XCODE_TOOLCHAIN}/$AR" ]; then
echo "ERROR: Failed to find MacOS ar. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "${XCODE_TOOLCHAIN}/$AS" ]; then
echo "ERROR: Failed to find MacOS as. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
# Error checking
if [ ! -e "${XCODE_TOOLCHAIN}/$LD" ]; then
echo "ERROR: Failed to find MacOS ld. Please edit this script."
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1
fi
#####################################################################
# Add tools to head of path, if not present already
LENGTH=${#XCODE_TOOLCHAIN}
SUBSTR=${PATH:0:$LENGTH}
if [ "${SUBSTR}" != "${XCODE_TOOLCHAIN}" ]; then
PATH="${XCODE_TOOLCHAIN}:$PATH"
export PATH
fi
#####################################################################
VERBOSE=${VERBOSE:-1}
if [ "$VERBOSE" -gt 0 ]; then
echo "XCODE_TOOLCHAIN: ${XCODE_TOOLCHAIN}"
echo "MACOS_SDK: ${MACOS_SDK}"
echo "MACOS_CPU: ${MACOS_CPU}"
if [ -n "${MACOS_CPPFLAGS}" ]; then
echo "MACOS_CPPFLAGS: ${MACOS_CPPFLAGS}"
fi
echo "MACOS_CFLAGS: ${MACOS_CFLAGS}"
echo "MACOS_CXXFLAGS: ${MACOS_CXXFLAGS}"
if [ -n "${MACOS_LDFLAGS}" ]; then
echo "MACOS_LDFLAGS: ${MACOS_LDFLAGS}"
fi
echo "MACOS_SYSROOT: ${MACOS_SYSROOT}"
fi
#####################################################################
# GNUmakefile-cross and Autotools expect these to be set.
# Note: prior to Crypto++ 8.6, CPPFLAGS, CXXFLAGS and LDFLAGS were not
# exported. At Crypto++ 8.6 CPPFLAGS, CXXFLAGS and LDFLAGS were exported.
export IS_MACOS=1
export CPP CC CXX LD AS AR RANLIB STRIP OBJDUMP
if [[ "${ANTIQUE_XCODE}" == "1" ]]
then
CPPFLAGS="${DEF_CPPFLAGS} ${MACOS_CPPFLAGS} -isysroot ${MACOS_SYSROOT}"
CFLAGS="${DEF_CFLAGS} ${MACOS_CFLAGS}"
CXXFLAGS="${DEF_CXXFLAGS} ${MACOS_CXXFLAGS}"
LDFLAGS="${DEF_LDFLAGS} ${MACOS_LDFLAGS} -sysroot=${MACOS_SYSROOT}"
else
CPPFLAGS="${DEF_CPPFLAGS} ${MACOS_CPPFLAGS} -isysroot ${MACOS_SYSROOT}"
CFLAGS="${DEF_CFLAGS} ${MACOS_CFLAGS}"
CXXFLAGS="${DEF_CXXFLAGS} ${MACOS_CXXFLAGS}"
LDFLAGS="${DEF_LDFLAGS} ${MACOS_LDFLAGS} --sysroot ${MACOS_SYSROOT}"
fi
# Trim whitespace as needed
CPPFLAGS=$(echo "${CPPFLAGS}" | awk '{$1=$1;print}')
CFLAGS=$(echo "${CFLAGS}" | awk '{$1=$1;print}')
CXXFLAGS=$(echo "${CXXFLAGS}" | awk '{$1=$1;print}')
LDFLAGS=$(echo "${LDFLAGS}" | awk '{$1=$1;print}')
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
#####################################################################
echo
echo "*******************************************************************************"
echo "It looks the the environment is set correctly. Your next step is build"
echo "the library with 'make -f GNUmakefile-cross'."
echo "*******************************************************************************"
echo
[ "$0" = "${BASH_SOURCE[0]}" ] && exit 0 || return 0

View File

@ -27,6 +27,8 @@ Test: TestVectors/hmac.txt
Test: TestVectors/kalyna.txt
Test: TestVectors/keccak.txt
Test: TestVectors/lea.txt
Test: TestVectors/lsh256.txt
Test: TestVectors/lsh512.txt
Test: TestVectors/mars.txt
Test: TestVectors/nr.txt
Test: TestVectors/panama.txt
@ -61,4 +63,3 @@ Test: TestVectors/vmac.txt
Test: TestVectors/wake.txt
Test: TestVectors/whrlpool.txt
Test: TestVectors/xts.txt

View File

@ -1,107 +1,522 @@
AlgorithmType: SymmetricCipher
Name: HIGHT/ECB
#
Source: HIGHT reference zip file, file KISA_HIGHT_ECB.c
#
Comment: HIGHT/ECB, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
Plaintext: D7 6D 0D 18 32 7E C5 62
Ciphertext: E4 BC 2E 31 22 77 E4 DD
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 29 23 BE 84 E1 6C D6 AE 52 90 49 F1 F1 BB E9 EB
Plaintext: B3 A6 DB 3C 87 0C 3E 99
Ciphertext: 23 CA D1 A3 CD DF 7E AB
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 24 5E 0D 1C 06 B7 47 DE B3 12 4D C8 43 BB 8B A6
Plaintext: 1F 03 5A 7D 09 38 25 1F
Ciphertext: 52 BD 91 BB 26 F8 ED 99
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 5D D4 CB FC 96 F5 45 3B 13 0D 89 0A 1C DB AE 32
Plaintext: 20 9A 50 EE 40 78 36 FD
Ciphertext: 95 02 B4 6D 87 B4 41 67
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 12 49 32 F6 9E 7D 49 DC AD 4F 14 F2 44 40 66 D0
Plaintext: 6B C4 30 B7 32 3B A1 22
Ciphertext: 20 CB CF 41 65 24 E5 A6
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: F6 22 91 9D E1 8B 1F DA B0 CA 99 02 B9 72 9D 49
Plaintext: 2C 80 7E C5 99 D5 E9 80
Ciphertext: F3 1C 89 E6 6C 4F 5A 6F
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: B2 EA C9 CC 53 BF 67 D6 BF 14 D6 7E 2D DC 8E 66
Plaintext: 83 EF 57 49 61 FF 69 8F
Ciphertext: 39 21 C8 3B FE 5E 59 6E
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 61 CD D1 1E 9D 9C 16 72 72 E6 1D F0 84 4F 4A 77
Plaintext: 02 D7 E8 39 2C 53 CB C9
Ciphertext: 98 2F D7 56 17 44 97 BF
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 12 1E 33 74 9E 0C F4 D5 D4 9F D4 A4 59 7E 35 CF
Plaintext: 32 22 F4 CC CF D3 90 2D
Ciphertext: BB 80 F5 0B 35 11 5B A8
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 5D D4 CB FC 96 F5 45 3B 13 0D 89 0A 1C DB AE 32
Plaintext : 20 9A 50 EE 40 78 36 FD
Ciphertext : 95 02 B4 6D 87 B4 41 67
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 12 49 32 F6 9E 7D 49 DC AD 4F 14 F2 44 40 66 D0
Plaintext : 6B C4 30 B7 32 3B A1 22
Ciphertext : 20 CB CF 41 65 24 E5 A6
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: F6 22 91 9D E1 8B 1F DA B0 CA 99 02 B9 72 9D 49
Plaintext : 2C 80 7E C5 99 D5 E9 80
Ciphertext : F3 1C 89 E6 6C 4F 5A 6F
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: B2 EA C9 CC 53 BF 67 D6 BF 14 D6 7E 2D DC 8E 66
Plaintext : 83 EF 57 49 61 FF 69 8F
Ciphertext : 39 21 C8 3B FE 5E 59 6E
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 61 CD D1 1E 9D 9C 16 72 72 E6 1D F0 84 4F 4A 77
Plaintext : 02 D7 E8 39 2C 53 CB C9
Ciphertext : 98 2F D7 56 17 44 97 BF
Test: Encrypt
#
Source: HIGHT reference implementation
Comment: HIGHT/ECB, 128-bit key
Key: 12 1E 33 74 9E 0C F4 D5 D4 9F D4 A4 59 7E 35 CF
Plaintext : 32 22 F4 CC CF D3 90 2D
Ciphertext : BB 80 F5 0B 35 11 5B A8
Test: Encrypt
AlgorithmType: SymmetricCipher
Name: HIGHT/CBC
Source: HIGHT reference zip file, file KISA_HIGHT_CBC.c
#
Comment: HIGHT/CBC, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 26 8D 66 A7 35 A8 1A 81
Plaintext: 00 01 02 03 04 05 06 07
Ciphertext: CE 15 95 08 5A 18 8C 28
Test: Encrypt
#
Comment: HIGHT/CBC, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 26 8D 66 A7 35 A8 1A 81
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: CE 15 95 08 5A 18 8C 28 C1 8D 77 08 D9 C1 25 86
Test: Encrypt
#
Comment: HIGHT/CBC, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 26 8D 66 A7 35 A8 1A 81
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07
Ciphertext: CE 15 95 08 5A 18 8C 28 C1 8D 77 08 D9 C1 25 86 4B 3D AF 2B F2 0D 52 47
Test: Encrypt
#
Comment: HIGHT/CBC, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 26 8D 66 A7 35 A8 1A 81
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: CE 15 95 08 5A 18 8C 28 C1 8D 77 08 D9 C1 25 86 4B 3D AF 2B F2 0D 52 47 63 4A 00 01 2F A0 E9 F0
Test: Encrypt
#
Comment: HIGHT/CBC, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 26 8D 66 A7 35 A8 1A 81
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07
Ciphertext: CE 15 95 08 5A 18 8C 28 C1 8D 77 08 D9 C1 25 86 4B 3D AF 2B F2 0D 52 47 63 4A 00 01 2F A0 E9 F0 44 9D E2 BC C1 68 51 6C
Test: Encrypt
#
Comment: HIGHT/CBC, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 26 8D 66 A7 35 A8 1A 81
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: CE 15 95 08 5A 18 8C 28 C1 8D 77 08 D9 C1 25 86 4B 3D AF 2B F2 0D 52 47 63 4A 00 01 2F A0 E9 F0 44 9D E2 BC C1 68 51 6C 0E 27 45 AC 37 C1 A6 74
Test: Encrypt
#
Comment: HIGHT/CBC, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 26 8D 66 A7 35 A8 1A 81
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07
Ciphertext: CE 15 95 08 5A 18 8C 28 C1 8D 77 08 D9 C1 25 86 4B 3D AF 2B F2 0D 52 47 63 4A 00 01 2F A0 E9 F0 44 9D E2 BC C1 68 51 6C 0E 27 45 AC 37 C1 A6 74 3A 1E A5 1E B4 07 D1 4E
Test: Encrypt
#
Comment: HIGHT/CBC, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 26 8D 66 A7 35 A8 1A 81
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: CE 15 95 08 5A 18 8C 28 C1 8D 77 08 D9 C1 25 86 4B 3D AF 2B F2 0D 52 47 63 4A 00 01 2F A0 E9 F0 44 9D E2 BC C1 68 51 6C 0E 27 45 AC 37 C1 A6 74 3A 1E A5 1E B4 07 D1 4E C8 C4 B4 35 CA 05 CC 62
Test: Encrypt
AlgorithmType: SymmetricCipher
Name: HIGHT/CTR
Source: HIGHT reference zip file, file KISA_HIGHT_CTR.c
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00
Ciphertext: B3
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01
Ciphertext: B3 D1
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02
Ciphertext: B3 D1 FF
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03
Ciphertext: B3 D1 FF FC
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04
Ciphertext: B3 D1 FF FC C2
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05
Ciphertext: B3 D1 FF FC C2 A1
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06
Ciphertext: B3 D1 FF FC C2 A1 9B
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07
Ciphertext: B3 D1 FF FC C2 A1 9B C0
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B 09
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B 09 9F
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B 09
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B 09 9F
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B 09 9F 60 49 1E 60 9F C2
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B 09 9F 60 49 1E 60 9F C2 13
Test: Encrypt
#
Comment: HIGHT/CTR, 128-bit key
Key: 88 E3 4F 8F 08 17 79 F1 E9 F3 94 37 0A D4 05 89
IV: 00 00 00 00 00 00 00 FE
Plaintext: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00
Ciphertext: B3 D1 FF FC C2 A1 9B C0 13 0D C1 62 1C 58 39 98 8A D7 C5 9B 40 A2 D5 B9 57 7A DF 09 B6 A1 9C A3 D7 6A 45 3B F7 0B 0B 6C 78 4E 51 B7 68 D3 1C EF B3 5E F7 FA 5F 07 5B 09 9F 60 49 1E 60 9F C2 13 F2
Test: Encrypt

View File

@ -0,0 +1,5 @@
AlgorithmType: FileList
Name: LSH test vectors
Test: TestVectors/lsh256.txt
Test: TestVectors/lsh512.txt
Test: TestVectors/lsh512_256.txt

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More