Update to CryptoPP 8.5.0. This should make it work with Apple M1

This commit is contained in:
Sebastian Messmer 2021-01-12 22:36:27 -08:00 committed by Sebastian Messmer
parent fd72b8c7ab
commit 46ada21a30
367 changed files with 39938 additions and 29066 deletions

View File

@ -9,6 +9,9 @@ Security:
able to access those two blocks (i.e. 64KB of the stored data) is bad enough. See Section 8.3 in https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
XChaCha20-Poly1305 does not suffer from this constraint and stays secure even if the filesystem gets very large.
New platforms:
* CryFS should now work on devices with Apple M1 silicon
Build changes:
* Switch to Conan package manager
* Allow an easy way to modify how the dependencies are found. This is mostly helpful for package maintainers.
@ -18,7 +21,7 @@ Build changes:
Improvements:
* Display the file system configuration when mounting a file system
* Now shows a better error message when failing to load the config file and distinguishes between "wrong password" and "config file not found".
* Now shows a better error message when failing to load the config file that distinguishes between "wrong password" and "config file not found".
New features:
* Add support for atime mount options (noatime, strictatime, relatime, atime, nodiratime).
@ -32,6 +35,8 @@ Other:
* Updated to spdlog 1.8.5
* Updated to ranges-v3 0.11.0
* Updated to boost 1.75
* Updated to crypto++ 8.5
Version 0.10.3
---------------

9
vendor/README vendored
View File

@ -1,9 +1,8 @@
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_2_0
- changed: added CMakeLists.txt and cryptopp-config.cmake from https://github.com/noloader/cryptopp-cmake/tree/CRYPTOPP_8_2_0
- changed: commented out line including winapifamily.h in CMakeLists.txt
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
- 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: Fix Android compilation using patch file https://github.com/termux/termux-root-packages/files/4664745/config.h.patch.txt from https://github.com/cryfs/cryfs/issues/345
- 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

@ -0,0 +1,55 @@
# Appveyor's documentation is at https://www.appveyor.com/docs/build-phase/,
# and a sample configuration file is at https://www.appveyor.com/docs/appveyor-yml/.
# I have to admit its a bit complex and I don't fully understand it.
version: 1.0.{build}
clone_depth: 5
skip_tags: true
configuration:
- Debug
- Release
platform:
- Win32
- x64
image:
- Visual Studio 2019
- Visual Studio 2017
- Visual Studio 2015
- Visual Studio 2013
environment:
matrix:
- BUILD_MODE: MSBuild
# Disable build through solution file
build: off
# Build through commands in script below
test_script:
- ps: >-
msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptlib.vcxproj
msbuild /t:Build /p:platform="$env:platform" /p:configuration="$env:configuration" cryptest.vcxproj
msbuild /t:CopyCryptestToRoot cryptest.vcxproj
.\cryptest.exe v
.\cryptest.exe tv all
notifications:
- provider: Email
to:
- cryptopp-build@googlegroups.com
on_build_success: true
on_build_failure: true

View File

@ -0,0 +1,59 @@
# https://cirrus-ci.org/examples/
# https://github.com/curl/curl/blob/master/.cirrus.yml
# FreeBSD seems to have constant version problems, which requires IGNORE_OSVERSION.
env:
CIRRUS_CLONE_DEPTH: 5
IGNORE_OSVERSION: yes
task:
matrix:
- name: Debug build, FreeBSD 12.1
freebsd_instance:
image_family: freebsd-12-1
pkginstall_script:
- pkg update -f
- pkg install -y gmake
configure_script:
compile_script:
- CXXFLAGS="-DDEBUG -g3 -O0" gmake -j 3
test_script:
- ./cryptest.exe v
- ./cryptest.exe tv all
- name: Release build, FreeBSD 12.1
freebsd_instance:
image_family: freebsd-12-1
pkginstall_script:
- pkg update -f
- pkg install -y gmake
configure_script:
compile_script:
- gmake -j 3
test_script:
- ./cryptest.exe v
- ./cryptest.exe tv all
- name: Debug build, FreeBSD 13.0 (snap)
freebsd_instance:
image_family: freebsd-13-0-snap
pkginstall_script:
- pkg update -f
- pkg install -y gmake
configure_script:
compile_script:
- CXXFLAGS="-DDEBUG -g3 -O0" gmake -j 3
test_script:
- ./cryptest.exe v
- ./cryptest.exe tv all
- name: Release build, FreeBSD 13.0 (snap)
freebsd_instance:
image_family: freebsd-13-0-snap
pkginstall_script:
- pkg update -f
- pkg install -y gmake
configure_script:
compile_script:
- gmake -j 3
test_script:
- ./cryptest.exe v
- ./cryptest.exe tv all

View File

@ -0,0 +1 @@
*.sh eol=lf

View File

@ -0,0 +1,17 @@
### Crypto++ Issue Report
Thanks for taking the time to report an issue. Reporting issues helps us improve stability and reliability for all users, so it is a valuable contribution.
Please do not ask questions in the bug tracker. Please ask questions on the Crypto++ Users List at http://groups.google.com/forum/#!forum/cryptopp-users.
Please _do not_ ask questions at Stack Overflow. We may not be able to answer your question.
There is a wiki page with information on filing useful bug reports. If you have some time please visit http://www.cryptopp.com/wiki/Bug_Report on the wiki. The executive summary is:
* State the operating system and version (Ubutnu 17 x86_64, Windows 7 Professional x64, etc)
* State the version of the Crypto++ library (Crypto++ 7.0, Master, etc)
* State how you built the library (Makefile, Cmake, distro, etc)
* Show a typical command line (the output of the compiler for cryptlib.cpp)
* Show the link command (the output of the linker for libcryptopp.so or cryptest.exe)
* Show the exact error message you are receiving (copy and paste it); or
* Clearly state the undesired behavior (and state the expected behavior)

View File

@ -0,0 +1,19 @@
name: C/C++ CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: make
run: make all
- name: make test
run: make test

View File

@ -3,7 +3,7 @@
# Allows you to use test.cxx and
# avoid getting in the way of things
####################################
*.cxx
#*.cxx
####################
## Crypto++ specific
@ -38,6 +38,18 @@ a.out
*.o
#################
## Emacs
#################
*~
\#*\#
#################
## Vi swap
#################
*.swp
*.swo
#################
## Eclipse
#################
@ -85,7 +97,10 @@ local.properties
[Dd]ebug/
[Rr]elease/
Win32/
x64/
Arm/
Arm64/
build/
[Bb]in/
[Oo]bj/

View File

@ -0,0 +1,655 @@
# In the YML below each job gets an environment that includes
# BUILD_OS and BUILD_MODE. The variables are used in the driver
# scripts and is used to select a test. For example, BUILD_OS=linux
# and BUILD_MODE=all means run 'make all' on Linux. The Android
# tests specify a ANDROID_API, ANDROID_CPU; and the iOS tests
# specify IOS_SDK and IOS_CPU. They are exported for the underlying
# setenv-*.sh scripts.
# DO NOT create top level (global) keys like env, arch, os, compiler.
# The top level/global keys invoke [unwanted] matrix expansion. Also
# see https://stackoverflow.com/q/58473000/608639 and
# https://docs.travis-ci.com/user/reference/overview/ and
# https://docs.travis-ci.com/user/multi-cpu-architectures and
# https://github.com/travis-ci/travis-yml/blob/master/schema.json.
language: cpp
dist: bionic
git:
depth: 5
# Use jobs rather than matrix since we are precisely
# specifiying our test cases. Do not move any of the
# keys (env, os, arch, compiler, etc) into global.
# Putting them in global invokes the matrix expansion.
jobs:
include:
- name: Standard build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=all
- name: Native build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=native
- name: No-asm build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=no-asm
- name: Debug build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=debug
- name: Asan build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=asan
- name: UBsan build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=ubsan
- name: PEM build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=pem
- name: Autotools build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=autotools
- name: CMake build, GCC, Linux, amd64
os: linux
arch: amd64
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=cmake
- name: Standard build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=all
- name: Native build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=native
- name: No-asm build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=no-asm
- name: Debug build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=debug
- name: Asan build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=asan
- name: UBsan build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=ubsan
- name: PEM build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=pem
- name: Autotools build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=autotools
- name: CMake build, Clang, Linux, amd64
os: linux
arch: amd64
compiler: clang
env:
- BUILD_OS=linux
- BUILD_MODE=cmake
- name: Standard build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=all
- name: Standard build (64-bit), Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- CXXFLAGS="-DNDEBUG -g2 -O3 -arch x86_64"
- BUILD_OS=osx
- BUILD_MODE=all
- name: Standard build (32-bit), Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- CXXFLAGS="-DNDEBUG -g2 -O3 -arch i386"
- BUILD_OS=osx
- BUILD_MODE=all
- name: Standard build (fat), Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- CXXFLAGS="-DNDEBUG -g2 -O3 -arch i386 -arch x86_64"
- BUILD_OS=osx
- BUILD_MODE=osx-fat
- name: Native build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=native
- name: No-asm build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=no-asm
- name: Debug build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=debug
- name: Asan build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=asan
- name: UBsan build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=ubsan
- name: PEM build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=pem
- name: Autotools build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=autotools
- name: CMake build, Clang, OS X, amd64
os: osx
osx_image: xcode10.1
arch: amd64
compiler: clang
env:
- BUILD_OS=osx
- BUILD_MODE=cmake
- name: Standard build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=all
- name: Native build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=native
- name: No-asm build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=no-asm
- name: Debug build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=debug
- name: Asan build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=asan
- name: UBsan build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=ubsan
- name: PEM build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=pem
- name: Autotools build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=autotools
- name: CMake build, GCC, Linux, arm64
os: linux
arch: arm64
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=cmake
- name: Standard build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=all
- name: Native build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=native
- name: No-asm build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=no-asm
- name: Debug build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=debug
- name: Asan build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=asan
- name: UBsan build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=ubsan
- name: PEM build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=pem
- name: Autotools build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=autotools
- name: CMake build, Clang, Linux, arm64
os: linux
arch: arm64
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=cmake
- name: Standard build, GCC, Linux, ppc64le
os: linux
arch: ppc64le
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=all
- name: Debug build, GCC, Linux, ppc64le
os: linux
arch: ppc64le
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=debug
- name: Standard build, Clang, Linux, ppc64le
os: linux
arch: ppc64le
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=all
- CC=clang-8
- CXX=clang++-8
- name: Debug build, Clang, Linux, ppc64le
os: linux
arch: ppc64le
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=debug
- CC=clang-8
- CXX=clang++-8
- name: Standard build, GCC, Linux, s390x
os: linux
arch: s390x
compiler: gcc
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=all
- name: Debug build, GCC, Linux, s390x
os: linux
arch: s390x
compiler: gcc
env:
- BUILD_OS=linux
- BUILD_MODE=debug
- name: Standard build, Clang, Linux, s390x
os: linux
arch: s390x
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=all
- CC=clang-8
- CXX=clang++-8
- name: Debug build, Clang, Linux, s390x
os: linux
arch: s390x
compiler: clang
dist: bionic
env:
- BUILD_OS=linux
- BUILD_MODE=debug
- CC=clang-8
- CXX=clang++-8
- name: Android, armv7a, Linux
os: linux
arch: amd64
env:
- BUILD_OS=linux
- BUILD_MODE=android
- ANDROID_CPU=armv7a
- ANDROID_API=23
- ANDROID_SDK_ROOT="/opt/android-sdk"
- ANDROID_NDK_ROOT="/opt/android-ndk"
- name: Android, aarch64, Linux
os: linux
arch: amd64
env:
- BUILD_OS=linux
- BUILD_MODE=android
- ANDROID_CPU=aarch64
- ANDROID_API=23
- ANDROID_SDK_ROOT="/opt/android-sdk"
- ANDROID_NDK_ROOT="/opt/android-ndk"
- name: Android, x86, Linux
os: linux
arch: amd64
env:
- BUILD_OS=linux
- BUILD_MODE=android
- ANDROID_CPU=x86
- ANDROID_API=23
- ANDROID_SDK_ROOT="/opt/android-sdk"
- ANDROID_NDK_ROOT="/opt/android-ndk"
- name: Android, x86_64, Linux
os: linux
arch: amd64
env:
- BUILD_OS=linux
- BUILD_MODE=android
- ANDROID_CPU=x86_64
- ANDROID_API=23
- ANDROID_SDK_ROOT="/opt/android-sdk"
- ANDROID_NDK_ROOT="/opt/android-ndk"
- name: iPhoneOS, armv7, iOS
os: osx
osx_image: xcode10.1
arch: amd64
env:
- BUILD_OS=osx
- BUILD_MODE=ios
- IOS_CPU=armv7s
- IOS_SDK=iPhoneOS
- name: iPhoneOS, arm64, iOS
os: osx
osx_image: xcode10.1
arch: amd64
env:
- BUILD_OS=osx
- BUILD_MODE=ios
- IOS_CPU=arm64
- IOS_SDK=iPhoneOS
- name: AppleTVOS, arm64, iOS
os: osx
osx_image: xcode10.1
arch: amd64
env:
- BUILD_OS=osx
- BUILD_MODE=ios
- IOS_CPU=arm64
- IOS_SDK=AppleTVOS
- name: WatchOS, armv7, iOS
os: osx
osx_image: xcode10.1
arch: amd64
env:
- BUILD_OS=osx
- BUILD_MODE=ios
- IOS_CPU=armv7k
- IOS_SDK=WatchOS
- name: iPhoneSimulator, i386, OS X
os: osx
osx_image: xcode10.1
arch: amd64
env:
- BUILD_OS=osx
- BUILD_MODE=ios
- IOS_CPU=i386
- IOS_SDK=iPhoneSimulator
- name: iPhoneSimulator, x86_64, OS X
os: osx
osx_image: xcode10.1
arch: amd64
env:
- BUILD_OS=osx
- BUILD_MODE=ios
- IOS_CPU=x86_64
- IOS_SDK=iPhoneSimulator
- name: AppleTVSimulator, x86_64, OS X
os: osx
osx_image: xcode10.1
arch: amd64
env:
- BUILD_OS=osx
- BUILD_MODE=ios
- IOS_CPU=x86_64
- IOS_SDK=AppleTVSimulator
- name: WatchSimulator, i386, OS X
os: osx
osx_image: xcode10.1
arch: amd64
env:
- BUILD_OS=osx
- BUILD_MODE=ios
- IOS_CPU=i386
- IOS_SDK=WatchSimulator
allow_failures:
# Clang has a fair amount of trouble
# on platforms Apple does not support
- os: linux
arch: s390x
compiler: clang
# Clang 7.0 and below will likely have trouble on ppc64le
# due to https://bugs.llvm.org/show_bug.cgi?id=39704.
- os: linux
arch: ppc64le
compiler: clang
before_install:
- |
if [[ "$BUILD_OS" == "linux" ]] && [[ "$BUILD_MODE" == "android" ]]; then
# https://github.com/travis-ci/travis-ci/issues/9037
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A145
sudo apt-get -qq -y update
sudo -E TestScripts/install-ndk.sh
fi
if [[ "$BUILD_OS" == "linux" ]] && [[ "$BUILD_MODE" == "autotools" ]]; then
# https://github.com/travis-ci/travis-ci/issues/9037
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A145
sudo apt-get -qq -y install autoconf automake libtool
fi
# Clang 7 compiler is completely broken on PPC64 and s390x
if [[ "$TRAVIS_CPU_ARCH" == "ppc64le" ]] || [[ "$TRAVIS_CPU_ARCH" == "s390x" ]]; then
if [[ "$TRAVIS_OS_NAME" == "linux" ]] && [[ "$TRAVIS_COMPILER" == "clang" ]]; then
# https://github.com/travis-ci/travis-ci/issues/9037
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A145
sudo apt-get -qq -y install --no-install-recommends clang-8
fi
fi
script:
- |
if [[ "$BUILD_MODE" == "ios" ]]; then
source TestScripts/setenv-ios.sh
make -f GNUmakefile-cross -j 2 all static dynamic
elif [[ "$BUILD_MODE" == "android" ]]; then
source TestScripts/setenv-android.sh
make -f GNUmakefile-cross -j 2 all static dynamic
elif [[ "$BUILD_MODE" == "autotools" ]]; then
bash TestScripts/cryptest-autotools.sh
elif [[ "$BUILD_MODE" == "cmake" ]]; then
bash TestScripts/cryptest-cmake.sh
elif [[ "$BUILD_MODE" == "pem" ]]; then
bash TestScripts/cryptest-pem.sh
elif [[ "$BUILD_MODE" == "osx-fat" ]]; then
CXXFLAGS="-DNDEBUG -g2 -O3 -arch i386 -arch x86_64" make -j 2
arch -i386 ./cryptest.exe v
arch -i386 ./cryptest.exe tv all
arch -x86_64 ./cryptest.exe v
arch -x86_64 ./cryptest.exe tv all
elif [[ "$BUILD_MODE" == "debug" ]]; then
CXXFLAGS="-DDEBUG -g2 -O1" make -j 2
./cryptest.exe v
./cryptest.exe tv all
else
make "$BUILD_MODE" -j 2
./cryptest.exe v
./cryptest.exe tv all
fi
# Whitelist branches to avoid testing feature branches twice
branches:
only:
- master
- /\/ci$/
notifications:
email:
recipients:
- cryptopp-build@googlegroups.com
on_success: always # default: change
on_failure: always # default: always

View File

@ -1,4 +1,4 @@
// 3way.cpp - modifed by Wei Dai from Joan Daemen's 3way.c
// 3way.cpp - modified by Wei Dai from Joan Daemen's 3way.c
// The original code and all modifications are in the public domain.
#include "pch.h"

View File

@ -34,11 +34,11 @@ cmake_policy(SET CMP0069 NEW)
if (${CMAKE_VERSION} VERSION_LESS "3.0.0")
project(cryptopp)
set(cryptopp_VERSION_MAJOR 8)
set(cryptopp_VERSION_MINOR 2)
set(cryptopp_VERSION_MINOR 5)
set(cryptopp_VERSION_PATCH 0)
else ()
cmake_policy(SET CMP0048 NEW)
project(cryptopp VERSION 8.2.0)
project(cryptopp VERSION 8.3.0)
if (NOT ${CMAKE_VERSION} VERSION_LESS "3.1.0")
cmake_policy(SET CMP0054 NEW)
endif ()
@ -84,7 +84,6 @@ option(DISABLE_AESNI "Disable AES-NI" OFF)
option(DISABLE_SHA "Disable SHA" OFF)
option(DISABLE_AVX "Disable AVX" OFF)
option(DISABLE_AVX2 "Disable AVX2" OFF)
option(CRYPTOPP_NATIVE_ARCH "Enable native architecture" OFF)
set(CRYPTOPP_DATA_DIR "" CACHE PATH "Crypto++ test data directory")
#============================================================================
@ -117,9 +116,24 @@ endif ()
if (DISABLE_SSE4)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE4)
endif ()
if (DISABLE_CLMUL)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_CLMUL)
endif ()
if (DISABLE_AESNI)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AESNI)
endif ()
if (DISABLE_RDRAND)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_RDRAND)
endif ()
if (DISABLE_RDSEED)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_RDSEED)
endif ()
if (DISABLE_AVX)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AVX)
endif ()
if (DISABLE_AVX2)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AVX2)
endif ()
if (DISABLE_SHA)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SHA)
endif ()
@ -227,30 +241,25 @@ function(CheckCompileLinkOption opt var prog)
# TODO: improve this...
CHECK_CXX_COMPILER_FLAG(${opt} ${var})
elseif (APPLE)
message(STATUS "Performing Test ${var}")
try_compile(COMMAND_SUCCESS ${CMAKE_BINARY_DIR} ${prog} COMPILE_DEFINITIONS ${opt})
if (COMMAND_SUCCESS)
set(${var} 1 PARENT_SCOPE)
message(STATUS "Performing Test ${var} - Success")
else ()
set(${var} 0 PARENT_SCOPE)
message(STATUS "Performing Test ${var} - Failed")
endif ()
else ()
message(STATUS "Performing Test ${var}")
execute_process(
COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} ${opt} ${prog} 2>&1"
RESULT_VARIABLE COMMAND_RESULT
OUTPUT_VARIABLE COMMAND_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
# message(STATUS "RESULT_VARIABLE ${RESULT_VARIABLE}")
# message(STATUS "COMMAND_RESULT ${COMMAND_RESULT}")
# message(STATUS "OUTPUT_VARIABLE ${OUTPUT_VARIABLE}")
# message(STATUS "COMMAND_OUTPUT ${COMMAND_OUTPUT}")
# This test is strict. We require two things. First, the invocation
# of the compile command must return 0. Second, there must be no
# messages on the console. We are interested in diagnostics like
# warnings to decide when to reject an option. But we will probably
# capture chatty compiler that want to say, "Hooray, success". For
# chatty compilers we will need to find a quiet option and use it
# for the test. Microsoft compilers come to mind.
if ("${COMMAND_RESULT}" EQUAL 0 AND "${COMMAND_OUTPUT}" STREQUAL "")
set(${var} 1 PARENT_SCOPE)
message(STATUS "Performing Test ${var} - Success")
try_compile(COMMAND_SUCCESS ${CMAKE_BINARY_DIR} ${prog} COMPILE_DEFINITIONS ${opt})
if (COMMAND_SUCCESS)
set(${var} 1 PARENT_SCOPE)
message(STATUS "Performing Test ${var} - Success")
else ()
set(${var} 0 PARENT_SCOPE)
message(STATUS "Performing Test ${var} - Failed")
@ -279,35 +288,36 @@ function(DumpMachine output pattern)
set(${output} 0 PARENT_SCOPE)
else ()
execute_process(
COMMAND sh -c "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1"
COMMAND ${GREP_CMD} -i -c -E "${pattern}"
OUTPUT_VARIABLE ${output}
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(${output} "${${output}}" PARENT_SCOPE)
if(CMAKE_SYSTEM_PROCESSOR MATCHES ${pattern})
set(${output} TRUE PARENT_SCOPE)
endif()
endif()
endfunction(DumpMachine)
# Thansk to Anonimal for MinGW; see http://github.com/weidai11/cryptopp/issues/466
DumpMachine(CRYPTOPP_AMD64 "amd64|x86_64")
DumpMachine(CRYPTOPP_I386 "i.86")
DumpMachine(CRYPTOPP_MINGW32 "\\<mingw32\\>")
DumpMachine(CRYPTOPP_MINGW64 "w64-mingw32|mingw64")
DumpMachine(CRYPTOPP_X32 "x32")
DumpMachine(CRYPTOPP_AARCH32 "Aarch32")
DumpMachine(CRYPTOPP_AARCH64 "Aarch64")
DumpMachine(CRYPTOPP_ARMHF "armhf|arm7l|eabihf")
DumpMachine(CRYPTOPP_ARM "\\<arm\\>")
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_ARM32 "(arm|armhf|arm7l|eabihf)")
DumpMachine(CRYPTOPP_PPC32 "^(powerpc|ppc)")
DumpMachine(CRYPTOPP_PPC64 "^ppc64")
# Cleanup 32/64 bit
if (CRYPTOPP_AMD64)
set (CRYPTOPP_I386 0)
endif ()
if (CRYPTOPP_ARMV8)
set (CRYPTOPP_ARM32 0)
endif ()
if (CRYPTOPP_PPC64)
set (CRYPTOPP_PPC32 0)
endif ()
# Detecting PowerPC is only good with GCC. IBM XLC compiler is
# a little different and I don't know how to ask to the triplet
# XLC is targeting. Below we punt by setting CRYPTOPP_POWERPC64
# if we detect the compiler is XLC.
DumpMachine(CRYPTOPP_POWERPC "ppc|powerpc")
DumpMachine(CRYPTOPP_POWERPC64 "ppc64")
###############################################################################
@ -328,8 +338,8 @@ if (NOT CRYPTOPP_SOLARIS)
endif ()
# Fixup PowerPC. If both 32-bit and 64-bit use 64-bit.
if (CRYPTOPP_POWERPC AND CRYPTOPP_POWERPC64)
unset(CRYPTOPP_POWERPC)
if (CRYPTOPP_PPC32 AND CRYPTOPP_PPC64)
unset(CRYPTOPP_PPC32)
endif ()
# Fixup for xlC compiler. -dumpmachine fails so we miss PowerPC
@ -337,7 +347,7 @@ endif ()
# Must use CMAKE_CXX_COMPILER here due to XLC 13.1 and LLVM front-end.
if (CMAKE_CXX_COMPILER MATCHES "xlC")
message ("-- Fixing platform due to IBM xlC")
set(CRYPTOPP_POWERPC64 1)
set(CRYPTOPP_PPC64 1)
endif ()
# DumpMachine SunCC style
@ -378,77 +388,12 @@ endif ()
###############################################################################
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} --version 2>&1"
COMMAND ${GREP_CMD} -i -c "macports"
OUTPUT_VARIABLE MACPORTS
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (MACPORTS EQUAL 0)
# Get GAS version, add defs + set as appropriate
set(GAS_CMD sh -c "${CMAKE_CXX_COMPILER} -xc -c /dev/null -Wa,-v -o/dev/null 2>&1")
execute_process(COMMAND ${GAS_CMD}
OUTPUT_VARIABLE GAS_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(FIND "${GAS_STRING}" "GNU assembler" GAS_OUTPUT)
if (NOT GAS_OUTPUT EQUAL -1)
#.intel_syntax wasn't supported until GNU assembler 2.10
# TODO(unassigned): string() REGEX was not cooperating at time of writing. Re-implement as needed.
execute_process(COMMAND echo ${GAS_STRING}
COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.[1-9][0-9]|[3-9])"
OUTPUT_VARIABLE GAS210_OR_LATER)
if (GAS210_OR_LATER EQUAL 0)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ASM)
set(DISABLE_ASM 1)
endif ()
execute_process(COMMAND echo ${GAS_STRING}
COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.1[7-9]|2\\.[2-9]|[3-9])"
OUTPUT_VARIABLE GAS217_OR_LATER)
if (GAS217_OR_LATER EQUAL 0)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE3)
set(DISABLE_SSSE3 1)
endif ()
# OpenBSD and CentOS 5 needed this one due to ARIA and BLAKE2
execute_process(COMMAND echo ${GAS_STRING}
COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.1[8-9]|2\\.[2-9]|[3-9])"
OUTPUT_VARIABLE GAS218_OR_LATER)
if (GAS218_OR_LATER EQUAL 0)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE4)
set(DISABLE_SSE4 1)
endif ()
execute_process(COMMAND echo ${GAS_STRING}
COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.19|2\\.[2-9]|[3-9])"
OUTPUT_VARIABLE GAS219_OR_LATER)
if (GAS219_OR_LATER EQUAL 0)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AESNI)
set(DISABLE_AESNI 1)
endif ()
# Ubuntu 10 and Ubuntu 12 needed this one
execute_process(COMMAND echo ${GAS_STRING}
COMMAND ${GREP_CMD} -i -c -E "GNU.[Aa]ssembler.*(2\\.2[3-9]|2\\.[3-9]|[3-9])"
OUTPUT_VARIABLE GAS223_OR_LATER)
if (GAS223_OR_LATER EQUAL 0)
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SHA)
set(DISABLE_SHA 1)
endif ()
endif ()
endif ()
endif ()
# TODO: what about ICC and LLVM on Windows?
if (MSVC)
if (CMAKE_SYSTEM_VERSION MATCHES "10\\.0.*")
list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "_WIN32_WINNT=0x0A00")
endif ()
#list(APPEND CRYPTOPP_COMPILE_OPTIONS "/FI\"winapifamily.h\"")
list(APPEND CRYPTOPP_COMPILE_OPTIONS /FI winapifamily.h)
endif ()
# Enable PIC for all target machines except 32-bit i386 due to register pressures.
@ -563,6 +508,11 @@ set(cryptopp_SOURCES
${cryptopp_SOURCES}
)
if(ANDROID)
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
list(APPEND cryptopp_SOURCES ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
endif()
set(cryptopp_SOURCES_ASM)
if (MSVC AND NOT DISABLE_ASM)
@ -572,6 +522,7 @@ if (MSVC AND NOT DISABLE_ASM)
enable_language(ASM_MASM)
list(APPEND cryptopp_SOURCES_ASM
${SRC_DIR}/rdrand.asm
${SRC_DIR}/rdseed.asm
)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND cryptopp_SOURCES_ASM
@ -596,7 +547,7 @@ endif ()
# Must use CMAKE_CXX_COMPILER here due to XLC 13.1 and LLVM front-end.
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER MATCHES "xlC")
if (CRYPTOPP_AMD64 OR CRYPTOPP_I386 OR CRYPTOPP_X32)
if (CRYPTOPP_AMD64 OR CRYPTOPP_I386)
CheckCompileLinkOption("-msse2" CRYPTOPP_IA32_SSE2
"${TEST_PROG_DIR}/test_x86_sse2.cxx")
@ -616,8 +567,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
"${TEST_PROG_DIR}/test_x86_avx2.cxx")
CheckCompileLinkOption("-msse4.2 -msha" CRYPTOPP_IA32_SHA
"${TEST_PROG_DIR}/test_x86_sha.cxx")
CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM
"${TEST_PROG_DIR}/test_mixed_asm.cxx")
if (EXISTS "${TEST_PROG_DIR}/test_asm_mixed.cxx")
CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM
"${TEST_PROG_DIR}/test_asm_mixed.cxx")
else ()
CheckCompileLinkOption("" CRYPTOPP_MIXED_ASM
"${TEST_PROG_DIR}/test_mixed_asm.cxx")
endif ()
# https://github.com/weidai11/cryptopp/issues/756
if (NOT CRYPTOPP_MIXED_ASM)
@ -638,7 +594,6 @@ 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}/simeck_simd.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)
@ -646,16 +601,14 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
elseif (CRYPTOPP_IA32_SSE41 AND NOT DISABLE_SSE4)
set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1")
set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1")
set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1")
set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1")
endif ()
if (NOT CRYPTOPP_IA32_SSE42 AND NOT DISABLE_SSE4)
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSE4")
elseif (CRYPTOPP_IA32_SSE42 AND NOT DISABLE_SSE4)
set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2")
if (NOT CRYPTOPP_IA32_CLMUL AND NOT DISABLE_AES)
if (NOT CRYPTOPP_IA32_CLMUL AND NOT DISABLE_CLMUL)
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_CLMUL")
elseif (CRYPTOPP_IA32_CLMUL AND NOT DISABLE_AES)
elseif (CRYPTOPP_IA32_CLMUL AND NOT DISABLE_CLMUL)
set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3 -mpclmul")
set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS "-mpclmul")
endif ()
@ -684,12 +637,22 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
endif ()
endif ()
elseif (CRYPTOPP_AARCH32 OR CRYPTOPP_AARCH64)
elseif (CRYPTOPP_ARMV8)
CheckCompileOption("-march=armv8-a" CRYPTOPP_ARMV8A_ASIMD)
CheckCompileOption("-march=armv8-a+crc" CRYPTOPP_ARMV8A_CRC)
CheckCompileOption("-march=armv8-a+crypto" CRYPTOPP_ARMV8A_CRYPTO)
CheckCompileOption("-march=armv8-a" CRYPTOPP_ARMV8A_NATIVE)
# This checks for <arm_acle.h>
CheckCompileLinkOption("-march=armv8-a" CRYPTOPP_ARM_ACLE_HEADER
"${TEST_PROG_DIR}/test_arm_acle_header.cxx")
# Use <arm_acle.h> if available
if (CRYPTOPP_ARM_NEON_HEADER)
CheckCompileOption("-march=armv8-a -DCRYPTOPP_ARM_ACLE_HEADER=1" CRYPTOPP_ARMV8A_ASIMD)
CheckCompileOption("-march=armv8-a+crc -DCRYPTOPP_ARM_ACLE_HEADER=1" CRYPTOPP_ARMV8A_CRC)
CheckCompileOption("-march=armv8-a+crypto -DCRYPTOPP_ARM_ACLE_HEADER=1" CRYPTOPP_ARMV8A_CRYPTO)
else ()
CheckCompileOption("-march=armv8-a" CRYPTOPP_ARMV8A_ASIMD)
CheckCompileOption("-march=armv8-a+crc" CRYPTOPP_ARMV8A_CRC)
CheckCompileOption("-march=armv8-a+crypto" CRYPTOPP_ARMV8A_CRYPTO)
endif ()
if (CRYPTOPP_ARMV8A_ASIMD)
set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
@ -699,10 +662,7 @@ 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 "-march=armv8-a")
set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
set_source_files_properties(${SRC_DIR}/neon_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
set_source_files_properties(${SRC_DIR}/simon64_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}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a")
endif ()
if (CRYPTOPP_ARMV8A_CRC)
@ -716,73 +676,90 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto")
endif ()
elseif (CRYPTOPP_ARM OR CRYPTOPP_ARMHF)
elseif (CRYPTOPP_ARM32)
# Need to set floating point ABI to something, like "hard" of "softfp".
# Most Linux use hard floats.
CheckCompileLinkOption("-march=armv7-a -mfpu=neon" CRYPTOPP_ARMV7A_NEON
"${TEST_PROG_DIR}/test_arm_neon.cxx")
CheckCompileLinkOption("-march=armv7-a -mfloat-abi=hard -mfpu=neon" CRYPTOPP_ARMV7A_HARD
"${TEST_PROG_DIR}/test_arm_neon.cxx")
CheckCompileLinkOption("-march=armv7-a -mfloat-abi=softfp -mfpu=neon" CRYPTOPP_ARMV7A_SOFTFP
"${TEST_PROG_DIR}/test_arm_neon.cxx")
# This checks for <arm_neon.h>
CheckCompileLinkOption("-march=armv7-a -mfpu=neon" CRYPTOPP_ARM_NEON_HEADER
"${TEST_PROG_DIR}/test_arm_neon_header.cxx")
if (CRYPTOPP_ARMV7A_HARD)
set(CRYPTOPP_ARMV7A_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=neon")
elseif (CRYPTOPP_ARMV7A_SOFTFP)
set(CRYPTOPP_ARMV7A_FLAGS "-march=armv7-a -mfloat-abi=softfp -mfpu=neon")
# 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")
else ()
AddCompileOption("-DCRYPTOPP_DISABLE_NEON")
endif()
if (CRYPTOPP_ARMV7A_HARD OR CRYPTOPP_ARMV7A_SOFTFP)
# Add ASM files for ARM
if (NOT MSVC)
list(APPEND cryptopp_SOURCES ${SRC_DIR}/aes_armv4.S)
set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES LANGUAGE C)
endif ()
set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/neon_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
set_source_files_properties(${SRC_DIR}/sm4_simd.cpp PROPERTIES COMPILE_FLAGS "${CRYPTOPP_ARMV7A_FLAGS}")
CheckCompileLinkOption("-march=armv7-a -mfpu=neon" CRYPTOPP_ARMV7A_NEON
"${TEST_PROG_DIR}/test_arm_neon.cxx")
endif ()
elseif (CRYPTOPP_POWERPC OR CRYPTOPP_POWERPC64)
if (CRYPTOPP_ARMV7A_NEON)
# Add Cryptogams ASM files for ARM on Linux. Linux is required due to GNU Assembler.
# AES requires -mthumb under Clang. Do not add -mthumb for SHA for any files.
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
list(APPEND cryptopp_SOURCES ${SRC_DIR}/aes_armv4.S)
list(APPEND cryptopp_SOURCES ${SRC_DIR}/sha1_armv4.S)
list(APPEND cryptopp_SOURCES ${SRC_DIR}/sha256_armv4.S)
list(APPEND cryptopp_SOURCES ${SRC_DIR}/sha512_armv4.S)
set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES LANGUAGE CXX)
set_source_files_properties(${SRC_DIR}/sha1_armv4.S PROPERTIES LANGUAGE CXX)
set_source_files_properties(${SRC_DIR}/sha256_armv4.S PROPERTIES LANGUAGE CXX)
set_source_files_properties(${SRC_DIR}/sha512_armv4.S PROPERTIES LANGUAGE CXX)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mthumb -mfpu=neon -Wa,--noexecstack")
else ()
set_source_files_properties(${SRC_DIR}/aes_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon -Wa,--noexecstack")
endif ()
set_source_files_properties(${SRC_DIR}/sha1_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon -Wa,--noexecstack")
set_source_files_properties(${SRC_DIR}/sha256_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon -Wa,--noexecstack")
set_source_files_properties(${SRC_DIR}/sha512_armv4.S PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon -Wa,--noexecstack")
endif ()
set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/neon_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv7-a -mfpu=neon")
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")
endif ()
elseif (CRYPTOPP_PPC32 OR CRYPTOPP_PPC64)
# XLC requires -qaltivec in addition to Arch or CPU option
# Disable POWER9 due to https://github.com/weidai11/cryptopp/issues/986.
if (CMAKE_CXX_COMPILER MATCHES "xlC")
set(CRYPTOPP_ALTIVEC_FLAGS "-qaltivec")
set(CRYPTOPP_POWER4_FLAGS "-qarch=pwr4 -qaltivec")
set(CRYPTOPP_POWER5_FLAGS "-qarch=pwr5 -qaltivec")
set(CRYPTOPP_POWER6_FLAGS "-qarch=pwr6 -qaltivec")
set(CRYPTOPP_POWER7_FLAGS "-qarch=pwr7 -qaltivec")
set(CRYPTOPP_POWER7_VSX_FLAG "-qarch=pwr7 -qvsx -qaltivec")
set(CRYPTOPP_POWER7_PWR_FLAGS "-qarch=pwr7 -qaltivec")
set(CRYPTOPP_POWER8_FLAGS "-qarch=pwr8 -qaltivec")
set(CRYPTOPP_POWER9_FLAGS "-qarch=pwr9 -qaltivec")
#set(CRYPTOPP_POWER9_FLAGS "-qarch=pwr9 -qaltivec")
else ()
set(CRYPTOPP_ALTIVEC_FLAGS "-maltivec")
set(CRYPTOPP_POWER7_FLAGS "-mcpu=power7 -maltivec")
set(CRYPTOPP_POWER8_FLAGS "-mcpu=power8 -maltivec")
set(CRYPTOPP_POWER9_FLAGS "-mcpu=power9 -maltivec")
set(CRYPTOPP_POWER7_VSX_FLAGS "-mcpu=power7 -mvsx")
set(CRYPTOPP_POWER7_PWR_FLAGS "-mcpu=power7")
set(CRYPTOPP_POWER8_FLAGS "-mcpu=power8")
#set(CRYPTOPP_POWER9_FLAGS "-mcpu=power9")
endif ()
CheckCompileLinkOption("${CRYPTOPP_ALTIVEC_FLAGS}" PPC_ALTIVEC_FLAG
"${TEST_PROG_DIR}/test_ppc_altivec.cxx")
# Hack for XLC
# 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
@ -810,25 +787,39 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
endif ()
endif ()
CheckCompileLinkOption("${CRYPTOPP_POWER7_FLAGS}" PPC_POWER7_FLAG
# 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")
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")
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")
CheckCompileLinkOption("${CRYPTOPP_POWER9_FLAGS}" PPC_POWER9_FLAG
"${TEST_PROG_DIR}/test_ppc_power9.cxx")
# 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")
if (PPC_POWER9_FLAG AND NOT DISABLE_POWER9)
set_source_files_properties(${SRC_DIR}/ppc_power9.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER9_FLAGS})
endif ()
#if (PPC_POWER9_FLAG AND NOT DISABLE_POWER9)
# set_source_files_properties(${SRC_DIR}/ppc_power9.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER9_FLAGS})
#endif ()
if (PPC_POWER8_FLAG AND NOT DISABLE_POWER8)
set_source_files_properties(${SRC_DIR}/ppc_power8.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
#set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
#set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS})
@ -838,34 +829,18 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
if (PPC_POWER7_FLAG AND NOT DISABLE_POWER7)
set_source_files_properties(${SRC_DIR}/ppc_power7.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
endif ()
if (PPC_ALTIVEC_FLAG AND NOT DISABLE_ALTIVEC)
set_source_files_properties(${SRC_DIR}/ppc_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS})
set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS})
set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS})
endif ()
# Drop to Power7 if Power8 unavailable
# Drop to Altivec if Power8 unavailable
if (NOT PPC_POWER8_FLAG)
if (PPC_POWER7_FLAG)
set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER7_FLAGS})
endif ()
endif ()
# Drop to Altivec if Power7 unavailable
if (NOT PPC_POWER7_FLAG)
if (PPC_ALTIVEC_FLAG)
set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS})
set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS})
set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS})
set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS})
set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_ALTIVEC_FLAGS})
endif ()
endif ()
@ -875,8 +850,8 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_POWER7")
elseif (NOT PPC_POWER8_FLAG)
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_POWER8")
elseif (NOT PPC_POWER9_FLAG)
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_POWER9")
#elseif (NOT PPC_POWER9_FLAG)
# list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_POWER9")
endif ()
endif ()
@ -885,7 +860,7 @@ endif ()
# New as of Pull Request 461, http://github.com/weidai11/cryptopp/pull/461.
if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
if (CRYPTOPP_AMD64 OR CRYPTOPP_I386 OR CRYPTOPP_X32)
if (CRYPTOPP_AMD64 OR CRYPTOPP_I386)
CheckCompileLinkOption("-xarch=sse2" CRYPTOPP_IA32_SSE2
"${TEST_PROG_DIR}/test_x86_sse2.cxx")
@ -918,15 +893,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3")
set_source_files_properties(${SRC_DIR}/cham_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3")
set_source_files_properties(${SRC_DIR}/lea_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3")
set_source_files_properties(${SRC_DIR}/simeck_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3")
set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3")
set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=ssse3")
set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=ssse3")
if (CRYPTOPP_IA32_SSE41 AND NOT DISABLE_SSE4)
set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_1")
set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_1")
set_source_files_properties(${SRC_DIR}/simon64_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_1")
set_source_files_properties(${SRC_DIR}/speck64_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_1")
set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=sse4_1")
endif ()
if (CRYPTOPP_IA32_SSE42 AND NOT DISABLE_SSE4)
@ -967,25 +939,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
endif ()
endif ()
# Attempt to determine a suitable native option
if (CRYPTOPP_NATIVE_ARCH)
CheckCompileOption("-march=native" NATIVE_ARCH)
if (NATIVE_ARCH)
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-march=native")
else ()
CheckCompileOption("-native" NATIVE_ARCH)
if (NATIVE_ARCH)
list(APPEND CRYPTOPP_COMPILE_OPTIONS "-native")
endif ()
endif ()
if (NOT NATIVE_ARCH)
message(WARNING "CRYPTOPP_NATIVE_ARCH enabled, but failed to detect native architecture option")
endif ()
endif()
#============================================================================
# Compile targets
#============================================================================
@ -1001,7 +954,7 @@ function(cryptopp_target_compile_properties target)
set_target_properties(${target} PROPERTIES COMPILE_DEFINITIONS "${CRYPTOPP_COMPILE_DEFINITIONS}")
endif()
if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.12")
target_compile_options(${target} PUBLIC ${CRYPTOPP_COMPILE_OPTIONS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
else()
string (REPLACE ";" " " PROP_STR "${CRYPTOPP_COMPILE_OPTIONS}")
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${PROP_STR}")
@ -1203,23 +1156,17 @@ if (CRYPTOPP_I386)
message(STATUS "Platform: i386/i686")
elseif (CRYPTOPP_AMD64)
message(STATUS "Platform: x86_64")
elseif (CRYPTOPP_X32)
message(STATUS "Platform: x86_64-x32")
elseif (CRYPTOPP_ARMHF)
message(STATUS "Platform: armhf")
elseif (CRYPTOPP_ARM)
message(STATUS "Platform: arm")
elseif (CRYPTOPP_AARCH32)
message(STATUS "Platform: Aarch32")
elseif (CRYPTOPP_AARCH64)
message(STATUS "Platform: Aarch64")
elseif (CRYPTOPP_ARM32)
message(STATUS "Platform: ARM-32")
elseif (CRYPTOPP_ARMV8)
message(STATUS "Platform: ARMv8")
elseif (CRYPTOPP_SPARC)
message(STATUS "Platform: Sparc")
elseif (CRYPTOPP_SPARC64)
message(STATUS "Platform: Sparc64")
elseif (CRYPTOPP_POWERPC)
elseif (CRYPTOPP_PPC32)
message(STATUS "Platform: PowerPC")
elseif (CRYPTOPP_POWERPC64)
elseif (CRYPTOPP_PPC64)
message(STATUS "Platform: PowerPC-64")
elseif (CRYPTOPP_MINGW32)
message(STATUS "Platform: MinGW-32")
@ -1229,11 +1176,6 @@ endif ()
if (CRYPTOPP_ARMV7A_NEON)
message(STATUS "NEON: TRUE")
endif ()
if (CRYPTOPP_NATIVE_ARCH)
message(STATUS "Native arch: TRUE")
else ()
message(STATUS "Native arch: FALSE")
endif ()
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS "Compiler options: ${CMAKE_CXX_FLAGS} ${CRYPTOPP_COMPILE_OPTIONS}")
message(STATUS "Compiler definitions: ${CRYPTOPP_COMPILE_DEFINITIONS}")

View File

@ -1,4 +1,4 @@
# Doxyfile 1.8.9
# Doxyfile 1.8.13
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@ -12,9 +12,6 @@
# For lists, items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (\" \").
#
# The file can be upgraded to the latest version of Doxygen with `doxygen -u <file`
#
#---------------------------------------------------------------------------
# Project related configuration options
@ -41,14 +38,13 @@ PROJECT_NAME = Crypto++
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 8.2
PROJECT_NUMBER = 8.5
# 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
# quick idea about the purpose of the project. Keep the description short.
# Without the HTML escape characters, Doxygen concatenates the string below...
PROJECT_BRIEF = Free&nbsp;C&#43;&#43;&nbsp;class&nbsp;library&nbsp;of&nbsp;cryptographic&nbsp;schemes
PROJECT_BRIEF = "Free&nbsp;C&#43;&#43;&nbsp;class&nbsp;library&nbsp;of&nbsp;cryptographic&nbsp;schemes"
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
@ -235,12 +231,6 @@ TAB_SIZE = 4
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@ -298,6 +288,15 @@ EXTENSION_MAPPING =
MARKDOWN_SUPPORT = NO
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 0.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by putting a % sign in front of the word or
@ -348,6 +347,13 @@ IDL_PROPERTY_SUPPORT = NO
DISTRIBUTE_GROUP_DOC = NO
# If one adds a struct or class to a group and this option is enabled, then also
# any nested class or struct is added to the same group. By default this option
# is disabled and one has to add nested compounds explicitly via \ingroup.
# The default value is: NO.
GROUP_NESTED_COMPOUNDS = NO
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that
# type (e.g. under the Public Functions section). Set it to NO to prevent
@ -737,6 +743,12 @@ WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered.
# The default value is: NO.
WARN_AS_ERROR = NO
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
# will be replaced by the file and line number from which the warning originated
@ -760,14 +772,13 @@ WARN_LOGFILE =
# The INPUT tag is used to specify the files and/or directories that contain
# documented source files. You may enter file names like myfile.cpp or
# directories like /usr/src/myproject. Separate the files or directories with
# spaces.
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = . \
GNUmakefile \
GNUmakefile-cross \
rdrand.asm \
rdrand.s
rdrand.asm
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@ -780,12 +791,17 @@ INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank the
# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
# *.qsf, *.as and *.js.
# *.h) to filter out the source-files in the directories.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# read by doxygen.
#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.
FILE_PATTERNS = *.h \
*.cpp
@ -803,7 +819,7 @@ RECURSIVE = NO
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE = adhoc.cpp cryptlib_bds.cpp
EXCLUDE = adhoc.cpp
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@ -819,7 +835,8 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS = *test* *validat*
EXCLUDE_PATTERNS = *test* \
*validat*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@ -872,6 +889,10 @@ IMAGE_PATH =
# Note that the filter must not add or remove lines; it is applied before the
# code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
INPUT_FILTER =
@ -881,6 +902,10 @@ INPUT_FILTER =
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
# patterns match the file name, INPUT_FILTER is applied.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
FILTER_PATTERNS =
@ -992,6 +1017,25 @@ USE_HTAGS = NO
VERBATIM_HEADERS = YES
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
# cost of reduced performance. This can be particularly helpful with template
# rich C++ code for which doxygen's built-in parser lacks the necessary type
# information.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse-libclang=ON option for CMake.
# The default value is: NO.
CLANG_ASSISTED_PARSING = NO
# If clang assisted parsing is enabled you can provide the compiler with command
# line options that you would normally use when invoking the compiler. Note that
# the include paths will already be set by doxygen for the files and directories
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
CLANG_OPTIONS =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@ -1139,8 +1183,9 @@ HTML_COLORSTYLE_GAMMA = 80
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: YES.
# to YES can help to show when doxygen was last run and thus if the
# documentation is up to date.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_TIMESTAMP = YES
@ -1225,6 +1270,7 @@ DOCSET_PUBLISHER_NAME = Crypto++
# compressed HTML files.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_HTMLHELP = NO
# The CHM_FILE tag can be used to specify the file name of the resulting .chm
@ -1493,10 +1539,7 @@ MATHJAX_CODEFILE =
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
# JW: Do _not_ enable server-side search. It consumes too many resources
# and results in OOM Kills on MySQL, which corrupts the database.
# https://github.com/weidai11/cryptopp/issues/720
SEARCHENGINE = NO
SEARCHENGINE = NO
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
@ -1508,10 +1551,7 @@ SEARCHENGINE = NO
# The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES.
# JW: Do _not_ enable server-side search. It consumes too many resources
# and results in OOM Kills on MySQL, which corrupts the database.
# https://github.com/weidai11/cryptopp/issues/720
SERVER_BASED_SEARCH = NO
SERVER_BASED_SEARCH = NO
# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
# script for searching. Instead the search results are written to an XML file
@ -1619,9 +1659,12 @@ COMPACT_LATEX = NO
PAPER_TYPE = a4
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
# that should be included in the LaTeX output. To get the times font for
# instance you can specify
# EXTRA_PACKAGES=times
# that should be included in the LaTeX output. The package can be specified just
# by its name or with the correct syntax as to be used with the LaTeX
# \usepackage command. To get the times font for instance you can specify :
# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
# To use the option intlimits with the amsmath package you can specify:
# EXTRA_PACKAGES=[intlimits]{amsmath}
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@ -1724,6 +1767,14 @@ LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_TIMESTAMP = NO
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
@ -2065,12 +2116,6 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
@ -2084,15 +2129,6 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
@ -2111,7 +2147,7 @@ HIDE_UNDOC_RELATIONS = YES
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
# Bell Labs. The other options in this section have no effect if this option is
# set to NO
# The default value is: NO.
# The default value is: YES.
HAVE_DOT = NO
@ -2133,7 +2169,7 @@ DOT_NUM_THREADS = 0
# The default value is: Helvetica.
# This tag requires that the tag HAVE_DOT is set to YES.
# DOT_FONTNAME = FreeSans.ttf
DOT_FONTNAME = Helvetica
# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
# dot graphs.
@ -2225,7 +2261,8 @@ INCLUDED_BY_GRAPH = YES
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
# functions only using the \callgraph command.
# functions only using the \callgraph command. Disabling a call graph can be
# accomplished by means of the command \hidecallgraph.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
@ -2236,7 +2273,8 @@ CALL_GRAPH = NO
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable caller graphs for selected
# functions only using the \callergraph command.
# functions only using the \callergraph command. Disabling a caller graph can be
# accomplished by means of the command \hidecallergraph.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
@ -2259,11 +2297,17 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot.
# generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see:
# http://www.graphviz.org/)).
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
# to make the SVG files visible in IE 9+ (other browsers do not have this
# requirement).
# Possible values are: png, jpg, gif and svg.
# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
# png:gdiplus:gdiplus.
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.
@ -2314,6 +2358,11 @@ DIAFILE_DIRS =
PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.

View File

@ -11,6 +11,8 @@ algebra.cpp
algebra.h
algparam.cpp
algparam.h
allocate.cpp
allocate.h
arc4.cpp
arc4.h
ariatab.cpp
@ -66,6 +68,16 @@ channels.h
cmac.cpp
cmac.h
config.h
config_align.h
config_asm.h
config_cpu.h
config_cxx.h
config_dll.h
config_int.h
config_misc.h
config_ns.h
config_os.h
config_ver.h
cpu.cpp
cpu.h
crc.cpp
@ -73,7 +85,6 @@ crc_simd.cpp
crc.h
cryptdll.vcxproj
cryptdll.vcxproj.filters
cryptest.sh
cryptest.sln
cryptest.vcxproj
cryptest.vcxproj.user
@ -263,12 +274,10 @@ rc5.cpp
rc5.h
rc6.cpp
rc6.h
rdrand-masm.cmd
rdrand-nasm.sh
rdrand.s
rdrand.asm
rdrand.cpp
rdrand.h
rdseed.asm
rdtables.cpp
regtest1.cpp
regtest2.cpp
@ -295,6 +304,7 @@ scrypt.h
seal.cpp
seal.h
secblock.h
secblockfwd.h
seckey.h
seed.cpp
seed.h
@ -304,6 +314,12 @@ serpentp.h
sha.cpp
sha_simd.cpp
sha.h
sha1_armv4.h
sha1_armv4.S
sha256_armv4.h
sha256_armv4.S
sha512_armv4.h
sha512_armv4.S
sha3.cpp
sha3.h
shacal2.cpp
@ -318,10 +334,8 @@ simple.cpp
simple.h
siphash.h
simeck.cpp
simeck_simd.cpp
simeck.h
simon.cpp
simon64_simd.cpp
simon128_simd.cpp
simon.h
skipjack.cpp
@ -335,7 +349,6 @@ smartptr.h
sosemanuk.cpp
sosemanuk.h
speck.cpp
speck64_simd.cpp
speck128_simd.cpp
speck.h
square.cpp
@ -390,6 +403,8 @@ xtr.cpp
xtr.h
xtrcrypt.cpp
xtrcrypt.h
xts.cpp
xts.h
zdeflate.cpp
zdeflate.h
zinflate.cpp
@ -421,6 +436,8 @@ TestData/dlie2048.dat
TestData/dsa1024.dat
TestData/dsa1024b.dat
TestData/dsa512.dat
TestData/ecies_p160.dat
TestData/ecies_t163.dat
TestData/ed25519.dat
TestData/ed25519_ver.dat
TestData/ed25519v0.dat
@ -554,21 +571,46 @@ TestVectors/vmac.txt
TestVectors/wake.txt
TestVectors/whrlpool.txt
TestVectors/xchacha.txt
TestVectors/xts.txt
TestPrograms/test_32bit.cxx
TestPrograms/test_64bit.cxx
TestPrograms/test_arm_acle.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_sha.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_mixed_asm.cxx
TestPrograms/test_glibc.cxx
TestPrograms/test_newlib.cxx
TestPrograms/test_ppc_aes.cxx
TestPrograms/test_ppc_altivec.cxx
@ -579,14 +621,19 @@ TestPrograms/test_ppc_sha.cxx
TestPrograms/test_ppc_vmull.cxx
TestPrograms/test_pthreads.cxx
TestPrograms/test_x86_aes.cxx
TestPrograms/test_x86_avx.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

895
vendor/cryptopp/vendor_cryptopp/GNUmakefile vendored Executable file → Normal file

File diff suppressed because it is too large Load Diff

411
vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross vendored Executable file → Normal file
View File

@ -5,12 +5,16 @@ SHELL = /bin/sh
# If needed
TMPDIR ?= /tmp
# Used for ARMv7 and NEON.
FP_ABI ?= hard
# Used for feature tests
TOUT ?= a.out
TOUT := $(strip $(TOUT))
# Allow override for the cryptest.exe recipe. Change to
# ./libcryptopp.so or ./libcryptopp.dylib to suit your
# taste. https://github.com/weidai11/cryptopp/issues/866
LINK_LIBRARY ?= libcryptopp.a
LINK_LIBRARY_PATH ?= ./
# Default CXXFLAGS if none were provided
CXXFLAGS ?= -DNDEBUG -g2 -O3 -fPIC -pipe
@ -21,7 +25,8 @@ CP ?= cp
MV ?= mv
CHMOD ?= chmod
MKDIR ?= mkdir -p
EGREP ?= egrep
GREP ?= grep
SED ?= sed
LN ?= ln -sf
LDCONF ?= /sbin/ldconfig -n
@ -29,7 +34,16 @@ LDCONF ?= /sbin/ldconfig -n
IS_IOS ?= 0
IS_ANDROID ?= 0
IS_ARM_EMBEDDED ?= 0
IS_NEON ?= 0
# Clang is reporting armv8l-unknown-linux-gnueabihf
# for ARMv7 images on Aarch64 hardware.
MACHINEX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null)
HOSTX := $(shell echo $(MACHINEX) | cut -f 1 -d '-')
ifeq ($(HOSTX),)
HOSTX := $(shell uname -m 2>/dev/null)
endif
IS_LINUX := $(shell echo $(MACHINEX) | $(GREP) -i -c "Linux")
# Can be used by Android and Embeeded cross-compiles. Disable by default because
# Android and embedded users typically don't run this configuration.
@ -83,14 +97,11 @@ endif
# iOS cross-compile configuration.
# See http://www.cryptopp.com/wiki/iOS_(Command_Line).
ifeq ($(IS_IOS),1)
CXX = clang++
CXXFLAGS += $(IOS_FLAGS) -arch $(IOS_ARCH)
CXXFLAGS += -isysroot "$(IOS_SYSROOT)" -stdlib=libc++
CXXFLAGS += $(IOS_CXXFLAGS) -stdlib=libc++
CXXFLAGS += --sysroot "$(IOS_SYSROOT)"
AR = libtool
ARFLAGS = -static -o
RANLIB = ranlib
endif
###########################################################
@ -100,22 +111,22 @@ endif
# Android cross-compile configuration.
# See http://www.cryptopp.com/wiki/Android_(Command_Line).
ifeq ($(IS_ANDROID),1)
# CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-android.sh'
CXXFLAGS += $(AOSP_FLAGS) -DANDROID --sysroot=$(AOSP_SYSROOT)
CXXFLAGS += -Wa,--noexecstack -I$(AOSP_STL_INC) -I$(AOSP_SYS_ARCH_INC)
LDFLAGS += --sysroot=$(AOSP_LD_SYSROOT)
CPPFLAGS += $(ANDROID_CPPFLAGS)
CPPFLAGS += -DANDROID
CXXFLAGS += $(ANDROID_CXXFLAGS)
CXXFLAGS += --sysroot=$(ANDROID_SYSROOT)
CXXFLAGS += -Wa,--noexecstack
# c++config.h shows up in odd places at times.
ifneq ($(AOSP_BITS_INC),)
CXXFLAGS += -I$(AOSP_BITS_INC)
endif
# STL headers
LDLIBS += $(AOSP_STL_LIB)
# 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
# Source files copied into PWD for Android cpu-features
# setenv-android.sh does the copying. Its a dirty compile.
AOSP_CPU_OBJ = cpu-features.o
ANDROID_CPU_OBJ = cpu-features.o
endif
###########################################################
@ -136,8 +147,8 @@ endif
# Wait until CXXFLAGS have been set by setenv scripts.
GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(EGREP) -v -E 'llvm|clang' | $(EGREP) -i -c -E '(gcc|g\+\+)')
CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(EGREP) -i -c -E 'llvm|clang')
GCC_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -v -E 'llvm|clang' | $(GREP) -i -c -E '(gcc|g\+\+)')
CLANG_COMPILER := $(shell $(CXX) --version 2>/dev/null | $(GREP) -i -c -E 'llvm|clang')
HOSTX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | cut -f 1 -d '-')
ifeq ($(HOSTX),)
@ -149,17 +160,25 @@ endif
# -arch arm64 yields x86_64 instead of aarch64 or arm64.
ifeq ($(CLANG_COMPILER),1)
IS_X86 := $(shell echo $(CXXFLAGS) | $(EGREP) -v 64 | $(EGREP) -i -c -E 'i.86')
IS_X64 := $(shell echo $(CXXFLAGS) | $(EGREP) -i -c -E 'x86_64|amd64')
IS_ARM32 := $(shell echo $(CXXFLAGS) | $(EGREP) -v 64 | $(EGREP) -i -c -E 'arm|armhf|arm7l|eabihf')
IS_ARMV8 := $(shell echo $(CXXFLAGS) | $(EGREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
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_ARMV8 := $(shell echo $(CXXFLAGS) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
else
IS_X86 := $(shell echo $(HOSTX) | $(EGREP) -v 64 | $(EGREP) -i -c -E 'i.86')
IS_X64 := $(shell echo $(HOSTX) | $(EGREP) -i -c -E 'x86_64|amd64')
IS_ARM32 := $(shell echo $(HOSTX) | $(EGREP) -v 64 | $(EGREP) -i -c -E 'arm|armhf|arm7l|eabihf')
IS_ARMV8 := $(shell echo $(HOSTX) | $(EGREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
IS_X86 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'i.86')
IS_X64 := $(shell echo $(HOSTX) | $(GREP) -i -c -E 'x86_64|amd64')
IS_ARM32 := $(shell echo $(HOSTX) | $(GREP) -v 64 | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf')
IS_ARMV8 := $(shell echo $(HOSTX) | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8')
endif
ifeq ($(IS_ARMV8),1)
IS_ARM32 = 0
endif
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))
###########################################################
@ -176,11 +195,14 @@ else ifeq ($(findstring distclean,$(MAKECMDGOALS)),distclean)
DETECT_FEATURES := 0
else ifeq ($(findstring distclean,$(MAKECMDGOALS)),trim)
DETECT_FEATURES := 0
else ifeq ($(IS_IOS),1)
DETECT_FEATURES := 0
endif
# Strip out -Wall, -Wextra and friends for feature testing
# 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 -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS))
TCXXFLAGS := $(filter-out -D_FORTIFY_SOURCE=% -M -MM -Wall -Wextra -Werror% -Wunused -Wconversion -Wp%, $(CXXFLAGS))
ifneq ($(strip $(TCXXFLAGS)),)
$(info Using testing flags: $(TCXXFLAGS))
endif
@ -212,7 +234,7 @@ ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_x86_sse2.cxx
TOPT = $(SSE2_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CHACHA_FLAG = $(SSE2_FLAG)
else
@ -221,15 +243,13 @@ ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_x86_ssse3.cxx
TOPT = $(SSSE3_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
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)
SIMECK_FLAG = $(SSSE3_FLAG)
SIMON64_FLAG = $(SSSE3_FLAG)
SIMON128_FLAG = $(SSSE3_FLAG)
SPECK64_FLAG = $(SSSE3_FLAG)
SPECK128_FLAG = $(SSSE3_FLAG)
else
SSSE3_FLAG =
@ -237,19 +257,17 @@ ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_x86_sse41.cxx
TOPT = $(SSE41_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
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)
SIMON64_FLAG = $(SSE41_FLAG)
SPECK64_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 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
CRC_FLAG = $(SSE42_FLAG)
else
@ -258,16 +276,17 @@ ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_x86_clmul.cxx
TOPT = $(CLMUL_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
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 | tr ' ' '\n' | wc -l)
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)
@ -277,7 +296,7 @@ ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_x86_avx.cxx
TOPT = $(AVX_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
# XXX_FLAG = $(AVX_FLAG)
else
@ -286,7 +305,7 @@ ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_x86_avx2.cxx
TOPT = $(AVX2_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
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
@ -295,7 +314,7 @@ ifeq ($(DETECT_FEATURES),1)
TPROG = TestPrograms/test_x86_sha.cxx
TOPT = $(SHANI_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
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
@ -341,6 +360,18 @@ ifeq ($(DETECT_FEATURES),1)
endif
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
@ -348,23 +379,30 @@ endif
endif
###########################################################
##### ARM A-32, Aach64 and NEON #####
##### ARM A-32 and NEON #####
###########################################################
ifneq ($(IS_ARM32)$(IS_ARMV8),00)
ifneq ($(IS_ARM32),0)
ifeq ($(DETECT_FEATURES),1)
ifeq ($(IS_ARM32),1)
ifneq ($(IS_IOS)$(IS_ANDROID),00)
NEON_FLAG =
# Android needs -c compile flag for NEON. Otherwise there's an odd linker message.
ifeq ($(IS_ANDROID),1)
NEON_FLAG = -march=armv7-a -mfpu=vfpv3-d16 -mfpu=neon
else
NEON_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon
NEON_FLAG = -march=armv7-a -mfpu=neon
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)
ifeq ($(strip $(HAVE_OPT)),0)
THEADER += -DCRYPTOPP_ARM_NEON_HEADER=1
endif
TPROG = TestPrograms/test_arm_neon.cxx
TOPT = $(NEON_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(NEON_FLAG)
AES_FLAG = $(NEON_FLAG)
@ -376,10 +414,7 @@ ifeq ($(IS_ARM32),1)
CHAM_FLAG = $(NEON_FLAG)
LEA_FLAG = $(NEON_FLAG)
SHA_FLAG = $(NEON_FLAG)
SIMECK_FLAG = $(NEON_FLAG)
SIMON64_FLAG = $(NEON_FLAG)
SIMON128_FLAG = $(NEON_FLAG)
SPECK64_FLAG = $(NEON_FLAG)
SPECK128_FLAG = $(NEON_FLAG)
SM4_FLAG = $(NEON_FLAG)
else
@ -387,10 +422,17 @@ ifeq ($(IS_ARM32),1)
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
endif
# DETECT_FEATURES
endif
# IS_ARM32
endif
ifeq ($(IS_ARMV8),1)
###########################################################
##### Aach32 and Aarch64 #####
###########################################################
ifneq ($(IS_ARMV8),0)
ifeq ($(DETECT_FEATURES),1)
ifeq ($(IS_IOS),1)
ASIMD_FLAG =
@ -402,22 +444,28 @@ ifeq ($(IS_ARMV8),1)
ASIMD_FLAG = -march=armv8-a
CRC_FLAG = -march=armv8-a+crc
AES_FLAG = -march=armv8-a+crypto
PMULL_FLAG = -march=armv8-a+crypto
GCM_FLAG = -march=armv8-a+crypto
GF2N_FLAG = -march=armv8-a+crypto
SHA_FLAG = -march=armv8-a+crypto
endif
TPROG = TestPrograms/test_arm_acle.cxx
TOPT = $(ASIMD_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
TPROG = TestPrograms/test_arm_neon_header.cxx
TOPT =
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ACLE_FLAG += -DCRYPTOPP_ARM_ACLE_AVAILABLE=1
else
CXXFLAGS += -DCRYPTOPP_ARM_ACLE_AVAILABLE=0
THEADER += -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)
ifeq ($(strip $(HAVE_OPT)),0)
THEADER += -DCRYPTOPP_ARM_ACLE_HEADER=1
endif
TPROG = TestPrograms/test_arm_asimd.cxx
TOPT = $(ASIMD_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
ARIA_FLAG = $(ASIMD_FLAG)
BLAKE2B_FLAG = $(ASIMD_FLAG)
@ -426,10 +474,7 @@ ifeq ($(IS_ARMV8),1)
CHAM_FLAG = $(ASIMD_FLAG)
LEA_FLAG = $(ASIMD_FLAG)
NEON_FLAG = $(ASIMD_FLAG)
SIMECK_FLAG = $(ASIMD_FLAG)
SIMON64_FLAG = $(ASIMD_FLAG)
SIMON128_FLAG = $(ASIMD_FLAG)
SPECK64_FLAG = $(ASIMD_FLAG)
SPECK128_FLAG = $(ASIMD_FLAG)
SM4_FLAG = $(ASIMD_FLAG)
else
@ -439,59 +484,70 @@ ifeq ($(IS_ARMV8),1)
TPROG = TestPrograms/test_arm_crc.cxx
TOPT = $(CRC_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
CRC_FLAG =
CXXFLAGS += -DCRYPTOPP_ARM_CRC32_AVAILABLE=0
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_CRC32
endif
TPROG = TestPrograms/test_arm_aes.cxx
TOPT = $(AES_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
AES_FLAG =
CXXFLAGS += -DCRYPTOPP_ARM_AES_AVAILABLE=0
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_AES
endif
TPROG = TestPrograms/test_arm_pmull.cxx
TOPT = $(PMULL_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
PMULL_FLAG =
CXXFLAGS += -DCRYPTOPP_ARM_PMULL_AVAILABLE=0
GCM_FLAG =
GF2N_FLAG =
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_PMULL
endif
TPROG = TestPrograms/test_arm_sha.cxx
TPROG = TestPrograms/test_arm_sha1.cxx
TOPT = $(SHA_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifneq ($(strip $(HAVE_OPT)),0)
SHA_FLAG =
CXXFLAGS += -DCRYPTOPP_ARM_SHA_AVAILABLE=0
CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA1
endif
TPROG = TestPrograms/test_arm_sha256.cxx
TOPT = $(SHA_FLAG)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 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) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SM3_FLAG = -march=armv8.4-a+crypto
SM4_FLAG = -march=armv8.4-a+crypto
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) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l)
HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(THEADER) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | wc -w)
ifeq ($(strip $(HAVE_OPT)),0)
SHA3_FLAG = -march=armv8.4-a+crypto
SHA512_FLAG = -march=armv8.4-a+crypto
else
#CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SHA3
#CXXFLAGS += -DCRYPTOPP_DISABLE_ARM_SM4
endif
# IS_ARMV8
endif
# DETECT_FEATURES
endif
# IS_ARM32, IS_ARMV8, IS_NEON
# IS_ARMV8
endif
###########################################################
@ -531,7 +587,7 @@ endif # Asan
# LD gold linker testing. Triggered by 'LD=ld.gold'.
ifeq ($(findstring ld.gold,$(LD)),ld.gold)
ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(EGREP) -i -c "elf")
ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(GREP) -i -c "elf")
ifneq ($(ELF_FORMAT),0)
LDFLAGS += -fuse-ld=gold
endif # ELF/ELF64
@ -544,15 +600,15 @@ ifneq ($(filter valgrind,$(MAKECMDGOALS)),)
CXXFLAGS := $(CXXFLAGS:-g%=-g3)
CXXFLAGS := $(CXXFLAGS:-O%=-O1)
CXXFLAGS := $(CXXFLAGS:-xO%=-xO1)
ifeq ($(findstring -DCRYPTOPP_VALGRIND,$(CXXFLAGS)),)
CXXFLAGS += -DCRYPTOPP_VALGRIND
endif # -DCRYPTOPP_VALGRIND
ifeq ($(findstring -DCRYPTOPP_COVERAGE,$(CXXFLAGS)),)
CXXFLAGS += -DCRYPTOPP_COVERAGE
endif # -DCRYPTOPP_COVERAGE
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)),)
USING_GLIBCXX := $(shell $(CXX) $(CXXFLAGS) -E pch.cpp 2>&1 | $(EGREP) -i -c "__GLIBCXX__")
USING_GLIBCXX := $(shell $(CXX) $(CXXFLAGS) -E pch.cpp 2>&1 | $(GREP) -i -c "__GLIBCXX__")
ifneq ($(USING_GLIBCXX),0)
ifeq ($(HAS_NEWLIB),0)
ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
@ -586,18 +642,34 @@ endif # Dead code stripping
###########################################################
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp cryptlib_bds.cpp,$(sort $(wildcard *.cpp)))
SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp,$(sort $(wildcard *.cpp)))
# For Makefile.am; resource.h is Windows
INCL := $(filter-out resource.h,$(sort $(wildcard *.h)))
# Cryptogams AES for ARMv4 and above. We couple to ARMv7.
# Avoid iOS. It cannot consume the assembly.
ifeq ($(IS_ARM32),1)
ifneq ($(IS_IOS),1)
CRYPTOGAMS_AES_FLAG = -march=armv7-a
CRYPTOGAMS_AES_FLAG += -Wa,--noexecstack
SRCS += aes_armv4.S
# Cryptogams source files. We couple to ARMv7.
# Limit to Linux. The source files target the GNU assembler.
# Also see https://www.cryptopp.com/wiki/Cryptogams.
ifeq ($(IS_ARM32)$(IS_LINUX),11)
ifeq ($(CLANG_COMPILER),1)
CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -mthumb -Wa,--noexecstack
else
CRYPTOGAMS_ARMV4_FLAG = -march=armv7-a -Wa,--noexecstack
CRYPTOGAMS_ARMV4_THUMB_FLAG = -march=armv7-a -Wa,--noexecstack
endif
SRCS += aes_armv4.S sha1_armv4.S sha256_armv4.S sha512_armv4.S
endif
# Remove unneeded arch specific files to speed build time.
ifeq ($(IS_PPC32)$(IS_PPC64),00)
SRCS := $(filter-out ppc_%,$(SRCS))
endif
ifeq ($(IS_ARM32)$(IS_ARMV8),00)
SRCS := $(filter-out arm_%,$(SRCS))
SRCS := $(filter-out neon_%,$(SRCS))
endif
ifeq ($(IS_X86)$(IS_X32)$(IS_X64),000)
SRCS := $(filter-out sse_%,$(SRCS))
endif
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
@ -612,8 +684,13 @@ TESTINCL := bench.h factory.h validate.h
TESTOBJS := $(TESTSRCS:.cpp=.o)
LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
# Clean recipe, Issue 998. Don't filter-out some artifacts from the list of objects
# The *.S is a hack. It makes the ASM appear like C++ so the object files make the CLEAN_OBJS list
CLEAN_SRCS := $(wildcard *.cpp) $(patsubst %.S,%.cpp,$(wildcard *.S))
CLEAN_OBJS := $(CLEAN_SRCS:.cpp=.o) $(CLEAN_SRCS:.cpp=.import.o) $(CLEAN_SRCS:.cpp=.export.o)
# For Shared Objects, Diff, Dist/Zip rules
LIB_VER := $(shell $(EGREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3)
LIB_VER := $(shell $(GREP) "define CRYPTOPP_VERSION" config_ver.h | cut -d" " -f 3)
LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
@ -660,7 +737,7 @@ lean: static dynamic cryptest.exe
.PHONY: clean
clean:
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) $(AOSP_CPU_OBJ) rdrand-*.o $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
-$(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
@ -677,15 +754,20 @@ autotools-clean:
@-$(RM) -f config.guess config.status config.sub config.h.in compile depcomp
@-$(RM) -f install-sh stamp-h1 ar-lib *.lo *.la *.m4 local.* lt*.sh missing
@-$(RM) -f cryptest cryptestcwd libtool* libcryptopp.la libcryptopp.pc*
@-$(RM) -rf m4/ auto*.cache/ .deps/ .libs/
@-$(RM) -rf build-aux/ m4/ auto*.cache/ .deps/ .libs/
.PHONY: cmake-clean
cmake-clean:
@-$(RM) -f cryptopp-config.cmake CMakeLists.txt
@-$(RM) -rf cmake_build/
.PHONY: android-clean
android-clean:
@-$(RM) -f $(patsubst %_simd.cpp,%_simd.cpp.neon,$(wildcard *_simd.cpp))
@-$(RM) -rf obj/
.PHONY: distclean
distclean: clean autotools-clean cmake-clean
distclean: clean autotools-clean cmake-clean android-clean
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt
@-$(RM) cryptest-*.txt cryptopp.tgz libcryptopp.pc *.o *.bc *.ii *~
@-$(RM) -r cryptlib.lib cryptest.exe *.suo *.sdf *.pdb Win32/ x64/ ipch/
@ -700,13 +782,13 @@ distclean: clean autotools-clean cmake-clean
install: cryptest.exe install-lib
@-$(MKDIR) $(DESTDIR)$(BINDIR)
$(CP) cryptest.exe $(DESTDIR)$(BINDIR)
$(CHMOD) 0755 $(DESTDIR)$(BINDIR)/cryptest.exe
$(CHMOD) u=rwx,go=rx $(DESTDIR)$(BINDIR)/cryptest.exe
@-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestData
@-$(MKDIR) $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
$(CP) TestData/*.dat $(DESTDIR)$(DATADIR)/cryptopp/TestData
$(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat
$(CHMOD) u=rw,go=r $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat
$(CP) TestVectors/*.txt $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
$(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt
$(CHMOD) u=rw,go=r $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt
# A recipe to install only the library, and not cryptest.exe. Also
# see https://github.com/weidai11/cryptopp/issues/653.
@ -714,22 +796,22 @@ install: cryptest.exe install-lib
install-lib:
@-$(MKDIR) $(DESTDIR)$(INCLUDEDIR)/cryptopp
$(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp
$(CHMOD) 0644 $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h
$(CHMOD) u=rw,go=r $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h
ifneq ($(wildcard libcryptopp.a),)
@-$(MKDIR) $(DESTDIR)$(LIBDIR)
$(CP) libcryptopp.a $(DESTDIR)$(LIBDIR)
$(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/libcryptopp.a
$(CHMOD) u=rw,go=r $(DESTDIR)$(LIBDIR)/libcryptopp.a
endif
ifneq ($(wildcard libcryptopp.dylib),)
@-$(MKDIR) $(DESTDIR)$(LIBDIR)
$(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR)
$(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
$(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
-install_name_tool -id $(DESTDIR)$(LIBDIR)/libcryptopp.dylib $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
endif
ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
@-$(MKDIR) $(DESTDIR)$(LIBDIR)
$(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)
$(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
$(CHMOD) u=rwx,go=rx $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
ifeq ($(HAS_SOLIB_VERSION),1)
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
$(LDCONF) $(DESTDIR)$(LIBDIR)
@ -738,7 +820,7 @@ endif
ifneq ($(wildcard libcryptopp.pc),)
@-$(MKDIR) $(DESTDIR)$(LIBDIR)/pkgconfig
$(CP) libcryptopp.pc $(DESTDIR)$(LIBDIR)/pkgconfig
$(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc
$(CHMOD) u=rw,go=r $(DESTDIR)$(LIBDIR)/pkgconfig/libcryptopp.pc
endif
.PHONY: remove uninstall
@ -751,8 +833,8 @@ remove uninstall:
@-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
@-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so
libcryptopp.a: $(LIBOBJS) $(AOSP_CPU_OBJ)
$(AR) $(ARFLAGS) $@ $(LIBOBJS) $(AOSP_CPU_OBJ)
libcryptopp.a: $(LIBOBJS) $(ANDROID_CPU_OBJ)
$(AR) $(ARFLAGS) $@ $(LIBOBJS) $(ANDROID_CPU_OBJ)
$(RANLIB) $@
ifeq ($(HAS_SOLIB_VERSION),1)
@ -760,18 +842,18 @@ ifeq ($(HAS_SOLIB_VERSION),1)
libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
endif
libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS) $(AOSP_CPU_OBJ)
$(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CXXFLAGS)) -Wl,--exclude-libs,ALL $(LIBOBJS) $(AOSP_CPU_OBJ) $(LDFLAGS) $(LDLIBS)
libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS) $(ANDROID_CPU_OBJ)
$(CXX) -shared $(SOLIB_FLAGS) -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) -Wl,--exclude-libs,ALL $(LIBOBJS) $(ANDROID_CPU_OBJ) $(LDFLAGS) $(LDLIBS)
ifeq ($(HAS_SOLIB_VERSION),1)
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
endif
libcryptopp.dylib: $(LIBOBJS) $(AOSP_CPU_OBJ)
$(CXX) -dynamiclib -o $@ $(strip $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS) $(AOSP_CPU_OBJ)
libcryptopp.dylib: $(LIBOBJS)
$(CXX) -dynamiclib -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS)
cryptest.exe: libcryptopp.a $(TESTOBJS)
$(CXX) -o $@ $(strip $(CXXFLAGS)) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
cryptest.exe: $(LINK_LIBRARY) $(TESTOBJS)
$(CXX) -o $@ $(strip $(CPPFLAGS) $(CXXFLAGS)) $(TESTOBJS) $(LINK_LIBRARY_PATH)$(LINK_LIBRARY) $(LDFLAGS) $(LDLIBS)
# Used to generate list of source files for Autotools, CMakeList and Android.mk
.PHONY: sources
@ -800,108 +882,121 @@ ifeq ($(wildcard GNUmakefile.deps),GNUmakefile.deps)
-include GNUmakefile.deps
endif # Dependencies
# Cryptogams ARM asm implementation.
aes_armv4.o : aes_armv4.S
$(CXX) $(strip $(CXXFLAGS) -fpermissive $(CRYPTOGAMS_AES_FLAG) -c) $<
# A few recipes trigger warnings for -std=c++11 and -stdlib=c++
NOSTD_CXXFLAGS=$(filter-out -stdlib=%,$(filter-out -std=%,$(CXXFLAGS)))
# Cryptogams ARM asm implementation. AES needs -mthumb for Clang
aes_armv4.o : aes_armv4.S
$(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_THUMB_FLAG) -c) $<
# Use C++ compiler on C source after patching.
# https://github.com/weidai11/cryptopp/issues/926
cpu-features.o: cpu-features.h cpu-features.c
$(CXX) $(strip $(CXXFLAGS) -fpermissive -c) cpu-features.c
$(CXX) -x c $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) -c) cpu-features.c
# SSSE3 or NEON available
aria_simd.o : aria_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(ARIA_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(ARIA_FLAG) -c) $<
# SSE, NEON or POWER7 available
blake2s_simd.o : blake2s_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2S_FLAG) -c) $<
# SSE, NEON or POWER8 available
blake2b_simd.o : blake2b_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(BLAKE2B_FLAG) -c) $<
# SSE2 or NEON available
chacha_simd.o : chacha_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(CHACHA_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_FLAG) -c) $<
# AVX2 available
chacha_avx.o : chacha_avx.cpp
$(CXX) $(strip $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHACHA_AVX2_FLAG) -c) $<
# SSSE3 available
cham_simd.o : cham_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(CHAM_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CHAM_FLAG) -c) $<
# Power9 available
darn.o : darn.cpp
$(CXX) $(strip $(CXXFLAGS) $(DARN_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(DARN_FLAG) -c) $<
# SSE2 on i686
donna_sse.o : donna_sse.cpp
$(CXX) $(strip $(CXXFLAGS) $(SSE2_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $<
# SSE2 on i686
sse_simd.o : sse_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SSE2_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SSE2_FLAG) -c) $<
# SSE4.2 or ARMv8a available
crc_simd.o : crc_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(CRC_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(CRC_FLAG) -c) $<
# PCLMUL or ARMv7a/ARMv8a available
gcm_simd.o : gcm_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(GCM_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GCM_FLAG) -c) $<
# Carryless multiply
gf2n_simd.o : gf2n_simd.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(GF2N_FLAG) -c) $<
# SSSE3 available
keccak_simd.o : keccak_simd.cpp
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(KECCAK_FLAG) -c) $<
# SSSE3 available
lea_simd.o : lea_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(LEA_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(LEA_FLAG) -c) $<
# NEON available
neon_simd.o : neon_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(NEON_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(NEON_FLAG) -c) $<
# AESNI or ARMv7a/ARMv8a available
rijndael_simd.o : rijndael_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(AES_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(AES_FLAG) -c) $<
# SSE4.2/SHA-NI or ARMv8a available
sha_simd.o : sha_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $<
# Cryptogams SHA1 asm implementation.
sha1_armv4.o : sha1_armv4.S
$(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
# Cryptogams SHA256 asm implementation.
sha256_armv4.o : sha256_armv4.S
$(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
# Cryptogams SHA512 asm implementation.
sha512_armv4.o : sha512_armv4.S
$(CXX) $(strip $(CPPFLAGS) $(NOSTD_CXXFLAGS) $(CRYPTOGAMS_ARMV4_FLAG) -c) $<
# SSE4.2/SHA-NI or ARMv8a available
shacal2_simd.o : shacal2_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SHA_FLAG) -c) $<
# SSSE3 or NEON available
simeck_simd.o : simeck_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SIMECK_FLAG) -c) $<
# SSE4.1, NEON or POWER7 available
simon64_simd.o : simon64_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SIMON64_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SHA_FLAG) -c) $<
# SSSE3, NEON or POWER8 available
simon128_simd.o : simon128_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SIMON128_FLAG) -c) $<
# SSE4.1, NEON or POWER7 available
speck64_simd.o : speck64_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SPECK64_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SIMON128_FLAG) -c) $<
# SSSE3, NEON or POWER8 available
speck128_simd.o : speck128_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SPECK128_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SPECK128_FLAG) -c) $<
# ARMv8.4 available
sm3_simd.o : sm3_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SM3_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM3_FLAG) -c) $<
# AESNI available
sm4_simd.o : sm4_simd.cpp
$(CXX) $(strip $(CXXFLAGS) $(SM4_FLAG) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) $(SM4_FLAG) -c) $<
%.o : %.cpp
$(CXX) $(strip $(CXXFLAGS) -c) $<
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS) -c) $<
.PHONY: dep deps depend
dep deps depend GNUmakefile.deps:
$(CXX) $(strip $(CXXFLAGS) -DCRYPTOPP_DISABLE_ASM) -MM *.cpp > GNUmakefile.deps
$(CXX) $(strip $(CPPFLAGS) $(CXXFLAGS)) -MM *.cpp > GNUmakefile.deps

View File

@ -480,3 +480,65 @@ last several releases.
- fix missing GF2NT_233_Multiply_Reduce_CLMUL in FIPS DLL
- add missing BLAKE2 constructors
- fix missing BlockSize() in BLAKE2 classes
8.3.0 - December 20, 2020
- minor release, recompile of programs required
- expanded community input and support
* 66 unique contributors as of this release
- fix use of macro CRYPTOPP_ALIGN_DATA
- fix potential out-of-bounds read in ECDSA
- fix std::bad_alloc when using ByteQueue in pipeline
- fix missing CRYPTOPP_CXX17_EXCEPTIONS with Clang
- fix potential out-of-bounds read in GCM mode
- add configure.sh when preprocessor macros fail
- fix potential out-of-bounds read in SipHash
- fix compile error on POWER9 due to vec_xl_be
- fix K233 curve on POWER8
- add Cirrus CI testing
- fix broken encryption for some 64-bit ciphers
- fix Android cpu-features.c using C++ compiler
- disable RDRAND and RDSEED for some AMD processors
- fix BLAKE2 hash calculation using Salt and Personalization
- refresh Android and iOS build scripts
- add XTS mode
- fix circular dependency between misc.h and secblock.h
- add Certificate interface
- fix recursion in AES::Encryption without AESNI
- add missing OID for ElGamal encryption
- fix missing override in KeyDerivationFunction-derived classes
- fix RDSEED assemble under MSVC
- fix elliptic curve timing leaks (CVE-2019-14318)
- add link-library variable to Makefiles
- fix SIZE_MAX definition in misc.h
- add GetWord64 and PutWord64 to BufferedTransformation
- use HKDF in AutoSeededX917RNG::Reseed
- fix Asan finding in VMAC on i686 in inline asm
- fix undeclared identifier _mm_roti_epi64 on Gentoo
- fix ECIES and GetSymmetricKeyLength
- fix possible divide by zero in PKCS5_PBKDF2_HMAC
- refine ASN.1 encoders and decoders
- disable BMI2 code paths in Integer class
- fix use of CRYPTOPP_CLANG_VERSION
- add NEON SHA1, SHA256 and SHA512 from Cryptogams
- add ARM SHA1, SHA256 and SHA512 from Cryptogams
- make config.h more autoconf friendly
- handle Clang triplet armv8l-unknown-linux-gnueabihf
- fix reference binding to misaligned address in xed25519
- clear asserts in TestDataNameValuePairs
8.4.0 - January 2, 2021
- minor release, recompile of programs required
- expanded community input and support
* 67 unique contributors as of this release
- fix SIGILL on POWER8 when compiling with GCC 10
- fix potential out-of-bounds write in FixedSizeAllocatorWithCleanup
- fix compile on AIX POWER7 with IBM XLC 12.01
- fix compile on Solaris with SunCC 12.6
- revert changes for constant-time elliptic curve algorithms
- fix makefile clean and distclean recipes
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

View File

@ -2,6 +2,7 @@ CONTENTS OF THIS FILE
---------------------
* Introduction
* Prerequisites
* Building the Library
* Alternate Build Systems
* Installing the Library
@ -16,27 +17,34 @@ INTRODUCTION
Crypto++ Library is a free C++ class library of cryptographic algorithms and schemes. The library was originally written and placed in public domain by Wei Dai, but it is now maintained by the community. The library homepage is at http://www.cryptopp.com/. The latest library source code can be found at http://github.com/weidai11/cryptopp. For licensing and copyright information, please see License.txt.
These are general instructions for the AIX, BSDs, Linux, OS X, Solaris and Unix. The library uses a GNU makefile, which combines configuration and a non-anemic make. On AIX, BSD and Solaris you will likely have to use `gmake` to build the library. On Linux, OS X and Unix, the system's make should be OK. On Windows, Crypto++ provides Visual Studio solutions.
These are general instructions for AIX, BSDs, Linux, OS X, Solaris and Unix. The library uses GNU Make and a GNUmakefile to avoid anemic make. On AIX, BSD and Solaris you will likely have to use `gmake` to build the library. On Linux and OS X, the system's make should be OK. On Windows, Crypto++ provides Visual Studio solutions.
You should look through the GNUmakefile and config.h to ensure settings look reasonable before building. There are two wiki pages that help explain them at http://www.cryptopp.com/wiki/GNUmakefile and http://www.cryptopp.com/wiki/Config.h.
Wiki pages are available for some platforms with specific build instructions. The pages include Android, ARM, iOS, MSBuild and Solaris. Solaris users should visit the wiki for important information on compiling the library with different versions of SunCC and options, and information on improving library performance and features.
Crypto++ does not depend upon other tools or libraries. It does not use Autotools, does not use CMake, and does not use Boost. If you use an alternate build system, like Autotools or CMake, then see the warning below about CXXFLAGS and lack of -DNDEBUG. CMake is available in Master as a matter of convenience, but its not officially supported.
Crypto++ does not depend upon other tools or libraries. The library only needs GNU Make 3.80 on Unix & Linux; or Visual Studio 2010 and above build tools on Windows. The library does not use Autotools, does not use CMake, and does not use Boost.
There is a partially complete CmakeList.txt available on the wiki at http://www.cryptopp.com/wiki/CMake. It is not recommended for use because it is not in a good state. If you have CMake expertise and can work some problems, then please see the wiki page for tasks related to CMake.
Autotools and CMake projects are not officially supported. The build systems take too much time and effort. Unofficial projects are available at https://github.com/noloader/cryptopp-autotools and https://github.com/noloader/cryptopp-cmake. The projects provide a central location to support Autotools and CMake. Collaborators for Autotools and CMake are welcomed.
PREREQUISITES
-------------
The library requires a semi-modern C++ compiler and GNU Make 3.81 or above. The compiler must support 64-bit words, C++03, namespaces, RTTI and exceptions.
The library does not depend on other build systems, like Autotools or CMake. The library does not depend on other libraries, like Boost.
BUILDING THE LIBRARY
--------------------
In general, all you should have to do is open a terminal, and then:
In general, all you should have to do is open a terminal, cd to the cryptopp directory, and then:
make
make test
sudo make install
The command above builds the static library and cryptest.exe program. It also uses a sane set of default flags, which are usually "-DNDEBUG -g2 -O3 -fPIC".
The command above builds the static library and cryptest.exe program. It also uses a sane default flags, which are usually "-DNDEBUG -g2 -O3 -fPIC".
If you want to build the shared object, then issue:
@ -70,7 +78,16 @@ LLVM's libc++ is also supported, so you can:
export CXXFLAGS="-std=c++11 -stdlib=libc++"
make
If you target 32-bit IA-32 machines (i386, i586 or i686), then the makefile forgoes -fPIC due to register pressures. You should add -fPIC yourself in this case:
If you are using the library on OS X with XCode then you should add LLVM's libc++. You can do so by modifying CXXFLAGS, or you can modify the GNUmakefile. To modify the GNUmakefile, open it and find the line for OS X builds around line 150:
ifneq ($(IS_DARWIN),0)
CXX ?= c++
CRYPTOPP_CXXFLAGS += -stdlib=libc++
AR = libtool
ARFLAGS = -static -o
endif
If you target 32-bit IA-32 machines (i386, i586 or i686), then the makefile forgoes -fPIC due to register pressures. You should add -fPIC yourself, if needed:
CXXFLAGS="-DNDEBUG -g2 -O3 -fPIC" make
@ -78,10 +95,27 @@ You can also override a variable so that only your flags are present. That is, t
make CXXFLAGS="-std=c++11"
Crypto++ does not enagage Specter remediations at this time. You can build with Specter resistance with the following flags:
Crypto++ does not engage Specter remediations at this time. You can build with Specter resistance with the following flags:
CXXFLAGS="-DNDEBUG -g2 -O3 -mfunction-return=thunk -mindirect-branch=thunk" make
The library does not support out-of-tree builds. You must cd to the Crypto++ directory before building. `make distclean` will return the Crypto++ directory to a pristine state.
BUILDING WITH VCPKG
-------------------
You can download and install cryptopp using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install cryptopp
The cryptopp port in vcpkg is kept up to date by Microsoft team members and community contributors.
If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
ALTERNATE BUILD SYSTEMS
-----------------------
@ -124,7 +158,7 @@ The following are some of the targets provided by the GNU makefile.
`make cryptest.exe` builds the library test harness.
`make test` and `make check` are the same recipe and invoke the test harness with the the validation option. That is, it executes `cryptest.exe v`.
`make test` and `make check` are the same recipe and invoke the test harness with the validation option. That is, it executes `cryptest.exe v`.
`make install` installs the library. By default, the makefile copies into `/usr/local` by default.
@ -147,18 +181,16 @@ The Crypto++ embraces tools like Undefined Behavior sanitizer (UBsan), Address s
UBsan and Asan are mutually exclusive options, so you can perform only one of these at a time:
make ubsan
./cryptest.exe v 2>&1 | egrep "(error|FAILED)"
./cryptest.exe tv all 2>&1 | egrep "(error|FAILED)"
./cryptest.exe v 2>&1 | grep -E "(error:|FAILED)"
./cryptest.exe tv all 2>&1 | grep -E "(error:|FAILED)"
Or:
make asan
./cryptest.exe v 2>&1 | egrep "(error|FAILED)"
./cryptest.exe tv all 2>&1 | egrep "(error|FAILED)"
./cryptest.exe v 2>&1 | grep -E "(error:|FAILED)"
./cryptest.exe tv all 2>&1 | grep -E "(error:|FAILED)"
If you experience self test failures or see reports of undefined behavior, then you should ensure CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is defined in config.h. CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is not defined due to historical purposes.
If you experience failures under Asan, then gather more information with:
If you experience failures under Asan, then gather more information with asan_symbolize. You may not need asan_symbolize nowadays:
./cryptest.exe v 2>&1 | asan_symbolize
@ -185,25 +217,25 @@ Fifth, the test harness provides a "validation" option which performs basic syst
./cryptest.exe v
...
All tests passed!
Test ended at Sun Jul 26 02:10:57 2015
Seed used was: 1437891055
Seed used was 1612313449
Test started at Tue Feb 2 19:50:49 2021
Test ended at Tue Feb 2 19:50:52 2021
Sixth, the test harness provides a "test vector" option which uses many known test vectors, even those published by other people (like Brian Gladman for AES). You run the test vectors as shown below. The tail of the output should indicate 0 failed tests.
./cryptest.exe tv all
...
Testing SymmetricCipher algorithm MARS/ECB.
.................
Tests complete. Total tests = 4094. Failed tests = 0.
Testing SymmetricCipher algorithm AES/XTS.
.....................
Tests complete. Total tests = 11260. Failed tests = 0.
The library also offers its test script for those who want to use it. The test script is names cryptest.sh, and it repeatedly builds the library and exectues the tests under various configurations. It takes 2 to 4 hours to run on a semi-modern desktop or server; and days to run on an IoT gadget. Also see http://github.com/weidai11/cryptopp/blob/master/cryptest.sh and http://cryptopp.com/wiki/Cryptest.sh.
The library also offers its test script for those who want to use it. The test script is names cryptest.sh, and it repeatedly builds the library and exectues the tests under various configurations. It takes about 4 hours to run on a semi-modern desktop or server; and several days to run on an IoT gadget. Also see http://github.com/weidai11/cryptopp/blob/master/cryptest.sh and http://cryptopp.com/wiki/Cryptest.sh.
REPORTING PROBLEMS
------------------
Dirty compiles and failures in the validation suite or test vectors should be reported at the Crypto++ User Group. The User Group is located at http://groups.google.com/forum/#!forum/cryptopp-users.
Build failures, dirty compiles and failures in the validation suite or test vectors should be reported at the Crypto++ User Group. The User Group is located at http://groups.google.com/forum/#!forum/cryptopp-users.
The library uses Wei Dai's GitHub to track issues. The tracker is located at http://github.com/weidai11/cryptopp/issues. Please do not ask questions in the bug tracker; ask questions on the mailing list instead. Also see http://www.cryptopp.com/wiki/Bug_Report.

View File

@ -29,8 +29,9 @@ Daniel J. Bernstein, Jack Lloyd - chacha.cpp, chacha_simd.cpp, chacha_avx.cpp
Andrew Moon - ed25519, x25519, donna_32.cpp, donna_64.cpp, donna_sse.cpp
The Crypto++ Library uses portions of Andy Polyakov's CRYPTOGAMS for Poly1305
scalar multiplication and aes_armv4.S. CRYPTOGAMS is dual licensed with a
permissive BSD-style license. The CRYPTOGAMS license is reproduced below.
scalar multiplication, aes_armv4.S, sha1_armv4.S and sha256_armv4.S. CRYPTOGAMS
is dual licensed with a permissive BSD-style license. The CRYPTOGAMS license is
reproduced below.
The Crypto++ Library uses portions of Jack Lloyd's Botan for ChaCha SSE2 and
AVX. Botan placed the code in public domain for Crypto++ to use.

View File

@ -1,5 +1,5 @@
Crypto++: free C++ Class Library of Cryptographic Schemes
Version 8.2 - APR/28/2019
Version 8.5 - March 7, 2021
Crypto++ Library is a free C++ class library of cryptographic schemes.
Currently the library contains the following algorithms:
@ -22,7 +22,7 @@ Currently the library contains the following algorithms:
Triple-DES (DES-EDE2 and DES-EDE3), TEA, XTEA
block cipher modes of operation ECB, CBC, CBC ciphertext stealing (CTS),
CFB, OFB, counter mode (CTR)
CFB, OFB, counter mode (CTR), XTS
message authentication codes BLAKE2s, BLAKE2b, CMAC, CBC-MAC, DMAC, GMAC, HMAC,
Poly1305, Poly1305 (IETF), SipHash, Two-Track-MAC,
@ -33,7 +33,7 @@ Currently the library contains the following algorithms:
SHAKE (128/256), SipHash, SM3, Tiger,
RIPEMD (128/160/256/320), WHIRLPOOL
RSA, DSA, Determinsitic DSA, ElGamal,
RSA, DSA, Deterministic DSA, ElGamal,
public-key cryptography Nyberg-Rueppel (NR), Rabin-Williams (RW), LUC,
LUCELG, EC-based German Digital Signature (ECGDSA),
DLIES (variants of DHAES), ESIGN
@ -45,7 +45,7 @@ Currently the library contains the following algorithms:
key agreement schemes Menezes-Qu-Vanstone (MQV), Hashed MQV (HMQV),
Fully Hashed MQV (FHMQV), LUCDIF, XTR-DH
elliptic curve cryptography ECDSA, Determinsitic ECDSA, ed25519, ECNR, ECIES,
elliptic curve cryptography ECDSA, Deterministic ECDSA, ed25519, ECNR, ECIES,
ECDH, ECMQV, x25519
insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL
@ -84,21 +84,21 @@ Other features include:
+ ARM-32, Aarch32 and Aarch64 provides NEON, ASIMD and ARMv8 implementations
+ Power8 provides in-core AES using NX Crypto Acceleration
The Crypto++ library was orginally written by Wei Dai. The library is now
The Crypto++ library was originally written by Wei Dai. The library is now
maintained by several team members and the community. You are welcome to use it
for any purpose without paying anyone, but see License.txt for the fine print.
The following compilers are supported for this release. Please visit
http://www.cryptopp.com the most up to date build instructions and porting notes.
* Visual Studio 2003 - 2017
* GCC 3.3 - 9.0
* Apple Clang 4.3 - 9.3
* LLVM Clang 2.9 - 7.0
* C++Builder 2015
* Visual Studio 2003 - 2019
* GCC 3.3 - 10.1
* Apple Clang 4.3 - 12.0
* LLVM Clang 2.9 - 11.0
* C++ Builder 2015
* Intel C++ Compiler 9 - 16.0
* Sun Studio 12u1 - 12.6
* IBM XL C/C++ 10.0 - 13.3
* IBM XL C/C++ 10.0 - 14.0
*** Important Usage Notes ***
@ -205,23 +205,28 @@ library in your programs to help avoid unwanted redirections.
*** Side Channel Attacks ***
Crypto++ attempts to resist side channel attacks using various remediations. We
believe the library is mostly hardened but the remdiations may be incomplete. The
first line of defense uses hardware instructions when possible for block ciphers,
hashes and other primitives. Hardware acceleration remediates many timing attacks.
The library also uses cache-aware algoirthms and access patterns to minimize leakage.
Crypto++ attempts to resist side channel attacks using various remediations.
The remdiations are applied as a best effort but are probably incomplete. They
are incomplete due to cpu speculation bugs like Spectre, Meltdown, Foreshadow.
The attacks target both cpu caches and internal buffers. Intel generally refers
to internal buffer attacks as "Microarchitectural Data Sampling" (MDS).
Some of the public key algorithms have branches and some of the branches depend on
data that can be private or secret. The branching occurs in some field operations
like exponentiation over integers and elliptic curves. The branching has been
minimized but not completely eliminated.
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
to minimize leakage cache evictions.
Crypto++ does not enagage 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.
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.
If you suspect or find an information leak then please report it.
Crypto++ does not enagage 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.
To help resist attacks you should disable hyperthreading on cpus. If you
suspect or find an information leak then please report it.
*** Documentation and Support ***
@ -243,7 +248,7 @@ The source code and its planned changes are available at the following locations
* The Crypto++ GitHub repository allows you to view the latest (unreleased)
Crypto++ source code via the Linux kernel's git beginning around June 2015.
Its also serves as an incubator to nuture and grow the library.
Its also serves as an incubator to nurture and grow the library.
* The former Crypto++ SourceForge repository allows you to view the Crypto++
source code via Apache's subversion until about July 2015. At that time,
SourceForge had infrastructure problems and a cutover to GutHub was performed.
@ -290,6 +295,68 @@ 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.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
8.4.0 - January 2, 2021
- minor release, recompile of programs required
- expanded community input and support
* 67 unique contributors as of this release
- fix SIGILL on POWER8 when compiling with GCC 10
- fix potential out-of-bounds write in FixedSizeAllocatorWithCleanup
- fix compile on AIX POWER7 with IBM XLC 12.01
- fix compile on Solaris with SunCC 12.6
- revert changes for constant-time elliptic curve algorithms
- fix makefile clean and distclean recipes
8.3.0 - December 20, 2020
- minor release, recompile of programs required
- expanded community input and support
* 66 unique contributors as of this release
- fix use of macro CRYPTOPP_ALIGN_DATA
- fix potential out-of-bounds read in ECDSA
- fix std::bad_alloc when using ByteQueue in pipeline
- fix missing CRYPTOPP_CXX17_EXCEPTIONS with Clang
- fix potential out-of-bounds read in GCM mode
- add configure.sh when preprocessor macros fail
- fix potential out-of-bounds read in SipHash
- fix compile error on POWER9 due to vec_xl_be
- fix K233 curve on POWER8
- add Cirrus CI testing
- fix broken encryption for some 64-bit ciphers
- fix Android cpu-features.c using C++ compiler
- disable RDRAND and RDSEED for some AMD processors
- fix BLAKE2 hash calculation using Salt and Personalization
- refresh Android and iOS build scripts
- add XTS mode
- fix circular dependency between misc.h and secblock.h
- add Certificate interface
- fix recursion in AES::Encryption without AESNI
- add missing OID for ElGamal encryption
- fix missing override in KeyDerivationFunction-derived classes
- fix RDSEED assemble under MSVC
- fix elliptic curve timing leaks (CVE-2019-14318)
- add link-library variable to Makefiles
- fix SIZE_MAX definition in misc.h
- add GetWord64 and PutWord64 to BufferedTransformation
- use HKDF in AutoSeededX917RNG::Reseed
- fix Asan finding in VMAC on i686 in inline asm
- fix undeclared identifier _mm_roti_epi64 on Gentoo
- fix ECIES and GetSymmetricKeyLength
- fix possible divide by zero in PKCS5_PBKDF2_HMAC
- refine ASN.1 encoders and decoders
- disable BMI2 code paths in Integer class
- fix use of CRYPTOPP_CLANG_VERSION
- add NEON SHA1, SHA256 and SHA512 from Cryptogams
- add ARM SHA1, SHA256 and SHA512 from Cryptogams
- make config.h more autoconf friendly
- handle Clang triplet armv8l-unknown-linux-gnueabihf
- fix reference binding to misaligned address in xed25519
- clear asserts in TestDataNameValuePairs
8.2.0 - April 28, 2019
- minor release, no recompile of programs required
- expanded community input and support
@ -337,64 +404,6 @@ for the record back to Crypto++ 1.0.
- add ARM AES asm implementation from Cryptogams
- remove CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS support
7.0.0 - April 8, 2018
- major release, recompile of programs required
- expanded community input and support
* 48 unique contributors as of this release
- fix incorrect result when using Integer::ModInverse
* may be CVE worthy, but request was not submitted
- fix ARIA/CTR bus error on Sparc64
- fix incorrect result when using a_exp_b_mod_c
- fix undeclared identifier uint32_t on early Visual Studio
- fix iPhoneSimulator build on i386
- fix incorrect adler32 in ZlibDecompressor
- fix Power7 test using PPC_FEATURE_ARCH_2_06
- workaround incorrect Glibc sysconf return value on ppc64-le
- add KeyDerivationFunction interface
- add scrypt key derivation function
- add Salsa20_Core transform callable from outside class
- add sbyte, sword16, sword32 and sword64
- remove s_nullNameValuePairs from unnamed namespace
- ported to MSVC 2017, Xcode 9.3, Sun Studio 12.5, GCC 8.0.1,
MacPorts GCC 7.0, Clang 4.0, Intel C++ 17.00, IBM XL C/C++ 13.1
6.1.0 - February 22, 2018
- minor release, maintenance items
- expanded community input and support
* 46 unique contributors as of this release
- use 2048-bit modulus default for DSA
- fix build under Linuxbrew
- use /bin/sh in GNUmakefile
- fix missing flags for SIMON and SPECK in GNUMakefile-cross
- fix ARM and MinGW misdetection
- port setenv-android.sh to latest NDK
- fix Clang check for C++11 lambdas
- Simon and Speck to little-endian implementation
- use LIB_MAJOR for ABI compatibility
- fix ODR violation in AdvancedProcessBlocks_{ARCH} templates
- handle C++17 std::uncaught_exceptions
- ported to MSVC 2017, Xcode 8.1, Sun Studio 12.5, GCC 8.0.1,
MacPorts GCC 7.0, Clang 4.0, Intel C++ 17.00, IBM XL C/C++ 13.1
6.0.0 - January 22, 2018
- major release, recompile of programs required
- expanded community input and support
* 43 unique contributors as of this release
- fixed CVE-2016-9939 (Issue 346, transient DoS)
- fixed CVE-2017-9434 (Issue 414, misidentified memory error)
- converted to BASE+SIMD implementation
* BASE provides an architecture neutral C++ implementation
* SIMD provides architecture specific hardware acceleration
- improved PowerPC Power4, Power7 and Power8 support
- added ARIA, EC German DSA, Deterministic signatures (RFC 6979),
Kalyna, NIST Hash and HMAC DRBG, Padlock RNG, Poly1305, SipHash,
Simon, Speck, SM3, SM4, Threefish algorithms
- added NaCl interface from the compact library
* x25519 key exhange and ed25519 signing provided through NaCl interface
- improved Testing and QA
- ported to MSVC 2017, Xcode 8.1, Sun Studio 12.5, GCC 7.3,
MacPorts GCC 7.0, Clang 4.0, Intel C++ 17.00, IBM XL C/C++ 13.1
June 2015 - Changing of the guard. Wei Dai turned the library over to the
community. The first community release was Crypto++ 5.6.3. Wei is
no longer involved with the daily operations of the project. Wei

View File

@ -0,0 +1,15 @@
# Security Policy
## Supported Versions
We support modern versions of the Crypto++ library. Modern versions include the tip of Master and the latest release.
We also support versions of the library supplied by distributions such as Debian, Fedora, Red Hat and Ubuntu. We don't leave distros unsupported simply because we have released a new version of the library. And we don't expect a package maintainer to fix our bugs for us.
## Reporting a Vulnerability
You can report a security related bug in the [GitHub bug tracker](https://github.com/weidai11/cryptopp) or at the [mailing list](https://groups.google.com/g/cryptopp-users).
If we receive a report of a security related bug then we will ensure a Github issue is opened and we will make an announcement on the mailing list. If you corresponded by private email then we will open the Github issue and make the announcement.
All information will be made public. We do not withhold information from users because stake holders need accurate information to access risk and place controls to remediate the risk.

View File

@ -0,0 +1 @@
3081C80201003081A406072A8648CE3D0201308198020101302006072A8648CE3D0101021500FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF302C0414FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC04141C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA450429044A96B5688EF573284664698968C38BB913CBFC8223A628553168947D59DCC912042351377AC5FB3202150100000000000000000001F4C8F927AED3CA752257020101041C301A02010104150023A68821ABB99DBB8429ED2320D61A8EA4C6D81B

View File

@ -0,0 +1 @@
3081D10201003081AD06072A8648CE3D02013081A1020101302506072A8648CE3D0102301A020200A306092A8648CE3D010203033009020103020106020107302E041507B6882CAAEFA84F9554FF8428BD88E246D2782AE204150713612DCDDCB40AAB946BDA29CA91F73AF958AFD9042B040369979697AB43897789566789567F787A7876A65400435EDB42EFAFB2989D51FEFCE3C80988F41FF883021503FFFFFFFFFFFFFFFFFFFF48AAB689C29CA710279B020102041C301A02010104150003693AB4D83EE8B544548BE7647AEA0EA64E8211

View File

@ -1 +1 @@
308201A40201003082011706072A8648CE3804013082010A028181008B333697371663F8869E3EC80A414E46BBAFE41F6D40E754A01ADA60FE7D12ACD16DE311C4115293114F6B92A54195909276380F04BCD4ED5CD993ED7F516DF7A752B928E5035E0D3A1A979A1CDE8387734338793C02001D59B662D4FC8F2BF0EABB1F553F9F46F57E74BCABCBA4E458812DB601FCD04609D435317181236B9702818045999B4B9B8B31FC434F1F640520A7235DD7F20FB6A073AA500D6D307F3E895668B6F188E208A94988A7B5C952A0CAC8493B1C07825E6A76AE6CC9F6BFA8B6FBD3A95C947281AF069D0D4BCD0E6F41C3B9A19C3C9E01000EACDB316A7E4795F8755D8FAA9FCFA37ABF3A5E55E5D2722C4096DB00FE682304EA1A98B8C091B5CB02010204818302818045999B4B9B8B31FC434F1F640520A7235DD7F20FB6A073AA500D6D307F3E895668B6F188E208A94988A7B5C952A0CAC8493B1C07825E6A76AE6CC9F6BFA8B6FBD3A95C947281AF069D0D4BCD0E6F41C3B9A19C3C9E01000EACDB316A7E4795F8755D8FAA9FCFA37ABF3A5E2958F40032EF29CB145C7481380458812D62F09287
308201360201003082011606062B0E070201013082010A02818100D18892CC35AD9E532C53810019E525CDE08882E6344D6787C366B171D68948F53D74F7923B148E0A0B4C9B956D695384DE24AC3034000B3C4AD4C8226470BBD88B5B053BCCB01E608B1352D6ED16324745253BDB204308E065368CB9D75ACDB290E671BD4CA1608500BFACD758E6E9EFAC8CCBAD83BE7E397A62E4F55634FC3B02818068C449661AD6CF299629C0800CF292E6F04441731A26B3C3E1B358B8EB44A47A9EBA7BC91D8A470505A64DCAB6B4A9C26F1256181A00059E256A641132385DEC45AD829DE6580F304589A96B768B1923A2929DED90218470329B465CEBAD66D9487338DEA650B042805FD66BAC7374F7D64665D6C1DF3F1CBD31727AAB1A7E1D0201030417021504ED7AED68B1A5EFDE11262210D9F1121D4A119CE8

View File

@ -0,0 +1,214 @@
// dump2def.cxx - 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
//
// The intended workflow in Crypto++ is:
//
// 1. Open a Developer Prompt
// 2. CD to cryptopp/ directory
// 3. nmake /f cryptest.nmake cryptopp.dll
//
// The cryptopp.dll recipe first builds cryptlib.lib. Then it calls
// dumpbin.exe to export all symbols from cryptlib.lib and writes them
// to cryptopp.dump. The recipe then calls dump2def.exe to create a
// module definition file. Finally, the recipe builds cryptopp.dll
// using the module definition file cryptopp.def. The linker creates
// the import lib cryptopp.lib and export cryptopp.exp automatically.
//
// This is only "half the problem solved" for those who wish to use
// a DLL. The program must import the import lib cryptopp.lib. Then
// the program must ensure the library headers export the symbol or
// class with CRYPTOPP_DLL. CRYPTOPP_DLL is only present on some classes
// because the FIPS module only allowed approved algorithms like AES and
// SHA. Other classes like Base64Encoder and HexEncoder lack CRYPTOPP_DLL.
//
// CRYPTOPP_DLL simply adds declspec(dllimport) when CRYPTOPP_IMPORTS is
// defined. The limitation of requiring declspec(dllimport) is imposed by
// Microsoft. Microsoft does not allow a program to "import everything".
//
// If you would like to read more about the FIPS module and the pain it
// causes then see https://www.cryptopp.com/wiki/FIPS_DLL. In fact we
// recommend you delete the CryptDll and DllTest projects from the
// Visual Studio solution file.
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
// Friendly name
#define LIBRARY_DESC "Crypto++ Library"
typedef std::set<std::string> SymbolMap;
const int ErrorSuccess = 0;
const int ErrorDumpExtension = 1;
const int ErrorTooFewOpts = 2;
const int ErrorTooManyOpts = 3;
const int ErrorOpenInputFailed = 4;
const int ErrorOpenOutputFailed = 5;
const int ErrorReadException = 6;
const int ErrorWriteException = 7;
void PrintHelpAndExit(int code)
{
std::cout << "dump2def - create a module definitions file from a dumpbin file" << std::endl;
std::cout << " Written and placed in public domain by Jeffrey Walton" << std::endl;
std::cout << std::endl;
switch (code)
{
case ErrorDumpExtension:
std::cout << "Error: input file is missing \".dump\" extension.\n" << std::endl;
break;
case ErrorTooFewOpts:
std::cout << "Error: Too few options were supplied.\n" << std::endl;
break;
case ErrorTooManyOpts:
std::cout << "Error: Too many options were supplied.\n" << std::endl;
break;
case ErrorOpenInputFailed:
std::cout << "Error: Failed to open input file.\n" << std::endl;
break;
case ErrorOpenOutputFailed:
std::cout << "Error: Failed to open output file.\n" << std::endl;
break;
default:
;;
}
std::cout << "Usage: " << std::endl;
std::cout << " dump2def <infile>" << std::endl;
std::cout << " - Create a def file from <infile> and write it to a file with" << std::endl;
std::cout << " the same name as <infile> but using the .def extension" << std::endl;
std::cout << " dump2def <infile> <outfile>" << std::endl;
std::cout << " - Create a def file from <infile> and write it to <outfile>" << std::endl;
std::exit((code == ErrorSuccess ? 0 : 1));
}
int main(int argc, char* argv[])
{
// ******************** Handle Options ******************** //
// Convenience item
std::vector<std::string> opts;
for (size_t i=0; i<argc; ++i)
opts.push_back(argv[i]);
// Look for help
std::string opt = (opts.size() > 1 ? opts[1].substr(0,2) : "");
if (opt == "/h" || opt == "-h" || opt == "/?" || opt == "-?")
PrintHelpAndExit(ErrorSuccess);
// Add <outfile> as needed
if (opts.size() == 2)
{
std::string outfile = opts[1];
std::string::size_type pos = outfile.length() < 5 ? std::string::npos : outfile.length() - 5;
if (pos == std::string::npos || outfile.substr(pos) != ".dump")
PrintHelpAndExit(ErrorDumpExtension);
outfile.replace(pos, 5, ".def");
opts.push_back(outfile);
}
// Check or exit
if (opts.size() < 2)
PrintHelpAndExit(ErrorTooFewOpts);
if (opts.size() > 3)
PrintHelpAndExit(ErrorTooManyOpts);
// ******************** Read MAP file ******************** //
SymbolMap symbols;
try
{
std::ifstream infile(opts[1].c_str());
if (infile.is_open() == false)
PrintHelpAndExit(ErrorOpenInputFailed);
std::string::size_type pos;
std::string line;
// Find start of the symbol table
while (std::getline(infile, line))
{
pos = line.find("public symbols");
if (pos == std::string::npos) { continue; }
// Eat the whitespace after the table heading
infile >> std::ws;
break;
}
while (std::getline(infile, line))
{
// End of table
if (line.empty()) { break; }
std::istringstream iss(line);
std::string address, symbol;
iss >> address >> symbol;
symbols.insert(symbol);
}
}
catch (const std::exception& ex)
{
std::cerr << "Unexpected exception:" << std::endl;
std::cerr << ex.what() << std::endl;
std::cerr << std::endl;
PrintHelpAndExit(ErrorReadException);
}
// ******************** Write DEF file ******************** //
try
{
std::ofstream outfile(opts[2].c_str());
if (outfile.is_open() == false)
PrintHelpAndExit(ErrorOpenOutputFailed);
// Library name, cryptopp.dll
std::string name = opts[2];
std::string::size_type pos = name.find_last_of(".");
if (pos != std::string::npos)
name.erase(pos);
outfile << "LIBRARY " << name << std::endl;
outfile << "DESCRIPTION \"" << LIBRARY_DESC << "\"" << std::endl;
outfile << "EXPORTS" << std::endl;
outfile << std::endl;
outfile << "\t;; " << symbols.size() << " symbols" << std::endl;
// Symbols from our object files
SymbolMap::const_iterator it = symbols.begin();
for ( ; it != symbols.end(); ++it)
outfile << "\t" << *it << std::endl;
}
catch (const std::exception& ex)
{
std::cerr << "Unexpected exception:" << std::endl;
std::cerr << ex.what() << std::endl;
std::cerr << std::endl;
PrintHelpAndExit(ErrorWriteException);
}
return 0;
}

View File

@ -1,7 +1,7 @@
#include <cstddef>
int main(int argc, char* argv[])
{
enum {N = (sizeof(std::size_t) == 4 ? 4 : -1)};
int x[N];
return 0;
enum {N = (sizeof(std::size_t) == 4 ? 4 : -1)};
int x[N];
return 0;
}

View File

@ -1,7 +1,7 @@
#include <cstddef>
int main(int argc, char* argv[])
{
enum {N = (sizeof(std::size_t) == 8 ? 8 : -1)};
int x[N];
return 0;
enum {N = (sizeof(std::size_t) == 8 ? 8 : -1)};
int x[N];
return 0;
}

View File

@ -1,5 +1,6 @@
#include <arm_acle.h>
int main(int argc, char* argv[])
{
return 0;
return 0;
}

View File

@ -1,19 +1,17 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.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[])
{
uint8x16_t x={0};
x=vaeseq_u8(x,x);
x=vaesmcq_u8(x);
x=vaesdq_u8(x,x);
x=vaesimcq_u8(x);
return 0;
uint8x16_t x={0};
x=vaeseq_u8(x,x);
x=vaesmcq_u8(x);
x=vaesdq_u8(x,x);
x=vaesimcq_u8(x);
return 0;
}

View File

@ -1,16 +1,14 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.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[])
{
uint32x4_t x={0};
x=veorq_u32(x,x);
return 0;
uint32x4_t x={0};
x=veorq_u32(x,x);
return 0;
}

View File

@ -1,23 +1,21 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.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;
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);
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;
return 0;
}

View File

@ -1,9 +1,11 @@
#include <arm_neon.h>
#include <stdint.h>
#ifdef CRYPTOPP_ARM_NEON_HEADER
# include <arm_neon.h>
#endif
int main(int argc, char* argv[])
{
uint32x4_t x={0};
x=veorq_u32(x,x);
return 0;
uint32x4_t x={0};
x=veorq_u32(x,x);
return 0;
}

View File

@ -0,0 +1,6 @@
#include <arm_neon.h>
int main(int argc, char* argv[])
{
return 0;
}

View File

@ -1,22 +1,20 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.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 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);
const poly128_t r1 = vmull_p64(a, b);
const poly128_t r2 = vmull_high_p64(d, d);
return 0;
return 0;
}

View File

@ -1,21 +0,0 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.h>
#endif
int main(int argc, char* argv[])
{
uint32x4_t y = {0};
y=vsha1cq_u32(y,0,y);
y=vsha1mq_u32(y,1,y);
y=vsha1pq_u32(y,2,y);
y=vsha256hq_u32(y, y, y);
y=vsha256h2q_u32(y, y, y);
y=vsha256su1q_u32(y, y, y);
return 0;
}

View File

@ -0,0 +1,16 @@
#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[])
{
uint32x4_t y = {0};
y=vsha1cq_u32(y,0,y);
y=vsha1mq_u32(y,1,y);
y=vsha1pq_u32(y,2,y);
return 0;
}

View File

@ -0,0 +1,16 @@
#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[])
{
uint32x4_t y = {0};
y=vsha256hq_u32(y, y, y);
y=vsha256h2q_u32(y, y, y);
y=vsha256su1q_u32(y, y, y);
return 0;
}

View File

@ -1,29 +1,27 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.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);
// 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);
// 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;
return 0;
}

View File

@ -1,29 +1,27 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.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);
// 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);
// 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;
return 0;
}

View File

@ -1,23 +1,21 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.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[])
{
// 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;
// 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

@ -1,18 +1,16 @@
#include <arm_neon.h>
#include <stdint.h>
// test_acle.h determines if this is available. Then,
// -DCRYPTOPP_ARM_ACLE_AVAILABLE=0 is added to CXXFLAGS
// if the ACLE header is not available.
#if (CRYPTOPP_ARM_ACLE_AVAILABLE)
# include <arm_acle.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;
// SM4 block cipher
uint32x4_t x;
x=vsm4ekeyq_u32(x,x);
x=vsm4eq_u32(x,x);
return 0;
}

View File

@ -0,0 +1,31 @@
// 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 .
#include <cstddef>
int main(int argc, char* argv[])
{
size_t ret = 1, N = 1;
asm __volatile__
(
#if defined(__amd64__) || defined(__x86_64__)
".intel_syntax noprefix ;\n"
"xor rsi, rsi ;\n"
"neg %1 ;\n"
"inc %1 ;\n"
"push %1 ;\n"
"pop rax ;\n"
".att_syntax prefix ;\n"
: "=a" (ret) : "c" (N) : "%rsi"
#else
".intel_syntax noprefix ;\n"
"xor esi, esi ;\n"
"neg %1 ;\n"
"inc %1 ;\n"
"push %1 ;\n"
"pop eax ;\n"
".att_syntax prefix ;\n"
: "=a" (ret) : "c" (N) : "%esi"
#endif
);
return (int)ret;
}

View File

@ -1,6 +1,6 @@
#include <string>
int main(int argc, char* argv[])
{
unsigned int x=0;
return x;
unsigned int x=0;
return x;
}

View File

@ -0,0 +1,11 @@
// Real C++11 libraries provide <forward_list>
#include <forward_list>
int main(int argc, char* argv[])
{
#if __cplusplus >= 201103L
std::forward_list<int> x;
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,5 @@
int main(int argc, char* argv[])
{
alignas(8) unsigned char x[16];
return 0;
}

View File

@ -0,0 +1,6 @@
#include <cstddef>
int main (int argc, char* argv[])
{
std::size_t n = alignof(int);
return 0;
}

View File

@ -0,0 +1,10 @@
// https://en.cppreference.com/w/cpp/feature_test
int main(int argc, char* argv[])
{
#if __cpp_static_assert >= 200410L
int x[1];
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,7 @@
#include <atomic>
int main(int argc, char* argv[])
{
std::atomic_flag f = ATOMIC_FLAG_INIT;
std::atomic<bool> g (false);
return 0;
}

View File

@ -0,0 +1,5 @@
int main(int argc, char* argv[])
{
auto a = 1 + 2;
return 0;
}

View File

@ -0,0 +1,10 @@
constexpr int fact(int n)
{
return n <= 1 ? 1 : (n * fact(n - 1));
}
int main(int argc, char* argv[])
{
fact(4);
return 0;
}

View File

@ -0,0 +1,10 @@
struct S {
S() = delete;
explicit S(int n) { }
};
int main (int argc, char* rgv[])
{
S s(1);
return 0;
}

View File

@ -0,0 +1,7 @@
#include <cstddef>
int main(int argc, char* argv[])
{
enum Size : std::size_t { Zero=0, One=1, Two=2 };
Size s(Size::Zero);
return 0;
}

View File

@ -0,0 +1,6 @@
#include <vector>
int main(int argc, char* argv[])
{
std::vector<int> v{0,1,2,3,4};
return 0;
}

View File

@ -0,0 +1,10 @@
// https://en.cppreference.com/w/cpp/feature_test
int main(int argc, char* argv[])
{
#if __cpp_lambdas >= 200907L
int x[1];
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,29 @@
#if defined(__GNUC__)
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
#endif
#if defined(__clang__) && defined(__apple_build_version__)
# undef GNUC_VERSION
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
#elif defined(__clang__)
# undef GNUC_VERSION
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
#endif
#if (GNUC_VERSION >= 7030)
# pragma GCC diagnostic ignored "-Wterminate"
#endif
#include <stdexcept>
void f(int n) noexcept(false)
{
if (n > 2)
throw std::runtime_error("Oops");
}
int main(int argc, char* argv[])
{
f(argc);
return 0;
}

View File

@ -0,0 +1,6 @@
#include <cstddef>
int main(int argc, char* argv[])
{
int* p = nullptr;
return 0;
}

View File

@ -0,0 +1,11 @@
// https://en.cppreference.com/w/cpp/feature_test
// Apple bug https://bugs.llvm.org/show_bug.cgi?id=47012.
int main(int argc, char* argv[])
{
#if __cpp_threadsafe_static_init >= 200806L
int x[1];
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,7 @@
#include <mutex>
int main(int argc, char* argv[])
{
std::mutex m;
std::lock_guard<std::mutex> l(m);
return 0;
}

View File

@ -0,0 +1,9 @@
int main(int argc, char* argv[])
{
#if __cpp_variadic_templates >= 200704L
int x[1];
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,9 @@
int main(int argc, char* argv[])
{
#if __cplusplus >= 201402L
int x[1];
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,9 @@
int main(int argc, char* argv[])
{
#if __cplusplus >= 201703L
int x[1];
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,10 @@
// https://en.cppreference.com/w/cpp/feature_test
int main(int argc, char* argv[])
{
#if __cpp_static_assert >= 201411L
int x[1];
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,11 @@
// https://en.cppreference.com/w/cpp/feature_test
#include <exception>
int main(int argc, char* argv[])
{
#if __cpp_lib_uncaught_exceptions >= 201411L
int x = std::uncaught_exceptions();
#else
int x[-1];
#endif
return 0;
}

View File

@ -0,0 +1,12 @@
#include <exception>
struct S {
S() {}
virtual ~S() {
bool b = std::uncaught_exception();
}
};
int main(int argc, char* argv[])
{
S s;
return 0;
}

View File

@ -0,0 +1,8 @@
#include <string>
int main(int argc, char* argv[])
{
#ifndef __GLIBCXX__
int x[-1];
#endif
return 0;
}

View File

@ -1,31 +0,0 @@
// 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 .
#include <cstddef>
int main(int argc, char* argv[])
{
size_t ret = 1, N = 1;
asm __volatile__
(
#if defined(__amd64__) || defined(__x86_64__)
".intel_syntax noprefix ;\n"
"xor rsi, rsi ;\n"
"neg %1 ;\n"
"inc %1 ;\n"
"push %1 ;\n"
"pop rax ;\n"
".att_syntax prefix ;\n"
: "=a" (ret) : "c" (N) : "%rsi"
#else
".intel_syntax noprefix ;\n"
"xor esi, esi ;\n"
"neg %1 ;\n"
"inc %1 ;\n"
"push %1 ;\n"
"pop eax ;\n"
".att_syntax prefix ;\n"
: "=a" (ret) : "c" (N) : "%esi"
#endif
);
return (int)ret;
}

View File

@ -2,7 +2,7 @@
int main(int argc, char* argv[])
{
#ifndef __NEWLIB__
XXX
int x[-1];
#endif
return 0;
return 0;
}

View File

@ -2,25 +2,25 @@
int main(int argc, char* argv[])
{
#if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__))
__vector unsigned char x = {1,2,3,4,5,6,7,8};
x=__vcipher(x,x);
x=__vcipherlast(x,x);
x=__vncipher(x,x);
x=__vncipherlast(x,x);
__vector unsigned char x = {1,2,3,4,5,6,7,8};
x=__vcipher(x,x);
x=__vcipherlast(x,x);
x=__vncipher(x,x);
x=__vncipherlast(x,x);
#elif defined(__clang__)
__vector unsigned long long x = {1,2};
x=__builtin_altivec_crypto_vcipher(x,x);
x=__builtin_altivec_crypto_vcipherlast(x,x);
x=__builtin_altivec_crypto_vncipher(x,x);
x=__builtin_altivec_crypto_vncipherlast(x,x);
__vector unsigned long long x = {1,2};
x=__builtin_altivec_crypto_vcipher(x,x);
x=__builtin_altivec_crypto_vcipherlast(x,x);
x=__builtin_altivec_crypto_vncipher(x,x);
x=__builtin_altivec_crypto_vncipherlast(x,x);
#elif defined(__GNUC__)
__vector unsigned long long x = {1,2};
x=__builtin_crypto_vcipher(x,x);
x=__builtin_crypto_vcipherlast(x,x);
x=__builtin_crypto_vncipher(x,x);
x=__builtin_crypto_vncipherlast(x,x);
__vector unsigned long long x = {1,2};
x=__builtin_crypto_vcipher(x,x);
x=__builtin_crypto_vcipherlast(x,x);
x=__builtin_crypto_vncipher(x,x);
x=__builtin_crypto_vncipherlast(x,x);
#else
int XXX[-1];
int XXX[-1];
#endif
return 0;
return 0;
}

View File

@ -1,8 +1,13 @@
#define GNUC_VERSION (__GNUC__*1000 + __GNUC_MAJOR__*10)
#if (GNUC_VERSION >= 4060) || defined(__clang__)
# pragma GCC diagnostic ignored "-Wdeprecated"
#endif
#include <altivec.h>
int main(int argc, char* argv[])
{
__vector unsigned char x;
x=vec_ld(0, (unsigned char*)argv[0]);
x=vec_add(x,x);
return 0;
__vector unsigned char x;
x=vec_ld(0, (unsigned char*)argv[0]);
x=vec_add(x,x);
return 0;
}

View File

@ -1,41 +1,44 @@
#if defined(__GNUC__)
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
#endif
#if defined(__clang__) && defined(__apple_build_version__)
# undef GNUC_VERSION
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
#elif defined(__clang__)
# undef GNUC_VERSION
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
#endif
#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000)
# pragma GCC diagnostic ignored "-Wdeprecated"
#endif
// 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.
#if defined(_AIX) && defined(_ARCH_PWR7) && defined(__xlC__)
# define __VSX__ 1
#endif
#include <altivec.h>
// This follows ppc_simd.h. XLC compilers for POWER7 use vec_xlw4 and
// vec_xstw4. Some XLC compilers for POWER7 and above use vec_xl and
// vec_xst. The way to tell the difference is, XLC compilers version
// 13.0 and earlier use use vec_xlw4 and vec_xstw4 XLC compilers 13.1
// and later are use vec_xl and vec_xst. The open question is, how to
// handle early Clang compilers for POWER7. We know the latest Clang
// compilers support vec_xl and vec_xst. Also see
// https://www-01.ibm.com/support/docview.wss?uid=swg21683541
#if defined(__xlc__) && (__xlc__ < 0x0d01)
# define __early_xlc__ 1
#endif
#if defined(__xlC__) && (__xlC__ < 0x0d01)
# define __early_xlC__ 1
#endif
int main(int argc, char* argv[])
{
__vector unsigned char x;
unsigned char res[16];
#if defined(_ARCH_PWR7) && defined(__VSX__)
// PWR7
__vector unsigned int a = {1,2,3,4};
__vector unsigned int b = vec_ld(0, (unsigned int*)argv[0]);
__vector unsigned int c = vec_xor(a, b);
#if defined(_ARCH_PWR7) && (defined(__early_xlc__) || defined(__early_xlC__))
x=vec_xlw4(0, (unsigned char*)argv[0]);
x=vec_add(x,x);
vec_xstw4(x, 0, res);
#elif defined(_ARCH_PWR7) && (defined(__xlc__) || defined(__xlC__) || defined(__clang__))
x=vec_xl(0, (unsigned char*)argv[0]);
x=vec_add(x,x);
vec_xst(x, 0, res);
#elif defined(_ARCH_PWR7) && defined(__GNUC__)
x=vec_vsx_ld(0, (unsigned char*)argv[0]);
x=vec_add(x,x);
vec_vsx_st(x, 0, res);
// VSX
__vector unsigned int x = {5,6,7,8};
__vector unsigned int y = vec_xl(0, (unsigned int*)argv[0]);
__vector unsigned int z = vec_xor(x, y);
__vector unsigned long long xx = {1,2};
__vector unsigned long long yy = (__vector unsigned long long)y;
#else
int XXX[-1];
int x[-1];
#endif
return 0;
return 0;
}

View File

@ -1,7 +1,46 @@
#if defined(__GNUC__)
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
#endif
#if defined(__clang__) && defined(__apple_build_version__)
# undef GNUC_VERSION
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
#elif defined(__clang__)
# undef GNUC_VERSION
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
#endif
#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000)
# pragma GCC diagnostic ignored "-Wdeprecated"
#endif
// 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
#if defined(_AIX) && defined(_ARCH_PWR8) && defined(__xlC__)
# define __CRYPTO__ 1
#endif
#include <altivec.h>
int main(int argc, char* argv[])
{
__vector unsigned long long z = {1, 2};
z=vec_add(z,z);
return 0;
#if defined(_ARCH_PWR8)
__vector unsigned long long r = {1, 2};
__vector unsigned int s = vec_xl(0, (unsigned int*)argv[0]); // Power7
__vector unsigned long long w = (__vector unsigned long long)r;
__vector unsigned long long x = (__vector unsigned long long)s;
__vector unsigned long long y = vec_xor(w, x);
__vector unsigned long long z = vec_add(y, vec_add(w, x));
# if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__))
__vector unsigned long long u = __vpmsumd (y, z);
# elif defined(__clang__)
__vector unsigned long long u = __builtin_altivec_crypto_vpmsumd (y, z);
# else
__vector unsigned long long u = __builtin_crypto_vpmsumd (y, z);
# endif
#else
int x[-1];
#endif
return 0;
}

View File

@ -1,36 +1,33 @@
// The problem we have here is, it appears only GCC 7.0 and above
// support Power9 builtins. Clang 7.0 has support for some (all?)
// assembly instructions but we don't see builtin support. We can't
// determine the state of XLC. Searching IBM's website for
// terms like 'darn' 'random number' is returning irrelevant hits.
// Searching with Google from the outside returns 0 hits.
//
// The support disconnect means we may report Power9 as unavailable
// and support DARN at the same time. We get into that state because
// we use inline asm to detect DARN availablity in the compiler.
// Also see cpu.cpp and the two query functions; and ppc_power9.cpp
// and the two probe functions.
#if defined(__GNUC__)
# define GNUC_VERSION (__GNUC__*1000 + __GNUC_MINOR__*10)
#endif
#if defined(__clang__) && defined(__apple_build_version__)
# undef GNUC_VERSION
# define APPLE_VERSION (__clang_major__*1000 + __clang_minor__*10)
#elif defined(__clang__)
# undef GNUC_VERSION
# define LLVM_VERSION (__clang_major__*1000 + __clang_minor__*10)
#endif
#if (GNUC_VERSION >= 4060) || (LLVM_VERSION >= 1070) || (APPLE_VERSION >= 2000)
# pragma GCC diagnostic ignored "-Wdeprecated"
#endif
#include <altivec.h>
int main(int argc, char* argv[])
{
#if 0
const unsigned char b = (unsigned char)argc;
const unsigned int r = (0xf << 24) | (0x3 << 16) | (0xf << 8) | (0x3 << 0);
#if defined(__clang__)
bool x = __builtin_altivec_byte_in_range(b, r);
#elif defined(__GNUC__)
bool x = __builtin_byte_in_range(b, r);
#if defined(_ARCH_PWR9)
__vector unsigned int v = vec_xl_be(0, (unsigned int*)argv[0]);
#else
int XXX[-1];
#endif
int XXX[-1];
#endif
#if defined(__GNUC__) || defined(__IBM_GCC_ASM)
unsigned int y = __builtin_darn_32();
unsigned int y = __builtin_darn_32();
#else
int XXX[-1];
int XXX[-1];
#endif
return 0;
return 0;
}

View File

@ -2,22 +2,22 @@
int main(int argc, char* argv[])
{
#if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__))
__vector unsigned int x = {1,2,3,4};
__vector unsigned int x = {1,2,3,4};
x=__vshasigmaw(x, 0, 0);
__vector unsigned long long y = {1,2};
__vector unsigned long long y = {1,2};
y=__vshasigmad(y, 0, 0);
#elif defined(__clang__)
__vector unsigned int x = {1,2,3,4};
__vector unsigned int x = {1,2,3,4};
x=__builtin_altivec_crypto_vshasigmaw(x, 0, 0);
__vector unsigned long long y = {1,2};
__vector unsigned long long y = {1,2};
y=__builtin_altivec_crypto_vshasigmad(y, 0, 0);
#elif defined(__GNUC__)
__vector unsigned int x = {1,2,3,4};
__vector unsigned int x = {1,2,3,4};
x=__builtin_crypto_vshasigmaw(x, 0, 0);
__vector unsigned long long y = {1,2};
__vector unsigned long long y = {1,2};
y=__builtin_crypto_vshasigmad(y, 0, 0);
#else
int XXX[-1];
#endif
return 0;
return 0;
}

View File

@ -1,17 +1,17 @@
#include <altivec.h>
int main(int argc, char* argv[])
{
__vector unsigned long long x = {1,2};
__vector unsigned long long y = {3,4};
__vector unsigned long long x = {1,2};
__vector unsigned long long y = {3,4};
#if defined(__ibmxl__) || (defined(_AIX) && defined(__xlC__))
__vector unsigned long long z=__vpmsumd(x,y);
__vector unsigned long long z=__vpmsumd(x,y);
#elif defined(__clang__)
__vector unsigned long long z=__builtin_altivec_crypto_vpmsumd(x,y);
__vector unsigned long long z=__builtin_altivec_crypto_vpmsumd(x,y);
#elif defined(__GNUC__)
__vector unsigned long long z=__builtin_crypto_vpmsumd(x,y);
__vector unsigned long long z=__builtin_crypto_vpmsumd(x,y);
#else
int XXX[-1];
int XXX[-1];
#endif
return 0;
return 0;
}

View File

@ -3,13 +3,13 @@
void* function(void *ptr)
{
return 0;
return 0;
}
int main(int argc, char* argv[])
{
pthread_t thread;
int ret = pthread_create(&thread, NULL, function, (void*)0);
pthread_join(thread, NULL);
return 0;
pthread_t thread;
int ret = pthread_create(&thread, NULL, function, (void*)0);
pthread_join(thread, NULL);
return 0;
}

View File

@ -2,10 +2,10 @@
#include <wmmintrin.h>
int main(int argc, char* argv[])
{
__m128i x = _mm_setzero_si128();
x=_mm_aesenc_si128(x,x);
x=_mm_aesenclast_si128(x,x);
x=_mm_aesdec_si128(x,x);
x=_mm_aesdeclast_si128(x,x);
return 0;
__m128i x = _mm_setzero_si128();
x=_mm_aesenc_si128(x,x);
x=_mm_aesenclast_si128(x,x);
x=_mm_aesdec_si128(x,x);
x=_mm_aesdeclast_si128(x,x);
return 0;
}

View File

@ -1,7 +1,7 @@
#include <immintrin.h>
int main(int argc, char* argv[])
{
__m256d x = _mm256_setzero_pd();
x=_mm256_addsub_pd(x,x);
return 0;
__m256d x = _mm256_setzero_pd();
x=_mm256_addsub_pd(x,x);
return 0;
}

View File

@ -1,7 +1,9 @@
#include <immintrin.h>
int main(int argc, char* argv[])
{
__m256i x = _mm256_setzero_si256();
x=_mm256_add_epi64 (x,x);
return 0;
// _mm256_broadcastsi128_si256 due to Clang
__m128i x = _mm_setzero_si128 ();
__m256i y = _mm256_broadcastsi128_si256 (x);
y = _mm256_add_epi64 (y,y);
return 0;
}

View File

@ -2,7 +2,7 @@
#include <wmmintrin.h>
int main(int argc, char* argv[])
{
__m128i x = _mm_setzero_si128();
x=_mm_clmulepi64_si128(x,x,0x11);
return 0;
__m128i x = _mm_setzero_si128();
x=_mm_clmulepi64_si128(x,x,0x11);
return 0;
}

View File

@ -1,7 +1,7 @@
int main(int argc, char* argv[])
{
unsigned int a, b, c, d;
asm volatile ( "cpuid" : "+a"(a), "=b"(b), "+c"(c), "=d"(d) );
unsigned int a, b, c, d;
asm volatile ( "cpuid" : "+a"(a), "=b"(b), "+c"(c), "=d"(d) );
return 0;
return 0;
}

View File

@ -0,0 +1,10 @@
#include <immintrin.h>
#if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
# include <x86intrin.h>
#endif
int main(int argc, char* argv[])
{
unsigned int x=0;
(void)_rdrand32_step (&x);
return x == 0 ? 0 : 0;
}

View File

@ -0,0 +1,10 @@
#include <immintrin.h>
#if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
# include <x86intrin.h>
#endif
int main(int argc, char* argv[])
{
unsigned int x=0;
(void)_rdseed32_step (&x);
return x == 0 ? 0 : 0;
}

View File

@ -2,13 +2,13 @@
#include <immintrin.h>
int main(int argc, char* argv[])
{
__m128i x = _mm_setzero_si128();
x=_mm_sha1msg1_epu32(x,x);
x=_mm_sha1msg2_epu32(x,x);
x=_mm_sha1nexte_epu32(x,x);
x=_mm_sha1rnds4_epu32(x,x,0);
x=_mm_sha256msg1_epu32(x,x);
x=_mm_sha256msg2_epu32(x,x);
x=_mm_sha256rnds2_epu32(x,x,x);
return 0;
__m128i x = _mm_setzero_si128();
x=_mm_sha1msg1_epu32(x,x);
x=_mm_sha1msg2_epu32(x,x);
x=_mm_sha1nexte_epu32(x,x);
x=_mm_sha1rnds4_epu32(x,x,0);
x=_mm_sha256msg1_epu32(x,x);
x=_mm_sha256msg2_epu32(x,x);
x=_mm_sha256rnds2_epu32(x,x,x);
return 0;
}

View File

@ -1,7 +1,7 @@
#include <emmintrin.h>
int main(int argc, char* argv[])
{
__m128i x = _mm_setzero_si128();
x=_mm_add_epi64(x,x);
return 0;
__m128i x = _mm_setzero_si128();
x=_mm_add_epi64(x,x);
return 0;
}

View File

@ -2,7 +2,7 @@
#include <pmmintrin.h>
int main(int argc, char* argv[])
{
__m128d x = _mm_setzero_pd();
x=_mm_addsub_pd(x,x);
return 0;
__m128d x = _mm_setzero_pd();
x=_mm_addsub_pd(x,x);
return 0;
}

View File

@ -2,9 +2,9 @@
#include <smmintrin.h>
int main(int argc, char* argv[])
{
__m128i x = _mm_setzero_si128();
__m128i a = _mm_setzero_si128();
__m128i b = _mm_setzero_si128();
x=_mm_blend_epi16(a,b,4);
return 0;
__m128i x = _mm_setzero_si128();
__m128i a = _mm_setzero_si128();
__m128i b = _mm_setzero_si128();
x=_mm_blend_epi16(a,b,4);
return 0;
}

View File

@ -1,7 +1,7 @@
#include <nmmintrin.h>
int main(int argc, char* argv[])
{
unsigned int x=32;
x=_mm_crc32_u8(x,4);
return 0;
unsigned int x=32;
x=_mm_crc32_u8(x,4);
return 0;
}

View File

@ -2,7 +2,7 @@
#include <tmmintrin.h>
int main(int argc, char* argv[])
{
__m128i x = _mm_setzero_si128();
x=_mm_alignr_epi8(x,x,2);
return 0;
__m128i x = _mm_setzero_si128();
x=_mm_alignr_epi8(x,x,2);
return 0;
}

View File

@ -0,0 +1,39 @@
// TODO: cut-in xcrypt-ecb
#include <cstdlib>
int main(int argc, char* argv[])
{
unsigned int msr=0;
unsigned int divisor=2;
unsigned int buffer;
__asm__ __volatile__
(
#if defined(__x86_64__) || defined(__amd64__)
"mov %1, %%rdi ;\n"
"movl %2, %%edx ;\n"
#else
"mov %1, %%edi ;\n"
"movl %2, %%edx ;\n"
#endif
// xstore-rng
".byte 0x0f, 0xa7, 0xc0 ;\n"
#if defined(__x86_64__) || defined(__amd64__)
"andq %%rax, 0x1f ;\n"
"movl %%eax, %0 ;\n"
#else
"andl %%eax, 0x1f ;\n"
"movl %%eax, %0 ;\n"
#endif
: "=g" (msr) : "g" (buffer), "g" (divisor)
#if defined(__x86_64__) || defined(__amd64__)
: "rax", "rdx", "rdi", "cc"
#else
: "eax", "edx", "edi", "cc"
#endif
);
return 0;
}

View File

@ -0,0 +1,38 @@
#include <cstdlib>
int main(int argc, char* argv[])
{
unsigned int msr=0;
unsigned int divisor=2;
unsigned int buffer;
__asm__ __volatile__
(
#if defined(__x86_64__) || defined(__amd64__)
"mov %1, %%rdi ;\n"
"movl %2, %%edx ;\n"
#else
"mov %1, %%edi ;\n"
"movl %2, %%edx ;\n"
#endif
// xstore-rng
".byte 0x0f, 0xa7, 0xc0 ;\n"
#if defined(__x86_64__) || defined(__amd64__)
"andq %%rax, 0x1f ;\n"
"movl %%eax, %0 ;\n"
#else
"andl %%eax, 0x1f ;\n"
"movl %%eax, %0 ;\n"
#endif
: "=g" (msr) : "g" (buffer), "g" (divisor)
#if defined(__x86_64__) || defined(__amd64__)
: "rax", "rdx", "rdi", "cc"
#else
: "eax", "edx", "edi", "cc"
#endif
);
return 0;
}

View File

@ -0,0 +1,39 @@
// TODO: cut-in xsha1
#include <cstdlib>
int main(int argc, char* argv[])
{
unsigned int msr=0;
unsigned int divisor=2;
unsigned int buffer;
__asm__ __volatile__
(
#if defined(__x86_64__) || defined(__amd64__)
"mov %1, %%rdi ;\n"
"movl %2, %%edx ;\n"
#else
"mov %1, %%edi ;\n"
"movl %2, %%edx ;\n"
#endif
// xstore-rng
".byte 0x0f, 0xa7, 0xc0 ;\n"
#if defined(__x86_64__) || defined(__amd64__)
"andq %%rax, 0x1f ;\n"
"movl %%eax, %0 ;\n"
#else
"andl %%eax, 0x1f ;\n"
"movl %%eax, %0 ;\n"
#endif
: "=g" (msr) : "g" (buffer), "g" (divisor)
#if defined(__x86_64__) || defined(__amd64__)
: "rax", "rdx", "rdi", "cc"
#else
: "eax", "edx", "edi", "cc"
#endif
);
return 0;
}

View File

@ -1,17 +1,29 @@
#!/usr/bin/env bash
# Use this script to switch back to the previous Crypto++ version before
#############################################################################
#
# This script switches back to the previous Crypto++ version before
# building the docs. Before running the script, copy it to the root
# directory. After running this script, you can 'make docs'
#
# Written and placed in public domain by Jeffrey Walton.
#
# 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.
#
# See https://www.cryptopp.com/wiki/Release_Versioning for more details
#
#############################################################################
sed 's|Library 8.2 API|Library 8.1 API|g' cryptlib.h > cryptlib.h.new
sed 's|Library 8.4 API|Library 8.3 API|g' cryptlib.h > cryptlib.h.new
mv cryptlib.h.new cryptlib.h
sed 's|= 8.2|= 8.1|g' Doxyfile > Doxyfile.new
sed 's|= 8.4|= 8.3|g' Doxyfile > Doxyfile.new
mv Doxyfile.new Doxyfile
sed 's|CRYPTOPP_MINOR 2|CRYPTOPP_MINOR 1|g' config.h > config.h.new
mv config.h.new config.h
sed 's|CRYPTOPP_MINOR 4|CRYPTOPP_MINOR 3|g' config_ver.h > config_ver.h.new
mv config_ver.h.new config_ver.h
sed 's|CRYPTOPP_VERSION 820|CRYPTOPP_VERSION 810|g' config.h > config.h.new
mv config.h.new config.h
sed 's|CRYPTOPP_VERSION 840|CRYPTOPP_VERSION 830|g' config_ver.h > config_ver.h.new
mv config_ver.h.new config_ver.h

View File

@ -0,0 +1,930 @@
#!/usr/bin/env bash
# Written and placed in public domain by Jeffrey Walton
#
# This script attempts to update various config_xxx.h files based on the
# current toolchain. It fills a gap where some features are misdetected based
# on compiler version and associated macros, but the feature is (or is not)
# present. For example, modern Android toolchains should be AES-NI and AVX
# capable, but the project removes the feature support.
#
# Use the same compiler and environment to run configure and the makefile.
#
# To use the script, copy the script to the root of the Crypto++ directory.
# Set the environment, and then run the tool:
#
# export CXX="..."
# export CXXFLAGS="..."
# export LDFLAGS="..."
# ./configure.sh
#
# Android and iOS would use the following if you are using setenv-android.sh
# or setenv-ios.sh to set the environment. Otherwise the script expects
# CXX and CXXFLAGS to be set properly for Android or iOS.
#
# export CXXFLAGS="$IOS_CXXFLAGS --sysroot=$IOS_SYSROOT"
# or
# export CXXFLAGS="${ANDROID_CXXFLAGS} --sysroot=${ANDROID_SYSROOT}"
#
# Do not use this script for a multiarch environment unless the cpu features
# are the same for each arch. For example, -arch i386 -arch x86_64 could
# cause problems if x86 only included SSE4.2, while x64 included AVX.
#
# A wiki page is available for this script at
# https://www.cryptopp.com/wiki/Configure.sh
#
# This script was added at Crypto++ 8.3. Also see GH #850. This script will
# work with earlier versions of the library that use config_xxx.h files.
# The monolithic config.h was split into config_xxx.h in May 2019 at
# Crypto++ 8.3. Also see GH #835, PR #836.
# shellcheck disable=SC2086
# Verify the file exists and is writeable.
if [[ ! -f ./config_asm.h ]]; then
echo "WARNING:"
echo "WARNING: Unable to locate config_asm.h"
echo "WARNING:"
elif [[ ! -w ./config_asm.h ]]; then
echo "WARNING:"
echo "WARNING: Unable to write to config_asm.h"
echo "WARNING:"
fi
TMPDIR="${TMPDIR:-$HOME/tmp}"
TPROG="${TPROG:-TestPrograms/test_cxx.cxx}"
TOUT="${TOUT:-a.out}"
CXX="${CXX:-c++}"
LD="${LD:-ld}"
CXXFLAGS="${CXXFLAGS:--DNDEBUG -g2 -O3}"
GREP="${GREP:-grep}"
if [[ -z "$(command -v ${CXX} 2>/dev/null)" ]]; then
echo "Compiler is not valid. Please install a compiler"
exit 1
fi
if [[ -z "$(command -v ${LD} 2>/dev/null)" ]]; then
echo "Linker is not valid. Please install a linker"
exit 1
fi
# Solaris fixup
if [[ -d /usr/gnu/bin ]]; then
GREP=/usr/gnu/bin/grep
fi
# Initialize these once
IS_X86=0
IS_X64=0
IS_IA32=0
IS_ARM32=0
IS_ARMV8=0
IS_PPC=0
IS_PPC64=0
# Determine compiler
GCC_COMPILER=$(${CXX} --version 2>/dev/null | ${GREP} -i -c -E '(^g\+\+|GNU)')
SUN_COMPILER=$(${CXX} -V 2>/dev/null | ${GREP} -i -c -E 'CC: (Sun|Oracle) Studio')
XLC_COMPILER=$(${CXX} -qversion 2>/dev/null | ${GREP} -i -c "IBM XL C/C++")
CLANG_COMPILER=$(${CXX} --version 2>/dev/null | ${GREP} -i -c -E 'clang|llvm')
if [[ "$SUN_COMPILER" -ne 0 ]]
then
# TODO: fix use of uname for SunCC
IS_X86=$(uname -m 2>&1 | ${GREP} -c -E 'i386|i486|i585|i686')
IS_X64=$(uname -m 2>&1 | ${GREP} -c -E 'i86pc|x86_64|amd64')
elif [[ "$XLC_COMPILER" -ne 0 ]]
then
IS_PPC=$(${CXX} ${CXXFLAGS} -qshowmacros -E ${TPROG} | ${GREP} -i -c -E '__PPC__|__POWERPC__')
IS_PPC64=$(${CXX} ${CXXFLAGS} -qshowmacros -E ${TPROG} | ${GREP} -i -c -E '__PPC64__|__POWERPC64__')
elif [[ "$CLANG_COMPILER" -ne 0 ]]
then
IS_X86=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'i386|i486|i585|i686')
IS_X64=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'i86pc|x86_64|amd64')
IS_ARM32=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'arm|armhf|armv7|eabihf|armv8')
IS_ARMV8=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'aarch32|aarch64|arm64')
IS_PPC=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -i -c -E 'ppc|powerpc')
IS_PPC64=$(${CXX} ${CXXFLAGS} -dM -E ${TPROG} | ${GREP} -c -E 'ppc64|powerpc64')
else
IS_X86=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'i386|i486|i585|i686')
IS_X64=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'x86_64|amd64')
IS_ARM32=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'arm|armhf|armv7|eabihf|armv8')
IS_ARMV8=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'aarch32|aarch64|arm64')
IS_PPC=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'ppc|powerpc')
IS_PPC64=$(${CXX} ${CXXFLAGS} -dumpmachine 2>&1 | ${GREP} -i -c -E 'ppc64|powerpc64')
fi
# One check for intel compatibles
if [[ "${IS_X86}" -ne 0 || "${IS_X64}" -ne 0 ]]; then IS_IA32=1; fi
# A 64-bit platform often matches the 32-bit variant due to appending '64'
if [[ "${IS_X64}" -ne 0 ]]; then IS_X86=0; fi
if [[ "${IS_ARMV8}" -ne 0 ]]; then IS_ARM32=0; fi
if [[ "${IS_PPC64}" -ne 0 ]]; then IS_PPC=0; fi
# Default values for setenv-*.sh scripts
IS_IOS="${IS_IOS:-0}"
IS_ANDROID="${IS_ANDROID:-0}"
TIMESTAMP=$(date "+%A, %B %d %Y, %I:%M %p")
# ===========================================================================
# =================================== Info ==================================
# ===========================================================================
if [[ "${IS_X86}" -ne 0 ]]; then echo "Configuring for x86"; fi
if [[ "${IS_X64}" -ne 0 ]]; then echo "Configuring for x86_64"; fi
if [[ "${IS_ARM32}" -ne 0 ]]; then echo "Configuring for ARM32"; fi
if [[ "${IS_ARMV8}" -ne 0 ]]; then echo "Configuring for Aarch64"; fi
if [[ "${IS_PPC}" -ne 0 ]]; then echo "Configuring for PowerPC"; fi
if [[ "${IS_PPC64}" -ne 0 ]]; then echo "Configuring for PowerPC64"; fi
echo "Compiler: $(command -v ${CXX})"
echo "Linker: $(command -v ${LD})"
# ===========================================================================
# =============================== config_asm.h ==============================
# ===========================================================================
rm -f config_asm.h.new
# ====================================================
# =================== common header ==================
# ====================================================
{
echo '// config_asm.h rewritten by configure.sh script'
echo '//' "${TIMESTAMP}"
echo '// Also see https://www.cryptopp.com/wiki/configure.sh'
echo ''
echo '#ifndef CRYPTOPP_CONFIG_ASM_H'
echo '#define CRYPTOPP_CONFIG_ASM_H'
echo ''
} >> config_asm.h.new
#############################################################################
# Pickup CRYPTOPP_DISABLE_ASM
disable_asm=$($GREP -c '\-DCRYPTOPP_DISABLE_ASM' <<< "${CPPFLAGS} ${CXXFLAGS}")
if [[ "$disable_asm" -ne 0 ]];
then
# Shell redirection
{
echo ''
echo '// Set in CPPFLAGS or CXXFLAGS'
echo '#define CRYPTOPP_DISABLE_ASM 1'
} >> config_asm.h.new
fi
#############################################################################
# Intel x86-based machines
if [[ "$disable_asm" -eq 0 && "$IS_IA32" -ne 0 ]];
then
if [[ "${SUN_COMPILER}" -ne 0 ]]; then
SSE2_FLAG=-xarch=sse2
SSE3_FLAG=-xarch=sse3
SSSE3_FLAG=-xarch=ssse3
SSE41_FLAG=-xarch=sse4_1
SSE42_FLAG=-xarch=sse4_2
CLMUL_FLAG=-xarch=aes
AESNI_FLAG=-xarch=aes
RDRAND_FLAG=-xarch=avx_i
RDSEED_FLAG=-xarch=avx2_i
AVX_FLAG=-xarch=avx
AVX2_FLAG=-xarch=avx2
SHANI_FLAG=-xarch=sha
else
SSE2_FLAG=-msse2
SSE3_FLAG=-msse3
SSSE3_FLAG=-mssse3
SSE41_FLAG=-msse4.1
SSE42_FLAG=-msse4.2
CLMUL_FLAG=-mpclmul
AESNI_FLAG=-maes
RDRAND_FLAG=-mrdrnd
RDSEED_FLAG=-mrdseed
AVX_FLAG=-mavx
AVX2_FLAG=-mavx2
SHANI_FLAG=-msha
fi
# Shell redirection
{
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_x86_sse2.cxx -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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_X86_ASM_AVAILABLE 1'
if [[ "${IS_X64}" -ne 0 ]]; then
echo '#define CRYPTOPP_X64_ASM_AVAILABLE 1'
echo '#define CRYPTOPP_SSE2_ASM_AVAILABLE 1'
fi
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE2_FLAG} TestPrograms/test_x86_sse2.cxx -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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
have_sse3=1
echo '#define CRYPTOPP_SSE3_AVAILABLE 1'
else
have_sse3=0
echo '#define CRYPTOPP_DISABLE_SSE3 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSSE3_FLAG} TestPrograms/test_x86_ssse3.cxx -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'
echo '#define CRYPTOPP_SSSE3_AVAILABLE 1'
else
have_ssse3=0
echo '#define CRYPTOPP_DISABLE_SSSE3 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE41_FLAG} TestPrograms/test_x86_sse41.cxx -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'
else
have_sse41=0
echo '#define CRYPTOPP_DISABLE_SSE4 1'
echo '#define CRYPTOPP_DISABLE_SSE41 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${SSE42_FLAG} TestPrograms/test_x86_sse42.cxx -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'
else
have_sse42=0
echo '#define CRYPTOPP_DISABLE_SSE4 1'
echo '#define CRYPTOPP_DISABLE_SSE42 1'
fi
########################################################
# 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)
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)
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)
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)
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)
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)
if [[ "${CXX_RESULT}" -eq 0 && "$have_sse42" -ne 0 ]]; then
have_avx=1
echo '#define CRYPTOPP_AVX_AVAILABLE 1'
else
have_avx=0
echo '#define CRYPTOPP_DISABLE_AVX 1'
fi
#####################
# AVX2 depends on AVX
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${AVX2_FLAG} TestPrograms/test_x86_avx2.cxx -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'
else
have_avx2=0
echo '#define CRYPTOPP_DISABLE_AVX2 1'
fi
# No flags, requires inline ASM
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_rng.cxx -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_PADLOCK_RNG_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_PADLOCK_RNG 1'
fi
# No flags, requires inline ASM
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_aes.cxx -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_PADLOCK_AES_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_PADLOCK_AES 1'
fi
# No flags, requires inline ASM
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_x86_via_sha.cxx -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_PADLOCK_SHA_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_PADLOCK_SHA 1'
fi
# Clang workaround
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_asm_mixed.cxx -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -ne 0 ]]; then
echo '#define CRYPTOPP_DISABLE_MIXED_ASM 1'
fi
if [[ "${SUN_COMPILER}" -ne 0 ]]; then
echo ''
echo '// Fixup for SunCC 12.1-12.4. Bad code generation in AES_Encrypt and friends.'
echo '#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5130)'
echo '# undef CRYPTOPP_AESNI_AVAILABLE'
echo '#endif'
echo ''
echo '// Fixup for SunCC 12.1-12.6. Compiler crash on GCM_Reduce_CLMUL.'
echo '// http://github.com/weidai11/cryptopp/issues/226'
echo '#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5150)'
echo '# undef CRYPTOPP_CLMUL_AVAILABLE'
echo '#endif'
fi
} >> config_asm.h.new
fi
#############################################################################
# ARM 32-bit machines
if [[ "$disable_asm" -eq 0 && "$IS_ARM32" -ne 0 ]];
then
# IS_IOS is set when ./setenv-ios is run
if [[ "$IS_IOS" -ne 0 ]]; then
ARMV7_FLAG="-arch arm"
NEON_FLAG="-arch arm"
elif [[ "$CLANG_COMPILER" -ne 0 ]]; then
ARMV7_FLAG="-march=armv7"
NEON_FLAG="-march=armv7 -mfpu=neon"
else
ARMV7_FLAG="-march=armv7"
NEON_FLAG="-mfpu=neon"
fi
# Shell redirection
{
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${NEON_FLAG} TestPrograms/test_arm_neon_header.cxx -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)
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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_NEON_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_NEON 1'
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)
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)
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)
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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOGAMS_ARM_SHA512 1'
fi
} >> config_asm.h.new
fi
#############################################################################
# ARM 64-bit machines
if [[ "$disable_asm" -eq 0 && "$IS_ARMV8" -ne 0 ]];
then
# IS_IOS is set when ./setenv-ios is run
if [[ "$IS_IOS" -ne 0 ]]; then
ARMV8_FLAG="-arch arm64"
ARMV81_CRC_FLAG="-arch arm64"
ARMV81_CRYPTO_FLAG="-arch arm64"
ARMV84_CRYPTO_FLAG="-arch arm64"
else
ARMV8_FLAG="-march=armv8-a"
ARMV81_CRC_FLAG="-march=armv8-a+crc"
ARMV81_CRYPTO_FLAG="-march=armv8-a+crypto"
ARMV84_CRYPTO_FLAG="-march=armv8.4-a+crypto"
fi
# Shell redirection
{
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_arm_neon_header.cxx -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)
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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_NEON_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_NEON 1'
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)
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)
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)
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)
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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_SHA_AVAILABLE 1'
echo '#define CRYPTOPP_ARM_SHA1_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_SHA 1'
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)
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)
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)
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)
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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_ARM_SM4_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_ARM_SM4 1'
fi
} >> config_asm.h.new
fi
#############################################################################
# PowerPC machines
if [[ "$disable_asm" -eq 0 && ("$IS_PPC" -ne 0 || "$IS_PPC64" -ne 0) ]];
then
# IBM XL C/C++ has the -qaltivec flag really screwed up. We can't seem
# to get it enabled without an -qarch= option. And -qarch= produces an
# error on later versions of the compiler. The only thing that seems
# to work consistently is -qarch=auto.
if [[ "${XLC_COMPILER}" -ne 0 ]]; then
POWER9_FLAG="-qarch=pwr9 -qaltivec"
POWER8_FLAG="-qarch=pwr8 -qaltivec"
POWER7_VSX_FLAG="-qarch=pwr7 -qvsx -qaltivec"
POWER7_PWR_FLAG="-qarch=pwr7 -qaltivec"
ALTIVEC_FLAG="-qarch=auto -qaltivec"
else
POWER9_FLAG="-mcpu=power9"
POWER8_FLAG="-mcpu=power8"
POWER7_VSX_FLAG="-mcpu=power7 -mvsx"
POWER7_PWR_FLAG="-mcpu=power7"
ALTIVEC_FLAG="-maltivec"
fi
# Shell redirection
{
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${ALTIVEC_FLAG} TestPrograms/test_ppc_altivec.cxx -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
have_altivec=1
echo '#define CRYPTOPP_ALTIVEC_AVAILABLE 1'
else
have_altivec=0
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)
if [[ "${CXX_RESULT}" -eq 0 && "$have_altivec" -ne 0 ]]; then
have_power7=1
echo '#define CRYPTOPP_POWER7_AVAILABLE 1'
else
have_power7=0
echo '#define CRYPTOPP_DISABLE_POWER7 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_power8.cxx -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'
else
have_power8=0
echo '#define CRYPTOPP_DISABLE_POWER8 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER9_FLAG} TestPrograms/test_ppc_power9.cxx -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'
else
have_power9=0
echo '#define CRYPTOPP_DISABLE_POWER9 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} ${POWER8_FLAG} TestPrograms/test_ppc_aes.cxx -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)
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)
if [[ "${CXX_RESULT}" -eq 0 && "$have_power8" -ne 0 ]]; then
echo '#define CRYPTOPP_POWER8_SHA_AVAILABLE 1'
else
echo '#define CRYPTOPP_DISABLE_POWER8_SHA 1'
fi
} >> config_asm.h.new
fi
# ====================================================
# =================== common footer ==================
# ====================================================
{
echo ''
echo '#endif // CRYPTOPP_CONFIG_ASM_H'
echo ''
} >> config_asm.h.new
if [[ -e config_asm.h ]]; then
cp config_asm.h config_asm.h.old
mv config_asm.h.new config_asm.h
fi
echo 'Done writing config_asm.h'
# ===========================================================================
# =============================== config_cxx.h ==============================
# ===========================================================================
rm -f config_cxx.h.new
# ====================================================
# =================== common header ==================
# ====================================================
{
echo '// config_cxx.h rewritten by configure.sh script'
echo '//' "${TIMESTAMP}"
echo '// Also see https://www.cryptopp.com/wiki/configure.sh'
echo ''
echo '#ifndef CRYPTOPP_CONFIG_CXX_H'
echo '#define CRYPTOPP_CONFIG_CXX_H'
} >> config_cxx.h.new
# Shell redirection
{
echo ''
echo '// ***************** C++98 and C++03 ********************'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx98_exception.cxx -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'
echo '#define CRYPTOPP_CXX98_UNCAUGHT_EXCEPTION 1'
else
echo '// Ancient Crypto++ define, dating back to C++98.'
echo '// #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE 1'
echo '// #define CRYPTOPP_CXX98_UNCAUGHT_EXCEPTION 1'
fi
echo ''
echo '// ***************** C++11 and above ********************'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11.cxx -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 '// #define CRYPTOPP_CXX11 1'
fi
echo ''
echo '#if defined(CRYPTOPP_CXX11)'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_atomic.cxx -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)
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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_SYNCHRONIZATION 1'
else
echo '// #define CRYPTOPP_CXX11_SYNCHRONIZATION 1'
fi
# CRYPTOPP_CXX11_DYNAMIC_INIT is old name
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_staticinit.cxx -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'
else
echo '// #define CRYPTOPP_CXX11_STATIC_INIT 1'
echo '// #define CRYPTOPP_CXX11_DYNAMIC_INIT 1'
fi
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_deletefn.cxx -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)
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)
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)
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)
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)
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)
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)
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)
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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_NULLPTR 1'
else
echo '// #define CRYPTOPP_CXX11_NULLPTR 1'
fi
# 2-argument static assert
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx11_assert.cxx -o ${TOUT} 2>&1 | wc -w)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX11_ASSERT 1'
else
echo '// #define CRYPTOPP_CXX11_ASSERT 1'
fi
echo ''
echo '#endif // CRYPTOPP_CXX11'
echo ''
echo '// ***************** C++14 and above ********************'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx14.cxx -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 '// #define CRYPTOPP_CXX14 1'
fi
echo ''
echo '#if defined(CRYPTOPP_CXX14)'
echo ''
echo '// No dead bodies here. Move on...'
echo ''
echo '#endif // CRYPTOPP_CXX14'
echo ''
echo '// ***************** C++17 and above ********************'
echo ''
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17.cxx -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 '// #define CRYPTOPP_CXX17 1'
fi
echo ''
echo '#if defined(CRYPTOPP_CXX17)'
echo ''
# 1-argument static assert
CXX_RESULT=$(${CXX} ${CXXFLAGS} TestPrograms/test_cxx17_assert.cxx -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)
if [[ "${CXX_RESULT}" -eq 0 ]]; then
echo '#define CRYPTOPP_CXX17_UNCAUGHT_EXCEPTIONS 1'
else
echo '// #define CRYPTOPP_CXX17_UNCAUGHT_EXCEPTIONS 1'
fi
echo ''
echo '#endif // CRYPTOPP_CXX17'
echo ''
echo '// ***************** C++ fixups ********************'
echo ''
echo '#if defined(CRYPTOPP_CXX11_NOEXCEPT)'
echo '# define CRYPTOPP_THROW noexcept(false)'
echo '# define CRYPTOPP_NO_THROW noexcept(true)'
echo '#else'
echo '# define CRYPTOPP_THROW'
echo '# define CRYPTOPP_NO_THROW'
echo '#endif // CRYPTOPP_CXX11_NOEXCEPT'
echo ''
echo '// C++11 nullptr_t type safety and analysis'
echo '#if defined(CRYPTOPP_CXX11_NULLPTR) && !defined(NULLPTR)'
echo '# define NULLPTR nullptr'
echo '#elif !defined(NULLPTR)'
echo '# define NULLPTR NULL'
echo '#endif // CRYPTOPP_CXX11_NULLPTR'
} >> config_cxx.h.new
# ====================================================
# =================== common footer ==================
# ====================================================
{
echo ''
echo '#endif // CRYPTOPP_CONFIG_CXX_H'
echo ''
} >> config_cxx.h.new
if [[ -e config_cxx.h ]]; then
cp config_cxx.h config_cxx.h.old
mv config_cxx.h.new config_cxx.h
fi
echo 'Done writing config_cxx.h'
rm -f "${TOUT}"
exit 0

View File

@ -0,0 +1,126 @@
#!/usr/bin/env bash
#############################################################################
#
# 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.
#
# 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.
#
# See http://www.cryptopp.com/wiki/Android.mk_(Command_Line) for more details
#
#############################################################################
# Error checking
if [ ! -d "${ANDROID_NDK_ROOT}" ]; then
echo "ERROR: ANDROID_NDK_ROOT is not a valid path for ${USER}. Please set it."
echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'"
exit 1
fi
# Error checking
if [ ! -d "${ANDROID_SDK_ROOT}" ]; then
echo "ERROR: ANDROID_SDK_ROOT is not a valid path for ${USER}. Please set it."
echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'"
exit 1
fi
# Error checking
if [ -z "$(command -v ndk-build 2>/dev/null)" ]; then
echo "ERROR: ndk-build is not on-path for ${USER}. Please set it."
echo "PATH is '${PATH}'"
exit 1
fi
# Temp directory
if [[ -z "${TMPDIR}" ]]; then
TMPDIR="$HOME/tmp"
mkdir -p "${TMPDIR}"
if [ -n "${SUDO_USER}" ]; then
chown -R "${SUDO_USER}" "${TMPDIR}"
fi
fi
# Sane default
if [[ -z "${MAKE_JOBS}" ]]; then
MAKE_JOBS=4
fi
# Fixup for sed and "illegal byte sequence"
IS_DARWIN=$(uname -s 2>/dev/null | grep -i -c darwin)
if [[ "${IS_DARWIN}" -ne 0 ]] && [[ -z "${LC_ALL}" ]]; then
export LC_ALL=C
fi
# Cleanup old artifacts
rm -rf "${TMPDIR}/build.failed" 2>/dev/null
rm -rf "${TMPDIR}/build.log" 2>/dev/null
#############################################################################
files=(Android.mk Application.mk make_neon.sh test_shared.hxx test_shared.cxx)
for file in "${files[@]}"; do
echo "Downloading $file"
if ! curl -L -s -o "${file}" "https://raw.githubusercontent.com/noloader/cryptopp-android-mk/master/${file}"; then
echo "${file} download failed"
exit 1
fi
# Permissions
chmod u=rw,go=r "${file}"
# Throttle
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
NDK_PROJECT_PATH="$PWD"
NDK_APPLICATION_MK="$PWD/Application.mk"
PLATFORMS=(armeabi-v7a arm64-v8a x86 x86_64)
# Clean all past artifacts
ndk-build APP_ABI=all NDK_PROJECT_PATH="${NDK_PROJECT_PATH}" NDK_APPLICATION_MK="${NDK_APPLICATION_MK}" distclean &>/dev/null
for platform in "${PLATFORMS[@]}"
do
echo ""
echo "===================================================================="
echo "Building for ${platform}..."
if ndk-build -j "${MAKE_JOBS}" APP_ABI="${platform}" NDK_PROJECT_PATH="${NDK_PROJECT_PATH}" NDK_APPLICATION_MK="${NDK_APPLICATION_MK}" V=1;
then
echo "${platform} ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
done
echo
echo "===================================================================="
cat "${TMPDIR}/build.log"
# let the script fail if any of the builds failed
if [ -f "${TMPDIR}/build.failed" ]; then
exit 1
fi
exit 0

View File

@ -1,75 +1,115 @@
#!/usr/bin/env bash
# ====================================================================
# Tests Android cross-compiles
#############################################################################
#
# This script tests Android cross-compiles using setenv-android.sh script.
#
# Written and placed in public domain by Jeffrey Walton.
#
# 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.
#
# See http://www.cryptopp.com/wiki/Android_(Command_Line) for more details
# ====================================================================
set +e
#
#############################################################################
if [ -z $(command -v ./setenv-android-gcc.sh) ]; then
echo "Failed to locate setenv-android-gcc.sh"
ls -Al *.sh
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
# Error checking
if [ -z "$(command -v ./setenv-android.sh 2>/dev/null)" ]; then
echo "Failed to locate setenv-android.sh."
exit 1
fi
if [ -z "${PLATFORM-}" ]; then
PLATFORMS=(armeabi armeabi-v7a armv7a-neon aarch64 mipsel mipsel64 x86 x86_64)
else
PLATFORMS=(${PLATFORM})
# Error checking
if [ ! -d "${ANDROID_NDK_ROOT}" ]; then
echo "ERROR: ANDROID_NDK_ROOT is not a valid path for ${USER}. Please set it."
echo "ANDROID_NDK_ROOT is '${ANDROID_NDK_ROOT}'"
exit 1
fi
RUNTIMES=(gnu-static gnu-shared stlport-static stlport-shared) #llvm-static llvm-shared
for platform in ${PLATFORMS[@]}
# Error checking
if [ ! -d "${ANDROID_SDK_ROOT}" ]; then
echo "ERROR: ANDROID_SDK_ROOT is not a valid path for ${USER}. Please set it."
echo "ANDROID_SDK_ROOT is '${ANDROID_SDK_ROOT}'"
exit 1
fi
# Error checking
if [ -z "$(command -v ndk-build 2>/dev/null)" ]; then
echo "ERROR: ndk-build is not on-path for ${USER}. Please set it."
echo "PATH is '${PATH}'"
exit 1
fi
# Temp directory
if [[ -z "${TMPDIR}" ]]; then
TMPDIR="$HOME/tmp"
mkdir -p "${TMPDIR}"
if [ -n "${SUDO_USER}" ]; then
chown -R "${SUDO_USER}" "${TMPDIR}"
fi
fi
# Sane default
if [[ -z "${MAKE_JOBS}" ]]; then
MAKE_JOBS=4
fi
# Cleanup old artifacts
rm -rf "${TMPDIR}/build.failed" 2>/dev/null
rm -rf "${TMPDIR}/build.log" 2>/dev/null
#############################################################################
PLATFORMS=(armv7a aarch64 x86 x86_64)
for platform in "${PLATFORMS[@]}"
do
for runtime in ${RUNTIMES[@]}
do
make -f GNUmakefile-cross distclean > /dev/null 2>&1
# setenv-android.sh reads these two variables for configuration info.
# Android 5.0 is 21. Android 6.0 is 23.
export ANDROID_API="21"
export ANDROID_CPU="${platform}"
echo
echo "===================================================================="
echo "Testing for Android support of $platform using $runtime"
make -f GNUmakefile-cross distclean > /dev/null 2>&1
# Test if we can set the environment for the platform
./setenv-android-gcc.sh "$platform" "$runtime"
echo
echo "===================================================================="
echo "Testing for Android support of ${platform}"
if [ "$?" -ne "0" ];
then
echo
echo "There were problems testing $platform with $runtime"
echo "$platform:$runtime ==> FAILURE" >> /tmp/build.log
# Test if we can set the environment for the platform
if ! ./setenv-android.sh > /dev/null 2>&1;
then
echo
echo "There were problems testing ${platform}"
echo "${platform} ==> SKIPPED" >> "${TMPDIR}/build.log"
touch /tmp/build.failed
continue
fi
continue
fi
echo
echo "Building for $platform using $runtime..."
echo
echo
echo "===================================================================="
echo "Building for ${platform}..."
# run in subshell to not keep any env vars
(
source ./setenv-android-gcc.sh "$platform" "$runtime" > /dev/null 2>&1
make -f GNUmakefile-cross static dynamic cryptest.exe
if [ "$?" -eq "0" ]; then
echo "$platform:$runtime ==> SUCCESS" >> /tmp/build.log
else
echo "$platform:$runtime ==> FAILURE" >> /tmp/build.log
touch /tmp/build.failed
fi
)
done
# run in subshell to not keep any envars
(
source ./setenv-android.sh
if make -k -j "${MAKE_JOBS}" -f GNUmakefile-cross static dynamic cryptest.exe;
then
echo "${platform} ==> SUCCESS" >> "${TMPDIR}/build.log"
else
echo "${platform} ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
)
done
cat /tmp/build.log
echo
echo "====================================================="
cat "${TMPDIR}/build.log"
# let the script fail if any of the builds failed
if [ -f /tmp/build.failed ]; then
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
if [ -f "${TMPDIR}/build.failed" ]; then
exit 1
fi
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0
exit 0

View File

@ -1,77 +1,74 @@
#!/usr/bin/env bash
PWD_DIR=$(pwd)
function cleanup {
cd "$PWD_DIR"
}
trap cleanup EXIT
#############################################################################
#
# This script tests the Autotools gear.
#
# Written and placed in public domain by Jeffrey Walton.
#
# 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.
#
# See https://www.cryptopp.com/wiki/Autotools for more details
#
#############################################################################
# Default tools
GREP=grep
SED=sed
AWK=awk
MAKE=make
# Fixup ancient Bash
# https://unix.stackexchange.com/q/468579/56041
if [[ -z "$BASH_SOURCE" ]]; then
BASH_SOURCE="$0"
fi
#############################################################################
# Fixup, Solaris and friends
if [[ (-d /usr/xpg4/bin) ]]; then
if [[ -d /usr/xpg4/bin ]]; then
SED=/usr/xpg4/bin/sed
AWK=/usr/xpg4/bin/awk
GREP=/usr/xpg4/bin/grep
elif [[ (-d /usr/bin/posix) ]]; then
elif [[ -d /usr/bin/posix ]]; then
SED=/usr/bin/posix/sed
AWK=/usr/bin/posix/awk
GREP=/usr/bin/posix/grep
fi
# Fixup for sed and "illegal byte sequence"
IS_DARWIN=$(uname -s | "$GREP" -i -c darwin)
IS_DARWIN=$(uname -s 2>/dev/null | "$GREP" -i -c darwin)
if [[ "$IS_DARWIN" -ne 0 ]]; then
export LC_ALL=C
fi
# Fixup for Solaris and BSDs
# Fixup for Solaris and BSDs
if [[ ! -z $(command -v gmake) ]]; then
if [[ -n "$(command -v gmake 2>/dev/null)" ]]; then
MAKE=gmake
else
MAKE=make
fi
# Fixup for missing libtool
if [[ ! -z $(command -v libtoolize) ]]; then
LIBTOOLIZE=$(command -v libtoolize)
elif [[ ! -z $(command -v glibtoolize) ]]; then
LIBTOOLIZE=$(command -v glibtoolize)
elif [[ ! -z $(command -v libtool) ]]; then
LIBTOOLIZE=$(command -v libtool)
elif [[ ! -z $(command -v glibtool) ]]; then
LIBTOOLIZE=$(command -v glibtool)
if [[ ! -z $(command -v glibtoolize 2>/dev/null) ]]; then
export LIBTOOLIZE=$(command -v glibtoolize)
elif [[ ! -z $(command -v libtoolize 2>/dev/null) ]]; then
export LIBTOOLIZE=$(command -v libtoolize)
elif [[ ! -z $(command -v glibtool 2>/dev/null) ]]; then
export LIBTOOLIZE=$(command -v glibtool)
elif [[ ! -z $(command -v libtool 2>/dev/null) ]]; then
export LIBTOOLIZE=$(command -v libtool)
fi
# Fecth the three required files
if ! wget --no-check-certificate 'https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/Makefile.am' -O Makefile.am; then
echo "Makefile.am download failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
# In case libtool is located in /opt, like under MacPorts or Compile Farm
if [[ -z $(command -v glibtoolize 2>/dev/null) ]]; then
export LIBTOOLIZE=$(find /opt -name libtool 2>/dev/null | head -n 1)
fi
if ! wget --no-check-certificate 'https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/configure.ac' -O configure.ac; then
echo "configure.ac download failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
#############################################################################
if [[ -z $(command -v aclocal 2>/dev/null) ]]; then
echo "Cannot find aclocal. Things may fail."
fi
if ! wget --no-check-certificate 'https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/libcryptopp.pc.in' -O libcryptopp.pc.in; then
echo "libcryptopp.pc.in download failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
fi
mkdir -p m4/
if [[ -z $(command -v autoupdate) ]]; then
if [[ -z $(command -v autoupdate 2>/dev/null) ]]; then
echo "Cannot find autoupdate. Things may fail."
fi
@ -79,77 +76,137 @@ if [[ -z "$LIBTOOLIZE" ]]; then
echo "Cannot find libtoolize. Things may fail."
fi
if [[ -z $(command -v autoreconf) ]]; then
if [[ -z $(command -v automake 2>/dev/null) ]]; then
echo "Cannot find automake. Things may fail."
fi
if [[ -z $(command -v autoreconf 2>/dev/null) ]]; then
echo "Cannot find autoreconf. Things may fail."
fi
echo "Running autoupdate"
if ! autoupdate 2>/dev/null; then
echo "autoupdate failed."
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
if [[ -z $(command -v curl 2>/dev/null) ]]; then
echo "Cannot find cURL. Things may fail."
fi
echo "Running libtoolize"
if ! "$LIBTOOLIZE" 2>/dev/null; then
echo "libtoolize failed."
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
#############################################################################
files=(configure.ac Makefile.am libcryptopp.pc.in)
for file in "${files[@]}"; do
echo "Downloading $file"
if ! curl -L -s -o "$file" "https://raw.githubusercontent.com/noloader/cryptopp-autotools/master/$file"; then
echo "$file download failed"
exit 1
fi
# Throttle
sleep 1
done
mkdir -p m4/
#############################################################################
echo "Running aclocal"
if ! aclocal &>/dev/null; then
echo "aclocal failed."
exit 1
fi
echo "Running autoupdate"
if ! autoupdate &>/dev/null; then
echo "autoupdate failed."
exit 1
fi
# Run autoreconf twice on failure. Also see
# https://github.com/tracebox/tracebox/issues/57
echo "Running autoreconf"
if ! autoreconf 2>/dev/null; then
if ! autoreconf --force --install &>/dev/null; then
echo "autoreconf failed, running again."
if ! autoreconf -fi; then
if ! autoreconf --force --install; then
echo "autoreconf failed, again."
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
fi
# Sparc need +w
if [[ -e config.sub ]]; then
chmod +w config.sub
fi
if [[ -e config.guess ]]; then
chmod +w config.guess
fi
#############################################################################
# Update config.sub config.guess. GNU recommends using the latest for all projects.
echo "Updating config.sub"
wget --no-check-certificate 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub' -O config.sub
curl -L -s -o config.sub.new 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub'
if [[ -e config.sub ]]; then
chmod +x config.sub
# Solaris removes +w, can't overwrite
chmod +w build-aux/config.sub
mv config.sub.new build-aux/config.sub
chmod +x build-aux/config.sub
if [[ "$IS_DARWIN" -ne 0 ]] && [[ -n $(command -v xattr 2>/dev/null) ]]; then
echo "Removing config.sub quarantine"
xattr -d "com.apple.quarantine" build-aux/config.sub &>/dev/null
fi
echo "Updating config.guess"
wget --no-check-certificate 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess' -O config.guess
curl -L -s -o config.guess.new 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess'
if [[ -e config.guess ]]; then
chmod +x config.guess
# Solaris removes +w, can't overwrite
chmod +w build-aux/config.guess
mv config.guess.new build-aux/config.guess
chmod +x build-aux/config.guess
if [[ "$IS_DARWIN" -ne 0 ]] && [[ -n $(command -v xattr 2>/dev/null) ]]; then
echo "Removing config.guess quarantine"
xattr -d "com.apple.quarantine" build-aux/config.guess &>/dev/null
fi
#############################################################################
echo "Running configure"
echo ""
if ! ./configure; then
echo "configure failed."
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
"$MAKE" clean 2>/dev/null
#############################################################################
echo ""
echo "Building test artifacts"
echo ""
"$MAKE" clean &>/dev/null
if ! "$MAKE" -j2 -f Makefile; then
echo "make failed."
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
#############################################################################
echo ""
echo "Testing library"
echo ""
if ! ./cryptest v; then
echo "cryptest v failed."
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
if ! ./cryptest tv all; then
echo "cryptest tv all failed."
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
#############################################################################
echo ""
echo "Building tarball"
echo ""
if ! make dist; then
echo "make dist failed."
exit 1
fi
# Return success
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0
exit 0

View File

@ -1,10 +1,18 @@
#!/usr/bin/env bash
PWD_DIR=$(pwd)
function cleanup {
cd "$PWD_DIR"
}
trap cleanup EXIT
#############################################################################
#
# This script tests the CMake gear.
#
# Written and placed in public domain by Jeffrey Walton.
#
# 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.
#
# See https://www.cryptopp.com/wiki/CMake for more details
#
#############################################################################
# Fixup ancient Bash
# https://unix.stackexchange.com/q/468579/56041
@ -24,50 +32,69 @@ if [[ -z "$CMAKE" ]]; then
CMAKE=cmake
fi
# Feth the three required files
if ! wget --no-check-certificate https://raw.githubusercontent.com/noloader/cryptopp-cmake/master/CMakeLists.txt -O CMakeLists.txt; then
echo "CMakeLists.txt download failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
#############################################################################
if [[ -z $(command -v "$CMAKE") ]]; then
echo "Cannot find $CMAKE. Things may fail."
fi
if ! wget --no-check-certificate https://github.com/noloader/cryptopp-cmake/blob/master/cryptopp-config.cmake -O cryptopp-config.cmake; then
echo "cryptopp-config.cmake download failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
if [[ -z $(command -v curl) ]]; then
echo "Cannot find cURL. Things may fail."
fi
rm -rf "$PWD_DIR/cmake_build"
mkdir -p "$PWD_DIR/cmake_build"
cd "$PWD_DIR/cmake_build"
#############################################################################
if [[ ! -z "$CXX" ]];
files=(CMakeLists.txt cryptopp-config.cmake)
for file in "${files[@]}"; do
echo "Downloading $file"
if ! curl -L -s -o "$file" "https://raw.githubusercontent.com/noloader/cryptopp-cmake/master/$file"; then
echo "$file download failed"
exit 1
fi
# Throttle
sleep 1
done
rm -rf "$(pwd)/cmake_build"
mkdir -p "$(pwd)/cmake_build"
cd "$(pwd)/cmake_build" || exit 1
#############################################################################
echo ""
echo "Building test artifacts"
echo ""
if [[ -n "$CXX" ]];
then
if ! CXX="$CXX" "$CMAKE" -DCMAKE_CXX_COMPILER="$CXX" ../; then
echo "cmake failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
else
if ! "$CMAKE" ../; then
echo "cmake failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
fi
"$MAKE" clean 2>/dev/null
"$MAKE" clean &>/dev/null
if ! "$MAKE" -j2 -f Makefile VERBOSE=1; then
echo "make failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
if ! ./cryptest.exe v; then
echo "cryptest.exe v failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
if ! ./cryptest.exe tv all; then
echo "cryptest.exe v failed"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
exit 1
fi
# Return success
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0
exit 0

View File

@ -1,70 +1,105 @@
#!/usr/bin/env bash
# ====================================================================
# Tests iOS cross-compiles
#############################################################################
#
# This script tests the cryptopp-ios gear.
#
# Written and placed in public domain by Jeffrey Walton.
#
# 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.
#
# See http://www.cryptopp.com/wiki/iOS_(Command_Line) for more details
# ====================================================================
#############################################################################
if [ -z $(command -v ./setenv-ios.sh) ]; then
echo "Failed to locate setenv-ios.sh"
ls -Al *.sh
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
if [ -z "$(command -v ./setenv-ios.sh)" ]; then
echo "Failed to locate setenv-ios.sh"
exit 1
fi
if [ -z "${PLATFORM-}" ]; then
PLATFORMS=(iPhoneOS iPhoneSimulator Arm64 WatchOS WatchSimulator AppleTVOS AppleTVSimulator)
else
PLATFORMS=(${PLATFORM})
# Temp directory
if [[ -z "${TMPDIR}" ]]; then
TMPDIR="$HOME/tmp"
mkdir "${TMPDIR}"
fi
for platform in ${PLATFORMS[@]}
# Sane default
if [[ -z "${MAKE_JOBS}" ]]; then
MAKE_JOBS=4
fi
# Cleanup old artifacts
rm -rf "${TMPDIR}/build.failed" 2>/dev/null
rm -rf "${TMPDIR}/build.log" 2>/dev/null
#############################################################################
# Hack a Bash data structure...
PLATFORMS=()
PLATFORMS+=("iPhoneOS:armv7")
PLATFORMS+=("iPhoneOS:arm64")
PLATFORMS+=("AppleTVOS:armv7")
PLATFORMS+=("AppleTVOS:arm64")
PLATFORMS+=("WatchOS:armv7")
PLATFORMS+=("WatchOS:arm64")
PLATFORMS+=("iPhoneSimulator:i386")
PLATFORMS+=("iPhoneSimulator:x86_64")
PLATFORMS+=("AppleTVSimulator:i386")
PLATFORMS+=("AppleTVSimulator:x86_64")
PLATFORMS+=("WatchSimulator:i386")
PLATFORMS+=("WatchSimulator:x86_64")
for platform in "${PLATFORMS[@]}"
do
make -f GNUmakefile-cross distclean > /dev/null 2>&1
echo
echo "====================================================="
echo "Testing for iOS support of $platform"
sdk=$(echo "${platform[@]}" | awk -F':' '{print $1}')
cpu=$(echo "${platform[@]}" | awk -F':' '{print $2}')
# Test if we can set the environment for the platform
./setenv-ios.sh "$platform"
# setenv-ios.sh reads these two variables for configuration info.
export IOS_SDK="$sdk"
export IOS_CPU="$cpu"
if [ "$?" -ne "0" ];
then
echo
echo "$platform not supported by Xcode"
echo "$platform ==> FAILURE" >> /tmp/build.log
make -f GNUmakefile-cross distclean > /dev/null 2>&1
touch /tmp/build.failed
continue
fi
echo
echo "====================================================="
echo "Testing for iOS support of ${platform}"
echo
echo "Building for $platform using $runtime..."
echo
# Test if we can set the environment for the platform
if ! ./setenv-ios.sh > /dev/null 2>&1;
then
echo
echo "${platform} not supported by Xcode"
echo "${platform} ==> SKIPPED" >> "${TMPDIR}/build.log"
# run in subshell to not keep any env vars
(
source ./setenv-ios.sh "$platform" > /dev/null 2>&1
make -f GNUmakefile-cross static dynamic cryptest.exe
if [ "$?" -eq "0" ]; then
echo "$platform ==> SUCCESS" >> /tmp/build.log
else
echo "$platform ==> FAILURE" >> /tmp/build.log
touch /tmp/build.failed
fi
)
continue
fi
echo
echo "====================================================="
echo "Building for ${platform}..."
# 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"
else
echo "${platform} ==> FAILURE" >> "${TMPDIR}/build.log"
touch "${TMPDIR}/build.failed"
fi
)
done
cat /tmp/build.log
echo
echo "====================================================="
cat "${TMPDIR}/build.log"
# let the script fail if any of the builds failed
if [ -f /tmp/build.failed ]; then
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
if [ -f "${TMPDIR}/build.failed" ]; then
exit 1
fi
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0
exit 0

View File

@ -0,0 +1,111 @@
#!/usr/bin/env bash
#############################################################################
#
# This script tests the cryptopp-pem gear.
#
# Written and placed in public domain by Jeffrey Walton.
#
# 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.
#
#############################################################################
GREP=grep
SED=sed
AWK=awk
MAKE=make
# Fixup, Solaris and friends
if [[ (-d /usr/xpg4/bin) ]]; then
SED=/usr/xpg4/bin/sed
AWK=/usr/xpg4/bin/awk
GREP=/usr/xpg4/bin/grep
elif [[ (-d /usr/bin/posix) ]]; then
SED=/usr/bin/posix/sed
AWK=/usr/bin/posix/awk
GREP=/usr/bin/posix/grep
fi
# Fixup for sed and "illegal byte sequence"
IS_DARWIN=$(uname -s | "$GREP" -i -c darwin)
if [[ "$IS_DARWIN" -ne 0 ]]; then
export LC_ALL=C
fi
# Fixup for Solaris and BSDs
if [[ ! -z $(command -v gmake) ]]; then
MAKE=gmake
else
MAKE=make
fi
#############################################################################
if [[ -z $(command -v "$MAKE") ]]; then
echo "Cannot find $MAKE. Things may fail."
fi
if [[ -z $(command -v curl) ]]; then
echo "Cannot find cURL. Things may fail."
fi
if [[ -z $(command -v openssl) ]]; then
echo "Cannot find openssl. Things may fail."
fi
#############################################################################
files=(pem_create.sh pem_verify.sh pem_test.cxx pem_eol.cxx
pem.h pem_common.cpp pem_common.h pem_read.cpp pem_write.cpp
x509cert.h x509cert.cpp)
for file in "${files[@]}"; do
echo "Downloading $file"
if ! curl -L -s -o "$file" "https://raw.githubusercontent.com/noloader/cryptopp-pem/master/$file"; then
echo "$file download failed"
exit 1
fi
# Throttle
sleep 1
done
# Add execute to scripts
chmod +x *.sh
if [[ "$IS_DARWIN" -ne 0 ]] && [[ -n $(command -v xattr) ]]; then
echo "Removing pem_create.sh pem_verify.sh quarantine"
xattr -d "com.apple.quarantine" pem_create.sh pem_verify.sh &>/dev/null
fi
#############################################################################
echo ""
echo "Building test artifacts"
echo ""
"$MAKE" clean &>/dev/null
if ! "$MAKE" -j 2; then
echo "make failed."
exit 1
fi
if ! ./cryptest.exe v; then
echo "cryptest v failed."
exit 1
fi
if ! ./pem_create.sh; then
echo "pem_create.sh failed."
exit 1
fi
if ! ./pem_verify.sh; then
echo "pem_verify.sh failed."
exit 1
fi
# Return success
exit 0

View File

@ -1,60 +1,53 @@
#!/usr/bin/env bash
# cryptest.sh - written and placed in public domain by Jeffrey Walton and Uri
# Blumenthal.
#############################################################################
#
# This is a test script that can be used on some Linux/Unix/Apple machines to
# automate testing of the shared object to ensure linking and symbols don't go
# missing from release to release.
#
# 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
# in the compilation are all public domain.
#
# See http://www.cryptopp.com/wiki/Android.mk_(Command_Line) for more details
#
#############################################################################
# Fixup ancient Bash
# https://unix.stackexchange.com/q/468579/56041
if [[ -z "$BASH_SOURCE" ]]; then
BASH_SOURCE="$0"
fi
############################################
# Cleanup
PWD_DIR=$(pwd)
function cleanup {
rm -f adhoc.cpp *.a *.o *.so *.dylib GNUmakefile-symbols
cd "$PWD_DIR"
}
trap cleanup EXIT
############################################
#############################################################################
# Tags to test
OLD_VERSION_TAG=CRYPTOPP_8_1_0
OLD_VERSION_TAG=CRYPTOPP_8_3_0
NEW_VERSION_TAG=master
############################################
#############################################################################
# If local repo is dirty, then promt first
DIRTY=$(git diff --shortstat 2> /dev/null | tail -1)
if [[ ! (-z "$DIRTY") ]]; then
if [[ ! -z "$DIRTY" ]]; then
echo
echo "The local repo is dirty. Continuing will reset the repo and lose changes."
read -p "Type 'Y' to proceed or 'N' to exit. Proceed? " -n 1 -r
echo # (optional) move to a new line
if [[ !($REPLY =~ ^[Yy]$) ]]; then
[[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0
exit 0
fi
else
echo
echo "The local repo is clean. Proceeding..."
fi
############################################
#############################################################################
echo
echo "****************************************************************"
echo "Testing '$NEW_VERSION_TAG' against '$OLD_VERSION_TAG'"
echo "****************************************************************"
############################################
#############################################################################
# Setup tools and platforms
GREP=grep
@ -64,118 +57,55 @@ AWK=awk
CXXFILT=c++filt
THIS_SYSTEM=$(uname -s 2>&1)
IS_DARWIN=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c darwin)
IS_LINUX=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c linux)
IS_CYGWIN=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c cygwin)
IS_MINGW=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c mingw)
IS_OPENBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c openbsd)
IS_FREEBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c freebsd)
IS_NETBSD=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c netbsd)
IS_SOLARIS=$(echo -n "$THIS_SYSTEM" | "$GREP" -i -c sunos)
IS_DARWIN=$("${GREP}" -i -c darwin <<< "${THIS_SYSTEM}")
IS_LINUX=$("${GREP}" -i -c linux <<< "${THIS_SYSTEM}")
IS_CYGWIN=$("${GREP}" -i -c cygwin <<< "${THIS_SYSTEM}")
IS_MINGW=$("${GREP}" -i -c mingw <<< "${THIS_SYSTEM}")
IS_OPENBSD=$("${GREP}" -i -c openbsd <<< "${THIS_SYSTEM}")
IS_FREEBSD=$("${GREP}" -i -c freebsd <<< "${THIS_SYSTEM}")
IS_NETBSD=$("${GREP}" -i -c netbsd <<< "${THIS_SYSTEM}")
IS_SOLARIS=$("${GREP}" -i -c sunos <<< "${THIS_SYSTEM}")
THIS_MACHINE=$(uname -m 2>&1)
IS_X86=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "(i386|i486|i586|i686)")
IS_X64=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "(amd64|x86_64)")
IS_PPC=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "(Power|PPC)")
IS_ARM32=$(echo -n "$THIS_MACHINE" | "$GREP" -v "64" | "$EGREP" -i -c "(arm|aarch32)")
IS_ARM64=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "(arm64|aarch64)")
IS_S390=$(echo -n "$THIS_MACHINE" | "$EGREP" -i -c "s390")
IS_X32=0
IS_X86=$("${EGREP}" -i -c 'i386|i486|i586|i686' <<< "${THIS_MACHINE}")
IS_X64=$("${EGREP}" -i -c "amd64|x86_64" <<< "${THIS_MACHINE}")
IS_PPC32=$("${EGREP}" -i -c "PowerPC|PPC" <<< "${THIS_MACHINE}")
IS_PPC64=$("${EGREP}" -i -c "PowerPC64|PPC64" <<< "${THIS_MACHINE}")
IS_ARM32=$("${EGREP}" -i -c "arm|aarch32" <<< "${THIS_MACHINE}")
IS_ARMV8=$("${EGREP}" -i -c "arm64|aarch64" <<< "${THIS_MACHINE}")
IS_S390=$("${EGREP}" -i -c "s390" <<< "${THIS_MACHINE}")
if [[ "${IS_X64}" -eq 1 ]]; then IS_X86=0; fi
if [[ "${IS_ARMV8}" -eq 1 ]]; then IS_ARM32=0; fi
if [[ "${IS_PPC64}" -eq 1 ]]; then IS_PPC32=0; fi
# Fixup
if [[ "$IS_SOLARIS" -ne "0" ]]; then
IS_X64=$(isainfo 2>/dev/null | "$GREP" -i -c "amd64")
if [[ "$IS_X64" -ne "0" ]]; then
IS_X86=0
fi
# Need something more powerful than the Posix versions
if [[ (-e "/usr/gnu/bin/grep") ]]; then
GREP=/usr/gnu/bin/grep
fi
if [[ (-e "/usr/gnu/bin/egrep") ]]; then
EGREP=/usr/gnu/bin/egrep
fi
if [[ (-e "/usr/gnu/bin/sed") ]]; then
SED=/usr/gnu/bin/sed
fi
if [[ (-e "/usr/gnu/bin/c++filt") ]]; then
CXXFILT=/usr/gnu/bin/c++filt
fi
if [[ (-e "/usr/gnu/bin/awk") ]]; then
AWK=/usr/gnu/bin/awk
else
AWK=nawk;
fi
fi
if [[ "$IS_DARWIN" -ne "0" ]]; then
SED_OPTS=(-i '')
else
SED_OPTS=(-i)
fi
# Fixup
if [[ ("$IS_FREEBSD" -ne "0" || "$IS_OPENBSD" -ne "0" || "$IS_NETBSD" -ne "0") ]]; then
if [[ "$IS_FREEBSD" -ne "0" || "$IS_OPENBSD" -ne "0" || "$IS_NETBSD" -ne "0" ]]; then
MAKE=gmake
elif [[ ("$IS_SOLARIS" -ne "0") ]]; then
MAKE=$(which gmake 2>/dev/null | "$GREP" -v "no gmake" | head -1)
if [[ (-z "$MAKE") && (-e "/usr/sfw/bin/gmake") ]]; then
elif [[ "$IS_SOLARIS" -ne "0" ]]; then
MAKE=$(command -v gmake 2>/dev/null | "${GREP}" -v "no gmake" | head -1)
if [[ -z "$MAKE" && -e "/usr/sfw/bin/gmake" ]]; then
MAKE=/usr/sfw/bin/gmake
fi
else
MAKE=make
fi
# We need to use the C++ compiler to determine feature availablility. Otherwise
# mis-detections occur on a number of platforms.
if [[ ((-z "$CXX") || ("$CXX" == "gcc")) ]]; then
if [[ ("$CXX" == "gcc") ]]; then
CXX=g++
elif [[ "$IS_DARWIN" -ne "0" ]]; then
CXX=c++
elif [[ "$IS_SOLARIS" -ne "0" ]]; then
if [[ (-e "/opt/developerstudio12.5/bin/CC") ]]; then
CXX=/opt/developerstudio12.5/bin/CC
elif [[ (-e "/opt/solarisstudio12.4/bin/CC") ]]; then
CXX=/opt/solarisstudio12.4/bin/CC
elif [[ (-e "/opt/solarisstudio12.3/bin/CC") ]]; then
CXX=/opt/solarisstudio12.3/bin/CC
elif [[ (-e "/opt/solstudio12.2/bin/CC") ]]; then
CXX=/opt/solstudio12.2/bin/CC
elif [[ (-e "/opt/solstudio12.1/bin/CC") ]]; then
CXX=/opt/solstudio12.1/bin/CC
elif [[ (-e "/opt/solstudio12.0/bin/CC") ]]; then
CXX=/opt/solstudio12.0/bin/CC
elif [[ (! -z $(which CC 2>/dev/null | "$GREP" -v "no CC" | head -1)) ]]; then
CXX=$(which CC | head -1)
elif [[ (! -z $(which g++ 2>/dev/null | "$GREP" -v "no g++" | head -1)) ]]; then
CXX=$(which g++ | head -1)
else
CXX=CC
fi
elif [[ ($(which g++ 2>&1 | "$GREP" -v "no g++" | "$GREP" -i -c g++) -ne "0") ]]; then
CXX=g++
else
CXX=c++
fi
if [[ "$IS_DARWIN" -ne "0" ]]; then
LINK_LIBRARY=libcryptopp.dylib
else
LINK_LIBRARY=libcryptopp.so
fi
SUN_COMPILER=$("$CXX" -V 2>&1 | "$EGREP" -i -c "CC: (Sun|Studio)")
GCC_COMPILER=$("$CXX" --version 2>&1 | "$GREP" -i -v "clang" | "$EGREP" -i -c "(gcc|g\+\+)")
INTEL_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "\(icc\)")
MACPORTS_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "MacPorts")
CLANG_COMPILER=$("$CXX" --version 2>&1 | "$EGREP" -i -c "clang")
if [[ -z "${CXX}" ]]; then CXX=c++; fi
if [[ ("$SUN_COMPILER" -eq "0") ]]; then
AMD64=$("$CXX" -dM -E - </dev/null 2>/dev/null | "$EGREP" -c "(__x64_64__|__amd64__)")
ILP32=$("$CXX" -dM -E - </dev/null 2>/dev/null | "$EGREP" -c "(__ILP32__|__ILP32)")
if [[ ("$AMD64" -ne "0") && ("$ILP32" -ne "0") ]]; then
IS_X32=1
fi
fi
SUN_COMPILER=$("${CXX}" -V 2>&1 | "${EGREP}" -i -c "CC: (Sun|Studio)")
GCC_COMPILER=$("${CXX}" --version 2>&1 | "${EGREP}" -i -c "^(gcc|g\+\+)")
INTEL_COMPILER=$("${CXX}" --version 2>&1 | "${GREP}" -i -c "icc")
MACPORTS_COMPILER=$("${CXX}" --version 2>&1 | "${GREP}" -i -c "MacPorts")
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
@ -183,25 +113,25 @@ fi
CPU_COUNT=1
MEM_SIZE=512
if [[ (-e "/proc/cpuinfo") && (-e "/proc/meminfo") ]]; then
CPU_COUNT=$(cat /proc/cpuinfo | "$GREP" -c '^processor')
MEM_SIZE=$(cat /proc/meminfo | "$GREP" "MemTotal" | "$AWK" '{print $2}')
if [[ -e "/proc/cpuinfo" && -e "/proc/meminfo" ]]; then
CPU_COUNT=$(cat /proc/cpuinfo | "${GREP}" -c '^processor')
MEM_SIZE=$(cat /proc/meminfo | "${GREP}" "MemTotal" | "${AWK}" '{print $2}')
MEM_SIZE=$(($MEM_SIZE/1024))
elif [[ "$IS_DARWIN" -ne "0" ]]; then
CPU_COUNT=$(sysctl -a 2>&1 | "$GREP" 'hw.availcpu' | "$AWK" '{print $3; exit}')
MEM_SIZE=$(sysctl -a 2>&1 | "$GREP" 'hw.memsize' | "$AWK" '{print $3; exit;}')
CPU_COUNT=$(sysctl -a 2>&1 | "${GREP}" 'hw.availcpu' | "${AWK}" '{print $3; exit}')
MEM_SIZE=$(sysctl -a 2>&1 | "${GREP}" 'hw.memsize' | "${AWK}" '{print $3; exit;}')
MEM_SIZE=$(($MEM_SIZE/1024/1024))
elif [[ "$IS_SOLARIS" -ne "0" ]]; then
CPU_COUNT=$(psrinfo 2>/dev/null | wc -l | "$AWK" '{print $1}')
MEM_SIZE=$(prtconf 2>/dev/null | "$GREP" Memory | "$AWK" '{print $3}')
CPU_COUNT=$(psrinfo 2>/dev/null | wc -l | "${AWK}" '{print $1}')
MEM_SIZE=$(prtconf 2>/dev/null | "${GREP}" Memory | "${AWK}" '{print $3}')
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'.
HAVE_SWAP=1
if [[ "$IS_LINUX" -ne "0" ]]; then
if [[ (-e "/proc/meminfo") ]]; then
SWAP_SIZE=$(cat /proc/meminfo | "$GREP" "SwapTotal" | "$AWK" '{print $2}')
if [[ -e "/proc/meminfo" ]]; then
SWAP_SIZE=$(cat /proc/meminfo | "${GREP}" "SwapTotal" | "${AWK}" '{print $2}')
if [[ "$SWAP_SIZE" -eq "0" ]]; then
HAVE_SWAP=0
fi
@ -210,41 +140,20 @@ if [[ "$IS_LINUX" -ne "0" ]]; then
fi
fi
if [[ ("$CPU_COUNT" -ge "2" && "$MEM_SIZE" -ge "1280" && "$HAVE_SWAP" -ne "0") ]]; then
if [[ ("$WANT_NICE" -eq "1") ]]; then
CPU_COUNT=$(echo -n "$CPU_COUNT 2" | "$AWK" '{print int($1/$2)}')
fi
if [[ "$CPU_COUNT" -ge "2" && "$MEM_SIZE" -ge "1280" && "$HAVE_SWAP" -ne "0" ]]; then
MAKEARGS=(-j "$CPU_COUNT")
fi
###############################################################################
###############################################################################
"$MAKE" distclean &>/dev/null
rm -f GNUmakefile-symbols
#############################################################################
#############################################################################
"${MAKE}" distclean &>/dev/null && cleanup &>/dev/null
git checkout master -f &>/dev/null
cp GNUmakefile GNUmakefile-symbols
git checkout "$OLD_VERSION_TAG" -f &>/dev/null
if [[ "$?" -ne "0" ]]; then
echo "Failed to checkout $OLD_VERSION_TAG"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
fi
echo
echo "****************************************************************"
echo "Patching makefile for dynamic linking by cryptest.exe"
echo "****************************************************************"
if [[ "$IS_DARWIN" -ne "0" ]]; then
"$SED" "$SED_OPTS" -e 's|libcryptopp.a $(TESTOBJS)|libcryptopp.dylib $(TESTOBJS)|g' GNUmakefile-symbols
"$SED" "$SED_OPTS" -e 's|$(TESTOBJS) ./libcryptopp.a |$(TESTOBJS) ./libcryptopp.dylib |g' GNUmakefile-symbols
else
"$SED" "$SED_OPTS" -e 's|libcryptopp.a $(TESTOBJS)|libcryptopp.so $(TESTOBJS)|g' GNUmakefile-symbols
"$SED" "$SED_OPTS" -e 's|$(TESTOBJS) ./libcryptopp.a |$(TESTOBJS) ./libcryptopp.so |g' GNUmakefile-symbols
exit 1
fi
echo
@ -253,30 +162,11 @@ echo "Building dynamic library for $OLD_VERSION_TAG"
echo "****************************************************************"
echo
"$MAKE" "${MAKEARGS[@]}" -f GNUmakefile-symbols dynamic
LINK_LIBRARY="$LINK_LIBRARY" "$MAKE" "${MAKEARGS[@]}" -f GNUmakefile cryptest.exe dynamic
if [[ "$IS_DARWIN" -ne "0" ]]; then
LIBNAME=libcryptopp.dylib
else
LIBNAME=libcryptopp.so
fi
if [[ ! -f "$LIBNAME" ]]; then
if [[ ! -f "$LINK_LIBRARY" ]]; then
echo "Failed to make $OLD_VERSION_TAG library"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
fi
echo
echo "****************************************************************"
echo "Building cryptest.exe for $OLD_VERSION_TAG"
echo "****************************************************************"
echo
"$MAKE" "${MAKEARGS[@]}" -f GNUmakefile-symbols cryptest.exe
if [[ ! -f "cryptest.exe" ]]; then
echo "Failed to make cryptest.exe"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
exit 1
fi
echo
@ -286,26 +176,15 @@ echo "****************************************************************"
echo
if [[ "$IS_DARWIN" -ne "0" ]]; then
DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" "$PWD/cryptest.exe" v 2>&1 | "$CXXFILT"
DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" "$PWD/cryptest.exe" tv all 2>&1 | "$CXXFILT"
DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" ./cryptest.exe v 2>&1 | "$CXXFILT"
DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" ./cryptest.exe tv all 2>&1 | "$CXXFILT"
else
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" "$PWD/cryptest.exe" v 2>&1 | "$CXXFILT"
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" "$PWD/cryptest.exe" tv all 2>&1 | "$CXXFILT"
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" ./cryptest.exe v 2>&1 | "$CXXFILT"
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" ./cryptest.exe tv all 2>&1 | "$CXXFILT"
fi
echo
echo "****************************************************************"
echo "Removing dynamic library and artifacts for $OLD_VERSION_TAG"
echo "****************************************************************"
rm -f adhoc.cpp *.a *.o *.so *.dylib
git checkout "$NEW_VERSION_TAG" -f &>/dev/null
if [[ "$?" -ne "0" ]]; then
echo "Failed to checkout $OLD_VERSION_TAG"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
fi
# Stash away old cryptest.exe
cp cryptest.exe cryptest.exe.saved
echo
echo "****************************************************************"
@ -313,13 +192,20 @@ echo "Building dynamic library for $NEW_VERSION_TAG"
echo "****************************************************************"
echo
"$MAKE" "${MAKEARGS[@]}" -f GNUmakefile-symbols dynamic
"${MAKE}" distclean &>/dev/null && cleanup &>/dev/null
git checkout master -f &>/dev/null
git checkout "$NEW_VERSION_TAG" -f &>/dev/null
if [[ ! -f "$LIBNAME" ]]; then
LINK_LIBRARY="$LINK_LIBRARY" "$MAKE" "${MAKEARGS[@]}" -f GNUmakefile cryptest.exe dynamic
if [[ ! -f "$LINK_LIBRARY" ]]; then
echo "Failed to make $NEW_VERSION_TAG library"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
exit 1
fi
# Fetch old cryptest.exe
cp cryptest.exe.saved cryptest.exe
echo
echo "****************************************************************"
echo "Running $OLD_VERSION_TAG cryptest.exe using $NEW_VERSION_TAG library"
@ -327,18 +213,14 @@ echo "****************************************************************"
echo
if [[ "$IS_DARWIN" -ne "0" ]]; then
DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" "$PWD/cryptest.exe" v 2>&1 | "$CXXFILT"
DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" "$PWD/cryptest.exe" tv all 2>&1 | "$CXXFILT"
DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" ./cryptest.exe v 2>&1 | "$CXXFILT"
DYLD_LIBRARY_PATH="$PWD:$DYLD_LIBRARY_PATH" ./cryptest.exe tv all 2>&1 | "$CXXFILT"
else
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" "$PWD/cryptest.exe" v 2>&1 | "$CXXFILT"
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" "$PWD/cryptest.exe" tv all 2>&1 | "$CXXFILT"
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" ./cryptest.exe v 2>&1 | "$CXXFILT"
LD_LIBRARY_PATH="$PWD:$LD_LIBRARY_PATH" ./cryptest.exe tv all 2>&1 | "$CXXFILT"
fi
"${MAKE}" distclean &>/dev/null && cleanup &>/dev/null
git checkout master -f &>/dev/null
if [[ "$?" -ne "0" ]]; then
echo "Failed to checkout Master"
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
fi
[[ "$0" = "$BASH_SOURCE" ]] && exit 0 || return 0
exit 0

View File

@ -1,5 +1,17 @@
#!/usr/bin/env bash
#############################################################################
#
# This script invokes clang-tidy on source files.
#
# Written and placed in public domain by Jeffrey Walton.
#
# 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.
#
#############################################################################
for file in $(find . -maxdepth 1 -type f -name '*.cpp'); do
echo "Tidying $file"
clang-tidy $file -checks=-clang-analyzer-optin.cplusplus.VirtualCall -- -std=c++03

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