diff --git a/.circleci/config.yml b/.circleci/config.yml index b9e70445..a06f7149 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -45,6 +45,8 @@ references: deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main + deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-8 main + deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-8 main EOF sudo chmod o-w /etc/apt/sources.list.d/clang.list @@ -57,8 +59,8 @@ references: # They aren't set automatically unfortunately sudo ln -s /usr/bin/$CC /usr/bin/clang sudo ln -s /usr/bin/$CXX /usr/bin/clang++ - sudo ln -s /usr/bin/clang-tidy-7 /usr/bin/clang-tidy - sudo ln -s /usr/bin/run-clang-tidy-7.py /usr/bin/run-clang-tidy.py + sudo ln -s /usr/bin/clang-tidy-8 /usr/bin/clang-tidy + sudo ln -s /usr/bin/run-clang-tidy-8.py /usr/bin/run-clang-tidy.py # Need a c++14 compliant STL for clang sudo apt-get install -y g++-5 @@ -299,6 +301,30 @@ jobs: GTEST_ARGS: "" CMAKE_FLAGS: "" RUN_TESTS: true + gcc_9_debug: + <<: *job_definition + environment: + CC: gcc-9 + CXX: g++-9 + BUILD_TOOLSET: gcc + APT_COMPILER_PACKAGE: "g++-9" + CXXFLAGS: "" + BUILD_TYPE: "Debug" + GTEST_ARGS: "" + CMAKE_FLAGS: "" + RUN_TESTS: true + gcc_9_release: + <<: *job_definition + environment: + CC: gcc-9 + CXX: g++-9 + BUILD_TOOLSET: gcc + APT_COMPILER_PACKAGE: "g++-9" + CXXFLAGS: "" + BUILD_TYPE: "Release" + GTEST_ARGS: "" + CMAKE_FLAGS: "" + RUN_TESTS: true clang_4_debug: <<: *job_definition environment: @@ -395,13 +421,37 @@ jobs: GTEST_ARGS: "" CMAKE_FLAGS: "" RUN_TESTS: true + clang_8_debug: + <<: *job_definition + environment: + CC: clang-8 + CXX: clang++-8 + BUILD_TOOLSET: clang + APT_COMPILER_PACKAGE: clang-8 + CXXFLAGS: "" + BUILD_TYPE: "Debug" + GTEST_ARGS: "" + CMAKE_FLAGS: "" + RUN_TESTS: true + clang_8_release: + <<: *job_definition + environment: + CC: clang-8 + CXX: clang++-8 + BUILD_TOOLSET: clang + APT_COMPILER_PACKAGE: clang-8 + CXXFLAGS: "" + BUILD_TYPE: "Release" + GTEST_ARGS: "" + CMAKE_FLAGS: "" + RUN_TESTS: true clang_werror: <<: *job_definition environment: - CC: clang-7 - CXX: clang++-7 + CC: clang-8 + CXX: clang++-8 BUILD_TOOLSET: clang - APT_COMPILER_PACKAGE: clang-7 + APT_COMPILER_PACKAGE: clang-8 CXXFLAGS: "" BUILD_TYPE: "Release" GTEST_ARGS: "" @@ -410,10 +460,10 @@ jobs: gcc_werror: <<: *job_definition environment: - CC: gcc-8 - CXX: g++-8 + CC: gcc-9 + CXX: g++-9 BUILD_TOOLSET: gcc - APT_COMPILER_PACKAGE: "g++-8" + APT_COMPILER_PACKAGE: "g++-9" CXXFLAGS: "" BUILD_TYPE: "Release" GTEST_ARGS: "" @@ -422,10 +472,10 @@ jobs: no_compatibility: <<: *job_definition environment: - CC: clang-7 - CXX: clang++-7 + CC: clang-8 + CXX: clang++-8 BUILD_TOOLSET: clang - APT_COMPILER_PACKAGE: clang-7 + APT_COMPILER_PACKAGE: clang-8 CXXFLAGS: "-DCRYFS_NO_COMPATIBILITY" BUILD_TYPE: "Debug" GTEST_ARGS: "" @@ -434,10 +484,10 @@ jobs: address_sanitizer: <<: *job_definition environment: - CC: clang-7 - CXX: clang++-7 + CC: clang-8 + CXX: clang++-8 BUILD_TOOLSET: clang - APT_COMPILER_PACKAGE: clang-7 + APT_COMPILER_PACKAGE: clang-8 CXXFLAGS: "-O2 -fsanitize=address -fno-omit-frame-pointer -fno-common -fsanitize-address-use-after-scope" BUILD_TYPE: "Debug" ASAN_OPTIONS: "detect_leaks=1 check_initialization_order=1 detect_stack_use_after_return=1 detect_invalid_pointer_pairs=1 atexit=1" @@ -448,10 +498,10 @@ jobs: ub_sanitizer: <<: *job_definition environment: - CC: clang-7 - CXX: clang++-7 + CC: clang-8 + CXX: clang++-8 BUILD_TOOLSET: clang - APT_COMPILER_PACKAGE: clang-7 + APT_COMPILER_PACKAGE: clang-8 CXXFLAGS: "-O2 -fno-sanitize-recover=undefined,nullability,implicit-conversion,unsigned-integer-overflow -fno-omit-frame-pointer -fno-common" BUILD_TYPE: "Debug" GTEST_ARGS: "" @@ -460,10 +510,10 @@ jobs: thread_sanitizer: <<: *job_definition environment: - CC: clang-7 - CXX: clang++-7 + CC: clang-8 + CXX: clang++-8 BUILD_TOOLSET: clang - APT_COMPILER_PACKAGE: clang-7 + APT_COMPILER_PACKAGE: clang-8 OMP_NUM_THREADS: "1" CXXFLAGS: "-O2 -fsanitize=thread -fno-omit-frame-pointer" BUILD_TYPE: "Debug" @@ -496,10 +546,10 @@ jobs: - store_artifacts: path: /tmp/clang-tidy-fixes environment: - CC: clang-7 - CXX: clang++-7 + CC: clang-8 + CXX: clang++-8 BUILD_TOOLSET: clang - APT_COMPILER_PACKAGE: "clang-7 clang-tidy-7" + APT_COMPILER_PACKAGE: "clang-8 clang-tidy-8" workflows: version: 2 @@ -522,6 +572,10 @@ workflows: <<: *enable_for_tags - gcc_8_release: <<: *enable_for_tags + - gcc_9_debug: + <<: *enable_for_tags + - gcc_9_release: + <<: *enable_for_tags - clang_4_debug: <<: *enable_for_tags - clang_4_release: @@ -538,6 +592,10 @@ workflows: <<: *enable_for_tags - clang_7_release: <<: *enable_for_tags + - clang_8_debug: + <<: *enable_for_tags + - clang_8_release: + <<: *enable_for_tags - clang_werror: <<: *enable_for_tags - gcc_werror: diff --git a/.clang-tidy b/.clang-tidy index 6ce5b1c8..b9569c1d 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -25,8 +25,13 @@ Checks: | -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-type-vararg, -cppcoreguidelines-avoid-goto, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-non-private-member-variables-in-classes, -clang-analyzer-optin.cplusplus.VirtualCall, + -clang-analyzer-cplusplus.NewDeleteLeaks, -misc-macro-parentheses, + -misc-non-private-member-variables-in-classes, -misc-unused-raii WarningsAsErrors: '*' HeaderFilterRegex: '/src/|/test/' diff --git a/CMakeSettings.json b/CMakeSettings.json index 626d3acc..5b35c8d4 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -7,7 +7,7 @@ "inheritEnvironments": [ "msvc_x86" ], "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "cmakeCommandArgs": "-DBUILD_TESTING=on -DBOOST_ROOT=C:\\local\\boost_1_68_0 -DDOKAN_PATH=\"C:\\Program Files\\Dokan\\DokanLibrary-1.1.0\"", + "cmakeCommandArgs": "-DBUILD_TESTING=on -DBOOST_ROOT=C:\\local\\boost_1_68_0 -DDOKAN_PATH=\"C:\\Program Files\\Dokan\\Dokan Library-1.2.2\"", "buildCommandArgs": "-v", "ctestCommandArgs": "" }, @@ -18,7 +18,7 @@ "inheritEnvironments": [ "msvc_x86" ], "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "cmakeCommandArgs": "-DBUILD_TESTING=on -DBOOST_ROOT=C:\\local\\boost_1_68_0 -DDOKAN_PATH=\"C:\\Program Files\\Dokan\\DokanLibrary-1.1.0\"", + "cmakeCommandArgs": "-DBUILD_TESTING=on -DBOOST_ROOT=C:\\local\\boost_1_68_0 -DDOKAN_PATH=\"C:\\Program Files\\Dokan\\Dokan Library-1.2.2\"", "buildCommandArgs": "-v", "ctestCommandArgs": "" }, @@ -29,7 +29,7 @@ "inheritEnvironments": [ "msvc_x64_x64" ], "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "cmakeCommandArgs": "-DBUILD_TESTING=on -DBOOST_ROOT=C:\\local\\boost_1_68_0 -DDOKAN_PATH=\"C:\\Program Files\\Dokan\\DokanLibrary-1.1.0\"", + "cmakeCommandArgs": "-DBUILD_TESTING=on -DBOOST_ROOT=C:\\local\\boost_1_68_0 -DDOKAN_PATH=\"C:\\Program Files\\Dokan\\Dokan Library-1.2.2\"", "buildCommandArgs": "-v", "ctestCommandArgs": "" }, @@ -40,7 +40,7 @@ "inheritEnvironments": [ "msvc_x64_x64" ], "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "cmakeCommandArgs": "-DBUILD_TESTING=on -DBOOST_ROOT=C:\\local\\boost_1_68_0 -DDOKAN_PATH=\"C:\\Program Files\\Dokan\\DokanLibrary-1.1.0\"", + "cmakeCommandArgs": "-DBUILD_TESTING=on -DBOOST_ROOT=C:\\local\\boost_1_68_0 -DDOKAN_PATH=\"C:\\Program Files\\Dokan\\Dokan Library-1.2.2\"", "buildCommandArgs": "-v", "ctestCommandArgs": "" } diff --git a/ChangeLog.txt b/ChangeLog.txt index afc160e6..ae68b6c9 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,4 @@ -Version 0.10.2 (unreleased) +Version 0.10.2 --------------- Fixed bugs: * Fix occasional crash in mkdir() on Windows @@ -7,6 +7,9 @@ Fixed bugs: Improvements: * Better logging when local state can't be loaded +Other: +* Updated to crypto++ 8.2 + Version 0.10.1 --------------- diff --git a/src/blobstore/implementations/onblocks/datatreestore/impl/LeafTraverser.cpp b/src/blobstore/implementations/onblocks/datatreestore/impl/LeafTraverser.cpp index 12d0b499..1a17e297 100644 --- a/src/blobstore/implementations/onblocks/datatreestore/impl/LeafTraverser.cpp +++ b/src/blobstore/implementations/onblocks/datatreestore/impl/LeafTraverser.cpp @@ -215,7 +215,7 @@ namespace blobstore { if (endIndex > beginIndex) { onBacktrackFromSubtree(newNode.get()); } - return std::move(newNode); + return newNode; } uint32_t LeafTraverser::_maxLeavesForTreeDepth(uint8_t depth) const { diff --git a/src/blockstore/implementations/caching/cache/QueueMap.h b/src/blockstore/implementations/caching/cache/QueueMap.h index 8db9d646..851b3265 100644 --- a/src/blockstore/implementations/caching/cache/QueueMap.h +++ b/src/blockstore/implementations/caching/cache/QueueMap.h @@ -48,7 +48,7 @@ public: _removeFromQueue(found->second); auto value = found->second.release(); _entries.erase(found); - return std::move(value); + return value; } boost::optional pop() { @@ -83,7 +83,7 @@ private: } void init(const Key *key_, Value value_) { key = key_; - new(__value) Value(std::move(value_)); + new(__value.data()) Value(std::move(value_)); } Value release() { Value value = std::move(*_value()); @@ -98,9 +98,9 @@ private: const Key *key; private: Value *_value() { - return reinterpret_cast(__value); + return reinterpret_cast(__value.data()); } - alignas(Value) char __value[sizeof(Value)]; + alignas(Value) std::array __value; DISALLOW_COPY_AND_ASSIGN(Entry); }; diff --git a/src/cpp-utils/crypto/RandomPadding.cpp b/src/cpp-utils/crypto/RandomPadding.cpp index 041fa7dc..8d9b2229 100644 --- a/src/cpp-utils/crypto/RandomPadding.cpp +++ b/src/cpp-utils/crypto/RandomPadding.cpp @@ -29,6 +29,6 @@ namespace cpputils { }; Data result(size); std::memcpy(result.data(), data.dataOffset(sizeof(size)), size); - return std::move(result); + return result; } } diff --git a/src/cpp-utils/crypto/symmetric/CFB_Cipher.h b/src/cpp-utils/crypto/symmetric/CFB_Cipher.h index 80ff2568..c1a8aa1c 100644 --- a/src/cpp-utils/crypto/symmetric/CFB_Cipher.h +++ b/src/cpp-utils/crypto/symmetric/CFB_Cipher.h @@ -70,7 +70,7 @@ boost::optional CFB_Cipher::decrypt(const CryptoPP:: // TODO Shouldn't we pass in ciphertextSize instead of plaintext.size() here as last argument (and also in the if above)? decryption.ProcessData(static_cast(plaintext.data()), ciphertextData, plaintext.size()); } - return std::move(plaintext); + return plaintext; } } diff --git a/src/cpp-utils/crypto/symmetric/GCM_Cipher.h b/src/cpp-utils/crypto/symmetric/GCM_Cipher.h index 13300bb8..af09aec1 100644 --- a/src/cpp-utils/crypto/symmetric/GCM_Cipher.h +++ b/src/cpp-utils/crypto/symmetric/GCM_Cipher.h @@ -80,7 +80,7 @@ boost::optional GCM_Cipher::decrypt(const CryptoPP:: CryptoPP::AuthenticatedDecryptionFilter::DEFAULT_FLAGS, TAG_SIZE ) ); - return std::move(plaintext); + return plaintext; } catch (const CryptoPP::HashVerificationFilter::HashVerificationFailed &e) { return boost::none; } diff --git a/src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h b/src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h index a37cffd8..f5753359 100644 --- a/src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h +++ b/src/cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h @@ -91,7 +91,7 @@ namespace cpputils { Data result(plaintextSize(ciphertextSize)); _xor(static_cast(result.data()), ciphertext + sizeof(uint64_t), plaintextSize(ciphertextSize), encKey.value ^ iv); - return std::move(result); + return result; } static constexpr const char *NAME = "FakeAuthenticatedCipher"; @@ -100,7 +100,7 @@ namespace cpputils { static uint64_t _checksum(const CryptoPP::byte *data, FakeKey encKey, std::size_t size) { uint64_t checksum = 34343435 * encKey.value; // some init value - for (unsigned int i = 0; i < size; ++i) { + for (size_t i = 0; i < size; ++i) { checksum ^= (static_cast(data[i]) << (56 - 8 * (i%8))); } diff --git a/src/cpp-utils/data/FixedSizeData.h b/src/cpp-utils/data/FixedSizeData.h index c4a88d73..832a96ee 100644 --- a/src/cpp-utils/data/FixedSizeData.h +++ b/src/cpp-utils/data/FixedSizeData.h @@ -37,7 +37,7 @@ private: FixedSizeData(): _data() {} template friend class FixedSizeData; - unsigned char _data[BINARY_LENGTH]; + std::array _data; }; template bool operator==(const FixedSizeData &lhs, const FixedSizeData &rhs); @@ -51,7 +51,7 @@ template constexpr size_t FixedSizeData::STRING_LENGTH; template FixedSizeData FixedSizeData::Null() { FixedSizeData result; - std::memset(result._data, 0, BINARY_LENGTH); + std::memset(result._data.data(), 0, BINARY_LENGTH); return result; } @@ -62,7 +62,7 @@ FixedSizeData FixedSizeData::FromString(const std::string &data) { { CryptoPP::StringSource _1(data, true, new CryptoPP::HexDecoder( - new CryptoPP::ArraySink(result._data, BINARY_LENGTH) + new CryptoPP::ArraySink(result._data.data(), BINARY_LENGTH) ) ); } @@ -72,7 +72,7 @@ FixedSizeData FixedSizeData::FromString(const std::string &data) { template std::string FixedSizeData::ToString() const { std::string result; - CryptoPP::ArraySource(_data, BINARY_LENGTH, true, + CryptoPP::ArraySource(_data.data(), BINARY_LENGTH, true, new CryptoPP::HexEncoder( new CryptoPP::StringSink(result) ) @@ -83,7 +83,7 @@ std::string FixedSizeData::ToString() const { template const unsigned char *FixedSizeData::data() const { - return _data; + return _data.data(); } template @@ -93,13 +93,13 @@ unsigned char *FixedSizeData::data() { template void FixedSizeData::ToBinary(void *target) const { - std::memcpy(target, _data, BINARY_LENGTH); + std::memcpy(target, _data.data(), BINARY_LENGTH); } template FixedSizeData FixedSizeData::FromBinary(const void *source) { FixedSizeData result; - std::memcpy(result._data, source, BINARY_LENGTH); + std::memcpy(result._data.data(), source, BINARY_LENGTH); return result; } @@ -107,7 +107,7 @@ template template FixedSizeData FixedSizeData::take() const { static_assert(size <= SIZE, "Out of bounds"); FixedSizeData result; - std::memcpy(result._data, _data, size); + std::memcpy(result._data.data(), _data.data(), size); return result; } @@ -115,7 +115,7 @@ template template FixedSizeData FixedSizeData::drop() const { static_assert(size <= SIZE, "Out of bounds"); FixedSizeData result; - std::memcpy(result._data, _data+size, SIZE-size); + std::memcpy(result._data.data(), _data.data()+size, SIZE-size); return result; } diff --git a/src/cpp-utils/io/IOStreamConsole.cpp b/src/cpp-utils/io/IOStreamConsole.cpp index 1c6213bb..48cdd7fa 100644 --- a/src/cpp-utils/io/IOStreamConsole.cpp +++ b/src/cpp-utils/io/IOStreamConsole.cpp @@ -67,7 +67,7 @@ unsigned int IOStreamConsole::ask(const string &question, const vector & throw std::invalid_argument("options should have at least one entry"); } _output << question << "\n"; - for (unsigned int i = 0; i < options.size(); ++i) { + for (size_t i = 0; i < options.size(); ++i) { _output << " [" << (i+1) << "] " << options[i] << "\n"; } int choice = _askForChoice("Your choice [1-" + std::to_string(options.size()) + "]: ", _parseUIntWithMinMax(1, options.size())); diff --git a/src/cpp-utils/process/subprocess.cpp b/src/cpp-utils/process/subprocess.cpp index c1eb1a9e..b044901a 100644 --- a/src/cpp-utils/process/subprocess.cpp +++ b/src/cpp-utils/process/subprocess.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #if defined(__APPLE__) @@ -44,9 +45,9 @@ namespace cpputils { string getOutput() { string output; - char buffer[1024]; - while (fgets(buffer, sizeof(buffer), _subprocess) != nullptr) { - output += buffer; + std::array buffer{}; + while (fgets(buffer.data(), buffer.size(), _subprocess) != nullptr) { + output += buffer.data(); } return output; } diff --git a/src/cpp-utils/system/filetime_nonwindows.cpp b/src/cpp-utils/system/filetime_nonwindows.cpp index 344f0c0e..6dccba6a 100644 --- a/src/cpp-utils/system/filetime_nonwindows.cpp +++ b/src/cpp-utils/system/filetime_nonwindows.cpp @@ -5,15 +5,16 @@ #include #include #include +#include #include namespace cpputils { int set_filetime(const char *filepath, timespec lastAccessTime, timespec lastModificationTime) { - struct timeval casted_times[2]; + std::array casted_times{}; TIMESPEC_TO_TIMEVAL(&casted_times[0], &lastAccessTime); TIMESPEC_TO_TIMEVAL(&casted_times[1], &lastModificationTime); - int retval = ::utimes(filepath, casted_times); + int retval = ::utimes(filepath, casted_times.data()); if (0 == retval) { return 0; } else { diff --git a/src/cpp-utils/thread/debugging_nonwindows.cpp b/src/cpp-utils/thread/debugging_nonwindows.cpp index 4afb4045..32bba95b 100644 --- a/src/cpp-utils/thread/debugging_nonwindows.cpp +++ b/src/cpp-utils/thread/debugging_nonwindows.cpp @@ -71,11 +71,11 @@ int pthread_getname_np_gcompat(pthread_t thread, char *name, size_t len) { #endif std::string get_thread_name(pthread_t thread) { - char name[MAX_NAME_LEN]; + std::array name{}; #if defined(__GLIBC__) || defined(__APPLE__) - int result = pthread_getname_np(thread, name, MAX_NAME_LEN); + int result = pthread_getname_np(thread, name.data(), MAX_NAME_LEN); #else - int result = pthread_getname_np_gcompat(thread, name, MAX_NAME_LEN); + int result = pthread_getname_np_gcompat(thread, name.data(), MAX_NAME_LEN); #endif if (0 != result) { throw std::runtime_error("Error getting thread name with pthread_getname_np. Code: " + std::to_string(result)); @@ -83,7 +83,7 @@ std::string get_thread_name(pthread_t thread) { // pthread_getname_np returns a null terminated string with maximum 16 bytes. // but just to be safe against a buggy implementation, let's set the last byte to zero. name[MAX_NAME_LEN - 1] = '\0'; - return name; + return name.data(); } } diff --git a/src/cryfs-cli/Cli.cpp b/src/cryfs-cli/Cli.cpp index f4785ae3..e0d30e90 100644 --- a/src/cryfs-cli/Cli.cpp +++ b/src/cryfs-cli/Cli.cpp @@ -404,7 +404,7 @@ namespace cryfs_cli { return false; } - int Cli::main(int argc, const char *argv[], unique_ref httpClient, std::function onMounted) { + int Cli::main(int argc, const char **argv, unique_ref httpClient, std::function onMounted) { cpputils::showBacktraceOnCrash(); cpputils::set_thread_name("cryfs"); diff --git a/src/cryfs-cli/Cli.h b/src/cryfs-cli/Cli.h index a077dd78..9a31fd53 100644 --- a/src/cryfs-cli/Cli.h +++ b/src/cryfs-cli/Cli.h @@ -18,7 +18,7 @@ namespace cryfs_cli { class Cli final { public: Cli(cpputils::RandomGenerator &keyGenerator, const cpputils::SCryptSettings& scryptSettings, std::shared_ptr console); - int main(int argc, const char *argv[], cpputils::unique_ref httpClient, std::function onMounted); + int main(int argc, const char **argv, cpputils::unique_ref httpClient, std::function onMounted); private: void _checkForUpdates(cpputils::unique_ref httpClient); diff --git a/src/cryfs-cli/program_options/Parser.cpp b/src/cryfs-cli/program_options/Parser.cpp index deb792c9..192b3d7f 100644 --- a/src/cryfs-cli/program_options/Parser.cpp +++ b/src/cryfs-cli/program_options/Parser.cpp @@ -20,11 +20,11 @@ using boost::optional; using boost::none; using namespace cpputils::logging; -Parser::Parser(int argc, const char *argv[]) +Parser::Parser(int argc, const char **argv) :_options(_argsToVector(argc, argv)) { } -vector Parser::_argsToVector(int argc, const char *argv[]) { +vector Parser::_argsToVector(int argc, const char **argv) { vector result; for(int i = 0; i < argc; ++i) { result.push_back(argv[i]); diff --git a/src/cryfs-cli/program_options/Parser.h b/src/cryfs-cli/program_options/Parser.h index ff5b4152..10a05030 100644 --- a/src/cryfs-cli/program_options/Parser.h +++ b/src/cryfs-cli/program_options/Parser.h @@ -10,12 +10,12 @@ namespace cryfs_cli { namespace program_options { class Parser final { public: - Parser(int argc, const char *argv[]); + Parser(int argc, const char **argv); ProgramOptions parse(const std::vector &supportedCiphers) const; private: - static std::vector _argsToVector(int argc, const char *argv[]); + static std::vector _argsToVector(int argc, const char **argv); static std::vector _to_const_char_vector(const std::vector &options); static void _addAllowedOptions(boost::program_options::options_description *desc); static void _addPositionalOptionForBaseDir(boost::program_options::options_description *desc, diff --git a/src/cryfs-unmount/Cli.cpp b/src/cryfs-unmount/Cli.cpp index e3badc24..ce6cbe7b 100644 --- a/src/cryfs-unmount/Cli.cpp +++ b/src/cryfs-unmount/Cli.cpp @@ -18,7 +18,7 @@ void _showVersion() { } } -void Cli::main(int argc, const char* argv[]) { +void Cli::main(int argc, const char **argv) { _showVersion(); ProgramOptions options = Parser(argc, argv).parse(); diff --git a/src/cryfs-unmount/Cli.h b/src/cryfs-unmount/Cli.h index d69b6f3e..498e6b74 100644 --- a/src/cryfs-unmount/Cli.h +++ b/src/cryfs-unmount/Cli.h @@ -6,7 +6,7 @@ namespace cryfs_unmount { class Cli final { public: - void main(int argc, const char* argv[]); + void main(int argc, const char **argv); }; } diff --git a/src/cryfs-unmount/program_options/Parser.cpp b/src/cryfs-unmount/program_options/Parser.cpp index 8f5f9d2d..ceb05ba1 100644 --- a/src/cryfs-unmount/program_options/Parser.cpp +++ b/src/cryfs-unmount/program_options/Parser.cpp @@ -17,11 +17,11 @@ using std::endl; using std::string; using namespace cpputils::logging; -Parser::Parser(int argc, const char *argv[]) +Parser::Parser(int argc, const char **argv) :_options(_argsToVector(argc, argv)) { } -vector Parser::_argsToVector(int argc, const char *argv[]) { +vector Parser::_argsToVector(int argc, const char **argv) { vector result; for (int i = 0; i < argc; ++i) { result.push_back(argv[i]); diff --git a/src/cryfs-unmount/program_options/Parser.h b/src/cryfs-unmount/program_options/Parser.h index ea5931fa..40b9e86e 100644 --- a/src/cryfs-unmount/program_options/Parser.h +++ b/src/cryfs-unmount/program_options/Parser.h @@ -10,12 +10,12 @@ namespace cryfs_unmount { namespace program_options { class Parser final { public: - Parser(int argc, const char *argv[]); + Parser(int argc, const char **argv); ProgramOptions parse() const; private: - static std::vector _argsToVector(int argc, const char *argv[]); + static std::vector _argsToVector(int argc, const char **argv); static std::vector _to_const_char_vector(const std::vector &options); static void _addAllowedOptions(boost::program_options::options_description *desc); static void _addPositionalOptionForBaseDir(boost::program_options::options_description *desc, diff --git a/src/cryfs/impl/config/CryConfigConsole.cpp b/src/cryfs/impl/config/CryConfigConsole.cpp index da7ebb54..6b0d36fd 100644 --- a/src/cryfs/impl/config/CryConfigConsole.cpp +++ b/src/cryfs/impl/config/CryConfigConsole.cpp @@ -29,7 +29,7 @@ namespace cryfs { bool askAgain = true; while(askAgain) { _console->print("\n"); - int cipherIndex = _console->ask("Which block cipher do you want to use?", ciphers); + unsigned int cipherIndex = _console->ask("Which block cipher do you want to use?", ciphers); cipherName = ciphers[cipherIndex]; askAgain = !_showWarningForCipherAndReturnIfOk(cipherName); }; @@ -54,7 +54,7 @@ namespace cryfs { uint32_t CryConfigConsole::_askBlocksizeBytes() const { vector sizes = {"4KB", "8KB", "16KB", "32KB", "64KB", "512KB", "1MB", "4MB"}; - int index = _console->ask("Which block size do you want to use?", sizes); + unsigned int index = _console->ask("Which block size do you want to use?", sizes); switch(index) { case 0: return 4*1024; case 1: return 8*1024; diff --git a/src/cryfs/impl/config/CryConfigFile.cpp b/src/cryfs/impl/config/CryConfigFile.cpp index 22a17ac8..9571cff6 100644 --- a/src/cryfs/impl/config/CryConfigFile.cpp +++ b/src/cryfs/impl/config/CryConfigFile.cpp @@ -49,7 +49,7 @@ either> CryConfigFile::load( configFile->save(); } //TODO For newer compilers, this works without std::move - return std::move(configFile); + return configFile; } unique_ref CryConfigFile::create(bf::path path, CryConfig config, CryKeyProvider* keyProvider) { diff --git a/src/cryfs/impl/filesystem/fsblobstore/SymlinkBlob.cpp b/src/cryfs/impl/filesystem/fsblobstore/SymlinkBlob.cpp index dc1b9f2d..67f14af2 100644 --- a/src/cryfs/impl/filesystem/fsblobstore/SymlinkBlob.cpp +++ b/src/cryfs/impl/filesystem/fsblobstore/SymlinkBlob.cpp @@ -28,6 +28,7 @@ unique_ref SymlinkBlob::InitializeSymlink(unique_ref blob, co } bf::path SymlinkBlob::_readTargetFromBlob(const FsBlobView &blob) { + // NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays) auto targetStr = std::make_unique(blob.size() + 1); // +1 because of the nullbyte blob.read(targetStr.get(), 0, blob.size()); targetStr[blob.size()] = '\0'; diff --git a/src/cryfs/impl/filesystem/fsblobstore/utils/DirEntryList.cpp b/src/cryfs/impl/filesystem/fsblobstore/utils/DirEntryList.cpp index f27c5783..21768605 100644 --- a/src/cryfs/impl/filesystem/fsblobstore/utils/DirEntryList.cpp +++ b/src/cryfs/impl/filesystem/fsblobstore/utils/DirEntryList.cpp @@ -175,7 +175,7 @@ vector::iterator DirEntryList::_findFirst(const BlockId &hint, std::fu return _entries.end(); } double startpos_percent = static_cast(*static_cast(hint.data().data())) / std::numeric_limits::max(); - auto iter = _entries.begin() + static_cast(startpos_percent * (_entries.size()-1)); + auto iter = _entries.begin() + static_cast(startpos_percent * static_cast(_entries.size()-1)); ASSERT(iter >= _entries.begin() && iter < _entries.end(), "Startpos out of range"); while(iter != _entries.begin() && pred(*iter)) { --iter; diff --git a/src/fspp/fstest/FsppOpenFileTest_Timestamps.h b/src/fspp/fstest/FsppOpenFileTest_Timestamps.h index e9b7d42f..dd4f2d5f 100644 --- a/src/fspp/fstest/FsppOpenFileTest_Timestamps.h +++ b/src/fspp/fstest/FsppOpenFileTest_Timestamps.h @@ -72,8 +72,8 @@ TYPED_TEST_P(FsppOpenFileTest_Timestamps, truncate_nonempty_to_nonempty_grow) { TYPED_TEST_P(FsppOpenFileTest_Timestamps, read_inbounds) { auto openFile = this->CreateAndOpenFileWithSize("/myfile", fspp::num_bytes_t(10)); auto operation = [&openFile] () { - char buffer[5]; - openFile->read(buffer, fspp::num_bytes_t(5), fspp::num_bytes_t(0)); + std::array buffer{}; + openFile->read(buffer.data(), fspp::num_bytes_t(5), fspp::num_bytes_t(0)); }; this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS(*openFile, operation, {this->ExpectUpdatesAccessTimestamp, this->ExpectDoesntUpdateModificationTimestamp, this->ExpectDoesntUpdateMetadataTimestamp}); } @@ -81,8 +81,8 @@ TYPED_TEST_P(FsppOpenFileTest_Timestamps, read_inbounds) { TYPED_TEST_P(FsppOpenFileTest_Timestamps, read_outofbounds) { auto openFile = this->CreateAndOpenFileWithSize("/myfile", fspp::num_bytes_t(0)); auto operation = [&openFile] () { - char buffer[5]; - openFile->read(buffer, fspp::num_bytes_t(5), fspp::num_bytes_t(2)); + std::array buffer{}; + openFile->read(buffer.data(), fspp::num_bytes_t(5), fspp::num_bytes_t(2)); }; this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS(*openFile, operation, {this->ExpectUpdatesAccessTimestamp, this->ExpectDoesntUpdateModificationTimestamp, this->ExpectDoesntUpdateMetadataTimestamp}); } diff --git a/src/fspp/fuse/Fuse.cpp b/src/fspp/fuse/Fuse.cpp index 4506f43f..e27089d3 100644 --- a/src/fspp/fuse/Fuse.cpp +++ b/src/fspp/fuse/Fuse.cpp @@ -113,8 +113,8 @@ int fusepp_ftruncate(const char *path, int64_t size, fuse_file_info *fileinfo) { return FUSE_OBJ->ftruncate(bf::path(path), size, fileinfo); } -int fusepp_utimens(const char *path, const timespec times[2]) { - return FUSE_OBJ->utimens(bf::path(path), times); +int fusepp_utimens(const char *path, const timespec times[2]) { // NOLINT(cppcoreguidelines-avoid-c-arrays) + return FUSE_OBJ->utimens(bf::path(path), {times[0], times[1]}); } int fusepp_open(const char *path, fuse_file_info *fileinfo) { @@ -540,7 +540,6 @@ int Fuse::unlink(const bf::path &path) { try { ASSERT(is_valid_fspp_path(path), "has to be an absolute path"); _fs->unlink(path); - ThreadNameForDebugging _threadName("unlink"); #ifdef FSPP_LOG LOG(DEBUG, "unlink({}): success", path); #endif @@ -778,7 +777,7 @@ int Fuse::ftruncate(const bf::path &path, int64_t size, fuse_file_info *fileinfo } } -int Fuse::utimens(const bf::path &path, const timespec times[2]) { +int Fuse::utimens(const bf::path &path, const std::array times) { ThreadNameForDebugging _threadName("utimens"); #ifdef FSPP_LOG LOG(DEBUG, "utimens({}, _)", path); diff --git a/src/fspp/fuse/Fuse.h b/src/fspp/fuse/Fuse.h index c0e58659..1a0c07c6 100644 --- a/src/fspp/fuse/Fuse.h +++ b/src/fspp/fuse/Fuse.h @@ -45,7 +45,7 @@ public: int chown(const boost::filesystem::path &path, ::uid_t uid, ::gid_t gid); int truncate(const boost::filesystem::path &path, int64_t size); int ftruncate(const boost::filesystem::path &path, int64_t size, fuse_file_info *fileinfo); - int utimens(const boost::filesystem::path &path, const timespec times[2]); + int utimens(const boost::filesystem::path &path, const std::array times); int open(const boost::filesystem::path &path, fuse_file_info *fileinfo); int release(const boost::filesystem::path &path, fuse_file_info *fileinfo); int read(const boost::filesystem::path &path, char *buf, size_t size, int64_t offset, fuse_file_info *fileinfo); diff --git a/src/parallelaccessstore/ParallelAccessStore.h b/src/parallelaccessstore/ParallelAccessStore.h index 6b2c36d3..296e643c 100644 --- a/src/parallelaccessstore/ParallelAccessStore.h +++ b/src/parallelaccessstore/ParallelAccessStore.h @@ -165,7 +165,7 @@ cpputils::unique_ref ParallelAccessStoresecond.getReference()); resourceRef->init(this, key); onExists(resourceRef.get()); - return std::move(resourceRef); + return resourceRef; } }; @@ -190,7 +190,7 @@ boost::optional> ParallelAccessStoresecond.getReference()); resourceRef->init(this, key); - return std::move(resourceRef); + return resourceRef; } } diff --git a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_ResizeByTraversing.cpp b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_ResizeByTraversing.cpp index b113fdb8..6503e814 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_ResizeByTraversing.cpp +++ b/test/blobstore/implementations/onblocks/datatreestore/DataTreeTest_ResizeByTraversing.cpp @@ -222,7 +222,7 @@ TEST_P(DataTreeTest_ResizeByTraversing_P, DataStaysIntact) { if (traversalBeginIndex < oldNumberOfLeaves) { // Traversal wrote over part of the pre-existing data, we can only check the data before it. if (traversalBeginIndex != 0) { - data.EXPECT_DATA_CORRECT(nodeStore->load(blockId).get().get(), traversalBeginIndex - 1); + data.EXPECT_DATA_CORRECT(nodeStore->load(blockId).get().get(), static_cast(traversalBeginIndex - 1)); } } else { // Here, traversal was entirely outside the preexisting data, we can check all preexisting data. diff --git a/test/blobstore/implementations/onblocks/datatreestore/testutils/TwoLevelDataFixture.h b/test/blobstore/implementations/onblocks/datatreestore/testutils/TwoLevelDataFixture.h index b5cbbd53..fd59a231 100644 --- a/test/blobstore/implementations/onblocks/datatreestore/testutils/TwoLevelDataFixture.h +++ b/test/blobstore/implementations/onblocks/datatreestore/testutils/TwoLevelDataFixture.h @@ -67,7 +67,7 @@ private: case SizePolicy::Full: return _dataNodeStore->layout().maxBytesPerLeaf(); case SizePolicy::Random: - return mod(_dataNodeStore->layout().maxBytesPerLeaf() - childIndex, _dataNodeStore->layout().maxBytesPerLeaf()); + return mod(static_cast(_dataNodeStore->layout().maxBytesPerLeaf() - childIndex), static_cast(_dataNodeStore->layout().maxBytesPerLeaf())); case SizePolicy::Unchanged: return leaf->numBytes(); default: diff --git a/test/blockstore/implementations/caching/cache/CacheTest_PushAndPop.cpp b/test/blockstore/implementations/caching/cache/CacheTest_PushAndPop.cpp index 86c48796..d4ff8c8a 100644 --- a/test/blockstore/implementations/caching/cache/CacheTest_PushAndPop.cpp +++ b/test/blockstore/implementations/caching/cache/CacheTest_PushAndPop.cpp @@ -21,7 +21,7 @@ TEST_F(CacheTest_PushAndPop, PopNonExistingEntry_NonEmptyCache) { TEST_F(CacheTest_PushAndPop, PopNonExistingEntry_FullCache) { //Add a lot of even numbered keys - for (unsigned int i = 0; i < MAX_ENTRIES; ++i) { + for (int i = 0; i < static_cast(MAX_ENTRIES); ++i) { push(2*i, 2*i); } //Request an odd numbered key @@ -43,35 +43,35 @@ TEST_F(CacheTest_PushAndPop, MultipleEntries) { } TEST_F(CacheTest_PushAndPop, FullCache) { - for(unsigned int i = 0; i < MAX_ENTRIES; ++i) { + for(int i = 0; i < static_cast(MAX_ENTRIES); ++i) { push(i, 2*i); } - for(unsigned int i = 0; i < MAX_ENTRIES; ++i) { - EXPECT_EQ(static_cast(2*i), pop(i).value()); + for(int i = 0; i < static_cast(MAX_ENTRIES); ++i) { + EXPECT_EQ(2*i, pop(i).value()); } } TEST_F(CacheTest_PushAndPop, FullCache_PushNonOrdered_PopOrdered) { - for(unsigned int i = 1; i < MAX_ENTRIES; i += 2) { + for(int i = 1; i < static_cast(MAX_ENTRIES); i += 2) { push(i, 2*i); } - for(unsigned int i = 0; i < MAX_ENTRIES; i += 2) { + for(int i = 0; i < static_cast(MAX_ENTRIES); i += 2) { push(i, 2*i); } - for(unsigned int i = 0; i < MAX_ENTRIES; ++i) { - EXPECT_EQ(static_cast(2*i), pop(i).value()); + for(int i = 0; i < static_cast(MAX_ENTRIES); ++i) { + EXPECT_EQ(2*i, pop(i).value()); } } TEST_F(CacheTest_PushAndPop, FullCache_PushOrdered_PopNonOrdered) { - for(unsigned int i = 0; i < MAX_ENTRIES; ++i) { + for(int i = 0; i < static_cast(MAX_ENTRIES); ++i) { push(i, 2*i); } - for(unsigned int i = 1; i < MAX_ENTRIES; i += 2) { - EXPECT_EQ(static_cast(2*i), pop(i).value()); + for(int i = 1; i < static_cast(MAX_ENTRIES); i += 2) { + EXPECT_EQ(2*i, pop(i).value()); } - for(unsigned int i = 0; i < MAX_ENTRIES; i += 2) { - EXPECT_EQ(static_cast(2*i), pop(i).value()); + for(int i = 0; i < static_cast(MAX_ENTRIES); i += 2) { + EXPECT_EQ(2*i, pop(i).value()); } } @@ -95,27 +95,27 @@ TEST_F(CacheTest_PushAndPop, FullCache_PushNonOrdered_PopNonOrdered) { for(int i = roundDownToEven(MAX_ENTRIES - 1); i >= 0; i -= 2) { push(i, 2*i); } - for(unsigned int i = 1; i < MAX_ENTRIES; i += 2) { + for(int i = 1; i < static_cast(MAX_ENTRIES); i += 2) { push(i, 2*i); } for(int i = roundDownToOdd(MAX_ENTRIES-1); i >= 0; i -= 2) { - EXPECT_EQ(static_cast(2*i), pop(i).value()); + EXPECT_EQ(2*i, pop(i).value()); } - for(unsigned int i = 0; i < MAX_ENTRIES; i += 2) { - EXPECT_EQ(static_cast(2*i), pop(i).value()); + for(int i = 0; i < static_cast(MAX_ENTRIES); i += 2) { + EXPECT_EQ(2*i, pop(i).value()); } } TEST_F(CacheTest_PushAndPop, MoreThanFullCache) { - for(unsigned int i = 0; i < MAX_ENTRIES + 2; ++i) { + for(int i = 0; i < static_cast(MAX_ENTRIES + 2); ++i) { push(i, 2*i); } //Check that the oldest two elements got deleted automatically EXPECT_EQ(boost::none, pop(0)); EXPECT_EQ(boost::none, pop(1)); //Check the other elements are still there - for(unsigned int i = 2; i < MAX_ENTRIES + 2; ++i) { - EXPECT_EQ(static_cast(2*i), pop(i).value()); + for(int i = 2; i < static_cast(MAX_ENTRIES + 2); ++i) { + EXPECT_EQ(2*i, pop(i).value()); } } diff --git a/test/cpp-utils/assert/exit_signal.cpp b/test/cpp-utils/assert/exit_signal.cpp index f0abb696..cedc9a8d 100644 --- a/test/cpp-utils/assert/exit_signal.cpp +++ b/test/cpp-utils/assert/exit_signal.cpp @@ -6,7 +6,7 @@ #include #endif -void handle_exit_signal(char* argv[]) { +void handle_exit_signal(char **argv) { const std::string kind = argv[1]; if (kind == "exception") { throw std::logic_error(argv[2]); @@ -18,7 +18,7 @@ void handle_exit_signal(char* argv[]) { DWORD code = std::atoll(argv[2]); ::RaiseException(code, EXCEPTION_NONCONTINUABLE, 0, NULL); #else - int code = std::strtol(argv[2], nullptr, 10); + int code = static_cast(std::strtol(argv[2], nullptr, 10)); ::raise(code); #endif } diff --git a/test/cpp-utils/process/exit_status.cpp b/test/cpp-utils/process/exit_status.cpp index 3d72f6b1..d61db0e6 100644 --- a/test/cpp-utils/process/exit_status.cpp +++ b/test/cpp-utils/process/exit_status.cpp @@ -11,6 +11,6 @@ int main(int argc, char* argv[]) { std::cout << argv[1]; - int exit_status = std::strtol(argv[2], nullptr, 10); + int exit_status = static_cast(std::strtol(argv[2], nullptr, 10)); return exit_status; } diff --git a/test/cryfs-cli/program_options/testutils/ProgramOptionsTestBase.h b/test/cryfs-cli/program_options/testutils/ProgramOptionsTestBase.h index 163915e8..9526a76d 100644 --- a/test/cryfs-cli/program_options/testutils/ProgramOptionsTestBase.h +++ b/test/cryfs-cli/program_options/testutils/ProgramOptionsTestBase.h @@ -10,7 +10,7 @@ public: void EXPECT_VECTOR_EQ(std::initializer_list expected, const std::vector &actual) { std::vector expectedVec(expected); ASSERT_EQ(expectedVec.size(), actual.size()); - for(unsigned int i = 0; i < expectedVec.size(); ++i) { + for(size_t i = 0; i < expectedVec.size(); ++i) { EXPECT_EQ(expectedVec[i], actual[i]); } } diff --git a/test/cryfs-cli/testutils/CliTest.h b/test/cryfs-cli/testutils/CliTest.h index c933654c..cf8299df 100644 --- a/test/cryfs-cli/testutils/CliTest.h +++ b/test/cryfs-cli/testutils/CliTest.h @@ -40,7 +40,7 @@ public: cpputils::unique_ref _httpClient() { cpputils::unique_ref httpClient = cpputils::make_unique_ref(); httpClient->addWebsite("https://www.cryfs.org/version_info.json", "{\"version_info\":{\"current\":\"0.8.5\"}}"); - return std::move(httpClient); + return httpClient; } int run(const std::vector& args, std::function onMounted) { diff --git a/test/fspp/fuse/read/FuseReadFileDescriptorTest.cpp b/test/fspp/fuse/read/FuseReadFileDescriptorTest.cpp index 9470b1ab..03809775 100644 --- a/test/fspp/fuse/read/FuseReadFileDescriptorTest.cpp +++ b/test/fspp/fuse/read/FuseReadFileDescriptorTest.cpp @@ -20,6 +20,6 @@ TEST_P(FuseReadFileDescriptorTest, FileDescriptorIsCorrect) { EXPECT_CALL(*fsimpl, read(Eq(GetParam()), _, _, _)) .Times(1).WillOnce(ReturnSuccessfulRead); - char buf[1]; - ReadFile(FILENAME, buf, fspp::num_bytes_t(1), fspp::num_bytes_t(0)); + std::array buf{}; + ReadFile(FILENAME, buf.data(), fspp::num_bytes_t(1), fspp::num_bytes_t(0)); } diff --git a/test/fspp/fuse/read/FuseReadOverflowTest.cpp b/test/fspp/fuse/read/FuseReadOverflowTest.cpp index 43c9dc44..54f33f64 100644 --- a/test/fspp/fuse/read/FuseReadOverflowTest.cpp +++ b/test/fspp/fuse/read/FuseReadOverflowTest.cpp @@ -26,13 +26,13 @@ constexpr fspp::num_bytes_t FuseReadOverflowTest::OFFSET; TEST_F(FuseReadOverflowTest, ReadMoreThanFileSizeFromBeginning) { - char buf[READSIZE.value()]; - auto retval = ReadFileReturnError(FILENAME, buf, READSIZE, fspp::num_bytes_t(0)); + std::array buf{}; + auto retval = ReadFileReturnError(FILENAME, buf.data(), READSIZE, fspp::num_bytes_t(0)); EXPECT_EQ(FILESIZE, retval.read_bytes); } TEST_F(FuseReadOverflowTest, ReadMoreThanFileSizeFromMiddle) { - char buf[READSIZE.value()]; - auto retval = ReadFileReturnError(FILENAME, buf, READSIZE, OFFSET); + std::array buf{}; + auto retval = ReadFileReturnError(FILENAME, buf.data(), READSIZE, OFFSET); EXPECT_EQ(FILESIZE-OFFSET, retval.read_bytes); } diff --git a/test/fspp/fuse/readDir/testutils/FuseReadDirTest.cpp b/test/fspp/fuse/readDir/testutils/FuseReadDirTest.cpp index 25a49fde..036c5b17 100644 --- a/test/fspp/fuse/readDir/testutils/FuseReadDirTest.cpp +++ b/test/fspp/fuse/readDir/testutils/FuseReadDirTest.cpp @@ -80,7 +80,7 @@ void FuseReadDirTest::closeDir(DIR *dir) { Action*(const char*)> FuseReadDirTest::ReturnDirEntries(vector entries) { vector *direntries = new vector(entries.size(), fspp::Dir::Entry(fspp::Dir::EntryType::FILE, "")); - for(unsigned int i = 0; i < entries.size(); ++i) { + for(size_t i = 0; i < entries.size(); ++i) { (*direntries)[i].name = entries[i]; } return Return(direntries); diff --git a/test/fspp/fuse/utimens/FuseUtimensTimeParameterTest.cpp b/test/fspp/fuse/utimens/FuseUtimensTimeParameterTest.cpp index 631a7249..f8a60728 100644 --- a/test/fspp/fuse/utimens/FuseUtimensTimeParameterTest.cpp +++ b/test/fspp/fuse/utimens/FuseUtimensTimeParameterTest.cpp @@ -5,18 +5,18 @@ using ::testing::Return; using ::testing::WithParamInterface; using ::testing::Values; -class FuseUtimensTimeParameterTest: public FuseUtimensTest, public WithParamInterface { +class FuseUtimensTimeParameterTest: public FuseUtimensTest, public WithParamInterface> { }; -const timespec TIMEVAL1[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,0)}; -const timespec TIMEVAL2[2] = {FuseUtimensTest::makeTimespec(1000,0), FuseUtimensTest::makeTimespec(0,0)}; -const timespec TIMEVAL3[2] = {FuseUtimensTest::makeTimespec(0,1000), FuseUtimensTest::makeTimespec(0,0)}; -const timespec TIMEVAL4[2] = {FuseUtimensTest::makeTimespec(1000,1000), FuseUtimensTest::makeTimespec(0,0)}; -const timespec TIMEVAL5[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,0)}; -const timespec TIMEVAL6[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(1000,0)}; -const timespec TIMEVAL7[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,1000)}; -const timespec TIMEVAL8[2] = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(1000,1000)}; -const timespec TIMEVAL9[2] = {FuseUtimensTest::makeTimespec(1417196126,123000), FuseUtimensTest::makeTimespec(1417109713,321000)}; // current timestamp and the day before as of writing this test case -const timespec TIMEVAL10[2] = {FuseUtimensTest::makeTimespec(UINT64_C(1024)*1024*1024*1024,999000), FuseUtimensTest::makeTimespec(UINT64_C(2*1024)*1024*1024*1024,321000)}; // needs 64bit for timestamp representation +const std::array TIMEVAL1 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,0)}; +const std::array TIMEVAL2 = {FuseUtimensTest::makeTimespec(1000,0), FuseUtimensTest::makeTimespec(0,0)}; +const std::array TIMEVAL3 = {FuseUtimensTest::makeTimespec(0,1000), FuseUtimensTest::makeTimespec(0,0)}; +const std::array TIMEVAL4 = {FuseUtimensTest::makeTimespec(1000,1000), FuseUtimensTest::makeTimespec(0,0)}; +const std::array TIMEVAL5 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,0)}; +const std::array TIMEVAL6 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(1000,0)}; +const std::array TIMEVAL7 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(0,1000)}; +const std::array TIMEVAL8 = {FuseUtimensTest::makeTimespec(0,0), FuseUtimensTest::makeTimespec(1000,1000)}; +const std::array TIMEVAL9 = {FuseUtimensTest::makeTimespec(1417196126,123000), FuseUtimensTest::makeTimespec(1417109713,321000)}; // current timestamp and the day before as of writing this test case +const std::array TIMEVAL10 = {FuseUtimensTest::makeTimespec(UINT64_C(1024)*1024*1024*1024,999000), FuseUtimensTest::makeTimespec(UINT64_C(2*1024)*1024*1024*1024,321000)}; // needs 64bit for timestamp representation INSTANTIATE_TEST_CASE_P(FuseUtimensTimeParameterTest, FuseUtimensTimeParameterTest, Values(TIMEVAL1, TIMEVAL2, TIMEVAL3, TIMEVAL4, TIMEVAL5, TIMEVAL6, TIMEVAL7, TIMEVAL8, TIMEVAL9, TIMEVAL10)); diff --git a/test/fspp/fuse/write/FuseWriteFileDescriptorTest.cpp b/test/fspp/fuse/write/FuseWriteFileDescriptorTest.cpp index e586eafd..50158d44 100644 --- a/test/fspp/fuse/write/FuseWriteFileDescriptorTest.cpp +++ b/test/fspp/fuse/write/FuseWriteFileDescriptorTest.cpp @@ -21,6 +21,6 @@ TEST_P(FuseWriteFileDescriptorTest, FileDescriptorIsCorrect) { EXPECT_CALL(*fsimpl, write(Eq(GetParam()), _, _, _)) .Times(1).WillOnce(Return()); - char buf[1]; - WriteFile(FILENAME, buf, fspp::num_bytes_t(1), fspp::num_bytes_t(0)); + std::array buf{}; + WriteFile(FILENAME, buf.data(), fspp::num_bytes_t(1), fspp::num_bytes_t(0)); } diff --git a/vendor/README b/vendor/README index 79e68e8e..8224ed18 100644 --- a/vendor/README +++ b/vendor/README @@ -1,6 +1,6 @@ This directory contains external projects, taken from the following locations: googletest: https://github.com/google/googletest/tree/release-1.8.1 spdlog: https://github.com/gabime/spdlog/tree/v1.3.1/include/spdlog -cryptopp: https://github.com/weidai11/cryptopp/tree/CRYPTOPP_8_1_0 - - changed: added CMakeLists.txt and cryptopp-config.cmake from https://github.com/noloader/cryptopp-cmake/tree/07a064d57d97477cb055f994a498f45425df0c1d +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 diff --git a/vendor/cryptopp/vendor_cryptopp/CMakeLists.txt b/vendor/cryptopp/vendor_cryptopp/CMakeLists.txt index 55d18719..b80f624f 100644 --- a/vendor/cryptopp/vendor_cryptopp/CMakeLists.txt +++ b/vendor/cryptopp/vendor_cryptopp/CMakeLists.txt @@ -13,17 +13,17 @@ # # error "The CMAKE_C_COMPILER is set to a C++ compiler" if(NOT DEFINED cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING) - set(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING 1) + set(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING 1) endif() if(cryptocpp_DISPLAY_CMAKE_SUPPORT_WARNING) - message( STATUS - "*************************************************************************\n" - "The Crypto++ library does not officially support CMake. CMake support is a\n" - "community effort, and the library works with the folks using CMake to help\n" - "improve it. If you find an issue then please fix it or report it at\n" - "https://github.com/noloader/cryptopp-cmake.\n" - "-- *************************************************************************" - ) + message( STATUS +"*************************************************************************\n" +"The Crypto++ library does not officially support CMake. CMake support is a\n" +"community effort, and the library works with the folks using CMake to help\n" +"improve it. If you find an issue then please fix it or report it at\n" +"https://github.com/noloader/cryptopp-cmake.\n" +"-- *************************************************************************" +) endif() # Print useful information @@ -31,16 +31,16 @@ message( STATUS "CMake version ${CMAKE_VERSION}" ) cmake_minimum_required(VERSION 2.8.6) if (${CMAKE_VERSION} VERSION_LESS "3.0.0") - project(cryptopp) - set(cryptopp_VERSION_MAJOR 7) - set(cryptopp_VERSION_MINOR 0) - set(cryptopp_VERSION_PATCH 0) + project(cryptopp) + set(cryptopp_VERSION_MAJOR 8) + set(cryptopp_VERSION_MINOR 2) + set(cryptopp_VERSION_PATCH 0) else () - cmake_policy(SET CMP0048 NEW) - project(cryptopp VERSION 7.0.0) - if (NOT ${CMAKE_VERSION} VERSION_LESS "3.1.0") - cmake_policy(SET CMP0054 NEW) - endif () + cmake_policy(SET CMP0048 NEW) + project(cryptopp VERSION 8.2.0) + if (NOT ${CMAKE_VERSION} VERSION_LESS "3.1.0") + cmake_policy(SET CMP0054 NEW) + endif () endif () # Need to set SRC_DIR manually after removing the Python library code. @@ -50,11 +50,11 @@ set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # If not in multi-configuration environments, no explicit build type or CXX # flags are set by the user and if we are the root CMakeLists.txt file. if (NOT CMAKE_CONFIGURATION_TYPES AND - NOT CMAKE_NO_BUILD_TYPE AND - NOT CMAKE_BUILD_TYPE AND - NOT CMAKE_CXX_FLAGS AND - CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - set(CMAKE_BUILD_TYPE RelWithDebInfo) + NOT CMAKE_NO_BUILD_TYPE AND + NOT CMAKE_BUILD_TYPE AND + NOT CMAKE_CXX_FLAGS AND + CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + set(CMAKE_BUILD_TYPE RelWithDebInfo) endif () include(GNUInstallDirs) @@ -103,39 +103,39 @@ set(LIB_VER ${cryptopp_VERSION_MAJOR}${cryptopp_VERSION_MINOR}${cryptopp_VERSION set(CMAKE_MACOSX_RPATH 0) if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - list(APPEND CRYPTOPP_COMPILE_OPTIONS -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180) + list(APPEND CRYPTOPP_COMPILE_OPTIONS -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180) endif () # Also see http://github.com/weidai11/cryptopp/issues/395 if (DISABLE_ASM) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ASM) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ASM) endif () if (DISABLE_SSSE3) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE3) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE3) endif () if (DISABLE_SSE4) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE4) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SSSE4) endif () if (DISABLE_AESNI) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AESNI) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_AESNI) endif () if (DISABLE_SHA) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SHA) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_SHA) endif () if (DISABLE_ALTIVEC) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ALTIVEC) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_ALTIVEC) endif () if (DISABLE_POWER7) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_POWER7) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_POWER7) endif () if (DISABLE_POWER8) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_POWER8) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_POWER8) endif () if (DISABLE_POWER9) - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_POWER9) + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS CRYPTOPP_DISABLE_POWER9) endif () if (NOT CRYPTOPP_DATA_DIR STREQUAL "") - list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "CRYPTOPP_DATA_DIR=${CRYPTOPP_DATA_DIR}") + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "CRYPTOPP_DATA_DIR=${CRYPTOPP_DATA_DIR}") endif () ############################################################################### @@ -144,125 +144,125 @@ endif () # Tru64, HP-UX and a few others need tweaking if (EXISTS /usr/xpg4/bin/grep) - set(GREP_CMD /usr/xpg4/bin/grep) + set(GREP_CMD /usr/xpg4/bin/grep) elseif (EXISTS /usr/gnu/bin/grep) - set(GREP_CMD /usr/gnu/bin/grep) + set(GREP_CMD /usr/gnu/bin/grep) elseif (EXISTS /usr/linux/bin/grep) - set(GREP_CMD /usr/linux/bin/grep) + set(GREP_CMD /usr/linux/bin/grep) else () - set(GREP_CMD grep) + set(GREP_CMD grep) endif () if (EXISTS /usr/xpg4/bin/sed) - set(SED_CMD /usr/xpg4/bin/sed) + set(SED_CMD /usr/xpg4/bin/sed) elseif (EXISTS /usr/gnu/bin/sed) - set(SED_CMD /usr/gnu/bin/sed) + set(SED_CMD /usr/gnu/bin/sed) elseif (EXISTS /usr/linux/bin/sed) - set(SED_CMD /usr/linux/bin/sed) + set(SED_CMD /usr/linux/bin/sed) else () - set(SED_CMD sed) + set(SED_CMD sed) endif () ############################################################################### function(CheckCompileOption opt var) - if (MSVC) + if (MSVC) - # TODO: improve this... - CHECK_CXX_COMPILER_FLAG(${opt} ${var}) + # TODO: improve this... + CHECK_CXX_COMPILER_FLAG(${opt} ${var}) - elseif (CMAKE_CXX_COMPILER_ID MATCHES "SunPro") + elseif (CMAKE_CXX_COMPILER_ID MATCHES "SunPro") - message(STATUS "Performing Test ${var}") - execute_process( - COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} ${opt} -c ${TEST_CXX_FILE} 2>&1" - COMMAND ${GREP_CMD} -i -c -E "illegal value ignored" - RESULT_VARIABLE COMMAND_RESULT - OUTPUT_VARIABLE COMMAND_OUTPUT - OUTPUT_STRIP_TRAILING_WHITESPACE) - - # No dereference below. Thanks for the warning, CMake (not!). - if (COMMAND_RESULT AND NOT COMMAND_OUTPUT) - set(${var} 1 PARENT_SCOPE) - message(STATUS "Performing Test ${var} - Success") - else () - set(${var} 0 PARENT_SCOPE) - message(STATUS "Performing Test ${var} - Failed") - endif () - - # Must use CMAKE_CXX_COMPILER here due to XLC 13.1 and LLVM front-end. - elseif (CMAKE_CXX_COMPILER MATCHES "xlC") - - message(STATUS "Performing Test ${var}") - execute_process( - COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} ${opt} -c ${TEST_CXX_FILE} 2>&1" - COMMAND ${GREP_CMD} -i -c -E "Unrecognized value" - RESULT_VARIABLE COMMAND_RESULT - OUTPUT_VARIABLE COMMAND_OUTPUT - OUTPUT_STRIP_TRAILING_WHITESPACE) - - # No dereference below. Thanks for the warning, CMake (not!). - if (COMMAND_RESULT AND NOT COMMAND_OUTPUT) - set(${var} 1 PARENT_SCOPE) - message(STATUS "Performing Test ${var} - Success") - else () - set(${var} 0 PARENT_SCOPE) - message(STATUS "Performing Test ${var} - Failed") - endif () + message(STATUS "Performing Test ${var}") + execute_process( + COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} ${opt} -c ${TEST_CXX_FILE} 2>&1" + COMMAND ${GREP_CMD} -i -c -E "illegal value ignored" + RESULT_VARIABLE COMMAND_RESULT + OUTPUT_VARIABLE COMMAND_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE) + # No dereference below. Thanks for the warning, CMake (not!). + if (COMMAND_RESULT AND NOT COMMAND_OUTPUT) + set(${var} 1 PARENT_SCOPE) + message(STATUS "Performing Test ${var} - Success") else () - - CHECK_CXX_COMPILER_FLAG(${opt} ${var}) - + set(${var} 0 PARENT_SCOPE) + message(STATUS "Performing Test ${var} - Failed") endif () + # Must use CMAKE_CXX_COMPILER here due to XLC 13.1 and LLVM front-end. + elseif (CMAKE_CXX_COMPILER MATCHES "xlC") + + message(STATUS "Performing Test ${var}") + execute_process( + COMMAND sh -c "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} ${opt} -c ${TEST_CXX_FILE} 2>&1" + COMMAND ${GREP_CMD} -i -c -E "Unrecognized value" + RESULT_VARIABLE COMMAND_RESULT + OUTPUT_VARIABLE COMMAND_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE) + + # No dereference below. Thanks for the warning, CMake (not!). + if (COMMAND_RESULT AND NOT COMMAND_OUTPUT) + 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 () + + CHECK_CXX_COMPILER_FLAG(${opt} ${var}) + + endif () + endfunction(CheckCompileOption) function(CheckCompileLinkOption opt var prog) - if (MSVC) + if (MSVC) - # TODO: improve this... - CHECK_CXX_COMPILER_FLAG(${opt} ${var}) + # TODO: improve this... + CHECK_CXX_COMPILER_FLAG(${opt} ${var}) + 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") 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") - else () - set(${var} 0 PARENT_SCOPE) - message(STATUS "Performing Test ${var} - Failed") - endif () - + set(${var} 0 PARENT_SCOPE) + message(STATUS "Performing Test ${var} - Failed") endif () + endif () + endfunction(CheckCompileLinkOption) function(AddCompileOption opt) if ("${COMMAND_OUTPUT}" NOT STREQUAL "") - list(APPEND CRYPTOPP_COMPILE_OPTIONS "${opt}") + list(APPEND CRYPTOPP_COMPILE_OPTIONS "${opt}") endif () endfunction(AddCompileOption) @@ -271,22 +271,22 @@ endfunction(AddCompileOption) function(DumpMachine output pattern) - if (MSVC) + if (MSVC) - # CMake does not provide a generic shell/terminal mechanism - # and Microsoft environments don't know what 'sh' is. - set(${output} 0 PARENT_SCOPE) + # CMake does not provide a generic shell/terminal mechanism + # and Microsoft environments don't know what 'sh' is. + set(${output} 0 PARENT_SCOPE) - else () + 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) + 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) - endif() + endif() endfunction(DumpMachine) @@ -312,66 +312,66 @@ DumpMachine(CRYPTOPP_POWERPC64 "ppc64") # Test SunCC for a string like 'CC: Sun C++ 5.13 SunOS_i386' if (NOT CRYPTOPP_SOLARIS) - execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} -V 2>&1" - COMMAND ${GREP_CMD} -i -c "SunOS" - OUTPUT_VARIABLE CRYPTOPP_SOLARIS - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} -V 2>&1" + COMMAND ${GREP_CMD} -i -c "SunOS" + OUTPUT_VARIABLE CRYPTOPP_SOLARIS + OUTPUT_STRIP_TRAILING_WHITESPACE) endif () # Test GCC for a string like 'i386-pc-solaris2.11' if (NOT CRYPTOPP_SOLARIS) - execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" - COMMAND ${GREP_CMD} -i -c "Solaris" - OUTPUT_VARIABLE CRYPTOPP_SOLARIS - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" + COMMAND ${GREP_CMD} -i -c "Solaris" + OUTPUT_VARIABLE CRYPTOPP_SOLARIS + OUTPUT_STRIP_TRAILING_WHITESPACE) endif () # Fixup PowerPC. If both 32-bit and 64-bit use 64-bit. if (CRYPTOPP_POWERPC AND CRYPTOPP_POWERPC64) - unset(CRYPTOPP_POWERPC) + unset(CRYPTOPP_POWERPC) endif () # Fixup for xlC compiler. -dumpmachine fails so we miss PowerPC # TODO: something better than proxying the platform via compiler # 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) + message ("-- Fixing platform due to IBM xlC") + set(CRYPTOPP_POWERPC64 1) endif () # DumpMachine SunCC style if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - # SunCC is 32-bit, but it builds both 32 and 64 bit. Use - execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} -V 2>&1" - COMMAND ${GREP_CMD} -i -c "Sparc" - OUTPUT_VARIABLE CRYPTOPP_SPARC - OUTPUT_STRIP_TRAILING_WHITESPACE) + # SunCC is 32-bit, but it builds both 32 and 64 bit. Use + execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} -V 2>&1" + COMMAND ${GREP_CMD} -i -c "Sparc" + OUTPUT_VARIABLE CRYPTOPP_SPARC + OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} -V 2>&1" - COMMAND ${GREP_CMD} -i -c -E "i386|i86" - OUTPUT_VARIABLE CRYPTOPP_I386 - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND sh -c "${CMAKE_CXX_COMPILER} -V 2>&1" + COMMAND ${GREP_CMD} -i -c -E "i386|i86" + OUTPUT_VARIABLE CRYPTOPP_I386 + OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND isainfo -k - COMMAND ${GREP_CMD} -i -c "i386" - OUTPUT_VARIABLE KERNEL_I386 - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND isainfo -k + COMMAND ${GREP_CMD} -i -c "i386" + OUTPUT_VARIABLE KERNEL_I386 + OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND isainfo -k - COMMAND ${GREP_CMD} -i -c "amd64" - OUTPUT_VARIABLE KERNEL_AMD64 - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND isainfo -k + COMMAND ${GREP_CMD} -i -c "amd64" + OUTPUT_VARIABLE KERNEL_AMD64 + OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND isainfo -k - COMMAND ${GREP_CMD} -i -c "Sparc" - OUTPUT_VARIABLE KERNEL_SPARC - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND isainfo -k + COMMAND ${GREP_CMD} -i -c "Sparc" + OUTPUT_VARIABLE KERNEL_SPARC + OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND isainfo -k - COMMAND ${GREP_CMD} -i -c -E "UltraSarc|Sparc64|SparcV9" - OUTPUT_VARIABLE KERNEL_SPARC64 - OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND isainfo -k + COMMAND ${GREP_CMD} -i -c -E "UltraSarc|Sparc64|SparcV9" + OUTPUT_VARIABLE KERNEL_SPARC64 + OUTPUT_STRIP_TRAILING_WHITESPACE) endif () @@ -379,125 +379,125 @@ 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) + 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") + 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) + 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 + 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 () + # 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 () + 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 () + # 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 () + 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 () + # 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\"") + if (CMAKE_SYSTEM_VERSION MATCHES "10\\.0.*") + list(APPEND CRYPTOPP_COMPILE_DEFINITIONS "_WIN32_WINNT=0x0A00") + endif () + #list(APPEND CRYPTOPP_COMPILE_OPTIONS "/FI\"winapifamily.h\"") endif () # Enable PIC for all target machines except 32-bit i386 due to register pressures. if (NOT CRYPTOPP_I386) - SET(CMAKE_POSITION_INDEPENDENT_CODE 1) + SET(CMAKE_POSITION_INDEPENDENT_CODE 1) endif () # IBM XLC compiler options for AIX and Linux. # Must use CMAKE_CXX_COMPILER here due to XLC 13.1 and LLVM front-end. if (CMAKE_CXX_COMPILER MATCHES "xlC") - #CheckCompileLinkOption("-qxlcompatmacros" CRYPTOPP_XLC_COMPAT "${TEST_CXX_FILE}") - #if (CRYPTOPP_XLC_COMPAT) - # list(APPEND CRYPTOPP_COMPILE_OPTIONS "-qxlcompatmacros") - #endif () + #CheckCompileLinkOption("-qxlcompatmacros" CRYPTOPP_XLC_COMPAT "${TEST_CXX_FILE}") + #if (CRYPTOPP_XLC_COMPAT) + # list(APPEND CRYPTOPP_COMPILE_OPTIONS "-qxlcompatmacros") + #endif () - CheckCompileLinkOption("-qrtti" CRYPTOPP_PPC_RTTI "${TEST_CXX_FILE}") - if (CRYPTOPP_PPC_RTTI) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-qrtti") - endif () + CheckCompileLinkOption("-qrtti" CRYPTOPP_PPC_RTTI "${TEST_CXX_FILE}") + if (CRYPTOPP_PPC_RTTI) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-qrtti") + endif () - CheckCompileLinkOption("-qmaxmem=-1" CRYPTOPP_PPC_MAXMEM "${TEST_CXX_FILE}") - if (CRYPTOPP_PPC_MAXMEM) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-qmaxmem=-1") - endif () + CheckCompileLinkOption("-qmaxmem=-1" CRYPTOPP_PPC_MAXMEM "${TEST_CXX_FILE}") + if (CRYPTOPP_PPC_MAXMEM) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-qmaxmem=-1") + endif () - CheckCompileLinkOption("-qthreaded" CRYPTOPP_PPC_THREADED "${TEST_CXX_FILE}") - if (CRYPTOPP_PPC_THREADED) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-qthreaded") - endif () + CheckCompileLinkOption("-qthreaded" CRYPTOPP_PPC_THREADED "${TEST_CXX_FILE}") + if (CRYPTOPP_PPC_THREADED) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-qthreaded") + endif () endif () # Solaris specific if (CRYPTOPP_SOLARIS) - # SunCC needs -template=no%extdef - if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-template=no%extdef") - endif () + # SunCC needs -template=no%extdef + if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-template=no%extdef") + endif () - # SunCC needs -xregs=no%appl on Sparc (not x86) for libraries (not test program) - # TODO: wire this up properly - if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro" AND (CRYPTOPP_SPARC OR CRYPTOPP_SPARC64)) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-xregs=no%appl") - endif () + # SunCC needs -xregs=no%appl on Sparc (not x86) for libraries (not test program) + # TODO: wire this up properly + if (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro" AND (CRYPTOPP_SPARC OR CRYPTOPP_SPARC64)) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-xregs=no%appl") + endif () - # GCC needs to enable use of '/' for division in the assembler - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-Wa,--divide") - endif () + # GCC needs to enable use of '/' for division in the assembler + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-Wa,--divide") + endif () endif () @@ -510,79 +510,79 @@ file(GLOB cryptopp_HEADERS ${SRC_DIR}/*.h) # Remove headers used to build test suite list(REMOVE_ITEM cryptopp_HEADERS - ${SRC_DIR}/bench.h - ${SRC_DIR}/validate.h - ) + ${SRC_DIR}/bench.h + ${SRC_DIR}/validate.h + ) # Test sources. You can use the GNUmakefile to generate the list: `make sources`. set(cryptopp_SOURCES_TEST - ${SRC_DIR}/test.cpp - ${SRC_DIR}/bench1.cpp - ${SRC_DIR}/bench2.cpp - ${SRC_DIR}/bench3.cpp - ${SRC_DIR}/validat0.cpp - ${SRC_DIR}/validat1.cpp - ${SRC_DIR}/validat2.cpp - ${SRC_DIR}/validat3.cpp - ${SRC_DIR}/validat4.cpp - ${SRC_DIR}/validat5.cpp - ${SRC_DIR}/validat6.cpp - ${SRC_DIR}/validat7.cpp - ${SRC_DIR}/validat8.cpp - ${SRC_DIR}/validat9.cpp - ${SRC_DIR}/validat10.cpp - ${SRC_DIR}/regtest1.cpp - ${SRC_DIR}/regtest2.cpp - ${SRC_DIR}/regtest3.cpp - ${SRC_DIR}/regtest4.cpp - ${SRC_DIR}/datatest.cpp - ${SRC_DIR}/fipsalgt.cpp - ${SRC_DIR}/fipstest.cpp - ${SRC_DIR}/dlltest.cpp - #${SRC_DIR}/adhoc.cpp - ) + ${SRC_DIR}/test.cpp + ${SRC_DIR}/bench1.cpp + ${SRC_DIR}/bench2.cpp + ${SRC_DIR}/bench3.cpp + ${SRC_DIR}/validat0.cpp + ${SRC_DIR}/validat1.cpp + ${SRC_DIR}/validat2.cpp + ${SRC_DIR}/validat3.cpp + ${SRC_DIR}/validat4.cpp + ${SRC_DIR}/validat5.cpp + ${SRC_DIR}/validat6.cpp + ${SRC_DIR}/validat7.cpp + ${SRC_DIR}/validat8.cpp + ${SRC_DIR}/validat9.cpp + ${SRC_DIR}/validat10.cpp + ${SRC_DIR}/regtest1.cpp + ${SRC_DIR}/regtest2.cpp + ${SRC_DIR}/regtest3.cpp + ${SRC_DIR}/regtest4.cpp + ${SRC_DIR}/datatest.cpp + ${SRC_DIR}/fipsalgt.cpp + ${SRC_DIR}/fipstest.cpp + ${SRC_DIR}/dlltest.cpp + #${SRC_DIR}/adhoc.cpp + ) # Library sources. You can use the GNUmakefile to generate the list: `make sources`. # Makefile sorted them at http://github.com/weidai11/cryptopp/pull/426. file(GLOB cryptopp_SOURCES ${SRC_DIR}/*.cpp) list(SORT cryptopp_SOURCES) list(REMOVE_ITEM cryptopp_SOURCES - ${SRC_DIR}/cryptlib.cpp - ${SRC_DIR}/cpu.cpp - ${SRC_DIR}/integer.cpp - ${SRC_DIR}/pch.cpp - ${SRC_DIR}/simple.cpp - ${SRC_DIR}/adhoc.cpp - ${cryptopp_SOURCES_TEST} - ) + ${SRC_DIR}/cryptlib.cpp + ${SRC_DIR}/cpu.cpp + ${SRC_DIR}/integer.cpp + ${SRC_DIR}/pch.cpp + ${SRC_DIR}/simple.cpp + ${SRC_DIR}/adhoc.cpp + ${cryptopp_SOURCES_TEST} + ) set(cryptopp_SOURCES - ${SRC_DIR}/cryptlib.cpp - ${SRC_DIR}/cpu.cpp - ${SRC_DIR}/integer.cpp - ${cryptopp_SOURCES} - ) + ${SRC_DIR}/cryptlib.cpp + ${SRC_DIR}/cpu.cpp + ${SRC_DIR}/integer.cpp + ${cryptopp_SOURCES} + ) set(cryptopp_SOURCES_ASM) if (MSVC AND NOT DISABLE_ASM) - if (${CMAKE_GENERATOR} MATCHES ".*ARM") - message(STATUS "Disabling ASM because ARM is specified as target platform.") + if (${CMAKE_GENERATOR} MATCHES ".*ARM") + message(STATUS "Disabling ASM because ARM is specified as target platform.") + else () + enable_language(ASM_MASM) + list(APPEND cryptopp_SOURCES_ASM + ${SRC_DIR}/rdrand.asm + ) + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND cryptopp_SOURCES_ASM + ${SRC_DIR}/x64dll.asm + ${SRC_DIR}/x64masm.asm + ) + set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES COMPILE_DEFINITIONS "_M_X64") else () - enable_language(ASM_MASM) - list(APPEND cryptopp_SOURCES_ASM - ${SRC_DIR}/rdrand.asm - ) - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - list(APPEND cryptopp_SOURCES_ASM - ${SRC_DIR}/x64dll.asm - ${SRC_DIR}/x64masm.asm - ) - set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES COMPILE_DEFINITIONS "_M_X64") - else () - set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES COMPILE_DEFINITIONS "_M_X86" COMPILE_FLAGS "/safeseh") - endif () - set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES LANGUAGE ASM_MASM) + set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES COMPILE_DEFINITIONS "_M_X86" COMPILE_FLAGS "/safeseh") endif () + set_source_files_properties(${cryptopp_SOURCES_ASM} PROPERTIES LANGUAGE ASM_MASM) + endif () endif () #============================================================================ @@ -595,375 +595,375 @@ 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 OR CRYPTOPP_X32) - CheckCompileLinkOption("-msse2" CRYPTOPP_IA32_SSE2 - "${TEST_PROG_DIR}/test_x86_sse2.cxx") - CheckCompileLinkOption("-mssse3" CRYPTOPP_IA32_SSSE3 - "${TEST_PROG_DIR}/test_x86_ssse3.cxx") - CheckCompileLinkOption("-msse4.1" CRYPTOPP_IA32_SSE41 - "${TEST_PROG_DIR}/test_x86_sse41.cxx") - CheckCompileLinkOption("-msse4.2" CRYPTOPP_IA32_SSE42 - "${TEST_PROG_DIR}/test_x86_sse42.cxx") - CheckCompileLinkOption("-mssse3 -mpclmul" CRYPTOPP_IA32_CLMUL - "${TEST_PROG_DIR}/test_x86_clmul.cxx") - CheckCompileLinkOption("-msse4.1 -maes" CRYPTOPP_IA32_AES - "${TEST_PROG_DIR}/test_x86_aes.cxx") - CheckCompileLinkOption("-mavx" CRYPTOPP_IA32_AVX - "${TEST_PROG_DIR}/test_x86_avx.cxx") - CheckCompileLinkOption("-mavx2" CRYPTOPP_IA32_AVX2 - "${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") - - # https://github.com/weidai11/cryptopp/issues/756 - if (NOT CRYPTOPP_MIXED_ASM) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_MIXED_ASM") - endif () - - if (NOT CRYPTOPP_IA32_SSE2 AND NOT DISABLE_ASM) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ASM") - elseif (CRYPTOPP_IA32_SSE2 AND NOT DISABLE_ASM) - set_source_files_properties(${SRC_DIR}/sse_simd.cpp PROPERTIES COMPILE_FLAGS "-msse2") - set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "-msse2") - set_source_files_properties(${SRC_DIR}/donna_sse.cpp PROPERTIES COMPILE_FLAGS "-msse2") - endif () - if (NOT CRYPTOPP_IA32_SSSE3 AND NOT DISABLE_SSSE3) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSSE3") - elseif (CRYPTOPP_IA32_SSSE3 AND NOT DISABLE_SSSE3) - set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3") - 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) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSE4") - 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) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_CLMUL") - elseif (CRYPTOPP_IA32_CLMUL AND NOT DISABLE_AES) - 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 () - if (NOT CRYPTOPP_IA32_AES AND NOT DISABLE_AES) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AESNI") - elseif (CRYPTOPP_IA32_AES AND NOT DISABLE_AES) - set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1 -maes") - set_source_files_properties(${SRC_DIR}/sm4_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3 -maes") - endif () - #if (NOT CRYPTOPP_IA32_AVX AND NOT DISABLE_AVX) - # list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AVX") - #elseif (CRYPTOPP_IA32_AVX AND NOT DISABLE_AVX) - # set_source_files_properties(${SRC_DIR}/XXX_avx.cpp PROPERTIES COMPILE_FLAGS "-mavx") - #endif () - if (NOT CRYPTOPP_IA32_AVX2 AND NOT DISABLE_AVX2) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AVX2") - elseif (CRYPTOPP_IA32_AVX2 AND NOT DISABLE_AVX2) - set_source_files_properties(${SRC_DIR}/chacha_avx.cpp PROPERTIES COMPILE_FLAGS "-mavx2") - endif () - if (NOT CRYPTOPP_IA32_SHA AND NOT DISABLE_SHA) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SHANI") - elseif (CRYPTOPP_IA32_SHA AND NOT DISABLE_SHA) - set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha") - set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha") - endif () - endif () - endif () - - elseif (CRYPTOPP_AARCH32 OR CRYPTOPP_AARCH64) - - 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) - - if (CRYPTOPP_ARMV8A_ASIMD) - set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") - set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") - set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") - set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") - 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) - set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crc") - endif () - if (CRYPTOPP_ARMV8A_CRYPTO) - set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") - set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") - set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") - set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") - set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") - endif () - - elseif (CRYPTOPP_ARM OR CRYPTOPP_ARMHF) - - # 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") - - 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") - 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}") - endif () - - elseif (CRYPTOPP_POWERPC OR CRYPTOPP_POWERPC64) - - 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_POWER8_FLAGS "-qarch=pwr8 -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") - endif () - - CheckCompileLinkOption("${CRYPTOPP_ALTIVEC_FLAGS}" PPC_ALTIVEC_FLAG - "${TEST_PROG_DIR}/test_ppc_altivec.cxx") - - # Hack for XLC - if (CMAKE_CXX_COMPILER MATCHES "xlC") - if (NOT PPC_ALTIVEC_FLAG) - CheckCompileLinkOption("${CRYPTOPP_POWER4_FLAGS}" PPC_POWER4_FLAG - "${TEST_PROG_DIR}/test_ppc_altivec.cxx") - if (PPC_POWER4_FLAG) - set(PPC_ALTIVEC_FLAG 1) - set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER4_FLAGS}") - endif () - endif () - if (NOT PPC_ALTIVEC_FLAG) - CheckCompileLinkOption("${CRYPTOPP_POWER5_FLAGS}" PPC_POWER5_FLAG - "${TEST_PROG_DIR}/test_ppc_altivec.cxx") - if (PPC_POWER5_FLAG) - set(PPC_ALTIVEC_FLAG 1) - set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER5_FLAGS}") - endif () - endif () - if (NOT PPC_ALTIVEC_FLAG) - CheckCompileLinkOption("${CRYPTOPP_POWER6_FLAGS}" PPC_POWER6_FLAG - "${TEST_PROG_DIR}/test_ppc_altivec.cxx") - if (PPC_POWER6_FLAG) - set(PPC_ALTIVEC_FLAG 1) - set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER6_FLAGS}") - endif () - endif () - endif () - - CheckCompileLinkOption("${CRYPTOPP_POWER7_FLAGS}" PPC_POWER7_FLAG - "${TEST_PROG_DIR}/test_ppc_power7.cxx") - - 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") - - 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}/blake2b_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}/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}) - set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) - set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) - endif () - - 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}) - endif () - - # Drop to Power7 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}) - endif () - endif () - - if (NOT PPC_ALTIVEC_FLAG) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ALTIVEC") - elseif (NOT PPC_POWER7_FLAG) - 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") - endif () + CheckCompileLinkOption("-msse2" CRYPTOPP_IA32_SSE2 + "${TEST_PROG_DIR}/test_x86_sse2.cxx") + CheckCompileLinkOption("-mssse3" CRYPTOPP_IA32_SSSE3 + "${TEST_PROG_DIR}/test_x86_ssse3.cxx") + CheckCompileLinkOption("-msse4.1" CRYPTOPP_IA32_SSE41 + "${TEST_PROG_DIR}/test_x86_sse41.cxx") + CheckCompileLinkOption("-msse4.2" CRYPTOPP_IA32_SSE42 + "${TEST_PROG_DIR}/test_x86_sse42.cxx") + CheckCompileLinkOption("-mssse3 -mpclmul" CRYPTOPP_IA32_CLMUL + "${TEST_PROG_DIR}/test_x86_clmul.cxx") + CheckCompileLinkOption("-msse4.1 -maes" CRYPTOPP_IA32_AES + "${TEST_PROG_DIR}/test_x86_aes.cxx") + CheckCompileLinkOption("-mavx" CRYPTOPP_IA32_AVX + "${TEST_PROG_DIR}/test_x86_avx.cxx") + CheckCompileLinkOption("-mavx2" CRYPTOPP_IA32_AVX2 + "${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") + # https://github.com/weidai11/cryptopp/issues/756 + if (NOT CRYPTOPP_MIXED_ASM) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_MIXED_ASM") endif () + + if (NOT CRYPTOPP_IA32_SSE2 AND NOT DISABLE_ASM) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ASM") + elseif (CRYPTOPP_IA32_SSE2 AND NOT DISABLE_ASM) + set_source_files_properties(${SRC_DIR}/sse_simd.cpp PROPERTIES COMPILE_FLAGS "-msse2") + set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "-msse2") + set_source_files_properties(${SRC_DIR}/donna_sse.cpp PROPERTIES COMPILE_FLAGS "-msse2") + endif () + if (NOT CRYPTOPP_IA32_SSSE3 AND NOT DISABLE_SSSE3) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSSE3") + elseif (CRYPTOPP_IA32_SSSE3 AND NOT DISABLE_SSSE3) + set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3") + 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) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SSE4") + 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) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_CLMUL") + elseif (CRYPTOPP_IA32_CLMUL AND NOT DISABLE_AES) + 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 () + if (NOT CRYPTOPP_IA32_AES AND NOT DISABLE_AES) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AESNI") + elseif (CRYPTOPP_IA32_AES AND NOT DISABLE_AES) + set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.1 -maes") + set_source_files_properties(${SRC_DIR}/sm4_simd.cpp PROPERTIES COMPILE_FLAGS "-mssse3 -maes") + endif () + #if (NOT CRYPTOPP_IA32_AVX AND NOT DISABLE_AVX) + # list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AVX") + #elseif (CRYPTOPP_IA32_AVX AND NOT DISABLE_AVX) + # set_source_files_properties(${SRC_DIR}/XXX_avx.cpp PROPERTIES COMPILE_FLAGS "-mavx") + #endif () + if (NOT CRYPTOPP_IA32_AVX2 AND NOT DISABLE_AVX2) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_AVX2") + elseif (CRYPTOPP_IA32_AVX2 AND NOT DISABLE_AVX2) + set_source_files_properties(${SRC_DIR}/chacha_avx.cpp PROPERTIES COMPILE_FLAGS "-mavx2") + endif () + if (NOT CRYPTOPP_IA32_SHA AND NOT DISABLE_SHA) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_SHANI") + elseif (CRYPTOPP_IA32_SHA AND NOT DISABLE_SHA) + set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha") + set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-msse4.2 -msha") + endif () + endif () + endif () + + elseif (CRYPTOPP_AARCH32 OR CRYPTOPP_AARCH64) + + 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) + + if (CRYPTOPP_ARMV8A_ASIMD) + set_source_files_properties(${SRC_DIR}/aria_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") + set_source_files_properties(${SRC_DIR}/blake2s_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") + set_source_files_properties(${SRC_DIR}/blake2b_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") + set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a") + 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) + set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crc") + endif () + if (CRYPTOPP_ARMV8A_CRYPTO) + set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") + set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") + set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") + set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") + set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-march=armv8-a+crypto") + endif () + + elseif (CRYPTOPP_ARM OR CRYPTOPP_ARMHF) + + # 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") + + 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") + 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}") + endif () + + elseif (CRYPTOPP_POWERPC OR CRYPTOPP_POWERPC64) + + 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_POWER8_FLAGS "-qarch=pwr8 -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") + endif () + + CheckCompileLinkOption("${CRYPTOPP_ALTIVEC_FLAGS}" PPC_ALTIVEC_FLAG + "${TEST_PROG_DIR}/test_ppc_altivec.cxx") + + # Hack for XLC + if (CMAKE_CXX_COMPILER MATCHES "xlC") + if (NOT PPC_ALTIVEC_FLAG) + CheckCompileLinkOption("${CRYPTOPP_POWER4_FLAGS}" PPC_POWER4_FLAG + "${TEST_PROG_DIR}/test_ppc_altivec.cxx") + if (PPC_POWER4_FLAG) + set(PPC_ALTIVEC_FLAG 1) + set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER4_FLAGS}") + endif () + endif () + if (NOT PPC_ALTIVEC_FLAG) + CheckCompileLinkOption("${CRYPTOPP_POWER5_FLAGS}" PPC_POWER5_FLAG + "${TEST_PROG_DIR}/test_ppc_altivec.cxx") + if (PPC_POWER5_FLAG) + set(PPC_ALTIVEC_FLAG 1) + set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER5_FLAGS}") + endif () + endif () + if (NOT PPC_ALTIVEC_FLAG) + CheckCompileLinkOption("${CRYPTOPP_POWER6_FLAGS}" PPC_POWER6_FLAG + "${TEST_PROG_DIR}/test_ppc_altivec.cxx") + if (PPC_POWER6_FLAG) + set(PPC_ALTIVEC_FLAG 1) + set(CRYPTOPP_ALTIVEC_FLAGS "${CRYPTOPP_POWER6_FLAGS}") + endif () + endif () + endif () + + CheckCompileLinkOption("${CRYPTOPP_POWER7_FLAGS}" PPC_POWER7_FLAG + "${TEST_PROG_DIR}/test_ppc_power7.cxx") + + 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") + + 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}/blake2b_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}/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}) + set_source_files_properties(${SRC_DIR}/simon128_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) + set_source_files_properties(${SRC_DIR}/speck128_simd.cpp PROPERTIES COMPILE_FLAGS ${CRYPTOPP_POWER8_FLAGS}) + endif () + + 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}) + endif () + + # Drop to Power7 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}) + endif () + endif () + + if (NOT PPC_ALTIVEC_FLAG) + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-DCRYPTOPP_DISABLE_ALTIVEC") + elseif (NOT PPC_POWER7_FLAG) + 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") + endif () + + endif () 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 OR CRYPTOPP_X32) - CheckCompileLinkOption("-xarch=sse2" CRYPTOPP_IA32_SSE2 - "${TEST_PROG_DIR}/test_x86_sse2.cxx") - CheckCompileLinkOption("-xarch=ssse3" CRYPTOPP_IA32_SSSE3 - "${TEST_PROG_DIR}/test_x86_ssse3.cxx") - CheckCompileLinkOption("-xarch=sse4_1" CRYPTOPP_IA32_SSE41 - "${TEST_PROG_DIR}/test_x86_sse41.cxx") - CheckCompileLinkOption("-xarch=sse4_2" CRYPTOPP_IA32_SSE42 - "${TEST_PROG_DIR}/test_x86_sse42.cxx") - CheckCompileLinkOption("-xarch=aes" CRYPTOPP_IA32_CLMUL - "${TEST_PROG_DIR}/test_x86_clmul.cxx") - CheckCompileLinkOption("-xarch=aes" CRYPTOPP_IA32_AES - "${TEST_PROG_DIR}/test_x86_aes.cxx") - CheckCompileLinkOption("-xarch=avx" CRYPTOPP_IA32_AVX - "${TEST_PROG_DIR}/test_x86_avx.cxx") - CheckCompileLinkOption("-xarch=avx2" CRYPTOPP_IA32_AVX2 - "${TEST_PROG_DIR}/test_x86_avx2.cxx") - CheckCompileLinkOption("-xarch=sha" CRYPTOPP_IA32_SHA - "${TEST_PROG_DIR}/test_x86_sha.cxx") + CheckCompileLinkOption("-xarch=sse2" CRYPTOPP_IA32_SSE2 + "${TEST_PROG_DIR}/test_x86_sse2.cxx") + CheckCompileLinkOption("-xarch=ssse3" CRYPTOPP_IA32_SSSE3 + "${TEST_PROG_DIR}/test_x86_ssse3.cxx") + CheckCompileLinkOption("-xarch=sse4_1" CRYPTOPP_IA32_SSE41 + "${TEST_PROG_DIR}/test_x86_sse41.cxx") + CheckCompileLinkOption("-xarch=sse4_2" CRYPTOPP_IA32_SSE42 + "${TEST_PROG_DIR}/test_x86_sse42.cxx") + CheckCompileLinkOption("-xarch=aes" CRYPTOPP_IA32_CLMUL + "${TEST_PROG_DIR}/test_x86_clmul.cxx") + CheckCompileLinkOption("-xarch=aes" CRYPTOPP_IA32_AES + "${TEST_PROG_DIR}/test_x86_aes.cxx") + CheckCompileLinkOption("-xarch=avx" CRYPTOPP_IA32_AVX + "${TEST_PROG_DIR}/test_x86_avx.cxx") + CheckCompileLinkOption("-xarch=avx2" CRYPTOPP_IA32_AVX2 + "${TEST_PROG_DIR}/test_x86_avx2.cxx") + CheckCompileLinkOption("-xarch=sha" CRYPTOPP_IA32_SHA + "${TEST_PROG_DIR}/test_x86_sha.cxx") - # Each -xarch=XXX options must be added to LDFLAGS if the option is used during a compile. - set(XARCH_LDFLAGS "") - - if (CRYPTOPP_IA32_SSE2 AND NOT DISABLE_ASM) - set_source_files_properties(${SRC_DIR}/sse_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse2") - set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse2") - set(XARCH_LDFLAGS "-xarch=sse2") - endif () - if (CRYPTOPP_IA32_SSSE3 AND NOT DISABLE_SSSE3) - 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) - set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_2") - set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=sse4_2") - if (CRYPTOPP_IA32_CLMUL AND NOT DISABLE_CLMUL) - set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=aes") - set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=aes") - endif () - if (CRYPTOPP_IA32_AES AND NOT DISABLE_AES) - set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=aes") - set_source_files_properties(${SRC_DIR}/sm4_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=aes") - set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=aes") - endif () - #if (CRYPTOPP_IA32_AVX AND NOT DISABLE_AVX) - # set_source_files_properties(${SRC_DIR}/XXX_avx.cpp PROPERTIES COMPILE_FLAGS "-xarch=avx2") - # set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=avx") - #endif () - if (CRYPTOPP_IA32_AVX2 AND NOT DISABLE_AVX2) - set_source_files_properties(${SRC_DIR}/chacha_avx.cpp PROPERTIES COMPILE_FLAGS "-xarch=avx2") - set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=avx2") - endif () - if (CRYPTOPP_IA32_SHA AND NOT DISABLE_SHA) - set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sha") - set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sha") - set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=sha") - endif () - endif () - endif () - - # https://stackoverflow.com/a/6088646/608639 - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${XARCH_LDFLAGS} -M${SRC_DIR}/cryptopp.mapfile") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${XARCH_LDFLAGS} -M${SRC_DIR}/cryptopp.mapfile") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${XARCH_LDFLAGS} -M${SRC_DIR}/cryptopp.mapfile") - - # elseif (CRYPTOPP_SPARC OR CRYPTOPP_SPARC64) + # Each -xarch=XXX options must be added to LDFLAGS if the option is used during a compile. + set(XARCH_LDFLAGS "") + if (CRYPTOPP_IA32_SSE2 AND NOT DISABLE_ASM) + set_source_files_properties(${SRC_DIR}/sse_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse2") + set_source_files_properties(${SRC_DIR}/chacha_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse2") + set(XARCH_LDFLAGS "-xarch=sse2") endif () + if (CRYPTOPP_IA32_SSSE3 AND NOT DISABLE_SSSE3) + 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) + set_source_files_properties(${SRC_DIR}/crc_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sse4_2") + set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=sse4_2") + if (CRYPTOPP_IA32_CLMUL AND NOT DISABLE_CLMUL) + set_source_files_properties(${SRC_DIR}/gcm_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=aes") + set_source_files_properties(${SRC_DIR}/gf2n_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=aes") + endif () + if (CRYPTOPP_IA32_AES AND NOT DISABLE_AES) + set_source_files_properties(${SRC_DIR}/rijndael_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=aes") + set_source_files_properties(${SRC_DIR}/sm4_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=aes") + set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=aes") + endif () + #if (CRYPTOPP_IA32_AVX AND NOT DISABLE_AVX) + # set_source_files_properties(${SRC_DIR}/XXX_avx.cpp PROPERTIES COMPILE_FLAGS "-xarch=avx2") + # set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=avx") + #endif () + if (CRYPTOPP_IA32_AVX2 AND NOT DISABLE_AVX2) + set_source_files_properties(${SRC_DIR}/chacha_avx.cpp PROPERTIES COMPILE_FLAGS "-xarch=avx2") + set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=avx2") + endif () + if (CRYPTOPP_IA32_SHA AND NOT DISABLE_SHA) + set_source_files_properties(${SRC_DIR}/sha_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sha") + set_source_files_properties(${SRC_DIR}/shacal2_simd.cpp PROPERTIES COMPILE_FLAGS "-xarch=sha") + set(XARCH_LDFLAGS "${XARCH_LDFLAGS} -xarch=sha") + endif () + endif () + endif () + + # https://stackoverflow.com/a/6088646/608639 + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${XARCH_LDFLAGS} -M${SRC_DIR}/cryptopp.mapfile") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${XARCH_LDFLAGS} -M${SRC_DIR}/cryptopp.mapfile") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${XARCH_LDFLAGS} -M${SRC_DIR}/cryptopp.mapfile") + + # elseif (CRYPTOPP_SPARC OR CRYPTOPP_SPARC64) + + endif () endif () # Attempt to determine a suitable native option @@ -971,16 +971,16 @@ if (CRYPTOPP_NATIVE_ARCH) CheckCompileOption("-march=native" NATIVE_ARCH) if (NATIVE_ARCH) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-march=native") + list(APPEND CRYPTOPP_COMPILE_OPTIONS "-march=native") else () - CheckCompileOption("-native" NATIVE_ARCH) - if (NATIVE_ARCH) - list(APPEND CRYPTOPP_COMPILE_OPTIONS "-native") - endif () + 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") + message(WARNING "CRYPTOPP_NATIVE_ARCH enabled, but failed to detect native architecture option") endif () endif() @@ -993,80 +993,80 @@ endif() # target_compile_xxxx commands # !!! DO NOT try to use the old way for newer version - it does not work !!! function(cryptopp_target_compile_properties target) - if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.11") - target_compile_definitions(${target} PUBLIC ${CRYPTOPP_COMPILE_DEFINITIONS}) - else() - string (REPLACE ";" " " PROP_STR "${CRYPTOPP_COMPILE_DEFINITIONS}") - 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}) - else() - string (REPLACE ";" " " PROP_STR "${CRYPTOPP_COMPILE_OPTIONS}") - set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${PROP_STR}") - endif() + if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.11") + target_compile_definitions(${target} PUBLIC ${CRYPTOPP_COMPILE_DEFINITIONS}) + else() + string (REPLACE ";" " " PROP_STR "${CRYPTOPP_COMPILE_DEFINITIONS}") + 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}) + else() + string (REPLACE ";" " " PROP_STR "${CRYPTOPP_COMPILE_OPTIONS}") + set_target_properties(${target} PROPERTIES COMPILE_FLAGS "${PROP_STR}") + endif() endfunction() set(cryptopp_LIBRARY_SOURCES ${cryptopp_SOURCES_ASM}) if (USE_INTERMEDIATE_OBJECTS_TARGET AND NOT ${CMAKE_VERSION} VERSION_LESS "2.8.8") - add_library(cryptopp-object OBJECT ${cryptopp_SOURCES}) - cryptopp_target_compile_properties(cryptopp-object) + add_library(cryptopp-object OBJECT ${cryptopp_SOURCES}) + cryptopp_target_compile_properties(cryptopp-object) - list(APPEND cryptopp_LIBRARY_SOURCES - $ - ) + list(APPEND cryptopp_LIBRARY_SOURCES + $ + ) else () - list(APPEND cryptopp_LIBRARY_SOURCES - ${cryptopp_SOURCES} - ) + list(APPEND cryptopp_LIBRARY_SOURCES + ${cryptopp_SOURCES} + ) endif () if (BUILD_STATIC) - add_library(cryptopp-static STATIC ${cryptopp_LIBRARY_SOURCES}) - cryptopp_target_compile_properties(cryptopp-static) - if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.11") - target_include_directories(cryptopp-static PUBLIC $ $) - else () - set_target_properties(cryptopp-static PROPERTIES INCLUDE_DIRECTORIES "$ $") - endif () + add_library(cryptopp-static STATIC ${cryptopp_LIBRARY_SOURCES}) + cryptopp_target_compile_properties(cryptopp-static) + if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.11") + target_include_directories(cryptopp-static PUBLIC $ $) + else () + set_target_properties(cryptopp-static PROPERTIES INCLUDE_DIRECTORIES "$ $") + endif () endif () if (BUILD_SHARED) - add_library(cryptopp-shared SHARED ${cryptopp_LIBRARY_SOURCES}) - cryptopp_target_compile_properties(cryptopp-shared) - if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.11") - target_include_directories(cryptopp-shared PUBLIC $ $) - else () - set_target_properties(cryptopp-shared PROPERTIES INCLUDE_DIRECTORIES "$ $") - endif () + add_library(cryptopp-shared SHARED ${cryptopp_LIBRARY_SOURCES}) + cryptopp_target_compile_properties(cryptopp-shared) + if (NOT ${CMAKE_VERSION} VERSION_LESS "2.8.11") + target_include_directories(cryptopp-shared PUBLIC $ $) + else () + set_target_properties(cryptopp-shared PROPERTIES INCLUDE_DIRECTORIES "$ $") + endif () endif () # Set filenames for targets to be "cryptopp" if (NOT MSVC) - set(COMPAT_VERSION ${cryptopp_VERSION_MAJOR}.${cryptopp_VERSION_MINOR}) + set(COMPAT_VERSION ${cryptopp_VERSION_MAJOR}.${cryptopp_VERSION_MINOR}) - if (BUILD_STATIC) - set_target_properties(cryptopp-static - PROPERTIES - OUTPUT_NAME cryptopp) - endif () - if (BUILD_SHARED) - set_target_properties(cryptopp-shared - PROPERTIES - SOVERSION ${COMPAT_VERSION} - OUTPUT_NAME cryptopp) - endif () + if (BUILD_STATIC) + set_target_properties(cryptopp-static + PROPERTIES + OUTPUT_NAME cryptopp) + endif () + if (BUILD_SHARED) + set_target_properties(cryptopp-shared + PROPERTIES + SOVERSION ${COMPAT_VERSION} + OUTPUT_NAME cryptopp) + endif () endif () # Add alternate ways to invoke the build for the shared library that are # similar to how the crypto++ 'make' tool works. # see https://github.com/noloader/cryptopp-cmake/issues/32 if (BUILD_STATIC) - add_custom_target(static DEPENDS cryptopp-static) + add_custom_target(static DEPENDS cryptopp-static) endif () if (BUILD_SHARED) - add_custom_target(shared DEPENDS cryptopp-shared) - add_custom_target(dynamic DEPENDS cryptopp-shared) + add_custom_target(shared DEPENDS cryptopp-shared) + add_custom_target(dynamic DEPENDS cryptopp-shared) endif () #============================================================================ @@ -1074,30 +1074,30 @@ endif () #============================================================================ if (WIN32) - if (BUILD_STATIC) - target_link_libraries(cryptopp-static ws2_32) - endif () - if (BUILD_SHARED) - target_link_libraries(cryptopp-shared ws2_32) - endif () + if (BUILD_STATIC) + target_link_libraries(cryptopp-static ws2_32) + endif () + if (BUILD_SHARED) + target_link_libraries(cryptopp-shared ws2_32) + endif () endif () # This may need to be expanded to "Solaris" if (CRYPTOPP_SOLARIS) - if (BUILD_STATIC) - target_link_libraries(cryptopp-static nsl socket) - endif () - if (BUILD_SHARED) - target_link_libraries(cryptopp-shared nsl socket) - endif () + if (BUILD_STATIC) + target_link_libraries(cryptopp-static nsl socket) + endif () + if (BUILD_SHARED) + target_link_libraries(cryptopp-shared nsl socket) + endif () endif () find_package(Threads) if (BUILD_STATIC) - target_link_libraries(cryptopp-static ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(cryptopp-static ${CMAKE_THREAD_LIBS_INIT}) endif () if (BUILD_SHARED) - target_link_libraries(cryptopp-shared ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(cryptopp-shared ${CMAKE_THREAD_LIBS_INIT}) endif () #============================================================================ @@ -1106,24 +1106,24 @@ endif () enable_testing() if (BUILD_TESTING) - add_executable(cryptest ${cryptopp_SOURCES_TEST}) - target_link_libraries(cryptest cryptopp-static) + add_executable(cryptest ${cryptopp_SOURCES_TEST}) + target_link_libraries(cryptest cryptopp-static) - # Setting "cryptest" binary name to "cryptest.exe" - if (NOT (WIN32 OR CYGWIN)) - set_target_properties(cryptest PROPERTIES OUTPUT_NAME cryptest.exe) - endif () - if (NOT TARGET cryptest.exe) - add_custom_target(cryptest.exe) - add_dependencies(cryptest.exe cryptest) - endif () + # Setting "cryptest" binary name to "cryptest.exe" + if (NOT (WIN32 OR CYGWIN)) + set_target_properties(cryptest PROPERTIES OUTPUT_NAME cryptest.exe) + endif () + if (NOT TARGET cryptest.exe) + add_custom_target(cryptest.exe) + add_dependencies(cryptest.exe cryptest) + endif () - file(COPY ${SRC_DIR}/TestData DESTINATION ${PROJECT_BINARY_DIR}) - file(COPY ${SRC_DIR}/TestVectors DESTINATION ${PROJECT_BINARY_DIR}) + file(COPY ${SRC_DIR}/TestData DESTINATION ${PROJECT_BINARY_DIR}) + file(COPY ${SRC_DIR}/TestVectors DESTINATION ${PROJECT_BINARY_DIR}) - add_test(NAME build_cryptest COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target cryptest) - add_test(NAME cryptest COMMAND $ v) - set_tests_properties(cryptest PROPERTIES DEPENDS build_cryptest) + add_test(NAME build_cryptest COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target cryptest) + add_test(NAME cryptest COMMAND $ v) + set_tests_properties(cryptest PROPERTIES DEPENDS build_cryptest) endif () #============================================================================ @@ -1131,24 +1131,24 @@ endif () #============================================================================ if (BUILD_DOCUMENTATION) - find_package(Doxygen REQUIRED) + find_package(Doxygen REQUIRED) - set(in_source_DOCS_DIR "${SRC_DIR}/html-docs") - set(out_source_DOCS_DIR "${PROJECT_BINARY_DIR}/html-docs") + set(in_source_DOCS_DIR "${SRC_DIR}/html-docs") + set(out_source_DOCS_DIR "${PROJECT_BINARY_DIR}/html-docs") - add_custom_target(docs ALL - COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING - WORKING_DIRECTORY ${SRC_DIR} - SOURCES ${SRC_DIR}/Doxyfile - ) + add_custom_target(docs ALL + COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING + WORKING_DIRECTORY ${SRC_DIR} + SOURCES ${SRC_DIR}/Doxyfile + ) - if (NOT ${in_source_DOCS_DIR} STREQUAL ${out_source_DOCS_DIR}) - add_custom_command( - TARGET docs POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory "${in_source_DOCS_DIR}" "${out_source_DOCS_DIR}" - COMMAND ${CMAKE_COMMAND} -E remove_directory "${in_source_DOCS_DIR}" - ) - endif () + if (NOT ${in_source_DOCS_DIR} STREQUAL ${out_source_DOCS_DIR}) + add_custom_command( + TARGET docs POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory "${in_source_DOCS_DIR}" "${out_source_DOCS_DIR}" + COMMAND ${CMAKE_COMMAND} -E remove_directory "${in_source_DOCS_DIR}" + ) + endif () endif () #============================================================================ @@ -1159,81 +1159,81 @@ set(export_name "cryptopp-targets") # Runtime package if (BUILD_SHARED) - export(TARGETS cryptopp-shared FILE ${export_name}.cmake ) - install( - TARGETS cryptopp-shared - EXPORT ${export_name} - DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) + export(TARGETS cryptopp-shared FILE ${export_name}.cmake ) + install( + TARGETS cryptopp-shared + EXPORT ${export_name} + DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) endif () # Development package if (BUILD_STATIC) - export(TARGETS cryptopp-static FILE ${export_name}.cmake ) - install(TARGETS cryptopp-static EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + export(TARGETS cryptopp-static FILE ${export_name}.cmake ) + install(TARGETS cryptopp-static EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif () install(FILES ${cryptopp_HEADERS} DESTINATION include/cryptopp) # CMake Package if (NOT CMAKE_VERSION VERSION_LESS 2.8.8) - include(CMakePackageConfigHelpers) - write_basic_package_version_file("${PROJECT_BINARY_DIR}/cryptopp-config-version.cmake" VERSION ${cryptopp_VERSION_MAJOR}.${cryptopp_VERSION_MINOR}.${cryptopp_VERSION_PATCH} COMPATIBILITY SameMajorVersion) - install(FILES cryptopp-config.cmake ${PROJECT_BINARY_DIR}/cryptopp-config-version.cmake DESTINATION "lib/cmake/cryptopp") - install(EXPORT ${export_name} DESTINATION "lib/cmake/cryptopp") + include(CMakePackageConfigHelpers) + write_basic_package_version_file("${PROJECT_BINARY_DIR}/cryptopp-config-version.cmake" VERSION ${cryptopp_VERSION_MAJOR}.${cryptopp_VERSION_MINOR}.${cryptopp_VERSION_PATCH} COMPATIBILITY SameMajorVersion) + install(FILES cryptopp-config.cmake ${PROJECT_BINARY_DIR}/cryptopp-config-version.cmake DESTINATION "lib/cmake/cryptopp") + install(EXPORT ${export_name} DESTINATION "lib/cmake/cryptopp") endif () # Tests if (BUILD_TESTING) - install(TARGETS cryptest DESTINATION ${CMAKE_INSTALL_BINDIR}) - install(DIRECTORY ${SRC_DIR}/TestData DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cryptopp) - install(DIRECTORY ${SRC_DIR}/TestVectors DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cryptopp) + install(TARGETS cryptest DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(DIRECTORY ${SRC_DIR}/TestData DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cryptopp) + install(DIRECTORY ${SRC_DIR}/TestVectors DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/cryptopp) endif () # Documentation if (BUILD_DOCUMENTATION) - install(DIRECTORY "${out_source_DOCS_DIR}" DESTINATION ${CMAKE_INSTALL_DOCDIR}) + install(DIRECTORY "${out_source_DOCS_DIR}" DESTINATION ${CMAKE_INSTALL_DOCDIR}) endif () # Print a configuration summary. We want CXX and CXXFLAGS, but they are not includd in ALL. if (CRYPTOPP_I386) - message(STATUS "Platform: i386/i686") + message(STATUS "Platform: i386/i686") elseif (CRYPTOPP_AMD64) - message(STATUS "Platform: x86_64") + message(STATUS "Platform: x86_64") elseif (CRYPTOPP_X32) - message(STATUS "Platform: x86_64-x32") + message(STATUS "Platform: x86_64-x32") elseif (CRYPTOPP_ARMHF) - message(STATUS "Platform: armhf") + message(STATUS "Platform: armhf") elseif (CRYPTOPP_ARM) - message(STATUS "Platform: arm") + message(STATUS "Platform: arm") elseif (CRYPTOPP_AARCH32) - message(STATUS "Platform: Aarch32") + message(STATUS "Platform: Aarch32") elseif (CRYPTOPP_AARCH64) - message(STATUS "Platform: Aarch64") + message(STATUS "Platform: Aarch64") elseif (CRYPTOPP_SPARC) - message(STATUS "Platform: Sparc") + message(STATUS "Platform: Sparc") elseif (CRYPTOPP_SPARC64) - message(STATUS "Platform: Sparc64") + message(STATUS "Platform: Sparc64") elseif (CRYPTOPP_POWERPC) - message(STATUS "Platform: PowerPC") + message(STATUS "Platform: PowerPC") elseif (CRYPTOPP_POWERPC64) - message(STATUS "Platform: PowerPC-64") + message(STATUS "Platform: PowerPC-64") elseif (CRYPTOPP_MINGW32) - message(STATUS "Platform: MinGW-32") + message(STATUS "Platform: MinGW-32") elseif (CRYPTOPP_MINGW32) - message(STATUS "Platform: MinGW-64") + message(STATUS "Platform: MinGW-64") endif () if (CRYPTOPP_ARMV7A_NEON) - message(STATUS "NEON: TRUE") + message(STATUS "NEON: TRUE") endif () if (CRYPTOPP_NATIVE_ARCH) - message(STATUS "Native arch: TRUE") + message(STATUS "Native arch: TRUE") else () - message(STATUS "Native arch: FALSE") + 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}") -message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") \ No newline at end of file +message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") diff --git a/vendor/cryptopp/vendor_cryptopp/Doxyfile b/vendor/cryptopp/vendor_cryptopp/Doxyfile index bc814409..74386e51 100644 --- a/vendor/cryptopp/vendor_cryptopp/Doxyfile +++ b/vendor/cryptopp/vendor_cryptopp/Doxyfile @@ -41,7 +41,7 @@ PROJECT_NAME = Crypto++ # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 8.1 +PROJECT_NUMBER = 8.2 # 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 diff --git a/vendor/cryptopp/vendor_cryptopp/Filelist.txt b/vendor/cryptopp/vendor_cryptopp/Filelist.txt index 5fbc0fdf..7e60a108 100644 --- a/vendor/cryptopp/vendor_cryptopp/Filelist.txt +++ b/vendor/cryptopp/vendor_cryptopp/Filelist.txt @@ -542,6 +542,7 @@ TestVectors/shacal2.txt TestVectors/simeck.txt TestVectors/simon.txt TestVectors/siphash.txt +TestVectors/skipjack.txt TestVectors/sm3.txt TestVectors/sm4.txt TestVectors/sosemanuk.txt diff --git a/vendor/cryptopp/vendor_cryptopp/GNUmakefile b/vendor/cryptopp/vendor_cryptopp/GNUmakefile index 83ff39b1..e7b7b3a6 100755 --- a/vendor/cryptopp/vendor_cryptopp/GNUmakefile +++ b/vendor/cryptopp/vendor_cryptopp/GNUmakefile @@ -10,8 +10,6 @@ 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)) @@ -53,8 +51,6 @@ IS_SPARC64 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'sun|sparc64') IS_ARM32 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'arm|armhf|arm7l|eabihf') IS_ARMV8 := $(shell echo "$(HOSTX)" | $(GREP) -i -c -E 'aarch32|aarch64|arm64|armv8') -IS_NEON := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null | $(GREP) -i -c -E 'armv7|armhf|arm7l|eabihf|armv8|aarch32|aarch64') - # Attempt to determine platform SYSTEMX := $(shell $(CXX) $(CXXFLAGS) -dumpmachine 2>/dev/null) ifeq ($(SYSTEMX),) @@ -439,37 +435,37 @@ endif ##### ARM A-32, Aach64 and NEON ##### ########################################################### -ifneq ($(IS_ARM32)$(IS_ARMV8)$(IS_NEON),000) +ifneq ($(IS_ARM32)$(IS_ARMV8),00) ifeq ($(DETECT_FEATURES),1) -ifeq ($(IS_ARM32)$(IS_NEON),11) +ifneq ($(IS_ARM32),0) TPROG = TestPrograms/test_arm_neon.cxx - TOPT = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon + TOPT = -march=armv7-a -mfpu=neon HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) - NEON_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - ARIA_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - AES_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - CRC_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - GCM_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - BLAKE2B_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - BLAKE2S_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - CHACHA_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - CHAM_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - LEA_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - SHA_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - SIMECK_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - SIMON64_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - SIMON128_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - SPECK64_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - SPECK128_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon - SM4_FLAG = -march=armv7-a -mfloat-abi=$(FP_ABI) -mfpu=neon + NEON_FLAG = -march=armv7-a -mfpu=neon + ARIA_FLAG = -march=armv7-a -mfpu=neon + AES_FLAG = -march=armv7-a -mfpu=neon + CRC_FLAG = -march=armv7-a -mfpu=neon + GCM_FLAG = -march=armv7-a -mfpu=neon + BLAKE2B_FLAG = -march=armv7-a -mfpu=neon + BLAKE2S_FLAG = -march=armv7-a -mfpu=neon + CHACHA_FLAG = -march=armv7-a -mfpu=neon + CHAM_FLAG = -march=armv7-a -mfpu=neon + LEA_FLAG = -march=armv7-a -mfpu=neon + SHA_FLAG = -march=armv7-a -mfpu=neon + SIMECK_FLAG = -march=armv7-a -mfpu=neon + SIMON64_FLAG = -march=armv7-a -mfpu=neon + SIMON128_FLAG = -march=armv7-a -mfpu=neon + SPECK64_FLAG = -march=armv7-a -mfpu=neon + SPECK128_FLAG = -march=armv7-a -mfpu=neon + SM4_FLAG = -march=armv7-a -mfpu=neon else CXXFLAGS += -DCRYPTOPP_DISABLE_ASM endif -# IS_NEON +# IS_ARM32 endif ifeq ($(IS_ARMV8),1) @@ -485,7 +481,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_asimd.cxx TOPT = -march=armv8-a - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) ASIMD_FLAG = -march=armv8-a ARIA_FLAG = -march=armv8-a @@ -508,7 +504,7 @@ ifeq ($(IS_ARMV8),1) ifneq ($(ASIMD_FLAG),) TPROG = TestPrograms/test_arm_crc.cxx TOPT = -march=armv8-a+crc - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) CRC_FLAG = -march=armv8-a+crc else @@ -517,7 +513,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_aes.cxx TOPT = -march=armv8-a+crypto - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) AES_FLAG = -march=armv8-a+crypto else @@ -526,7 +522,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_pmull.cxx TOPT = -march=armv8-a+crypto - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) GCM_FLAG = -march=armv8-a+crypto GF2N_FLAG = -march=armv8-a+crypto @@ -536,7 +532,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_sha.cxx TOPT = -march=armv8-a+crypto - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) SHA_FLAG = -march=armv8-a+crypto else @@ -545,7 +541,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_sm3.cxx TOPT = -march=armv8.4-a+crypto - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) SM3_FLAG = -march=armv8.4-a+crypto SM4_FLAG = -march=armv8.4-a+crypto @@ -553,7 +549,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_sha3.cxx TOPT = -march=armv8.4-a+crypto - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) SHA3_FLAG = -march=armv8.4-a+crypto endif @@ -567,7 +563,7 @@ endif # DETECT_FEATURES endif -# IS_ARM32, IS_ARMV8, IS_NEON +# IS_ARM32, IS_ARMV8 endif ########################################################### @@ -622,13 +618,21 @@ ifeq ($(DETECT_FEATURES),1) TOPT = $(POWER8_FLAG) HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) + AES_FLAG = $(POWER8_FLAG) + ARIA_FLAG = $(POWER8_FLAG) BLAKE2B_FLAG = $(POWER8_FLAG) + BLAKE2S_FLAG = $(POWER8_FLAG) + CHACHA_FLAG = $(POWER8_FLAG) + CHAM_FLAG = $(POWER8_FLAG) CRC_FLAG = $(POWER8_FLAG) GCM_FLAG = $(POWER8_FLAG) GF2N_FLAG = $(POWER8_FLAG) - AES_FLAG = $(POWER8_FLAG) + LEA_FLAG = $(POWER8_FLAG) SHA_FLAG = $(POWER8_FLAG) SHACAL2_FLAG = $(POWER8_FLAG) + SIMECK_FLAG = $(POWER8_FLAG) + SIMON64_FLAG = $(POWER8_FLAG) + SPECK64_FLAG = $(POWER8_FLAG) SIMON128_FLAG = $(POWER8_FLAG) SPECK128_FLAG = $(POWER8_FLAG) else @@ -641,16 +645,7 @@ ifeq ($(DETECT_FEATURES),1) TPROG = TestPrograms/test_ppc_power7.cxx TOPT = $(POWER7_FLAG) HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) - ifeq ($(strip $(HAVE_OPT)),0) - ARIA_FLAG = $(POWER7_FLAG) - BLAKE2S_FLAG = $(POWER7_FLAG) - CHACHA_FLAG = $(POWER7_FLAG) - CHAM_FLAG = $(POWER7_FLAG) - LEA_FLAG = $(POWER7_FLAG) - SIMECK_FLAG = $(POWER7_FLAG) - SIMON64_FLAG = $(POWER7_FLAG) - SPECK64_FLAG = $(POWER7_FLAG) - else + ifneq ($(strip $(HAVE_OPT)),0) POWER7_FLAG = endif @@ -693,18 +688,12 @@ ifeq ($(DETECT_FEATURES),1) ##################################################################### # Fixups for algorithms that can drop to a lower ISA, if needed - # Drop to Power7 if Power8 is not available. + # Drop to Power4 if Power8 not available ifeq ($(POWER8_FLAG),) - ifneq ($(POWER7_FLAG),) - GCM_FLAG = $(POWER7_FLAG) - endif - endif - - # Drop to Power4 if Power7 not available - ifeq ($(POWER7_FLAG),) ifneq ($(ALTIVEC_FLAG),) BLAKE2S_FLAG = $(ALTIVEC_FLAG) CHACHA_FLAG = $(ALTIVEC_FLAG) + GCM_FLAG = $(ALTIVEC_FLAG) SIMON64_FLAG = $(ALTIVEC_FLAG) SPECK64_FLAG = $(ALTIVEC_FLAG) endif @@ -1349,7 +1338,7 @@ libcryptopp.pc: @echo '' >> libcryptopp.pc @echo 'Name: Crypto++' >> libcryptopp.pc @echo 'Description: Crypto++ cryptographic library' >> libcryptopp.pc - @echo 'Version: 8.1' >> libcryptopp.pc + @echo 'Version: 8.2' >> libcryptopp.pc @echo 'URL: https://cryptopp.com/' >> libcryptopp.pc @echo '' >> libcryptopp.pc @echo 'Cflags: -I$${includedir}' >> libcryptopp.pc @@ -1430,7 +1419,7 @@ endif # Dependencies # Cryptogams ARM asm implementation. aes_armv4.o : aes_armv4.S - $(CC) $(strip $(CXXFLAGS) $(CRYPTOGAMS_AES_FLAG) -mfloat-abi=$(FP_ABI) -c) $< + $(CC) $(strip $(CXXFLAGS) $(CRYPTOGAMS_AES_FLAG) -c) $< # SSSE3 or NEON available aria_simd.o : aria_simd.cpp diff --git a/vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross b/vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross index c308c123..c13cd68b 100755 --- a/vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross +++ b/vendor/cryptopp/vendor_cryptopp/GNUmakefile-cross @@ -384,10 +384,10 @@ ifeq ($(IS_ARM32),1) SM4_FLAG = $(NEON_FLAG) else NEON_FLAG = - CXXFLAGS += -DCRYPTOPP_DISABLE_NEON + CXXFLAGS += -DCRYPTOPP_DISABLE_ASM endif -# IS_NEON +# IS_ARM32 endif ifeq ($(IS_ARMV8),1) @@ -417,7 +417,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_asimd.cxx TOPT = $(ASIMD_FLAG) - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) ARIA_FLAG = $(ASIMD_FLAG) BLAKE2B_FLAG = $(ASIMD_FLAG) @@ -439,7 +439,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_crc.cxx TOPT = $(CRC_FLAG) - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifneq ($(strip $(HAVE_OPT)),0) CRC_FLAG = CXXFLAGS += -DCRYPTOPP_ARM_CRC32_AVAILABLE=0 @@ -447,7 +447,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_aes.cxx TOPT = $(AES_FLAG) - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifneq ($(strip $(HAVE_OPT)),0) AES_FLAG = CXXFLAGS += -DCRYPTOPP_ARM_AES_AVAILABLE=0 @@ -455,7 +455,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_pmull.cxx TOPT = $(PMULL_FLAG) - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifneq ($(strip $(HAVE_OPT)),0) PMULL_FLAG = CXXFLAGS += -DCRYPTOPP_ARM_PMULL_AVAILABLE=0 @@ -463,7 +463,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_sha.cxx TOPT = $(SHA_FLAG) - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifneq ($(strip $(HAVE_OPT)),0) SHA_FLAG = CXXFLAGS += -DCRYPTOPP_ARM_SHA_AVAILABLE=0 @@ -471,7 +471,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_sm3.cxx TOPT = -march=armv8.4-a+crypto - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) SM3_FLAG = -march=armv8.4-a+crypto SM4_FLAG = -march=armv8.4-a+crypto @@ -479,7 +479,7 @@ ifeq ($(IS_ARMV8),1) TPROG = TestPrograms/test_arm_sha3.cxx TOPT = -march=armv8.4-a+crypto - HAVE_OPT = $(shell $(CXX) $(CXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) + HAVE_OPT = $(shell $(CXX) $(TCXXFLAGS) $(ACLE_FLAG) $(ZOPT) $(TOPT) $(TPROG) -o $(TOUT) 2>&1 | tr ' ' '\n' | wc -l) ifeq ($(strip $(HAVE_OPT)),0) SHA3_FLAG = -march=armv8.4-a+crypto SHA512_FLAG = -march=armv8.4-a+crypto diff --git a/vendor/cryptopp/vendor_cryptopp/History.txt b/vendor/cryptopp/vendor_cryptopp/History.txt index 15bf004f..7897dd23 100644 --- a/vendor/cryptopp/vendor_cryptopp/History.txt +++ b/vendor/cryptopp/vendor_cryptopp/History.txt @@ -455,10 +455,10 @@ last several releases. 8.1.0 - February 22, 2019 - minor release, no recompile of programs required - expanded community input and support - 56 unique contributors as of this release + * 56 unique contributors as of this release - fix OS X PowerPC builds with Clang - add Microsoft ARM64 support - - fix iPhone Simulator build due to missign symbols + - fix iPhone Simulator build due to missing symbols - add CRYPTOPP_BUGGY_SIMD_LOAD_AND_STORE - add carryless multiplies for NIST b233 and k233 curves - fix OpenMP build due to use of OpenMP 4 with down-level compilers @@ -467,3 +467,16 @@ last several releases. - add SHAKE-128 and SHAKE-256 - fix AVX2 build due to _mm256_broadcastsi128_si256 - add IETF ChaCha, XChaCha, ChaChaPoly1305 and XChaChaPoly1305 + +8.2.0 - April 28, 2019 + - minor release, no recompile of programs required + - expanded community input and support + * 56 unique contributors as of this release + - use PowerPC unaligned loads and stores with Power8 + - add SKIPJACK test vectors + - fix SHAKE-128 and SHAKE-256 compile + - removed IS_NEON from Makefile + - fix Aarch64 build on Fedora 29 + - fix missing GF2NT_233_Multiply_Reduce_CLMUL in FIPS DLL + - add missing BLAKE2 constructors + - fix missing BlockSize() in BLAKE2 classes diff --git a/vendor/cryptopp/vendor_cryptopp/Readme.txt b/vendor/cryptopp/vendor_cryptopp/Readme.txt index e0ba0cd9..1831facb 100644 --- a/vendor/cryptopp/vendor_cryptopp/Readme.txt +++ b/vendor/cryptopp/vendor_cryptopp/Readme.txt @@ -1,5 +1,5 @@ Crypto++: free C++ Class Library of Cryptographic Schemes -Version 8.0 - DEC/28/2018 +Version 8.2 - APR/28/2019 Crypto++ Library is a free C++ class library of cryptographic schemes. Currently the library contains the following algorithms: @@ -290,8 +290,36 @@ documentation is one of the highest returns on investment. The items in this section comprise the most recent history. Please see History.txt for the record back to Crypto++ 1.0. -8.0.0 - December 28, 2018 +8.2.0 - April 28, 2019 + - minor release, no recompile of programs required + - expanded community input and support + * 56 unique contributors as of this release + - use PowerPC unaligned loads and stores with Power8 + - add SKIPJACK test vectors + - fix SHAKE-128 and SHAKE-256 compile + - removed IS_NEON from Makefile + - fix Aarch64 build on Fedora 29 + - fix missing GF2NT_233_Multiply_Reduce_CLMUL in FIPS DLL + - add missing BLAKE2 constructors + - fix missing BlockSize() in BLAKE2 classes +8.1.0 - February 22, 2019 + - minor release, no recompile of programs required + - expanded community input and support + * 56 unique contributors as of this release + - fix OS X PowerPC builds with Clang + - add Microsoft ARM64 support + - fix iPhone Simulator build due to missing symbols + - add CRYPTOPP_BUGGY_SIMD_LOAD_AND_STORE + - add carryless multiplies for NIST b233 and k233 curves + - fix OpenMP build due to use of OpenMP 4 with down-level compilers + - add SignStream and VerifyStream for ed25519 and large files + - fix missing AlgorithmProvider in PanamaHash + - add SHAKE-128 and SHAKE-256 + - fix AVX2 build due to _mm256_broadcastsi128_si256 + - add IETF ChaCha, XChaCha, ChaChaPoly1305 and XChaChaPoly1305 + +8.0.0 - December 28, 2018 - major release, recompile of programs required - expanded community input and support * 54 unique contributors as of this release diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/change-version.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/change-version.sh index f3226b8d..af2475ed 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/change-version.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/change-version.sh @@ -4,11 +4,14 @@ # building the docs. Before running the script, copy it to the root # directory. After running this script, you can 'make docs' -sed 's|Library 8.1 API|Library 8.0 API|g' cryptlib.h > cryptlib.h.new +sed 's|Library 8.2 API|Library 8.1 API|g' cryptlib.h > cryptlib.h.new mv cryptlib.h.new cryptlib.h -sed 's|= 8.1|= 8.0|g' Doxyfile > Doxyfile.new +sed 's|= 8.2|= 8.1|g' Doxyfile > Doxyfile.new mv Doxyfile.new Doxyfile -sed 's|CRYPTOPP_VERSION 810|CRYPTOPP_VERSION 800|g' config.h > config.h.new +sed 's|CRYPTOPP_MINOR 2|CRYPTOPP_MINOR 1|g' config.h > config.h.new +mv config.h.new config.h + +sed 's|CRYPTOPP_VERSION 820|CRYPTOPP_VERSION 810|g' config.h > config.h.new mv config.h.new config.h diff --git a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-symbols.sh b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-symbols.sh index 42ad330d..ea65c84b 100755 --- a/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-symbols.sh +++ b/vendor/cryptopp/vendor_cryptopp/TestScripts/cryptest-symbols.sh @@ -26,7 +26,7 @@ trap cleanup EXIT ############################################ # Tags to test -OLD_VERSION_TAG=CRYPTOPP_8_0_0 +OLD_VERSION_TAG=CRYPTOPP_8_1_0 NEW_VERSION_TAG=master ############################################ diff --git a/vendor/cryptopp/vendor_cryptopp/TestVectors/all.txt b/vendor/cryptopp/vendor_cryptopp/TestVectors/all.txt index 3ab9c8c3..f60a9f4e 100644 --- a/vendor/cryptopp/vendor_cryptopp/TestVectors/all.txt +++ b/vendor/cryptopp/vendor_cryptopp/TestVectors/all.txt @@ -49,6 +49,7 @@ Test: TestVectors/sha.txt Test: TestVectors/simeck.txt Test: TestVectors/simon.txt Test: TestVectors/siphash.txt +Test: TestVectors/skipjack.txt Test: TestVectors/sm3.txt Test: TestVectors/sm4.txt Test: TestVectors/sosemanuk.txt diff --git a/vendor/cryptopp/vendor_cryptopp/TestVectors/skipjack.txt b/vendor/cryptopp/vendor_cryptopp/TestVectors/skipjack.txt new file mode 100644 index 00000000..51bceba8 --- /dev/null +++ b/vendor/cryptopp/vendor_cryptopp/TestVectors/skipjack.txt @@ -0,0 +1,1046 @@ +AlgorithmType: SymmetricCipher +Name: SKIPJACK/ECB +Source: SP800-17, Table 6, pp. 140-42 +# +Comment: Round 0 known answer +Key: 80000000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 7A00E49441461F5A +Test: Encrypt +# +Comment: Round 1 known answer +Key: 40000000000000000000 +Plaintext: 0000000000000000 +Ciphertext: A14FF8BCD1BC9EF9 +Test: Encrypt +# +Comment: Round 2 known answer +Key: 20000000000000000000 +Plaintext: 0000000000000000 +Ciphertext: D7E810385A42AAEA +Test: Encrypt +# +Comment: Round 3 known answer +Key: 10000000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 28FE2C3332AABD35 +Test: Encrypt +# +Comment: Round 4 known answer +Key: 08000000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 3FC0F05EE6CE788A +Test: Encrypt +# +Comment: Round 5 known answer +Key: 04000000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 443DD0CB7526F74B +Test: Encrypt +# +Comment: Round 6 known answer +Key: 02000000000000000000 +Plaintext: 0000000000000000 +Ciphertext: AD819E677CF90305 +Test: Encrypt +# +Comment: Round 7 known answer +Key: 01000000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 9891755E5EBA5B1D +Test: Encrypt +# +Comment: Round 8 known answer +Key: 00800000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 0E64B494633BF2CB +Test: Encrypt +# +Comment: Round 9 known answer +Key: 00400000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 63381A08A47FC48D +Test: Encrypt +# +Comment: Round 10 known answer +Key: 00200000000000000000 +Plaintext: 0000000000000000 +Ciphertext: F4108B099B047040 +Test: Encrypt +# +Comment: Round 11 known answer +Key: 00100000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 740216614ED0E25B +Test: Encrypt +# +Comment: Round 12 known answer +Key: 00080000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 8000917B2E16B92A +Test: Encrypt +# +Comment: Round 13 known answer +Key: 00040000000000000000 +Plaintext: 0000000000000000 +Ciphertext: A9769B62B3A0BE4E +Test: Encrypt +# +Comment: Round 14 known answer +Key: 00020000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 42FDB872EA314121 +Test: Encrypt +# +Comment: Round 15 known answer +Key: 00010000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 1D672BA0156AB39D +Test: Encrypt +# +Comment: Round 16 known answer +Key: 00008000000000000000 +Plaintext: 0000000000000000 +Ciphertext: F44441D7C777F057 +Test: Encrypt +# +Comment: Round 17 known answer +Key: 00004000000000000000 +Plaintext: 0000000000000000 +Ciphertext: EA487DDC360D1594 +Test: Encrypt +# +Comment: Round 18 known answer +Key: 00002000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 324B0E785FF2B908 +Test: Encrypt +# +Comment: Round 19 known answer +Key: 00001000000000000000 +Plaintext: 0000000000000000 +Ciphertext: 1AF59EC2B9D64C4F +Test: Encrypt +# +Comment: Round 20 known answer +Key: 00000800000000000000 +Plaintext: 0000000000000000 +Ciphertext: 819B7E102E76A0EE +Test: Encrypt +# +Comment: Round 21 known answer +Key: 00000400000000000000 +Plaintext: 0000000000000000 +Ciphertext: 0B0BFE0D4A37AA9E +Test: Encrypt +# +Comment: Round 22 known answer +Key: 00000200000000000000 +Plaintext: 0000000000000000 +Ciphertext: 12B43E3760D30DA6 +Test: Encrypt +# +Comment: Round 23 known answer +Key: 00000100000000000000 +Plaintext: 0000000000000000 +Ciphertext: 3177256C461541EE +Test: Encrypt +# +Comment: Round 24 known answer +Key: 00000080000000000000 +Plaintext: 0000000000000000 +Ciphertext: 3600EB92836CA026 +Test: Encrypt +# +Comment: Round 25 known answer +Key: 00000040000000000000 +Plaintext: 0000000000000000 +Ciphertext: 75A435AD22ECF793 +Test: Encrypt +# +Comment: Round 26 known answer +Key: 00000020000000000000 +Plaintext: 0000000000000000 +Ciphertext: 7190AA9913C1F9EC +Test: Encrypt +# +Comment: Round 27 known answer +Key: 00000010000000000000 +Plaintext: 0000000000000000 +Ciphertext: ABA718B185A11DD0 +Test: Encrypt +# +Comment: Round 28 known answer +Key: 00000008000000000000 +Plaintext: 0000000000000000 +Ciphertext: 40F67ABFCC3B873C +Test: Encrypt +# +Comment: Round 29 known answer +Key: 00000004000000000000 +Plaintext: 0000000000000000 +Ciphertext: 38A0A58FB09728F2 +Test: Encrypt +# +Comment: Round 30 known answer +Key: 00000002000000000000 +Plaintext: 0000000000000000 +Ciphertext: CA702E49BF6FA645 +Test: Encrypt +# +Comment: Round 31 known answer +Key: 00000001000000000000 +Plaintext: 0000000000000000 +Ciphertext: 455D93F039EA0860 +Test: Encrypt +# +Comment: Round 32 known answer +Key: 00000000800000000000 +Plaintext: 0000000000000000 +Ciphertext: 5347643FE803883F +Test: Encrypt +# +Comment: Round 33 known answer +Key: 00000000400000000000 +Plaintext: 0000000000000000 +Ciphertext: F40FF1DCBA2BC1E5 +Test: Encrypt +# +Comment: Round 34 known answer +Key: 00000000200000000000 +Plaintext: 0000000000000000 +Ciphertext: 574A4848369D412E +Test: Encrypt +# +Comment: Round 35 known answer +Key: 00000000100000000000 +Plaintext: 0000000000000000 +Ciphertext: B2BE936E36670636 +Test: Encrypt +# +Comment: Round 36 known answer +Key: 00000000080000000000 +Plaintext: 0000000000000000 +Ciphertext: 5C88517D2742E619 +Test: Encrypt +# +Comment: Round 37 known answer +Key: 00000000040000000000 +Plaintext: 0000000000000000 +Ciphertext: 993C89D09A2FE556 +Test: Encrypt +# +Comment: Round 38 known answer +Key: 00000000020000000000 +Plaintext: 0000000000000000 +Ciphertext: 1A3F72DA694C9FC7 +Test: Encrypt +# +Comment: Round 39 known answer +Key: 00000000010000000000 +Plaintext: 0000000000000000 +Ciphertext: 9659D5228F4CB151 +Test: Encrypt +# +Comment: Round 40 known answer +Key: 00000000008000000000 +Plaintext: 0000000000000000 +Ciphertext: 7C13F49E750F5C30 +Test: Encrypt +# +Comment: Round 41 known answer +Key: 00000000004000000000 +Plaintext: 0000000000000000 +Ciphertext: 3500BD407BCD01F6 +Test: Encrypt +# +Comment: Round 42 known answer +Key: 00000000002000000000 +Plaintext: 0000000000000000 +Ciphertext: 85C58E3C49442028 +Test: Encrypt +# +Comment: Round 43 known answer +Key: 00000000001000000000 +Plaintext: 0000000000000000 +Ciphertext: 8413840A2D48ABEA +Test: Encrypt +# +Comment: Round 44 known answer +Key: 00000000000800000000 +Plaintext: 0000000000000000 +Ciphertext: 832850E6E5C4AE5A +Test: Encrypt +# +Comment: Round 45 known answer +Key: 00000000000400000000 +Plaintext: 0000000000000000 +Ciphertext: 29E97F0D9F0FDC5F +Test: Encrypt +# +Comment: Round 46 known answer +Key: 00000000000200000000 +Plaintext: 0000000000000000 +Ciphertext: 2C45230437FF2E04 +Test: Encrypt +# +Comment: Round 47 known answer +Key: 00000000000100000000 +Plaintext: 0000000000000000 +Ciphertext: 10C409FB872A984F +Test: Encrypt +# +Comment: Round 48 known answer +Key: 00000000000080000000 +Plaintext: 0000000000000000 +Ciphertext: 14693B30C3AF7470 +Test: Encrypt +# +Comment: Round 49 known answer +Key: 00000000000040000000 +Plaintext: 0000000000000000 +Ciphertext: 913A9050D585BAB9 +Test: Encrypt +# +Comment: Round 50 known answer +Key: 00000000000020000000 +Plaintext: 0000000000000000 +Ciphertext: 5BFB0F83AB0C6EEA +Test: Encrypt +# +Comment: Round 51 known answer +Key: 00000000000010000000 +Plaintext: 0000000000000000 +Ciphertext: 6C0CA7284D836AAE +Test: Encrypt +# +Comment: Round 52 known answer +Key: 00000000000008000000 +Plaintext: 0000000000000000 +Ciphertext: AC5727D612E185E8 +Test: Encrypt +# +Comment: Round 53 known answer +Key: 00000000000004000000 +Plaintext: 0000000000000000 +Ciphertext: 38D7D596A3D29D90 +Test: Encrypt +# +Comment: Round 54 known answer +Key: 00000000000002000000 +Plaintext: 0000000000000000 +Ciphertext: 78BADAD3BC436CA2 +Test: Encrypt +# +Comment: Round 55 known answer +Key: 00000000000001000000 +Plaintext: 0000000000000000 +Ciphertext: E405778741B04BA0 +Test: Encrypt +# +Comment: Round 56 known answer +Key: 00000000000000800000 +Plaintext: 0000000000000000 +Ciphertext: 72FFE43DEA02AFA5 +Test: Encrypt +# +Comment: Round 57 known answer +Key: 00000000000000400000 +Plaintext: 0000000000000000 +Ciphertext: 52E931DF248CE4C7 +Test: Encrypt +# +Comment: Round 58 known answer +Key: 00000000000000200000 +Plaintext: 0000000000000000 +Ciphertext: 4BB165FDB3BFF65C +Test: Encrypt +# +Comment: Round 59 known answer +Key: 00000000000000100000 +Plaintext: 0000000000000000 +Ciphertext: 7CFAFA6861D7B47D +Test: Encrypt +# +Comment: Round 60 known answer +Key: 00000000000000080000 +Plaintext: 0000000000000000 +Ciphertext: 48D1755231F87A2A +Test: Encrypt +# +Comment: Round 61 known answer +Key: 00000000000000040000 +Plaintext: 0000000000000000 +Ciphertext: 413207DA1C9B6AB5 +Test: Encrypt +# +Comment: Round 62 known answer +Key: 00000000000000020000 +Plaintext: 0000000000000000 +Ciphertext: 63F818E9382A2778 +Test: Encrypt +# +Comment: Round 63 known answer +Key: 00000000000000010000 +Plaintext: 0000000000000000 +Ciphertext: EDAF2B85FC30EB09 +Test: Encrypt +# +Comment: Round 64 known answer +Key: 00000000000000008000 +Plaintext: 0000000000000000 +Ciphertext: 11FC5993820763F7 +Test: Encrypt +# +Comment: Round 65 known answer +Key: 00000000000000004000 +Plaintext: 0000000000000000 +Ciphertext: E539C3969915092F +Test: Encrypt +# +Comment: Round 66 known answer +Key: 00000000000000002000 +Plaintext: 0000000000000000 +Ciphertext: 506F6A1E834AD8F7 +Test: Encrypt +# +Comment: Round 67 known answer +Key: 00000000000000001000 +Plaintext: 0000000000000000 +Ciphertext: 8B15BA3047FA3195 +Test: Encrypt +# +Comment: Round 68 known answer +Key: 00000000000000000800 +Plaintext: 0000000000000000 +Ciphertext: 130BE15C393E4B7A +Test: Encrypt +# +Comment: Round 69 known answer +Key: 00000000000000000400 +Plaintext: 0000000000000000 +Ciphertext: 8895EC3104CA1041 +Test: Encrypt +# +Comment: Round 70 known answer +Key: 00000000000000000200 +Plaintext: 0000000000000000 +Ciphertext: E440ACDF4B64C9C9 +Test: Encrypt +# +Comment: Round 71 known answer +Key: 00000000000000000100 +Plaintext: 0000000000000000 +Ciphertext: C23280EBE093F002 +Test: Encrypt +# +Comment: Round 72 known answer +Key: 00000000000000000080 +Plaintext: 0000000000000000 +Ciphertext: 5264A65741FE78E3 +Test: Encrypt +# +Comment: Round 73 known answer +Key: 00000000000000000040 +Plaintext: 0000000000000000 +Ciphertext: 80892E768547CE61 +Test: Encrypt +# +Comment: Round 74 known answer +Key: 00000000000000000020 +Plaintext: 0000000000000000 +Ciphertext: 0911412D72093475 +Test: Encrypt +# +Comment: Round 75 known answer +Key: 00000000000000000010 +Plaintext: 0000000000000000 +Ciphertext: 9F21AA764783E649 +Test: Encrypt +# +Comment: Round 76 known answer +Key: 00000000000000000008 +Plaintext: 0000000000000000 +Ciphertext: 4CA9FABEAD2C02C6 +Test: Encrypt +# +Comment: Round 77 known answer +Key: 00000000000000000004 +Plaintext: 0000000000000000 +Ciphertext: 59CE10973A7B1FD5 +Test: Encrypt +# +Comment: Round 78 known answer +Key: 00000000000000000002 +Plaintext: 0000000000000000 +Ciphertext: 683B2934E0CCBEAA +Test: Encrypt +# +Comment: Round 79 known answer +Key: 00000000000000000001 +Plaintext: 0000000000000000 +Ciphertext: 74D0E7C2E3B450A8 +Test: Encrypt + +Name: SKIPJACK/CBC +Source: Botan library v1.11.7 +# +Comment: Test 0 +Key: 1EBA1F396E463D3FBC46 +IV: 9483E84EC4DC0DCA +Plaintext: D606E6F4211D3FB2 +Ciphertext: CA7B2FEFD16CD957 +Test: Encrypt +# +Comment: Test 1 +Key: EE5634FD03FAE7E2EB82 +IV: 74760D02A8004BFC +Plaintext: 47F73AB933B9BB17 +Ciphertext: 8815C7CF9FE4B40F +Test: Encrypt +# +Comment: Test 2 +Key: 4BD56557BB6302D7EBA0 +IV: 1A8874DA6C171B72 +Plaintext: 5DF4E8E7F4B2A612 +Ciphertext: 14D5C4D914AF6F62 +Test: Encrypt +# +Comment: Test 3 +Key: 515A89EB41F672F39190 +IV: D5F3C10A0C1D335B +Plaintext: BF5B2973F30BF32E +Ciphertext: B970A36494DCA293 +Test: Encrypt +# +Comment: Test 4 +Key: 81BA6BEDE7CE7BC59C2B +IV: EFEF008B2AA6A73C +Plaintext: 4F7AFE4E044EF348 +Ciphertext: E960CAAA7B5F7E2B +Test: Encrypt +# +Comment: Test 5 +Key: 5917E08396501306AF74 +IV: 7CA1023C674087C5 +Plaintext: 2550BFF219F9C2EF +Ciphertext: 24C664025BEAD041 +Test: Encrypt +# +Comment: Test 6 +Key: 73852553AA5B4AFD7AB2 +IV: AF07745290B6CE5A +Plaintext: 08CDE44E989D3BE4 +Ciphertext: A2C28685E770D266 +Test: Encrypt +# +Comment: Test 7 +Key: 5515EBF31C475F96D4A1 +IV: EAE4E7B7B92F2024 +Plaintext: 2894FB52E03C5E85 +Ciphertext: 9BD3D708FA7B7968 +Test: Encrypt +# +Comment: Test 8 +Key: 7EEA0FAA12923A0280C0 +IV: 3BE1E02F7049A672 +Plaintext: 7D0CE44D3809ABB9206EC82F066D76FE +Ciphertext: 6275BAAF00AB768C5173AB09CD6A46ED +Test: Encrypt +# +Comment: Test 9 +Key: F97DF107340C08BEBD0E +IV: D0C975D3019D0616 +Plaintext: 340F7DC38AE325E96822BDC41A37C72A +Ciphertext: 94D291D3F48B7182B95425C94B7DB660 +Test: Encrypt +# +Comment: Test 10 +Key: A7BB3314AE821F4343F6 +IV: F648CBC8EE9C54B3 +Plaintext: F7BD15CE8D2BAFC6618DA2BD495A6ABE +Ciphertext: 75BF6FBF77C115B5FE2E3C16E89EC384 +Test: Encrypt +# +Comment: Test 11 +Key: 9C9470DA34CD0851BC7C +IV: 223196853ECDDDEC +Plaintext: C7549AA2DF91B4ED183AE8D42AC13B68 +Ciphertext: E77F27711D97B3254B4B8804919AB7D7 +Test: Encrypt +# +Comment: Test 12 +Key: A5E4BE72EC9DB2677376 +IV: 28269B29683F6CCC +Plaintext: 2BFC04A1A86488725868EAE191D905FB +Ciphertext: 3CEBE7E407CB75C940A7B9529F2C8344 +Test: Encrypt +# +Comment: Test 13 +Key: A92C18345FA2962E224B +IV: 5986FD624CD09449 +Plaintext: 68FE8031BF52E14F4921B3C3B365214B +Ciphertext: DDF619C16FDDB15C7C467BD946845DD8 +Test: Encrypt +# +Comment: Test 14 +Key: D48D9F7F8ECA2CD3DBA6 +IV: 5D8E1B9FFDF4A609 +Plaintext: 7D03E83A6007B222B59FCBD87E0FB367 +Ciphertext: 54F35A4D4C08D5E89D47C19B21F914B4 +Test: Encrypt +# +Comment: Test 15 +Key: 603C6BC18CC94E323F7C +IV: 77F30A26D3F316C8 +Plaintext: F734DE563AE9D899D7FE7672340C6C02 +Ciphertext: D554DAE6B1DE9CAFA3446046E2684FAA +Test: Encrypt +# +Comment: Test 16 +Key: 785B62C2140867DA74A1 +IV: 72B29C576974DD7C +Plaintext: BEF225DCE22F3EA628D81AB17BA11D13014C9210E1BE71F8 +Ciphertext: 8C79505598EBD8598DE7DA1C317731256FE764F735355DB0 +Test: Encrypt +# +Comment: Test 17 +Key: 68F9DBC1640C9D07EE25 +IV: 24FAF59178C55CD5 +Plaintext: 7A086CA3F10F8E5359C622AAABC28A2B866F342630FCB7D3 +Ciphertext: F684A8EABB4B8F596D8277364AF148AFC59AD6BCFC81839E +Test: Encrypt +# +Comment: Test 18 +Key: 40E2A820931079579D37 +IV: 551FBFA8E80BF7D1 +Plaintext: 013B257E8EEE93B8F70B9718A356A0F3BF29D77088F8D83A +Ciphertext: BC8B49BEDF43BF2C0C4B956CA22C701A28D66D2357EE9621 +Test: Encrypt +# +Comment: Test 19 +Key: 824E4A692831F0A4A92D +IV: 8D11134F420BEDE1 +Plaintext: 4E65401AEF8AB5C08DE55809F6999AA31E207CB43B16404F +Ciphertext: 8FC79E38F7CF52C2E61AA9B017130971A66F9DCEECF7F43A +Test: Encrypt +# +Comment: Test 20 +Key: 6E5DAE21185EE1801EB7 +IV: 442B30DD34390D28 +Plaintext: 86B8F418D4F159B44598D0E226A6EF1C3308E2D11F0B9CF3 +Ciphertext: C7DC61B134E9E03B531E4437B326E4804A6B6BC7D0DC0140 +Test: Encrypt +# +Comment: Test 21 +Key: 67B913AB6C703B187F95 +IV: D0184447F25A72BF +Plaintext: 5BBE8DD8BB9E6227E1CD76754A7B230B2A0D9C0AF4A58B38 +Ciphertext: AF1BEB64F9BD1D7FBEDD36E6FA4FA552AFE831D76061EBD4 +Test: Encrypt +# +Comment: Test 22 +Key: DA54E10008A5AA8CEB74 +IV: C97795A112F8BE84 +Plaintext: DF7A00170C3C44BA650691941E74D8C0205DB0E0AD2193BE +Ciphertext: DFD1596CD77B13EB08AEAC2480AB6D89BECE5F933EDC1DF1 +Test: Encrypt +# +Comment: Test 23 +Key: 6EA82192C35934FF7040 +IV: B6C42C3D2250A023 +Plaintext: 71EFB527AFD69EDCEDDD9542A09BF87BB200CEE6CB3775ED +Ciphertext: 49F0FE3F6FA8C3495A99F6B9A26E9E546C2973CF725A5CA5 +Test: Encrypt +# +Comment: Test 24 +Key: 085C8BA119BC0F3346C3 +IV: 744744B21CFB266D +Plaintext: 69F8930CA15ED2F1BCF7353D5E6EFCDC2985E3DFEF8C4CF30F7F767B659E3126 +Ciphertext: 097E59EEE44F279DFD041ACA2DDEFA697854BCF4173965AA3FB2219C1ABB625C +Test: Encrypt +# +Comment: Test 25 +Key: B361D4F0F1DF2CA4DCE7 +IV: B48B2B7601B108C6 +Plaintext: 90E27B7FD0381CDF6712AF2DAC4C4D60CC44249C17277068A732447F32C1DCA3 +Ciphertext: D717D0712B062171E57DE55D76814ECCBDFE2FEB6C6FB5D6C505E0197064BAFF +Test: Encrypt +# +Comment: Test 26 +Key: C88F10F7B2EF37F9C924 +IV: BD10E377A21A7144 +Plaintext: E6C7AD887ED2DC227B166956B90CAE6BDDC32EA6C1813DD93C39614AD1C5DB2C +Ciphertext: C0033B363F00D825DECB8953C4C18F0A16B7BDA723799ED8F4076D714189CDAA +Test: Encrypt +# +Comment: Test 27 +Key: 13C9D71AC92FE7A9A8C8 +IV: D1C0D05A37EAA64A +Plaintext: 456CD7647ACB3D576486CB3723B607A3EC751CEAA370738A9770915D009D0360 +Ciphertext: 645AFC71547775DEA68F2C88B0017FED76D2928FECC854986AB0AD74A0B16E4F +Test: Encrypt +# +Comment: Test 28 +Key: 58DCDAAA5382D16D8675 +IV: 4AB3DA6C69EE1468 +Plaintext: 2F7EFF71BC0F2644475D59423E1C750609B56849041A50C6D6967FAA6F9D55E5 +Ciphertext: 1DE4BD8D7EFF542C140168508AC49705595BC25FE0549BC133A23A00AD28DC2B +Test: Encrypt +# +Comment: Test 29 +Key: E8720DC6280668E4775A +IV: 1C94CB484CE1FD82 +Plaintext: 690EF69DA644678235C5F9B0A61B7E30D19FC8F17D055ABA8430217D56057259 +Ciphertext: 888C684116533E85485D4EA6731B78EA0EF41351830CD9FF273688DD91E08B8B +Test: Encrypt +# +Comment: Test 30 +Key: EF7476BDBA75F30B6914 +IV: ADED6C5E4A336831 +Plaintext: 5EDBB89BFC278D9CAB4C353EBCFEC57E03A23A433B74C0D502717A326C4CAFC3 +Ciphertext: 355FB9C5BCF1E6D3B987D15A116C1F99A58DADE8C5BD86B45EBC76EF6DF81676 +Test: Encrypt +# +Comment: Test 31 +Key: 18D1D75942A1677247E9 +IV: 373D45BCE58F2DF1 +Plaintext: D1945AF48EE26640ADDE57EB3EA4D7A33E10C4242B8ED154795D796A23E1D1DE +Ciphertext: 9BC503B618CFC620A4ED0700A4D8D6E4D3BF8E5BA2C9D4CEE7B56DB8F0995C0A +Test: Encrypt +# +Comment: Test 32 +Key: DFF3BFB6B8AF9DB5E9EB +IV: EF9C41CA78288B0E +Plaintext: 7922CA718DA2F97D7FAB5DCEE40C6C5941493B7FB020A4B196A05840011BA55C2A9357686018A904 +Ciphertext: 8AA481B88C40904FE62B25DD26207EDEAD7948CB41E74585BE33BC8EAC666C7282E2ED9E086AFA71 +Test: Encrypt +# +Comment: Test 33 +Key: 012A0BBBBC88D4099719 +IV: F19D30209C202154 +Plaintext: D6657291EDEB3574010B0BB3B20C6FBB464D5A8D12C6726B803B24689BFB193DBCC872372C70F820 +Ciphertext: FCE7CA59CA2DE809ED9F9B1B4B869C09D67FC67DA1E8118BA570D8CB1F67A1B416ACCA0186DCF381 +Test: Encrypt +# +Comment: Test 34 +Key: EAB242D2B54BD884CEF7 +IV: C41FB1AA0CF00527 +Plaintext: AD37FCA932BE6B3D7A6C699DF08854A19376367BC10790D48A4EA87F21AD380C32EE0FC8ECFF08E0 +Ciphertext: F903514643E83E107599CAEF53680C6DA4707A4C9FCD046F95DAC8582E73B27C08F3217F9A5D889D +Test: Encrypt +# +Comment: Test 35 +Key: 3E8F207A1CD074057221 +IV: EF79429342B73B68 +Plaintext: 875C419A10FADCFAFA79821748ACA36EFAAD2619E9271B0E6175EA547100A842AD685856BF8725C6 +Ciphertext: 4D4A3F9A9A05618C4FDD4420BED871866656575C01EC21264EA8211DF24863B01983131EDD56B604 +Test: Encrypt +# +Comment: Test 36 +Key: 5435B6F2F120DCD3885E +IV: 15BE5819C6B6E1CA +Plaintext: 32BDA2700FD3501838859BF79F295BE7A7B663A3A4EA497A9A8BB3C7901126F906703F66A26F14A2 +Ciphertext: F427BC0DBAFDA8FD34D2BA3CB851B6CA9A4E63B33EC41305E153B14D8AE5177B0DD1E2DBB5412233 +Test: Encrypt +# +Comment: Test 37 +Key: CCD7D7193BEF9E625312 +IV: 7BC8E3CA100A5A95 +Plaintext: 8FCA296E15DD1F93673CFF98F568F63499EA473D7B9EC1979B173811CDA8D6E3CFE0103E4C42F5AD +Ciphertext: BEDB51EC20102A5E863E0B8A88DB92DCFA48B00686A2D92CF353BEF6BC3A1D686B1148F5E18EB166 +Test: Encrypt +# +Comment: Test 38 +Key: 2E69FB7AC60C5C1C9B09 +IV: E9B9C8A6BAF3A13B +Plaintext: 2645F74D56CC7E6C479BD48606DA61160D1F85831B58DAC8B7CE51EA15B4379B57BC33A807E7CD57 +Ciphertext: FFE5D7E5C3CC7B5357476039A6E836525ECBF8933506F4C52EAFE3885491B343C16F04936D348882 +Test: Encrypt +# +Comment: Test 39 +Key: B61E22675D2B6636370F +IV: B6DAC7CD3459331C +Plaintext: CDD3BB67951C4EFD89150E1D7E623411A1C67BFBD2B89C3F7FC927C5AA373D1BC41EF552A18E90B6 +Ciphertext: 0AF07209B33BBE5018F06814600C67EDCBB62168CD13773118C19487D5577DFD98411234D589537D +Test: Encrypt +# +Comment: Test 40 +Key: ACA5CC7B09306E949290 +IV: 7F630CB0B5205E97 +Plaintext: 5AD3ED904754D7318AE6A2002174053A8F639AE685A42748E294E0D5D6061D368010484B369826892B5AE0420C389A93 +Ciphertext: A005AD3280FF52CC23D601D97490154F9EE88F528C3EF2B9C58A446D852FBCC3FA5590E6E67632BA0E5DE2E48858555E +Test: Encrypt +# +Comment: Test 41 +Key: 4044E55A7FB05D4470DA +IV: 9C61A159F20296BA +Plaintext: 5CFBCC11300507C4C5119048827EDCCBF00D6C3CD493241BD90B18533ACBF70A000B22F993404A30C7C5B4A6EF348182 +Ciphertext: F73E586B508B58B243FDA38D6817D134E1797AD9953A7DCA016981D6B2FD80E7421769222B4DCEF1602607985D7E9F3E +Test: Encrypt +# +Comment: Test 42 +Key: 4894022307E590FEB1F2 +IV: F9FFCAB0FB5F13EF +Plaintext: FAA24155F8B7F90CA56E44DD01A26324C5DD859D99D4D2D47A62F4472E03B5706471570948559BEAB683448975BA5BB8 +Ciphertext: 1088543F97740BD05A6AED84F97F08133065655AB2FD4A96413C6752FC3E7EDC0FD37D31505D72FC239FCD2C74B42FEC +Test: Encrypt +# +Comment: Test 43 +Key: 6B844A98C4CF3B8DA6BA +IV: D036BE40BC053DE1 +Plaintext: 29E41F174200114B125DEC67D7080B4BA191802498D86B9E69CA371000BC1A92088FA39362E175B2412B51F15A95473D +Ciphertext: ECAF6C89FE4393AF66313AB939AD84121860AA22D6849BF7799C1D3D60270A667BAC8950DB68B325BA6729C28A095E4B +Test: Encrypt +# +Comment: Test 44 +Key: A96EC73A9265A67428EB +IV: CBCE588C9870AC2E +Plaintext: 8A97DE50B3E5CDBBBEACF7F110912E635EDC84AD586338971EBC1998ACEC6CD7918FA81A570343738583B1E6E486CDC8 +Ciphertext: 04956BAAEA0B948120E220ADEFF28805673B2ED12471C9065697B645C9E7EEACF05D54E99A7ECDA7594D0151C143231C +Test: Encrypt +# +Comment: Test 45 +Key: 57ABF6B8C9E137992D52 +IV: 4472709782879460 +Plaintext: FEAF1B25E0B98E82120F728729A07A7A50AAEE139F47EEBC86136D26672FD251CDA8F4ED919968963933F9A3E0D23B59 +Ciphertext: 401DBAA3CB96535A50F889C3CE7078CC9AAAD8352788872A86B811DCF44CB4B989DFF859E062B88128A1A857E230D7F1 +Test: Encrypt +# +Comment: Test 46 +Key: 1FA955033D3128EB5CFE +IV: 331C0F2DBF0C6B98 +Plaintext: C33DDDD37C3A40059F45D8C077172A49ACF4B4CF41C0D1BE24B676687F1AC60C62FA1A74AB7A4C2DAF5722DD0A2FA311 +Ciphertext: C9F40302E11293871EEF0BA475657431AD41056765D810273BE518B882DB8EFBA934BD39C089FB068AB03AEAFF213360 +Test: Encrypt +# +Comment: Test 47 +Key: D978110E2BF626278366 +IV: 00589C8C8050032E +Plaintext: 1D8CB3CB3DE4BA72EEAE4E3636085BD36C5725F789161A9506C26E82A582EFA91CA26FA0CA420DE4BE82A475B8DBF1B5 +Ciphertext: C9EF35BF6F18E5AEBA4B24F5E9E21C0578C84C0551683D73F7EB5A46A9BC0416B480A5955D82DC0F5D0C45E07B68211A +Test: Encrypt +# +Comment: Test 48 +Key: 94A098D3BEC3ABC5CD4F +IV: 8971952CBB60B9E8 +Plaintext: ED87309A14AF277C641E15A9268DE966866B4DE76399EDEE4C294ACB555AAED9C343B93A13BC2A5EDF3F8CF140FAD0792B6AB7E5798B2D2F +Ciphertext: FA90A7783986949A7EA1D64D9A3EC76A4D30D6CC3E418247D690C08594C399DB5EEBEE75A4E125D983D2802E041677C81543973C1814405F +Test: Encrypt +# +Comment: Test 49 +Key: A344F2E617E4273249BE +IV: 13F19C70C0E4A544 +Plaintext: 66E8D57B2BAED10331F5B589267B5548BA4294FE7F50F5202CFEDF64D40C9CCD05C6D353100C4A30F35ECB798D832493AA0562C3515A9541 +Ciphertext: 2A990208443FB712FE1601B86E9DE18287D467FB00D042845448201E9C010F907E051E6DA2C631F82051305F9C430E24BB23611467F18110 +Test: Encrypt +# +Comment: Test 50 +Key: A896F986F4B8DBBE79A8 +IV: 3E295F175DE70ED6 +Plaintext: E7B6586803B765297BDB166F4120BE9D86E8F3CAEC8618DD3CFF0AB22742B65FEF9ED483EDC1A1ADD1C931A9571F53CE02C3D6363658FD33 +Ciphertext: B9518EF26B1460984A21351D3C11FF6412CCBE1279FAE38478F41E56C605761693C17541076FA33FDB1685DC3002CCEB2FC9E4B32AE53103 +Test: Encrypt +# +Comment: Test 51 +Key: 55619F45A78C1A31865C +IV: 062BF56B3798B028 +Plaintext: C7FAF156FB2463A049DECAEC9A6990D01C6CDB6F085E5AFA228E487ED27436FCB0DD0007667CBB958437CE97A2CED1A2EDA444FAE41E1935 +Ciphertext: 8BCE93DBABA14DC421DAE927119264F53043AE68EF999997E68DBB614C0AA35216086ED283133B36B6035A9AC8E76A9EC045345EF8F91CAA +Test: Encrypt +# +Comment: Test 52 +Key: 8315EBA2D2F7B99CFF24 +IV: 2C0A9EAC5AD413D8 +Plaintext: 5794019B1096A58D1ECD4CE51E02BC858C6F8E23E545CE732C83CBEFE62CD061EF90CC02471F91F5AB8ABFDC9D4C41B0E04E4A7319807BA8 +Ciphertext: F3FF81DCE49205B64B1A5766E6E21E0B63B82B38D727DE3891936DFBB17DA0EF0C4643346991F18530C40F53513CE0796F0EC4CDBE3C3EBA +Test: Encrypt +# +Comment: Test 53 +Key: FD1139458EE38CB6EB2C +IV: 5198002FF19B9E01 +Plaintext: EC692FC4876FE3B8DF49324A5CA7ED79A65E5E350DD9042105464423C51810AFE2E220533D773D6021B98F7A91A14D2FE6F763A60E941EC5 +Ciphertext: A569FA5DCDA987442337A60C912DAA0D21EB72309F6FB9F44D7E547C732B77C6AC35C894F944A1AD104115A890033AEC429DBA56F9CAD555 +Test: Encrypt +# +Comment: Test 54 +Key: 67069E9B4949A4D988CA +IV: 103F6E38F5BDA366 +Plaintext: 7639279E1649D677741CF69993C0B9BDED53A969B94185AC79240D8A815052435BAECCA6F062BE2551DC2246B4048F6893195E1F15CBB342 +Ciphertext: 1B3D907D739FFA7084AA56F10841332CB12BE126C1EEBA32AA75346D0EC47262AF11B685E3990897A93D9CFE4CD17822EABBDD6B4072B076 +Test: Encrypt +# +Comment: Test 55 +Key: C54ADA6947DB1FABD782 +IV: 9F316112C20D35F1 +Plaintext: 9CF386C226B076204C5AFD80AB995D8E618AC049D04766043286043BB6B99656C1B8731D05A1D6AF8DC1C341109A003ED696D17E5B097058 +Ciphertext: 950DD8B47783A27129AB4A9D7E2A8CD70D3174F37E5F260F78F8139C82C5B4D3DBE67F76BEB79AC00D04EE370D961EAAE81269163A067939 +Test: Encrypt +# +Comment: Test 56 +Key: 8FE5AEE4D5A52119EA41 +IV: 309CCC2DC6F9B4C1 +Plaintext: 29CDBD30A3B4A033DECB9C8BF434F58A81CDBDD4FD7331F2ABE6A9C4062A16FD250AA13968D9AC18670541B1419DAF38D14F9F1CA901E8F6DA5520111A3A3C20 +Ciphertext: 8D8D31C8200F0173529BD386B882AF2947AB37A251B36A8A7A50FBB5B6167F45BEBA941A517D41309CAD68DF1E51B2503A4A40DAA70DD4DBFF7634393BB6E8C9 +Test: Encrypt +# +Comment: Test 57 +Key: 4BC715608DE4993C3E23 +IV: 2E8985E7DEFA0738 +Plaintext: A2AF43EC39BA0842A6E12A5CBD8E17216DFB6BEF323E4AB47AF6413616BA651EAFC806A4DAC0739E7AF968E88EE7670E68AF25A997B7F4DBF6BB6A82C6345B50 +Ciphertext: 7D50E2C7B6BA8FCCAE1E690DA010F37F5CE5EAC12CEABDF8B8CA904FA62A38D6A1A1B599EA72898A5004E65E1BA918067B8083599FB62F266CB9690EC600A474 +Test: Encrypt +# +Comment: Test 58 +Key: 5216AD26BB64B5F82537 +IV: A2B29BD935CA5F33 +Plaintext: 884C4377D64CB11700EEF98721868A1AEBE61F0BE21FFC7B32745F47591727B8167B738D26DB40B0DCD5207E7C7FA4F1980F4C85DA702C5CB3229236DEFCBA1F +Ciphertext: AACA119F5213BCA42E1934806E361C3B3061B227353DE2329BA205417CF6C4EF73C6D9F669A3D797425916A4F854F89F13C3DCD8640C25F7A888EDDED475D2A1 +Test: Encrypt +# +Comment: Test 59 +Key: 7014C10AD6B2C529ECA7 +IV: 2C0945195DDF95E5 +Plaintext: 514A09C2CC5E2B0E05DC74FD99AEC01ACE9BD29A190175AC3FE17C6C1B3AB53CC3A363648C91FD97D7C50BCA0974F4201CE0A94EAA04A665DC46E47533CD8764 +Ciphertext: C9EE702571103E4244F33F628BFFCA25E23CE806CF469F2A8759444E74866C13EA460D0D34747D7453FD60F3FCD3E0882372C27FAA49F6FF52356C7EA399784E +Test: Encrypt +# +Comment: Test 60 +Key: 841B87D7AC2A5BA87E70 +IV: 2D60788707CFDFAC +Plaintext: C2F1BAC9782959F692D29A4B119153ED02A29716ED132120DBC79E065C0BEEA85705897512EE5C0F160D60E29BFA692B4123207C2388C5A2700BC93C701D0BD8 +Ciphertext: 275CBDD886D3E31297E0392D85A7CD853AB6F60DF9753D4C1B3E12434AEFABB24224F10BEE33DC002C4568DF16734698277C3AC9740E25293946891CA6E79D7B +Test: Encrypt +# +Comment: Test 61 +Key: 7097773F33A1D05B7A19 +IV: D3C5E22ADCF9F7E6 +Plaintext: 477CB64F07099D2F8DCAB899FC8D6590BF1156E5F3FCB6ADF4F05966B18698E7BFA32BE0BAC64706D0268F6293E66D085C131773B7CDA472531C09D988F54D23 +Ciphertext: 99D759E31213E2C1987232FD08CC2BB5BE1A6EFE1012A3A8B17FBE3A363F8F9283D89EF02421B2FA89DA59646796038D6F2FF2B4DA405896D3BE2665B187BB9E +Test: Encrypt +# +Comment: Test 62 +Key: 7335C181CCF2A5AE5BCA +IV: A97AFA2D904C3C03 +Plaintext: FBB74C0D4CDD21655CE7C4F90D836D9A004838281CE6A7EC09A91FBF155AF4D563782311DCF4381857543741EFE70E796A72375DB19FEF463EB6CA4DE232E9F8 +Ciphertext: 11AE0B2B5FCAE81887EE8DACC637E59A9F66F8ABF30070C4C4BD3C61CDB4A7BF3D47712267EBCB41572CC4FC4387B8238E2077F0D34BD16608109D57F7A2B460 +Test: Encrypt +# +Comment: Test 63 +Key: 3A8D4C48A524D26A43EB +IV: 8E6F9171D334A23F +Plaintext: 2704DBD13A8CEC41BC347C5096F7D51D95EA934331315847180EA0090D30703372C798CCA432DC36FA987A462DB32E5074A70923B991E1C73333E81E228841E2 +Ciphertext: 63AFDC0045E29BEC2EA2836B3161A64DFFBA0AE3A76833676CA0849B48A096609E4633841B26AD734322F66B08891F33D2A0B9D018501E02231BF262E0CD5546 +Test: Encrypt +# +Comment: Test 64 +Key: 1D3490A6B3AB7564B828 +IV: 91520926884F4D06 +Plaintext: 246D8BF4B33C59A62E74291B6EF3B384663CE1379E7051C2BF7F56AD3889970C7F8DA297AFD228C2B7B0D321F50C910E895EB58BBE6C28EE47D55100FD580D6351CA32C33D847DF5 +Ciphertext: A1823C8AAF83E977DD093E5501487BB9FE279BEAE9FA2565FA31BC3CE727F7999D6883BA256871221A76C620660829D6033F0D08BA54DCF31A9B22B30428116775FD5EBE2A144682 +Test: Encrypt +# +Comment: Test 65 +Key: 65742EF3789901EF4064 +IV: B88386D139B2BF5B +Plaintext: 083CC04DF9A12CA71B2A6174A93BC1032CC5D4E38B5861A60FD41AD121977DC9C7D22DB86AF5629CD9A1273C952BCB712CF209B7BBDE0404AF6A026C111F93CB8B53340A26E1D3F3 +Ciphertext: F2E45EBD121BF87637964C261DF22BBDE7255D079B5C6E54E5733BE88BF8343EEA3B92E69F1722C01DAB6659277ADE7D9E337A61A61EAA5CD63348E9E0F74D0B2CB8C422A3CD1CE1 +Test: Encrypt +# +Comment: Test 66 +Key: 34B068A92D7C68A69689 +IV: 4F909996F78111C8 +Plaintext: 46F8A81CCB2C9548F9F8D297B283AD45D9512D37193FE3EBB7E3428C87FF55DBC3F186379A3CE57801C71680892D9A278AB175B202D987C43B6847841BCED61D0F0657290B165FAF +Ciphertext: 381FFF8E08E5A91E929CD5F6063A7304756D4548531FFAFBD28A7FA3AA19F688F33E9FE1DE5A25BACE2ADA4BD771F98A0494EC0AEE4EF0B2C11994612A44228B6BA3BF496C1A8571 +Test: Encrypt +# +Comment: Test 67 +Key: AB526077DDA405C94EED +IV: 5369B885BCD46A1A +Plaintext: 00117B2C55D12C315A77EE227963F99C57D144885C3B2D722C4FDAC361F8ADD7E6245F2FC1B9D50A5F0EBEE903CC6A237DB025DA739DE35CA57F528482295E2FDBF120BFDF0ECDED +Ciphertext: 4D4DEE75C367D397302963CC2D0161BBD44FE0210D15F87D3F9F33BC404DDB3DB872391F97F55595C59AECF0BE62A963B4994C15E0AD4D71CF8A59B17E2234C180F9BE01312A3975 +Test: Encrypt +# +Comment: Test 68 +Key: AEABFADE29C488DA76E1 +IV: F24383BF95F62466 +Plaintext: 0FF660B7217735CE73275DCF52EF1E1089BABCA8CA027BEBF2B0AF3C08C3A19F8037122EDE698477C895ED398E16FA1F60B3BB787D84CCC9367AB31D5D0B1FBB9622DD4FD4A5295C +Ciphertext: 893C142FF904C5000F038E640A730382214AA4840F461AC0F66AE66B05E4C70F55BD534CD0D73AC21BF969B4DD27E6DBD13F7172955CBD1F88AA6A126ED132BFB7D6B045090EB284 +Test: Encrypt +# +Comment: Test 69 +Key: 37737664EBBB4406C0EF +IV: D8B54E262C2287CD +Plaintext: 213448094853AE1C17C07A1ABD8351AFCB121DEE3BB5CFF988A2226FE1E6A84A043F3D47FDA8A126A734D75E29D94A11D98FA6409AAB6E6E994EE4D415518B84CD904D98EA814534 +Ciphertext: 5459BD040AF03DE3FE1B1E7E175882644C1ABFA2A4A53249D400CF37B26E16FE07B81C320E40015A67ADCA4BBB939A9D5530E4135BEDB2E00CDC3E7755034EE2FC23BC26A5F7C89B +Test: Encrypt +# +Comment: Test 70 +Key: 06A3E6CAF7957ED38B0D +IV: FAD521EC06931EE4 +Plaintext: 83913855364D91152392BE02C51271A5AA0DD97130DDC24A73DB654EFF3DA289CE97584C3CF2AB08AB3A07138D07C2B6B5955B68618EB5B69AAD43DD78B55B4820723134ACA6634B +Ciphertext: 195D648DEC7AACFEB5BAB45109A387A919B39A23459430C7CD6054E5CD0E409647D724FB4FE19A7D8B91C351F4023C3927DEDEA17984FF2D4B506E542C14ADAE617CB4FE470DE181 +Test: Encrypt +# +Comment: Test 71 +Key: C9F98AAD70008B6F7FF0 +IV: 539FC497318EAFD2 +Plaintext: 8511457949F99DE29A390380B425ADF3803702AE77FBB5EF09488F193B8EDE6A0A8FCE706E1694F52413183A8EC95624DD86F9D6E7AA27DE555148DB8E655592C70C58ED100C896C +Ciphertext: F53BF1CBCF659C97F3345B06CE809B614F816A2D9B9FE9F24861E9F117135A46BBFF7686DFBE9DF8E822DA19AB9B7111A95EC2575B82C0032D7153C60DCD2DE419D8001A07831434 +Test: Encrypt +# +Comment: Test 72 +Key: 7229D62890E07FD21CBA +IV: 4AA881882DBDDCDE +Plaintext: 5CF8D4A04C00F44A2678BDBD48E66C827A3F7E128A88E594343D42518F1EE4302CB711466FAD2A0FDC43735A4DBA3177CE19D109230FAAED5C8913BCB0EAA93F69EE316BFA993C70C3952F0C73A194AF +Ciphertext: 9793ED34E744E8E4EBE7C4ECF2ECEEE69B652A917208A70CEF8BEC17304189126AE3E775249B6947BD6E2E16B580EFDBD5DA39A2E396141B51C9119362C1B58C0657CE53164105C16398CF26C8A0657A +Test: Encrypt +# +Comment: Test 73 +Key: 5A72F4AED99E30172CE9 +IV: 805862B66B540940 +Plaintext: 3384861C4116AD91BB6F386C13A32478562032384A5DE2D04697F2D6081FC5AF1D9016703B5CA1AAE453DDE70ED9AFD66B3C119AB22628D284ACE18E01B861ACA1B3F2382EB9549744FE26F6BEE2F373 +Ciphertext: 41123E22AB573FD137942C7B5A24D8EC02EF699B273313C3BBE3B0DF5EA5118C65736982CD855A3131190A0573E28C1EEB555F5BB0B55AAE04643EACE8210C34539F06DC56C2AE9B89F2ECA6D16299AD +Test: Encrypt +# +Comment: Test 74 +Key: B3FBD0B33277E6177323 +IV: 5596C97573C71614 +Plaintext: ED1CB6D8E3929E935460AF6A8171FEFCC0053821C99335C4A877E6329C5824F8953A2459C1094D446B5F6FDFA8F3FDA03FD5299CBEB536CF6FDB57E9B8D55F26F1D17506B793B19961429118BA33283F +Ciphertext: 54158269ECC0A54AF212D8FA996C90B47A6C2DD77A9E527DE1F3C8B50B190E1997826E6D0BE147C2F24B0F1B77F36E05255322B3B1DA23A68769D7341F61B22FA3FAA97680EE7FD2BE87E3FD9F97B784 +Test: Encrypt +# +Comment: Test 75 +Key: B735229D74304524BF5C +IV: D9960C50007F9CD3 +Plaintext: D318F12DC24024284FDADFF1DBDF405FBE3458AC95E60CE9DE959E5A6AEEC4A2656830459998B330EBC4D2ACF05754B87BBEC64FE16E923C1812D0393C42BDADCADAC748FE90E0DBA2E5A717F967497F +Ciphertext: A3413814BA8AFD242DAAFBBD1B1F9FFB803D2A6923412CB36C9FB567CA6955CB7BA3F73D0831B68AD2B90CB9C9E6F72D8EF76F516A0FDBC42732D8E0BAEEC25B0BDABF5FACDA0DD457A095B314B9D1E6 +Test: Encrypt +# +Comment: Test 76 +Key: 09E6E8718237FE41E962 +IV: 0D9A9B64E9182CBB +Plaintext: F3064126817B160A47085F4A5B2381F6875C1E627EFD32B993262BE0E4ED0EAB81669CF70C40AEF99D8F558CB1373FFBA55183526C3409B076E529C428AD562471EE7BF33045D0642FF47177BACBBC85 +Ciphertext: DD3DD6F79263619C6CD0BE7D164E85227E401B97C41020CE7D6BDBED44EFEB2F3FE18E50D4DF204A819A39782FED4BC3DD4246715FB51AB9C38636B0C3CC0D8BC93847D43B0147E56E04537FE8EC23E6 +Test: Encrypt +# +Comment: Test 77 +Key: 833628B87D396017C4BC +IV: 353B06C21318F7E1 +Plaintext: 2253D779CBB16DFABC4AA8616090667AB214100A94A5FE6FC04F8A34B1EEEB9FEECD2459659FE048D3C9A82F5D62E459B13C1270C0A42B383CB298E1D408045734D6C2CF15A11C3A080224B4ED6F63DA +Ciphertext: 8D68D929CBD86C4DA102AEB15474B3690078EEAA641BB72140BB6E8A058E584BD1DFEC4E37A0A11A5C53F3147F3A3E3C0A437524F0A8E850781D36EF7E53A7B4AC8762D97A5F6D62C5995649B4026D23 +Test: Encrypt +# +Comment: Test 78 +Key: 762DC6790190C686E06C +IV: DD2D4804D3BBBAEF +Plaintext: C6DCA753D286A8E4AA4F7C7B26DD6C5971C30660E7261D2E45185D66CF1BD72C249ACCA537920252DAD4E843F88A3B28017824A7E9587BCC9CC2FCFE3DAB80EFDA0CB9188B31B99027FEC26D69243B42 +Ciphertext: F851B7078D51C0F8AFA40A72CC4B6810A9D45A7351935ECA57BBAF326D3D76E4D2CF05F020B040FF0F384CD4A5C8F527114106EA0E5245857AF1282C8C29B30140C5FDB3DE6AD4A3F3028A4F534B7C26 +Test: Encrypt +# +Comment: Test 79 +Key: 10F76133248468347E85 +IV: 1106375D63619DA0 +Plaintext: C1DD53593D64F83EFE8DFE8A8D9CA10C5314EC90852BDFBD5B744D8D1FF5F48DE50644028B40FD44EF590AD008D970DE5537E5DF80E252FB78949B89BB06CDB69540500B10BC4613173CAB878B6256D9 +Ciphertext: 7FF51E0B18E041834CDAAED6A2D0BC0BAA15544DF73BE407DBE106EADF12EDF094A596A728BC3CB5671793C5A62E226F646DCCAA96A98F7CFF7C4066EAFF0CD5C2164F78B688E97E7205BCE363411580 +Test: Encrypt diff --git a/vendor/cryptopp/vendor_cryptopp/blake2.cpp b/vendor/cryptopp/vendor_cryptopp/blake2.cpp index 7646eaa9..f8872619 100644 --- a/vendor/cryptopp/vendor_cryptopp/blake2.cpp +++ b/vendor/cryptopp/vendor_cryptopp/blake2.cpp @@ -38,8 +38,8 @@ // https://github.com/weidai11/cryptopp/issues/743 #if defined(__xlC__) && (__xlC__ < 0x0d01) # define CRYPTOPP_DISABLE_ALTIVEC 1 -# define CRYPTOPP_POWER7_ALTIVEC 1 # undef CRYPTOPP_POWER7_AVAILABLE +# undef CRYPTOPP_POWER8_AVAILABLE # undef CRYPTOPP_ALTIVEC_AVAILABLE #endif @@ -171,8 +171,8 @@ extern void BLAKE2_Compress32_NEON(const byte* input, BLAKE2s_State& state); extern void BLAKE2_Compress64_NEON(const byte* input, BLAKE2b_State& state); #endif -#if CRYPTOPP_POWER7_AVAILABLE -extern void BLAKE2_Compress32_POWER7(const byte* input, BLAKE2s_State& state); +#if CRYPTOPP_POWER8_AVAILABLE +extern void BLAKE2_Compress32_POWER8(const byte* input, BLAKE2s_State& state); #elif CRYPTOPP_ALTIVEC_AVAILABLE extern void BLAKE2_Compress32_ALTIVEC(const byte* input, BLAKE2s_State& state); #endif @@ -233,8 +233,8 @@ unsigned int BLAKE2s::OptimalDataAlignment() const return 4; else #endif -#if (CRYPTOPP_POWER7_AVAILABLE) - if (HasPower7()) +#if (CRYPTOPP_POWER8_AVAILABLE) + if (HasPower8()) return 16; else #elif (CRYPTOPP_ALTIVEC_AVAILABLE) @@ -257,9 +257,9 @@ std::string BLAKE2s::AlgorithmProvider() const return "NEON"; else #endif -#if (CRYPTOPP_POWER7_AVAILABLE) - if (HasPower7()) - return "Power7"; +#if (CRYPTOPP_POWER8_AVAILABLE) + if (HasPower8()) + return "Power8"; else #elif (CRYPTOPP_ALTIVEC_AVAILABLE) if (HasAltivec()) @@ -343,6 +343,26 @@ BLAKE2b::BLAKE2b(bool treeMode, unsigned int digestSize) (Name::TreeMode(), treeMode)); } +BLAKE2s::BLAKE2s(unsigned int digestSize) + : m_digestSize(digestSize), m_keyLength(0), m_treeMode(false) +{ + CRYPTOPP_ASSERT(digestSize <= DIGESTSIZE); + + UncheckedSetKey(NULLPTR, 0, MakeParameters + (Name::DigestSize(), (int)digestSize) + (Name::TreeMode(), false)); +} + +BLAKE2b::BLAKE2b(unsigned int digestSize) + : m_digestSize(digestSize), m_keyLength(0), m_treeMode(false) +{ + CRYPTOPP_ASSERT(digestSize <= DIGESTSIZE); + + UncheckedSetKey(NULLPTR, 0, MakeParameters + (Name::DigestSize(), (int)digestSize) + (Name::TreeMode(), false)); +} + BLAKE2s::BLAKE2s(const byte *key, size_t keyLength, const byte* salt, size_t saltLength, const byte* personalization, size_t personalizationLength, bool treeMode, unsigned int digestSize) : m_digestSize(digestSize), m_keyLength(static_cast(keyLength)), m_treeMode(treeMode) @@ -670,10 +690,10 @@ void BLAKE2s::Compress(const byte *input) return BLAKE2_Compress32_NEON(input, m_state); } #endif -#if CRYPTOPP_POWER7_AVAILABLE - if(HasPower7()) +#if CRYPTOPP_POWER8_AVAILABLE + if(HasPower8()) { - return BLAKE2_Compress32_POWER7(input, m_state); + return BLAKE2_Compress32_POWER8(input, m_state); } #elif CRYPTOPP_ALTIVEC_AVAILABLE if(HasAltivec()) diff --git a/vendor/cryptopp/vendor_cryptopp/blake2.h b/vendor/cryptopp/vendor_cryptopp/blake2.h index 1d977707..5e0542f2 100644 --- a/vendor/cryptopp/vendor_cryptopp/blake2.h +++ b/vendor/cryptopp/vendor_cryptopp/blake2.h @@ -256,17 +256,25 @@ public: /// \brief Construct a BLAKE2s hash /// \param digestSize the digest size, in bytes /// \param treeMode flag indicating tree mode + /// \since Crypto++ 5.6.4 BLAKE2s(bool treeMode=false, unsigned int digestSize = DIGESTSIZE); + /// \brief Construct a BLAKE2s hash + /// \param digestSize the digest size, in bytes + /// \details treeMode flag is set to false + /// \since Crypto++ 8.2 + BLAKE2s(unsigned int digestSize); + /// \brief Construct a BLAKE2s hash /// \param key a byte array used to key the cipher /// \param keyLength the size of the byte array /// \param salt a byte array used as salt /// \param saltLength the size of the byte array - /// \param personalization a byte array used as prsonalization string + /// \param personalization a byte array used as personalization string /// \param personalizationLength the size of the byte array /// \param treeMode flag indicating tree mode /// \param digestSize the digest size, in bytes + /// \since Crypto++ 5.6.4 BLAKE2s(const byte *key, size_t keyLength, const byte* salt = NULLPTR, size_t saltLength = 0, const byte* personalization = NULLPTR, size_t personalizationLength = 0, bool treeMode=false, unsigned int digestSize = DIGESTSIZE); @@ -278,6 +286,7 @@ public: /// Message Authentication Code (MAC). For example, "BLAKE2b-512" and "BLAKE2s-256". std::string AlgorithmName() const {return std::string(BLAKE2s_Info::StaticAlgorithmName()) + "-" + IntToString(DigestSize()*8);} + unsigned int BlockSize() const {return BLOCKSIZE;} unsigned int DigestSize() const {return m_digestSize;} unsigned int OptimalDataAlignment() const; @@ -354,17 +363,25 @@ public: /// \brief Construct a BLAKE2b hash /// \param digestSize the digest size, in bytes /// \param treeMode flag indicating tree mode + /// \since Crypto++ 5.6.4 BLAKE2b(bool treeMode=false, unsigned int digestSize = DIGESTSIZE); + /// \brief Construct a BLAKE2s hash + /// \param digestSize the digest size, in bytes + /// \details treeMode flag is set to false + /// \since Crypto++ 8.2 + BLAKE2b(unsigned int digestSize); + /// \brief Construct a BLAKE2b hash /// \param key a byte array used to key the cipher /// \param keyLength the size of the byte array /// \param salt a byte array used as salt /// \param saltLength the size of the byte array - /// \param personalization a byte array used as prsonalization string + /// \param personalization a byte array used as personalization string /// \param personalizationLength the size of the byte array /// \param treeMode flag indicating tree mode /// \param digestSize the digest size, in bytes + /// \since Crypto++ 5.6.4 BLAKE2b(const byte *key, size_t keyLength, const byte* salt = NULLPTR, size_t saltLength = 0, const byte* personalization = NULLPTR, size_t personalizationLength = 0, bool treeMode=false, unsigned int digestSize = DIGESTSIZE); @@ -376,6 +393,7 @@ public: /// Message Authentication Code (MAC). For example, "BLAKE2b-512" and "BLAKE2s-256". std::string AlgorithmName() const {return std::string(BLAKE2b_Info::StaticAlgorithmName()) + "-" + IntToString(DigestSize()*8);} + unsigned int BlockSize() const {return BLOCKSIZE;} unsigned int DigestSize() const {return m_digestSize;} unsigned int OptimalDataAlignment() const; diff --git a/vendor/cryptopp/vendor_cryptopp/blake2b_simd.cpp b/vendor/cryptopp/vendor_cryptopp/blake2b_simd.cpp index 9a220bd1..13272d21 100644 --- a/vendor/cryptopp/vendor_cryptopp/blake2b_simd.cpp +++ b/vendor/cryptopp/vendor_cryptopp/blake2b_simd.cpp @@ -29,6 +29,7 @@ #if defined(__xlC__) && (__xlC__ < 0x0d01) # define CRYPTOPP_DISABLE_ALTIVEC 1 # undef CRYPTOPP_POWER7_AVAILABLE +# undef CRYPTOPP_POWER8_AVAILABLE # undef CRYPTOPP_ALTIVEC_AVAILABLE #endif diff --git a/vendor/cryptopp/vendor_cryptopp/blake2s_simd.cpp b/vendor/cryptopp/vendor_cryptopp/blake2s_simd.cpp index 4b46c525..ff461da8 100644 --- a/vendor/cryptopp/vendor_cryptopp/blake2s_simd.cpp +++ b/vendor/cryptopp/vendor_cryptopp/blake2s_simd.cpp @@ -38,8 +38,8 @@ // https://github.com/weidai11/cryptopp/issues/743 #if defined(__xlC__) && (__xlC__ < 0x0d01) # define CRYPTOPP_DISABLE_ALTIVEC 1 -# define CRYPTOPP_POWER7_ALTIVEC 1 # undef CRYPTOPP_POWER7_AVAILABLE +# undef CRYPTOPP_POWER8_AVAILABLE # undef CRYPTOPP_ALTIVEC_AVAILABLE #endif @@ -692,7 +692,7 @@ void BLAKE2_Compress32_NEON(const byte* input, BLAKE2s_State& state) } #endif // CRYPTOPP_ARM_NEON_AVAILABLE -#if (CRYPTOPP_POWER7_AVAILABLE || CRYPTOPP_ALTIVEC_AVAILABLE) +#if (CRYPTOPP_POWER8_AVAILABLE || CRYPTOPP_ALTIVEC_AVAILABLE) inline uint32x4_p VecLoad32(const void* p) { @@ -838,7 +838,7 @@ inline uint32x4_p VectorSet32(const uint32x4_p a, const uint32x4_p b, const uint32x4_p t0 = VectorSet32(a, b); const uint32x4_p t1 = VectorSet32(c, d); - // Power7 follows SSE2's implementation, and this is _mm_set_epi32. + // PowerPC follows SSE2's implementation, and this is _mm_set_epi32. const uint8x16_p mask = {20,21,22,23, 16,17,18,19, 4,5,6,7, 0,1,2,3}; return VecPermute(t0, t1, mask); } @@ -1015,11 +1015,11 @@ void BLAKE2_Compress32_CORE(const byte* input, BLAKE2s_State& state) VecStore32LE(state.h()+0, VecXor(ff0, VecXor(row1, row3))); VecStore32LE(state.h()+4, VecXor(ff1, VecXor(row2, row4))); } -#endif // CRYPTOPP_POWER7_AVAILABLE || CRYPTOPP_ALTIVEC_AVAILABLE +#endif // CRYPTOPP_POWER8_AVAILABLE || CRYPTOPP_ALTIVEC_AVAILABLE -#if (CRYPTOPP_POWER7_AVAILABLE) +#if (CRYPTOPP_POWER8_AVAILABLE) -void BLAKE2_Compress32_POWER7(const byte* input, BLAKE2s_State& state) +void BLAKE2_Compress32_POWER8(const byte* input, BLAKE2s_State& state) { BLAKE2_Compress32_CORE(input, state); } diff --git a/vendor/cryptopp/vendor_cryptopp/chacha.cpp b/vendor/cryptopp/vendor_cryptopp/chacha.cpp index dccde301..58fd2201 100644 --- a/vendor/cryptopp/vendor_cryptopp/chacha.cpp +++ b/vendor/cryptopp/vendor_cryptopp/chacha.cpp @@ -28,8 +28,8 @@ extern void ChaCha_OperateKeystream_AVX2(const word32 *state, const byte* input, extern void ChaCha_OperateKeystream_SSE2(const word32 *state, const byte* input, byte *output, unsigned int rounds); #endif -#if (CRYPTOPP_POWER7_AVAILABLE) -extern void ChaCha_OperateKeystream_POWER7(const word32 *state, const byte* input, byte *output, unsigned int rounds); +#if (CRYPTOPP_POWER8_AVAILABLE) +extern void ChaCha_OperateKeystream_POWER8(const word32 *state, const byte* input, byte *output, unsigned int rounds); #elif (CRYPTOPP_ALTIVEC_AVAILABLE) extern void ChaCha_OperateKeystream_ALTIVEC(const word32 *state, const byte* input, byte *output, unsigned int rounds); #endif @@ -153,13 +153,13 @@ void ChaCha_OperateKeystream(KeystreamOperation operation, } #endif -#if (CRYPTOPP_POWER7_AVAILABLE) - if (HasPower7()) +#if (CRYPTOPP_POWER8_AVAILABLE) + if (HasPower8()) { while (iterationCount >= 4 && MultiBlockSafe(state[12], 4)) { const bool xorInput = (operation & INPUT_NULL) != INPUT_NULL; - ChaCha_OperateKeystream_POWER7(state, xorInput ? input : NULLPTR, output, rounds); + ChaCha_OperateKeystream_POWER8(state, xorInput ? input : NULLPTR, output, rounds); // MultiBlockSafe avoids overflow on the counter words state[12] += 4; @@ -267,9 +267,9 @@ std::string ChaCha_AlgorithmProvider() return "NEON"; else #endif -#if (CRYPTOPP_POWER7_AVAILABLE) - if (HasPower7()) - return "Power7"; +#if (CRYPTOPP_POWER8_AVAILABLE) + if (HasPower8()) + return "Power8"; else #elif (CRYPTOPP_ALTIVEC_AVAILABLE) if (HasAltivec()) diff --git a/vendor/cryptopp/vendor_cryptopp/chacha_simd.cpp b/vendor/cryptopp/vendor_cryptopp/chacha_simd.cpp index 65316384..9fd6b0f1 100644 --- a/vendor/cryptopp/vendor_cryptopp/chacha_simd.cpp +++ b/vendor/cryptopp/vendor_cryptopp/chacha_simd.cpp @@ -209,7 +209,7 @@ inline __m128i RotateLeft<16>(const __m128i val) #if (CRYPTOPP_ALTIVEC_AVAILABLE) -// ChaCha_OperateKeystream_POWER7 is optimized for POWER7. However, Altivec +// ChaCha_OperateKeystream_POWER8 is optimized for POWER7. However, Altivec // is supported by using vec_ld and vec_st, and using a composite VecAdd // that supports 64-bit element adds. vec_ld and vec_st add significant // overhead when memory is not aligned. Despite the drawbacks Altivec @@ -827,7 +827,7 @@ void ChaCha_OperateKeystream_SSE2(const word32 *state, const byte* input, byte * #endif // CRYPTOPP_SSE2_INTRIN_AVAILABLE -#if (CRYPTOPP_POWER7_AVAILABLE || CRYPTOPP_ALTIVEC_AVAILABLE) +#if (CRYPTOPP_POWER8_AVAILABLE || CRYPTOPP_ALTIVEC_AVAILABLE) // ChaCha_OperateKeystream_CORE will use either POWER7 or ALTIVEC, // depending on the flags used to compile this source file. The @@ -1096,11 +1096,11 @@ inline void ChaCha_OperateKeystream_CORE(const word32 *state, const byte* input, VecStore32LE(output + 15*16, r3_3); } -#endif // CRYPTOPP_POWER7_AVAILABLE || CRYPTOPP_ALTIVEC_AVAILABLE +#endif // CRYPTOPP_POWER8_AVAILABLE || CRYPTOPP_ALTIVEC_AVAILABLE -#if (CRYPTOPP_POWER7_AVAILABLE) +#if (CRYPTOPP_POWER8_AVAILABLE) -void ChaCha_OperateKeystream_POWER7(const word32 *state, const byte* input, byte *output, unsigned int rounds) +void ChaCha_OperateKeystream_POWER8(const word32 *state, const byte* input, byte *output, unsigned int rounds) { ChaCha_OperateKeystream_CORE(state, input, output, rounds); } diff --git a/vendor/cryptopp/vendor_cryptopp/config.h b/vendor/cryptopp/vendor_cryptopp/config.h index 4516d2b3..283c4090 100644 --- a/vendor/cryptopp/vendor_cryptopp/config.h +++ b/vendor/cryptopp/vendor_cryptopp/config.h @@ -74,24 +74,6 @@ // Also see https://bugs.llvm.org/show_bug.cgi?id=39895 . // #define CRYPTOPP_DISABLE_MIXED_ASM 1 -// Several compilers discard SIMD code that loads unaligned data. The symptom -// is often self test failures and UBsan findings for unaligned loads. For -// example, Power7 can load unaligned data using vec_vsx_ld but some versions -// of GCC and Clang require 16-byte aligned data when using the builtin. -// It is not limited to SSE and PowerPC code. Define this to disable -// Crypto++ code that uses potentially problematic builtins or intrinsics. -// Also see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88234 and -// https://bugs.llvm.org/show_bug.cgi?id=39704 -// #define CRYPTOPP_BUGGY_SIMD_LOAD_AND_STORE 1 - -// This list will probably grow over time as more compilers are identified. -#if defined(CRYPTOPP_BUGGY_SIMD_LOAD_AND_STORE) -# define CRYPTOPP_DISABLE_LEA_SIMD 1 -# define CRYPTOPP_DISABLE_SIMON_SIMD 1 -# define CRYPTOPP_DISABLE_SPECK_SIMD 1 -# define CRYPTOPP_DISABLE_SM4_SIMD 1 -#endif - // Define CRYPTOPP_NO_CXX11 to avoid C++11 related features shown at the // end of this file. Some compilers and standard C++ headers advertise C++11 // but they are really just C++03 with some additional C++11 headers and @@ -116,7 +98,10 @@ // the version of the library the headers came from. It is not // necessarily the version of the library built as a shared object if // versions are inadvertently mixed and matched. -#define CRYPTOPP_VERSION 810 +#define CRYPTOPP_MAJOR 8 +#define CRYPTOPP_MINOR 2 +#define CRYPTOPP_REVISION 0 +#define CRYPTOPP_VERSION 820 // Define this if you want to set a prefix for TestData/ and TestVectors/ // Be sure to add the trailing slash since its simple concatenation. diff --git a/vendor/cryptopp/vendor_cryptopp/cpu.cpp b/vendor/cryptopp/vendor_cryptopp/cpu.cpp index 5a160529..4424af0b 100644 --- a/vendor/cryptopp/vendor_cryptopp/cpu.cpp +++ b/vendor/cryptopp/vendor_cryptopp/cpu.cpp @@ -341,8 +341,8 @@ void DetectX86Features() word64 xcr0 = a | static_cast(d) << 32; g_hasAVX = (xcr0 & YMM_FLAG) == YMM_FLAG; -// Visual Studio 2008 and below lack xgetbv -#elif defined(_MSC_VER) && _MSC_VER <= 1500 && defined(_M_IX86) +// Visual Studio 2010 and below lack xgetbv +#elif defined(_MSC_VER) && _MSC_VER <= 1600 && defined(_M_IX86) word32 a=0, d=0; __asm { push eax diff --git a/vendor/cryptopp/vendor_cryptopp/cryptdll.vcxproj b/vendor/cryptopp/vendor_cryptopp/cryptdll.vcxproj index 88360ed5..2a65a6b9 100644 --- a/vendor/cryptopp/vendor_cryptopp/cryptdll.vcxproj +++ b/vendor/cryptopp/vendor_cryptopp/cryptdll.vcxproj @@ -212,6 +212,7 @@ + diff --git a/vendor/cryptopp/vendor_cryptopp/cryptdll.vcxproj.filters b/vendor/cryptopp/vendor_cryptopp/cryptdll.vcxproj.filters index 23bf3f49..a4951a76 100644 --- a/vendor/cryptopp/vendor_cryptopp/cryptdll.vcxproj.filters +++ b/vendor/cryptopp/vendor_cryptopp/cryptdll.vcxproj.filters @@ -98,6 +98,9 @@ Source Files + + Source Files + Source Files diff --git a/vendor/cryptopp/vendor_cryptopp/cryptest.nmake b/vendor/cryptopp/vendor_cryptopp/cryptest.nmake index e480c5f8..1919122e 100644 --- a/vendor/cryptopp/vendor_cryptopp/cryptest.nmake +++ b/vendor/cryptopp/vendor_cryptopp/cryptest.nmake @@ -69,21 +69,22 @@ LIB_SRCS = \ gcm_simd.cpp gf256.cpp gf2_32.cpp gf2n.cpp gf2n_simd.cpp gfpcrypt.cpp \ gost.cpp gzip.cpp hc128.cpp hc256.cpp hex.cpp hight.cpp hmac.cpp \ hrtimer.cpp ida.cpp idea.cpp iterhash.cpp kalyna.cpp kalynatab.cpp \ - keccak.cpp keccakc.cpp lea.cpp lea_simd.cpp luc.cpp mars.cpp marss.cpp \ - md2.cpp md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp mqv.cpp \ - nbtheory.cpp neon_simd.cpp oaep.cpp osrng.cpp padlkrng.cpp panama.cpp \ - pkcspad.cpp poly1305.cpp polynomi.cpp ppc_power7.cpp ppc_power8.cpp \ - ppc_power9.cpp ppc_simd.cpp pssr.cpp pubkey.cpp queue.cpp rabbit.cpp \ - rabin.cpp randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp rdtables.cpp \ - rijndael.cpp rijndael_simd.cpp ripemd.cpp rng.cpp rsa.cpp rw.cpp \ - safer.cpp salsa.cpp scrypt.cpp seal.cpp seed.cpp serpent.cpp sha.cpp \ - sha3.cpp sha_simd.cpp shacal2.cpp shacal2_simd.cpp shark.cpp sharkbox.cpp \ - simeck.cpp simeck_simd.cpp simon.cpp simon128_simd.cpp simon64_simd.cpp \ - skipjack.cpp sm3.cpp sm4.cpp sm4_simd.cpp sosemanuk.cpp speck.cpp \ - speck128_simd.cpp speck64_simd.cpp square.cpp squaretb.cpp sse_simd.cpp \ - strciphr.cpp tea.cpp tftables.cpp threefish.cpp tiger.cpp tigertab.cpp \ - ttmac.cpp tweetnacl.cpp twofish.cpp vmac.cpp wake.cpp whrlpool.cpp \ - xed25519.cpp xtr.cpp xtrcrypt.cpp zdeflate.cpp zinflate.cpp zlib.cpp + keccak.cpp keccak_core.cpp keccak_simd.cpp lea.cpp lea_simd.cpp luc.cpp \ + mars.cpp marss.cpp md2.cpp md4.cpp md5.cpp misc.cpp modes.cpp mqueue.cpp \ + mqv.cpp nbtheory.cpp neon_simd.cpp oaep.cpp osrng.cpp padlkrng.cpp \ + panama.cpp pkcspad.cpp poly1305.cpp polynomi.cpp ppc_power7.cpp \ + ppc_power8.cpp ppc_power9.cpp ppc_simd.cpp pssr.cpp pubkey.cpp queue.cpp \ + rabbit.cpp rabin.cpp randpool.cpp rc2.cpp rc5.cpp rc6.cpp rdrand.cpp \ + rdtables.cpp rijndael.cpp rijndael_simd.cpp ripemd.cpp rng.cpp rsa.cpp \ + rw.cpp safer.cpp salsa.cpp scrypt.cpp seal.cpp seed.cpp serpent.cpp \ + sha.cpp sha3.cpp sha_simd.cpp shacal2.cpp shacal2_simd.cpp shake.cpp \ + shark.cpp sharkbox.cpp simeck.cpp simeck_simd.cpp simon.cpp \ + simon128_simd.cpp simon64_simd.cpp skipjack.cpp sm3.cpp sm4.cpp \ + sm4_simd.cpp sosemanuk.cpp speck.cpp speck128_simd.cpp speck64_simd.cpp \ + square.cpp squaretb.cpp sse_simd.cpp strciphr.cpp tea.cpp tftables.cpp \ + threefish.cpp tiger.cpp tigertab.cpp ttmac.cpp tweetnacl.cpp twofish.cpp \ + vmac.cpp wake.cpp whrlpool.cpp xed25519.cpp xtr.cpp xtrcrypt.cpp \ + zdeflate.cpp zinflate.cpp zlib.cpp LIB_OBJS = \ cryptlib.obj cpu.obj integer.obj 3way.obj adler32.obj algebra.obj \ @@ -99,21 +100,22 @@ LIB_OBJS = \ gcm_simd.obj gf256.obj gf2_32.obj gf2n.obj gf2n_simd.obj gfpcrypt.obj \ gost.obj gzip.obj hc128.obj hc256.obj hex.obj hight.obj hmac.obj \ hrtimer.obj ida.obj idea.obj iterhash.obj kalyna.obj kalynatab.obj \ - keccak.obj keccakc.obj lea.obj lea_simd.obj luc.obj mars.obj marss.obj \ - md2.obj md4.obj md5.obj misc.obj modes.obj mqueue.obj mqv.obj \ - nbtheory.obj neon_simd.obj oaep.obj osrng.obj padlkrng.obj panama.obj \ - pkcspad.obj poly1305.obj polynomi.obj ppc_power7.obj ppc_power8.obj \ - ppc_power9.obj ppc_simd.obj pssr.obj pubkey.obj queue.obj rabbit.obj \ - rabin.obj randpool.obj rc2.obj rc5.obj rc6.obj rdrand.obj rdtables.obj \ - rijndael.obj rijndael_simd.obj ripemd.obj rng.obj rsa.obj rw.obj \ - safer.obj salsa.obj scrypt.obj seal.obj seed.obj serpent.obj sha.obj \ - sha3.obj sha_simd.obj shacal2.obj shacal2_simd.obj shark.obj sharkbox.obj \ - simeck.obj simeck_simd.obj simon.obj simon128_simd.obj simon64_simd.obj \ - skipjack.obj sm3.obj sm4.obj sm4_simd.obj sosemanuk.obj speck.obj \ - speck128_simd.obj speck64_simd.obj square.obj squaretb.obj sse_simd.obj \ - strciphr.obj tea.obj tftables.obj threefish.obj tiger.obj tigertab.obj \ - ttmac.obj tweetnacl.obj twofish.obj vmac.obj wake.obj whrlpool.obj \ - xed25519.obj xtr.obj xtrcrypt.obj zdeflate.obj zinflate.obj zlib.obj + keccak.obj keccak_core.obj keccak_simd.obj lea.obj lea_simd.obj luc.obj \ + mars.obj marss.obj md2.obj md4.obj md5.obj misc.obj modes.obj mqueue.obj \ + mqv.obj nbtheory.obj neon_simd.obj oaep.obj osrng.obj padlkrng.obj \ + panama.obj pkcspad.obj poly1305.obj polynomi.obj ppc_power7.obj \ + ppc_power8.obj ppc_power9.obj ppc_simd.obj pssr.obj pubkey.obj queue.obj \ + rabbit.obj rabin.obj randpool.obj rc2.obj rc5.obj rc6.obj rdrand.obj \ + rdtables.obj rijndael.obj rijndael_simd.obj ripemd.obj rng.obj rsa.obj \ + rw.obj safer.obj salsa.obj scrypt.obj seal.obj seed.obj serpent.obj \ + sha.obj sha3.obj sha_simd.obj shacal2.obj shacal2_simd.obj shake.obj \ + shark.obj sharkbox.obj simeck.obj simeck_simd.obj simon.obj \ + simon128_simd.obj simon64_simd.obj skipjack.obj sm3.obj sm4.obj \ + sm4_simd.obj sosemanuk.obj speck.obj speck128_simd.obj speck64_simd.obj \ + square.obj squaretb.obj sse_simd.obj strciphr.obj tea.obj tftables.obj \ + threefish.obj tiger.obj tigertab.obj ttmac.obj tweetnacl.obj twofish.obj \ + vmac.obj wake.obj whrlpool.obj xed25519.obj xtr.obj xtrcrypt.obj \ + zdeflate.obj zinflate.obj zlib.obj ASM_OBJS = \ rdrand-x86.obj rdrand-x64.obj x64masm.obj x64dll.obj diff --git a/vendor/cryptopp/vendor_cryptopp/cryptlib.h b/vendor/cryptopp/vendor_cryptopp/cryptlib.h index 0f5c112e..8049c511 100644 --- a/vendor/cryptopp/vendor_cryptopp/cryptlib.h +++ b/vendor/cryptopp/vendor_cryptopp/cryptlib.h @@ -3,7 +3,7 @@ /// \file cryptlib.h /// \brief Abstract base classes that provide a uniform interface to this library. -/*! \mainpage Crypto++ Library 8.1 API Reference +/*! \mainpage Crypto++ Library 8.2 API Reference
Abstract Base Classes
cryptlib.h diff --git a/vendor/cryptopp/vendor_cryptopp/cryptopp-config.cmake b/vendor/cryptopp/vendor_cryptopp/cryptopp-config.cmake index 66487005..b739501a 100644 --- a/vendor/cryptopp/vendor_cryptopp/cryptopp-config.cmake +++ b/vendor/cryptopp/vendor_cryptopp/cryptopp-config.cmake @@ -1 +1 @@ -include("${CMAKE_CURRENT_LIST_DIR}/cryptopp-targets.cmake") \ No newline at end of file +include("${CMAKE_CURRENT_LIST_DIR}/cryptopp-targets.cmake") diff --git a/vendor/cryptopp/vendor_cryptopp/cryptopp.rc b/vendor/cryptopp/vendor_cryptopp/cryptopp.rc index 07bfea74..6961418f 100644 --- a/vendor/cryptopp/vendor_cryptopp/cryptopp.rc +++ b/vendor/cryptopp/vendor_cryptopp/cryptopp.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 8,1,0,0 - PRODUCTVERSION 8,1,0,0 + FILEVERSION 8,2,0,0 + PRODUCTVERSION 8,2,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -46,13 +46,13 @@ BEGIN VALUE "Comments", "Free crypto library, more information available at www.cryptopp.com" VALUE "CompanyName", "Wei Dai" VALUE "FileDescription", "Crypto++® Library DLL" - VALUE "FileVersion", "8, 1, 0, 0" + VALUE "FileVersion", "8, 2, 0, 0" VALUE "InternalName", "cryptopp" - VALUE "LegalCopyright", "Copyright© 1995-2018 by Wei Dai" + VALUE "LegalCopyright", "Copyright© 1995-2019 by Wei Dai" VALUE "LegalTrademarks", "Crypto++®" VALUE "OriginalFilename", "cryptopp.dll" VALUE "ProductName", "Crypto++® Library" - VALUE "ProductVersion", "8, 1, 0, 0" + VALUE "ProductVersion", "8, 2, 0, 0" END END BLOCK "VarFileInfo" diff --git a/vendor/cryptopp/vendor_cryptopp/datatest.cpp b/vendor/cryptopp/vendor_cryptopp/datatest.cpp index d948421a..310603b1 100644 --- a/vendor/cryptopp/vendor_cryptopp/datatest.cpp +++ b/vendor/cryptopp/vendor_cryptopp/datatest.cpp @@ -8,7 +8,6 @@ #include "factory.h" #include "integer.h" #include "filters.h" -#include "hex.h" #include "randpool.h" #include "files.h" #include "trunhash.h" @@ -16,6 +15,8 @@ #include "smartptr.h" #include "validate.h" #include "stdcpp.h" +#include "misc.h" +#include "hex.h" #include "trap.h" #include @@ -208,7 +209,7 @@ void PutDecodedDatumInto(const TestData &data, const char *name, BufferedTransfo while (repeat--) { - q.Put(reinterpret_cast(&s2[0]), s2.size()); + q.Put(ConstBytePtr(s2), BytePtrSize(s2)); RandomizedTransfer(q, target, false); } } @@ -265,10 +266,11 @@ public: *reinterpret_cast(pValue) = atoi(value.c_str()); else if (valueType == typeid(word64)) { - std::string x(value); errno = 0; + std::string x(value.empty() ? "0" : value); const char* beg = &x[0]; char* end = &x[0] + value.size(); + errno = 0; *reinterpret_cast(pValue) = STRTOUL64(beg, &end, 0); if (errno != 0) return false; @@ -279,7 +281,7 @@ public: { m_temp.clear(); PutDecodedDatumInto(m_data, name, StringSink(m_temp).Ref()); - reinterpret_cast(pValue)->Assign(reinterpret_cast(&m_temp[0]), m_temp.size(), false); + reinterpret_cast(pValue)->Assign(BytePtr(m_temp), BytePtrSize(m_temp), false); } else throw ValueTypeMismatch(name, typeid(std::string), valueType); @@ -496,8 +498,8 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters) } else { - encryptor->SetKey(reinterpret_cast(&key[0]), key.size(), pairs); - decryptor->SetKey(reinterpret_cast(&key[0]), key.size(), pairs); + encryptor->SetKey(ConstBytePtr(key), BytePtrSize(key), pairs); + decryptor->SetKey(ConstBytePtr(key), BytePtrSize(key), pairs); } word64 seek64 = pairs.GetWord64ValueWithDefault("Seek64", 0); @@ -547,13 +549,13 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters) encrypted.reserve(10000 * plaintext.size()); for (int j=0; j<10000; j++) { - cipher->ProcessString(reinterpret_cast(&buf[0]), buf.size()); + cipher->ProcessString(BytePtr(buf), BytePtrSize(buf)); encrypted.append(buf.begin(), buf.end()); } encrypted.erase(0, encrypted.size() - keybuf.size()); - xorbuf(reinterpret_cast(&keybuf[0]), reinterpret_cast(&encrypted[0]), keybuf.size()); - cipher->SetKey(reinterpret_cast(&keybuf[0]), keybuf.size()); + xorbuf(BytePtr(keybuf), BytePtr(encrypted), BytePtrSize(keybuf)); + cipher->SetKey(BytePtr(keybuf), BytePtrSize(keybuf)); } encrypted.assign(buf.begin(), buf.end()); @@ -641,8 +643,8 @@ void TestAuthenticatedSymmetricCipher(TestData &v, const NameValuePairs &overrid member_ptr encryptor, decryptor; encryptor.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); decryptor.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); - encryptor->SetKey(reinterpret_cast(&key[0]), key.size(), pairs); - decryptor->SetKey(reinterpret_cast(&key[0]), key.size(), pairs); + encryptor->SetKey(ConstBytePtr(key), BytePtrSize(key), pairs); + decryptor->SetKey(ConstBytePtr(key), BytePtrSize(key), pairs); // Code coverage (void)encryptor->AlgorithmName(); @@ -736,7 +738,7 @@ void TestDigestOrMAC(TestData &v, bool testDigest) mac.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); pHash = mac.get(); std::string key = GetDecodedDatum(v, "Key"); - mac->SetKey(reinterpret_cast(&key[0]), key.size(), pairs); + mac->SetKey(ConstBytePtr(key), BytePtrSize(key), pairs); // Code coverage (void)mac->AlgorithmName(); @@ -779,8 +781,7 @@ void TestKeyDerivationFunction(TestData &v) kdf.reset(ObjectFactoryRegistry::Registry().CreateObject(name.c_str())); std::string calculated; calculated.resize(expected.size()); - kdf->DeriveKey(reinterpret_cast(&calculated[0]), calculated.size(), - reinterpret_cast(&secret[0]), secret.size(), pairs); + kdf->DeriveKey(BytePtr(calculated), BytePtrSize(calculated), BytePtr(secret), BytePtrSize(secret), pairs); if(calculated != expected) { diff --git a/vendor/cryptopp/vendor_cryptopp/filters.h b/vendor/cryptopp/vendor_cryptopp/filters.h index 0118a4ac..f86901d0 100644 --- a/vendor/cryptopp/vendor_cryptopp/filters.h +++ b/vendor/cryptopp/vendor_cryptopp/filters.h @@ -474,7 +474,7 @@ struct BlockPaddingSchemeDef /// \brief 0's padding added to a block /// \since Crypto++ 5.0 ZEROS_PADDING, - /// \brief PKCS #5 padding added to a block + /// \brief PKCS padding added to a block /// \since Crypto++ 5.0 PKCS_PADDING, /// \brief 1 and 0's padding added to a block diff --git a/vendor/cryptopp/vendor_cryptopp/gcm.cpp b/vendor/cryptopp/vendor_cryptopp/gcm.cpp index d1c3011c..c7c51071 100644 --- a/vendor/cryptopp/vendor_cryptopp/gcm.cpp +++ b/vendor/cryptopp/vendor_cryptopp/gcm.cpp @@ -75,8 +75,8 @@ extern void GCM_Xor16_SSE2(byte *a, const byte *b, const byte *c); extern void GCM_Xor16_NEON(byte *a, const byte *b, const byte *c); #endif -#if CRYPTOPP_POWER7_AVAILABLE -extern void GCM_Xor16_POWER7(byte *a, const byte *b, const byte *c); +#if CRYPTOPP_POWER8_AVAILABLE +extern void GCM_Xor16_POWER8(byte *a, const byte *b, const byte *c); #endif #if CRYPTOPP_CLMUL_AVAILABLE @@ -213,11 +213,11 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const for (k=1; k::DeriveKey(output, size, m_counterAndSeed, m_counterAndSeed.size(), NULLPTR, 0); } + // UBsan finding, -Wstringop-overflow + inline size_t ClampSize(size_t req) const + { + // Clamp at 16 MB + if (req > 16U*1024*1024) + return 16U*1024*1024; + return req; + } + private: word32 m_counter; SecByteBlock m_counterAndSeed; diff --git a/vendor/cryptopp/vendor_cryptopp/keccak_simd.cpp b/vendor/cryptopp/vendor_cryptopp/keccak_simd.cpp index 863bca58..71389cbd 100644 --- a/vendor/cryptopp/vendor_cryptopp/keccak_simd.cpp +++ b/vendor/cryptopp/vendor_cryptopp/keccak_simd.cpp @@ -12,8 +12,8 @@ // KeccakF1600x2_SSE is ParallelHash128. The SSE2 ParallelHash128 // implementation was extracted from XKCP using the following command. // -// gcc -I lib/common -I lib/low/KeccakP-1600/Optimized \ -// -I lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull \ +// gcc -I lib/common -I lib/low/KeccakP-1600/Optimized +// -I lib/low/KeccakP-1600-times2/SIMD128/SSE2ufull // lib/low/KeccakP-1600-times2/SIMD128/KeccakP-1600-times2-SIMD128.c -E #include "pch.h" @@ -23,7 +23,7 @@ #if (CRYPTOPP_SSSE3_AVAILABLE) # include -# include +# include #endif // Squash MS LNK4221 and libtool warnings @@ -39,8 +39,8 @@ extern void KeccakF1600x2_SSE(word64 *state); // The F1600 round constants extern const word64 KeccakF1600Constants[24]; -const word64 rho8[2] = {0x0605040302010007, 0x0E0D0C0B0A09080F}; -const word64 rho56[2] = {0x0007060504030201, 0x080F0E0D0C0B0A09}; +const word64 rho8[2] = {W64LIT(0x0605040302010007), W64LIT(0x0E0D0C0B0A09080F)}; +const word64 rho56[2] = {W64LIT(0x0007060504030201), W64LIT(0x080F0E0D0C0B0A09)}; #define V128 __m128i #define CV128 const __m128i diff --git a/vendor/cryptopp/vendor_cryptopp/misc.h b/vendor/cryptopp/vendor_cryptopp/misc.h index 67e399d4..7a12175f 100644 --- a/vendor/cryptopp/vendor_cryptopp/misc.h +++ b/vendor/cryptopp/vendor_cryptopp/misc.h @@ -388,6 +388,38 @@ inline size_t PtrByteDiff(const PTR pointer1, const PTR pointer2) return (size_t)(reinterpret_cast(pointer1) - reinterpret_cast(pointer2)); } +/// \brief Pointer to the first element of a string +/// \param str std::string +/// \details BytePtr returns NULL pointer for an empty string. +/// \return Pointer to the first element of a string +inline byte* BytePtr(std::string& str) +{ + // Caller wants a writeable pointer + CRYPTOPP_ASSERT(str.empty() == false); + + if (str.empty()) + return NULLPTR; + return reinterpret_cast(&str[0]); +} + +/// \brief Const pointer to the first element of a string +/// \param str std::string +/// \details ConstBytePtr returns non-NULL pointer for an empty string. +/// \return Pointer to the first element of a string +inline const byte* ConstBytePtr(const std::string& str) +{ + // Use c_str() so a pointer is always available + return reinterpret_cast(str.c_str()); +} + +/// \brief Size of a string +/// \param str std::string +/// \return size of a string +inline size_t BytePtrSize(const std::string& str) +{ + return str.size(); +} + #if (!__STDC_WANT_SECURE_LIB__ && !defined(_MEMORY_S_DEFINED)) || defined(CRYPTOPP_WANT_SECURE_LIB) /// \brief Bounds checking replacement for memcpy() diff --git a/vendor/cryptopp/vendor_cryptopp/ppc_simd.h b/vendor/cryptopp/vendor_cryptopp/ppc_simd.h index d074e33f..a2d001e3 100644 --- a/vendor/cryptopp/vendor_cryptopp/ppc_simd.h +++ b/vendor/cryptopp/vendor_cryptopp/ppc_simd.h @@ -57,7 +57,7 @@ // // inline uint32x4_p VecLoad(const byte src[16]) // { -// #if defined(_ARCH_PWR7) +// #if defined(_ARCH_PWR8) // return (uint32x4_p) *(uint8x16_p*)((byte*)src); // #else // return VecLoad_ALTIVEC(src); @@ -128,7 +128,7 @@ typedef __vector unsigned short uint16x8_p; /// \since Crypto++ 6.0 typedef __vector unsigned int uint32x4_p; -#if defined(_ARCH_PWR7) || defined(CRYPTOPP_DOXYGEN_PROCESSING) +#if defined(_ARCH_PWR8) || defined(CRYPTOPP_DOXYGEN_PROCESSING) /// \brief Vector of 64-bit elements /// \details uint64x2_p is available on POWER7 and above. Some supporting /// functions, like 64-bit vec_add (vaddudm), did not @@ -137,7 +137,7 @@ typedef __vector unsigned int uint32x4_p; /// __vector unsigned long long /// \since Crypto++ 6.0 typedef __vector unsigned long long uint64x2_p; -#endif // _ARCH_PWR7 +#endif // _ARCH_PWR8 /// \brief The 0 vector /// \returns a 32-bit vector of 0's @@ -252,7 +252,7 @@ inline uint32x4_p VecLoad_ALTIVEC(int off, const byte src[16]) /// \since Crypto++ 6.0 inline uint32x4_p VecLoad(const byte src[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) return (uint32x4_p)vec_xlw4(0, (byte*)src); # elif defined(__xlc__) || defined(__xlC__) || defined(__clang__) @@ -280,7 +280,7 @@ inline uint32x4_p VecLoad(const byte src[16]) /// \since Crypto++ 6.0 inline uint32x4_p VecLoad(int off, const byte src[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) return (uint32x4_p)vec_xlw4(off, (byte*)src); # elif defined(__xlc__) || defined(__xlC__) || defined(__clang__) @@ -328,7 +328,7 @@ inline uint32x4_p VecLoad(int off, const word32 src[4]) return VecLoad(off, (const byte*)src); } -#if defined(_ARCH_PWR7) || defined(CRYPTOPP_DOXYGEN_PROCESSING) +#if defined(_ARCH_PWR8) || defined(CRYPTOPP_DOXYGEN_PROCESSING) /// \brief Loads a vector from a word array /// \param src the word array @@ -367,7 +367,7 @@ inline uint64x2_p VecLoad(int off, const word64 src[2]) return (uint64x2_p)VecLoad(off, (const byte*)src); } -#endif // _ARCH_PWR7 +#endif // _ARCH_PWR8 /// \brief Loads a vector from an aligned byte array /// \param src the byte array @@ -382,7 +382,7 @@ inline uint64x2_p VecLoad(int off, const word64 src[2]) /// \since Crypto++ 8.0 inline uint32x4_p VecLoadAligned(const byte src[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) return (uint32x4_p)vec_xlw4(0, (byte*)src); # elif defined(__xlc__) || defined(__xlC__) || defined(__clang__) @@ -390,10 +390,10 @@ inline uint32x4_p VecLoadAligned(const byte src[16]) # else return (uint32x4_p)vec_vsx_ld(0, (byte*)src); # endif -#else // _ARCH_PWR7 +#else // _ARCH_PWR8 CRYPTOPP_ASSERT(((uintptr_t)src) % 16 == 0); return (uint32x4_p)vec_ld(0, (byte*)src); -#endif // _ARCH_PWR7 +#endif // _ARCH_PWR8 } /// \brief Loads a vector from an aligned byte array @@ -410,7 +410,7 @@ inline uint32x4_p VecLoadAligned(const byte src[16]) /// \since Crypto++ 8.0 inline uint32x4_p VecLoadAligned(int off, const byte src[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) return (uint32x4_p)vec_xlw4(off, (byte*)src); # elif defined(__xlc__) || defined(__xlC__) || defined(__clang__) @@ -418,10 +418,10 @@ inline uint32x4_p VecLoadAligned(int off, const byte src[16]) # else return (uint32x4_p)vec_vsx_ld(off, (byte*)src); # endif -#else // _ARCH_PWR7 +#else // _ARCH_PWR8 CRYPTOPP_ASSERT((((uintptr_t)src)+off) % 16 == 0); return (uint32x4_p)vec_ld(off, (byte*)src); -#endif // _ARCH_PWR7 +#endif // _ARCH_PWR8 } /// \brief Loads a vector from a byte array @@ -439,7 +439,7 @@ inline uint32x4_p VecLoadAligned(int off, const byte src[16]) /// \since Crypto++ 6.0 inline uint32x4_p VecLoadBE(const byte src[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) # if (CRYPTOPP_BIG_ENDIAN) return (uint32x4_p)vec_xlw4(0, (byte*)src); @@ -455,13 +455,13 @@ inline uint32x4_p VecLoadBE(const byte src[16]) return (uint32x4_p)VecReverse(vec_vsx_ld(0, (byte*)src)); # endif # endif -#else // _ARCH_PWR7 +#else // _ARCH_PWR8 # if (CRYPTOPP_BIG_ENDIAN) return (uint32x4_p)VecLoad((const byte*)src); # else return (uint32x4_p)VecReverse(VecLoad((const byte*)src)); # endif -#endif // _ARCH_PWR7 +#endif // _ARCH_PWR8 } /// \brief Loads a vector from a byte array @@ -480,7 +480,7 @@ inline uint32x4_p VecLoadBE(const byte src[16]) /// \since Crypto++ 6.0 inline uint32x4_p VecLoadBE(int off, const byte src[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) # if (CRYPTOPP_BIG_ENDIAN) return (uint32x4_p)vec_xlw4(off, (byte*)src); @@ -496,13 +496,13 @@ inline uint32x4_p VecLoadBE(int off, const byte src[16]) return (uint32x4_p)VecReverse(vec_vsx_ld(off, (byte*)src)); # endif # endif -#else // _ARCH_PWR7 +#else // _ARCH_PWR8 # if (CRYPTOPP_BIG_ENDIAN) return (uint32x4_p)VecLoad(off, (const byte*)src); # else return (uint32x4_p)VecReverse(VecLoad(off, (const byte*)src)); # endif -#endif // _ARCH_PWR7 +#endif // _ARCH_PWR8 } //@} @@ -604,7 +604,7 @@ inline void VecStore_ALTIVEC(const T data, int off, byte dest[16]) template inline void VecStore(const T data, byte dest[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) vec_xstw4((uint8x16_p)data, 0, (byte*)dest); # elif defined(__xlc__) || defined(__xlC__) || defined(__clang__) @@ -635,7 +635,7 @@ inline void VecStore(const T data, byte dest[16]) template inline void VecStore(const T data, int off, byte dest[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) vec_xstw4((uint8x16_p)data, off, (byte*)dest); # elif defined(__xlc__) || defined(__xlC__) || defined(__clang__) @@ -750,7 +750,7 @@ inline void VecStore(const T data, int off, word64 dest[2]) template inline void VecStoreBE(const T data, byte dest[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) # if (CRYPTOPP_BIG_ENDIAN) vec_xstw4((uint8x16_p)data, 0, (byte*)dest); @@ -766,13 +766,13 @@ inline void VecStoreBE(const T data, byte dest[16]) vec_vsx_st((uint8x16_p)VecReverse(data), 0, (byte*)dest); # endif # endif -#else // _ARCH_PWR7 +#else // _ARCH_PWR8 # if (CRYPTOPP_BIG_ENDIAN) VecStore_ALTIVEC((uint8x16_p)data, 0, (byte*)dest); # else VecStore_ALTIVEC((uint8x16_p)VecReverse(data), 0, (byte*)dest); # endif -#endif // _ARCH_PWR7 +#endif // _ARCH_PWR8 } /// \brief Stores a vector to a byte array @@ -794,7 +794,7 @@ inline void VecStoreBE(const T data, byte dest[16]) template inline void VecStoreBE(const T data, int off, byte dest[16]) { -#if defined(_ARCH_PWR7) +#if defined(_ARCH_PWR8) # if defined(__early_xlc__) || defined(__early_xlC__) # if (CRYPTOPP_BIG_ENDIAN) vec_xstw4((uint8x16_p)data, off, (byte*)dest); @@ -810,13 +810,13 @@ inline void VecStoreBE(const T data, int off, byte dest[16]) vec_vsx_st((uint8x16_p)VecReverse(data), off, (byte*)dest); # endif # endif -#else // _ARCH_PWR7 +#else // _ARCH_PWR8 # if (CRYPTOPP_BIG_ENDIAN) VecStore_ALTIVEC((uint8x16_p)data, off, (byte*)dest); # else VecStore_ALTIVEC((uint8x16_p)VecReverse(data), off, (byte*)dest); # endif -#endif // _ARCH_PWR7 +#endif // _ARCH_PWR8 } /// \brief Stores a vector to a word array diff --git a/vendor/cryptopp/vendor_cryptopp/regtest3.cpp b/vendor/cryptopp/vendor_cryptopp/regtest3.cpp index f954c09a..5e2f64dc 100644 --- a/vendor/cryptopp/vendor_cryptopp/regtest3.cpp +++ b/vendor/cryptopp/vendor_cryptopp/regtest3.cpp @@ -92,7 +92,9 @@ void RegisterFactories4() RegisterSymmetricCipherDefaultFactories >(); RegisterSymmetricCipherDefaultFactories >(); RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); RegisterSymmetricCipherDefaultFactories >(); RegisterSymmetricCipherDefaultFactories >(); RegisterSymmetricCipherDefaultFactories >(); diff --git a/vendor/cryptopp/vendor_cryptopp/seckey.h b/vendor/cryptopp/vendor_cryptopp/seckey.h index f80767ac..21649e48 100644 --- a/vendor/cryptopp/vendor_cryptopp/seckey.h +++ b/vendor/cryptopp/vendor_cryptopp/seckey.h @@ -14,7 +14,7 @@ #if CRYPTOPP_MSC_VERSION # pragma warning(push) -# pragma warning(disable: 4189) +# pragma warning(disable: 4189 4296) #endif // Issue 340 diff --git a/vendor/cryptopp/vendor_cryptopp/shake.h b/vendor/cryptopp/vendor_cryptopp/shake.h index a615b573..37cb8274 100644 --- a/vendor/cryptopp/vendor_cryptopp/shake.h +++ b/vendor/cryptopp/vendor_cryptopp/shake.h @@ -125,7 +125,7 @@ public: /// requires the output size in advance because the algoirthm uses /// output size as a parameter to the hash function. /// \since Crypto++ 8.1 - SHAKE128(unsigned int outputSize) : SHAKE_Final(outputSize) {} + SHAKE128(unsigned int outputSize) : SHAKE_Final<128>(outputSize) {} }; /// \brief SHAKE256 message digest @@ -155,7 +155,7 @@ public: /// requires the output size in advance because the algoirthm uses /// output size as a parameter to the hash function. /// \since Crypto++ 8.1 - SHAKE256(unsigned int outputSize) : SHAKE_Final(outputSize) {} + SHAKE256(unsigned int outputSize) : SHAKE_Final<256>(outputSize) {} }; NAMESPACE_END diff --git a/vendor/cryptopp/vendor_cryptopp/simon.cpp b/vendor/cryptopp/vendor_cryptopp/simon.cpp index 099cd7a2..d508d974 100644 --- a/vendor/cryptopp/vendor_cryptopp/simon.cpp +++ b/vendor/cryptopp/vendor_cryptopp/simon.cpp @@ -255,9 +255,9 @@ std::string SIMON64::Base::AlgorithmProvider() const if (HasNEON()) return "NEON"; # endif -# if (CRYPTOPP_POWER7_AVAILABLE) - if (HasPower7()) - return "Power7"; +# if (CRYPTOPP_POWER8_AVAILABLE) + if (HasPower8()) + return "Power8"; # endif # if (CRYPTOPP_ALTIVEC_AVAILABLE) if (HasAltivec()) diff --git a/vendor/cryptopp/vendor_cryptopp/simon128_simd.cpp b/vendor/cryptopp/vendor_cryptopp/simon128_simd.cpp index 7b3f8518..5331c351 100644 --- a/vendor/cryptopp/vendor_cryptopp/simon128_simd.cpp +++ b/vendor/cryptopp/vendor_cryptopp/simon128_simd.cpp @@ -44,7 +44,7 @@ # include #endif -#if defined(CRYPTOPP_POWER7_AVAILABLE) +#if defined(CRYPTOPP_POWER8_AVAILABLE) # include "adv_simd.h" # include "ppc_simd.h" #endif @@ -108,13 +108,8 @@ inline uint64x2_t RotateRight64(const uint64x2_t& val) template <> inline uint64x2_t RotateLeft64<8>(const uint64x2_t& val) { -#if (CRYPTOPP_BIG_ENDIAN) - const uint8_t maskb[16] = { 14,13,12,11, 10,9,8,15, 6,5,4,3, 2,1,0,7 }; - const uint8x16_t mask = vld1q_u8(maskb); -#else const uint8_t maskb[16] = { 7,0,1,2, 3,4,5,6, 15,8,9,10, 11,12,13,14 }; const uint8x16_t mask = vld1q_u8(maskb); -#endif return vreinterpretq_u64_u8( vqtbl1q_u8(vreinterpretq_u8_u64(val), mask)); @@ -124,13 +119,8 @@ inline uint64x2_t RotateLeft64<8>(const uint64x2_t& val) template <> inline uint64x2_t RotateRight64<8>(const uint64x2_t& val) { -#if (CRYPTOPP_BIG_ENDIAN) - const uint8_t maskb[16] = { 8,15,14,13, 12,11,10,9, 0,7,6,5, 4,3,2,1 }; - const uint8x16_t mask = vld1q_u8(maskb); -#else const uint8_t maskb[16] = { 1,2,3,4, 5,6,7,0, 9,10,11,12, 13,14,15,8 }; const uint8x16_t mask = vld1q_u8(maskb); -#endif return vreinterpretq_u64_u8( vqtbl1q_u8(vreinterpretq_u8_u64(val), mask)); diff --git a/vendor/cryptopp/vendor_cryptopp/simon64_simd.cpp b/vendor/cryptopp/vendor_cryptopp/simon64_simd.cpp index 3ad26bcd..b14e1c6e 100644 --- a/vendor/cryptopp/vendor_cryptopp/simon64_simd.cpp +++ b/vendor/cryptopp/vendor_cryptopp/simon64_simd.cpp @@ -106,13 +106,8 @@ inline uint32x4_t RotateRight32(const uint32x4_t& val) template <> inline uint32x4_t RotateLeft32<8>(const uint32x4_t& val) { -#if (CRYPTOPP_BIG_ENDIAN) - const uint8_t maskb[16] = { 14,13,12,15, 10,9,8,11, 6,5,4,7, 2,1,0,3 }; - const uint8x16_t mask = vld1q_u8(maskb); -#else const uint8_t maskb[16] = { 3,0,1,2, 7,4,5,6, 11,8,9,10, 15,12,13,14 }; const uint8x16_t mask = vld1q_u8(maskb); -#endif return vreinterpretq_u32_u8( vqtbl1q_u8(vreinterpretq_u8_u32(val), mask)); @@ -122,13 +117,8 @@ inline uint32x4_t RotateLeft32<8>(const uint32x4_t& val) template <> inline uint32x4_t RotateRight32<8>(const uint32x4_t& val) { -#if (CRYPTOPP_BIG_ENDIAN) - const uint8_t maskb[16] = { 12,15,14,13, 8,11,10,9, 4,7,6,5, 0,3,2,1 }; - const uint8x16_t mask = vld1q_u8(maskb); -#else const uint8_t maskb[16] = { 1,2,3,0, 5,6,7,4, 9,10,11,8, 13,14,14,12 }; const uint8x16_t mask = vld1q_u8(maskb); -#endif return vreinterpretq_u32_u8( vqtbl1q_u8(vreinterpretq_u8_u32(val), mask)); @@ -576,7 +566,7 @@ inline void SIMON64_Enc_Block(uint32x4_p &block0, uint32x4_p &block1, for (int i = 0; i < static_cast(rounds & ~1)-1; i += 2) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk1 = vec_splats(subkeys[i]); const uint32x4_p rk2 = vec_splats(subkeys[i+1]); #else @@ -592,7 +582,7 @@ inline void SIMON64_Enc_Block(uint32x4_p &block0, uint32x4_p &block1, if (rounds & 1) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk = vec_splats(subkeys[rounds-1]); #else const uint8x16_p m = {0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3}; @@ -634,7 +624,7 @@ inline void SIMON64_Dec_Block(uint32x4_p &block0, uint32x4_p &block1, if (rounds & 1) { std::swap(x1, y1); -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk = vec_splats(subkeys[rounds-1]); #else const uint8x16_p m = {0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3}; @@ -647,7 +637,7 @@ inline void SIMON64_Dec_Block(uint32x4_p &block0, uint32x4_p &block1, for (int i = static_cast(rounds-2); i >= 0; i -= 2) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk1 = vec_splats(subkeys[i+1]); const uint32x4_p rk2 = vec_splats(subkeys[i]); #else @@ -696,7 +686,7 @@ inline void SIMON64_Enc_6_Blocks(uint32x4_p &block0, uint32x4_p &block1, for (int i = 0; i < static_cast(rounds & ~1)-1; i += 2) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk1 = vec_splats(subkeys[i]); const uint32x4_p rk2 = vec_splats(subkeys[i+1]); #else @@ -717,7 +707,7 @@ inline void SIMON64_Enc_6_Blocks(uint32x4_p &block0, uint32x4_p &block1, if (rounds & 1) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk = vec_splats(subkeys[rounds-1]); #else const uint8x16_p m = {0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3}; @@ -771,7 +761,7 @@ inline void SIMON64_Dec_6_Blocks(uint32x4_p &block0, uint32x4_p &block1, { std::swap(x1, y1); std::swap(x2, y2); std::swap(x3, y3); -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk = vec_splats(subkeys[rounds-1]); #else const uint8x16_p m = {0,1,2,3, 0,1,2,3, 0,1,2,3, 0,1,2,3}; @@ -786,7 +776,7 @@ inline void SIMON64_Dec_6_Blocks(uint32x4_p &block0, uint32x4_p &block1, for (int i = static_cast(rounds-2); i >= 0; i -= 2) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk1 = vec_splats(subkeys[i+1]); const uint32x4_p rk2 = vec_splats(subkeys[i]); #else diff --git a/vendor/cryptopp/vendor_cryptopp/skipjack.h b/vendor/cryptopp/vendor_cryptopp/skipjack.h index 0775cd7c..b761f8a9 100644 --- a/vendor/cryptopp/vendor_cryptopp/skipjack.h +++ b/vendor/cryptopp/vendor_cryptopp/skipjack.h @@ -2,6 +2,12 @@ /// \file skipjack.h /// \brief Classes for the SKIPJACK block cipher +/// \details The Crypto++ implementation conforms to SKIPJACK and KEA +/// Algorithm Specifications published by NIST in May 1998. The library passes +/// known answer tests available in NIST SP800-17, Table 6, pp. 140-42. +/// \sa SKIPJACK +/// and KEA Algorithm Specifications (May 1998), SKIPJACK on the Crypto++ wiki #ifndef CRYPTOPP_SKIPJACK_H #define CRYPTOPP_SKIPJACK_H @@ -18,7 +24,12 @@ struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10> }; /// \brief SKIPJACK block cipher -/// \sa SKIPJACK +/// \details The Crypto++ implementation conforms to SKIPJACK and KEA +/// Algorithm Specifications published by NIST in May 1998. The library passes +/// known answer tests available in NIST SP800-17, Table 6, pp. 140-42. +/// \sa SKIPJACK +/// and KEA Algorithm Specifications (May 1998), SKIPJACK on the Crypto++ wiki class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation { /// \brief SKIPJACK block cipher default operation diff --git a/vendor/cryptopp/vendor_cryptopp/speck.cpp b/vendor/cryptopp/vendor_cryptopp/speck.cpp index 61fac2cf..151bac78 100644 --- a/vendor/cryptopp/vendor_cryptopp/speck.cpp +++ b/vendor/cryptopp/vendor_cryptopp/speck.cpp @@ -235,9 +235,9 @@ std::string SPECK64::Base::AlgorithmProvider() const if (HasNEON()) return "NEON"; # endif -# if (CRYPTOPP_POWER7_AVAILABLE) - if (HasPower7()) - return "Power7"; +# if (CRYPTOPP_POWER8_AVAILABLE) + if (HasPower8()) + return "Power8"; # endif # if (CRYPTOPP_ALTIVEC_AVAILABLE) if (HasAltivec()) diff --git a/vendor/cryptopp/vendor_cryptopp/speck128_simd.cpp b/vendor/cryptopp/vendor_cryptopp/speck128_simd.cpp index d5028fe6..2c356346 100644 --- a/vendor/cryptopp/vendor_cryptopp/speck128_simd.cpp +++ b/vendor/cryptopp/vendor_cryptopp/speck128_simd.cpp @@ -107,13 +107,8 @@ inline uint64x2_t RotateRight64(const uint64x2_t& val) template <> inline uint64x2_t RotateLeft64<8>(const uint64x2_t& val) { -#if (CRYPTOPP_BIG_ENDIAN) - const uint8_t maskb[16] = { 14,13,12,11, 10,9,8,15, 6,5,4,3, 2,1,0,7 }; - const uint8x16_t mask = vld1q_u8(maskb); -#else const uint8_t maskb[16] = { 7,0,1,2, 3,4,5,6, 15,8,9,10, 11,12,13,14 }; const uint8x16_t mask = vld1q_u8(maskb); -#endif return vreinterpretq_u64_u8( vqtbl1q_u8(vreinterpretq_u8_u64(val), mask)); @@ -123,13 +118,8 @@ inline uint64x2_t RotateLeft64<8>(const uint64x2_t& val) template <> inline uint64x2_t RotateRight64<8>(const uint64x2_t& val) { -#if (CRYPTOPP_BIG_ENDIAN) - const uint8_t maskb[16] = { 8,15,14,13, 12,11,10,9, 0,7,6,5, 4,3,2,1 }; - const uint8x16_t mask = vld1q_u8(maskb); -#else const uint8_t maskb[16] = { 1,2,3,4, 5,6,7,0, 9,10,11,12, 13,14,15,8 }; const uint8x16_t mask = vld1q_u8(maskb); -#endif return vreinterpretq_u64_u8( vqtbl1q_u8(vreinterpretq_u8_u64(val), mask)); diff --git a/vendor/cryptopp/vendor_cryptopp/speck64_simd.cpp b/vendor/cryptopp/vendor_cryptopp/speck64_simd.cpp index 885acad4..e6ab4336 100644 --- a/vendor/cryptopp/vendor_cryptopp/speck64_simd.cpp +++ b/vendor/cryptopp/vendor_cryptopp/speck64_simd.cpp @@ -105,13 +105,8 @@ inline uint32x4_t RotateRight32(const uint32x4_t& val) template <> inline uint32x4_t RotateLeft32<8>(const uint32x4_t& val) { -#if (CRYPTOPP_BIG_ENDIAN) - const uint8_t maskb[16] = { 14,13,12,15, 10,9,8,11, 6,5,4,7, 2,1,0,3 }; - const uint8x16_t mask = vld1q_u8(maskb); -#else const uint8_t maskb[16] = { 3,0,1,2, 7,4,5,6, 11,8,9,10, 15,12,13,14 }; const uint8x16_t mask = vld1q_u8(maskb); -#endif return vreinterpretq_u32_u8( vqtbl1q_u8(vreinterpretq_u8_u32(val), mask)); @@ -121,13 +116,8 @@ inline uint32x4_t RotateLeft32<8>(const uint32x4_t& val) template <> inline uint32x4_t RotateRight32<8>(const uint32x4_t& val) { -#if (CRYPTOPP_BIG_ENDIAN) - const uint8_t maskb[16] = { 12,15,14,13, 8,11,10,9, 4,7,6,5, 0,3,2,1 }; - const uint8x16_t mask = vld1q_u8(maskb); -#else const uint8_t maskb[16] = { 1,2,3,0, 5,6,7,4, 9,10,11,8, 13,14,15,12 }; const uint8x16_t mask = vld1q_u8(maskb); -#endif return vreinterpretq_u32_u8( vqtbl1q_u8(vreinterpretq_u8_u32(val), mask)); @@ -517,7 +507,7 @@ void SPECK64_Enc_Block(uint32x4_p &block0, uint32x4_p &block1, for (int i=0; i < static_cast(rounds); ++i) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk = vec_splats(subkeys[i]); #else // subkeys has extra elements so memory backs the last subkey @@ -564,7 +554,7 @@ void SPECK64_Dec_Block(uint32x4_p &block0, uint32x4_p &block1, for (int i = static_cast(rounds-1); i >= 0; --i) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk = vec_splats(subkeys[i]); #else // subkeys has extra elements so memory backs the last subkey @@ -616,7 +606,7 @@ void SPECK64_Enc_6_Blocks(uint32x4_p &block0, uint32x4_p &block1, for (int i=0; i < static_cast(rounds); ++i) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk = vec_splats(subkeys[i]); #else // subkeys has extra elements so memory backs the last subkey @@ -685,7 +675,7 @@ void SPECK64_Dec_6_Blocks(uint32x4_p &block0, uint32x4_p &block1, for (int i = static_cast(rounds-1); i >= 0; --i) { -#if CRYPTOPP_POWER7_AVAILABLE +#if CRYPTOPP_POWER8_AVAILABLE const uint32x4_p rk = vec_splats(subkeys[i]); #else // subkeys has extra elements so memory backs the last subkey diff --git a/vendor/cryptopp/vendor_cryptopp/validat5.cpp b/vendor/cryptopp/vendor_cryptopp/validat5.cpp index a2fa6642..1484e4ff 100644 --- a/vendor/cryptopp/vendor_cryptopp/validat5.cpp +++ b/vendor/cryptopp/vendor_cryptopp/validat5.cpp @@ -265,13 +265,13 @@ bool ValidateSHAKE_XOF() StringSource(msg, true, new HexDecoder(new StringSink(m))); StringSource(out, true, new HexDecoder(new StringSink(o))); - r.reserve(o.size()); + r.resize(o.size()); - SHAKE128 hash((unsigned int)r.size()); - hash.Update((const byte*)&m[0], m.size()); - hash.TruncatedFinal((byte*)&o[0], o.size()); + SHAKE128 hash((unsigned int)o.size()); + hash.Update(ConstBytePtr(m), BytePtrSize(m)); + hash.TruncatedFinal(BytePtr(r), BytePtrSize(r)); - fail = (std::memcmp(r.data(), r.data(), o.size()) != 0); + fail = (std::memcmp(r.data(), o.data(), o.size()) != 0); pass = pass & !fail; if (fail) @@ -292,13 +292,13 @@ bool ValidateSHAKE_XOF() StringSource(msg, true, new HexDecoder(new StringSink(m))); StringSource(out, true, new HexDecoder(new StringSink(o))); - r.reserve(o.size()); + r.resize(o.size()); - SHAKE128 hash((unsigned int)r.size()); - hash.Update((const byte*)&m[0], m.size()); - hash.TruncatedFinal((byte*)&o[0], o.size()); + SHAKE128 hash((unsigned int)o.size()); + hash.Update(ConstBytePtr(m), BytePtrSize(m)); + hash.TruncatedFinal(BytePtr(r), BytePtrSize(r)); - fail = (std::memcmp(r.data(), r.data(), o.size()) != 0); + fail = (std::memcmp(r.data(), o.data(), o.size()) != 0); pass = pass & !fail; if (fail) @@ -317,13 +317,13 @@ bool ValidateSHAKE_XOF() StringSource(msg, true, new HexDecoder(new StringSink(m))); StringSource(out, true, new HexDecoder(new StringSink(o))); - r.reserve(o.size()); + r.resize(o.size()); - SHAKE256 hash((unsigned int)r.size()); - hash.Update((const byte*)&m[0], m.size()); - hash.TruncatedFinal((byte*)&o[0], o.size()); + SHAKE256 hash((unsigned int)o.size()); + hash.Update(ConstBytePtr(m), BytePtrSize(m)); + hash.TruncatedFinal(BytePtr(r), BytePtrSize(r)); - fail = (std::memcmp(r.data(), r.data(), o.size()) != 0); + fail = (std::memcmp(r.data(), o.data(), o.size()) != 0); pass = pass & !fail; if (fail) @@ -347,13 +347,13 @@ bool ValidateSHAKE_XOF() StringSource(msg, true, new HexDecoder(new StringSink(m))); StringSource(out, true, new HexDecoder(new StringSink(o))); - r.reserve(o.size()); + r.resize(o.size()); - SHAKE256 hash((unsigned int)r.size()); - hash.Update((const byte*)&m[0], m.size()); - hash.TruncatedFinal((byte*)&o[0], o.size()); + SHAKE256 hash((unsigned int)o.size()); + hash.Update(ConstBytePtr(m), BytePtrSize(m)); + hash.TruncatedFinal(BytePtr(r), BytePtrSize(r)); - fail = (std::memcmp(r.data(), r.data(), o.size()) != 0); + fail = (std::memcmp(r.data(), o.data(), o.size()) != 0); pass = pass & !fail; if (fail) @@ -362,7 +362,7 @@ bool ValidateSHAKE_XOF() pass = pass && !fail; } - std::cout << (!pass ? "FAILED " : "passed ") << " SHAKE XOF message digests" << std::endl; + std::cout << (!pass ? "FAILED " : "passed ") << "SHAKE XOF message digests" << std::endl; return pass; } @@ -729,11 +729,11 @@ bool TestPBKDF(KeyDerivationFunction &pbkdf, const PBKDF_TestTuple *testSet, uns double timeInSeconds = 0.0f; AlgorithmParameters params = MakeParameters("Purpose", (int)tuple.purpose) - (Name::Salt(), ConstByteArrayParameter((const byte*)&salt[0], salt.size())) + (Name::Salt(), ConstByteArrayParameter(ConstBytePtr(salt), BytePtrSize(salt))) ("Iterations", (int)tuple.iterations)("TimeInSeconds", timeInSeconds); SecByteBlock derived(derivedKey.size()); - pbkdf.DeriveKey(derived, derived.size(), (const byte *)password.data(), password.size(), params); + pbkdf.DeriveKey(derived, derived.size(), ConstBytePtr(password), BytePtrSize(password), params); bool fail = !!memcmp(derived, derivedKey.data(), derived.size()) != 0; pass = pass && !fail; @@ -815,13 +815,13 @@ bool TestHKDF(KeyDerivationFunction &kdf, const HKDF_TestTuple *testSet, unsigne AlgorithmParameters params; if (tuple.hexSalt) - params(Name::Salt(), ConstByteArrayParameter((const byte*)&salt[0], salt.size())); + params(Name::Salt(), ConstByteArrayParameter(ConstBytePtr(salt), BytePtrSize(salt))); if (tuple.hexSalt) - params("Info", ConstByteArrayParameter((const byte*)&info[0], info.size())); + params("Info", ConstByteArrayParameter(ConstBytePtr(info), BytePtrSize(info))); - kdf.DeriveKey((byte*)&derived[0], derived.size(), (const byte*)&secret[0], secret.size(), params); + kdf.DeriveKey(derived, derived.size(), ConstBytePtr(secret), BytePtrSize(secret), params); - bool fail = !VerifyBufsEqual(derived, (const byte*)&expected[0], derived.size()); + bool fail = !VerifyBufsEqual(derived, ConstBytePtr(expected), BytePtrSize(expected)); pass = pass && !fail; HexEncoder enc(new FileSink(std::cout)); @@ -946,10 +946,10 @@ bool TestScrypt(KeyDerivationFunction &pbkdf, const Scrypt_TestTuple *testSet, u AlgorithmParameters params = MakeParameters("Cost", (word64)tuple.n) ("BlockSize", (word64)tuple.r)("Parallelization", (word64)tuple.p) - (Name::Salt(), ConstByteArrayParameter((const byte*)&salt[0], salt.size())); + (Name::Salt(), ConstByteArrayParameter(ConstBytePtr(salt), BytePtrSize(salt))); SecByteBlock derived(expect.size()); - pbkdf.DeriveKey(derived, derived.size(), (const byte *)password.data(), password.size(), params); + pbkdf.DeriveKey(derived, derived.size(), ConstBytePtr(password), BytePtrSize(password), params); bool fail = !!memcmp(derived, expect.data(), expect.size()) != 0; pass = pass && !fail; diff --git a/vendor/cryptopp/vendor_cryptopp/xed25519.h b/vendor/cryptopp/vendor_cryptopp/xed25519.h index c0e0dd30..4a6ac52a 100644 --- a/vendor/cryptopp/vendor_cryptopp/xed25519.h +++ b/vendor/cryptopp/vendor_cryptopp/xed25519.h @@ -66,6 +66,13 @@ public: virtual ~x25519() {} + /// \brief Create a x25519 object + /// \details This constructor creates an empty x25519 object. It is + /// intended for use in loading existing parameters, like CryptoBox + /// parameters. If you are perfoming key agreement you should use a + /// constructor that generates random parameters on construction. + x25519() {} + /// \brief Create a x25519 object /// \param y public key /// \param x private key