diff --git a/CHANGES.md b/CHANGES.md index 8c4107c7a..3727cd1fd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,20 @@ # List of Changes +## Version 4.1.2 + +- Merged [(PR #619)](https://github.com/microsoft/SEAL/pull/619): Removed unqualified calls to `std::move`. +- Merged [(PR #651)](https://github.com/microsoft/SEAL/pull/651): Fixed filename typos in native examples. +- Merged [(PR #662)](https://github.com/microsoft/SEAL/pull/662) and [(PR #666)](https://github.com/microsoft/SEAL/pull/666): Fixed broken links in [README.md](README.md). +- Merged [(PR #669)](https://github.com/microsoft/SEAL/pull/669): Removed extra semicolons that caused compiler warnings. + +### Hotfix - 6/13/2024 + +- Merged [(PR #688)](https://github.com/microsoft/SEAL/pull/688): Fixed incorrect version numbers in [native/tests/CMakeLists.txt](native/tests/CMakeLists.txt). + +### Hotfix - 7/10/2024 + +- Merged [(PR #695)](https://github.com/microsoft/SEAL/pull/695): Fixed incorrect version numbers in [native/examples/CMakeLists.txt](native/examples/CMakeLists.txt) + ## Version 4.1.1 ### Bug Fixes diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a7a2bfdb..41e97abaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ if(NOT CMAKE_BUILD_TYPE) endif() message(STATUS "Build type (CMAKE_BUILD_TYPE): ${CMAKE_BUILD_TYPE}") -project(SEAL VERSION 4.1.1 LANGUAGES CXX C) +project(SEAL VERSION 4.1.2 LANGUAGES CXX C) ######################## # Global configuration # diff --git a/README.md b/README.md index 9c1eb44f8..28064738e 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ The [APSI library for Asymmetric PSI](https://eprint.iacr.org/2021/1116) is avai - [Basic CMake Options](#basic-cmake-options) - [Advanced CMake Options](#advanced-cmake-options) - [Linking with Microsoft SEAL through CMake](#linking-with-microsoft-seal-through-cmake) - - [Examples, Tests, and Benchmark](#examples-tests-and-benchmark) + - [Examples, Tests, and Benchmarks](#examples-tests-and-benchmarks) - [Building .NET Components](#building-net-components) - [Windows, Linux, and macOS](#windows-linux-and-macos) - [Android and iOS](#android-and-ios) @@ -133,8 +133,8 @@ The optional dependencies and their tested versions (other versions may work as | ------------------------------------------------------ | -------------- | ------------------------------------------------ | | [Intel HEXL](https://github.com/intel/hexl) | 1.2.5 | Acceleration of low-level kernels | | [Microsoft GSL](https://github.com/microsoft/GSL) | 4.0.0 | API extensions | -| [ZLIB](https://github.com/madler/zlib) | 1.2.13 | Compressed serialization | -| [Zstandard](https://github.com/facebook/zstd) | 1.5.2 | Compressed serialization (much faster than ZLIB) | +| [ZLIB](https://github.com/madler/zlib) | 1.3.1 | Compressed serialization | +| [Zstandard](https://github.com/facebook/zstd) | 1.5.7 | Compressed serialization (much faster than ZLIB) | | [GoogleTest](https://github.com/google/googletest) | 1.12.1 | For running tests | | [GoogleBenchmark](https://github.com/google/benchmark) | 1.7.1 | For running benchmarks | @@ -215,7 +215,7 @@ The examples are available (and identical) in C++ and C#, and are divided into s It is recommended to read the comments and the code snippets along with command line printout from running an example. For easier navigation, command line printout provides the line number in the associated source file where the associated code snippets start. -To build the examples, see [Examples, Tests, and Benchmark](#examples-tests-and-benchmark) (C++) and [Building .NET Components](#building-net-components) (C#). +To build the examples, see [Examples, Tests, and Benchmark](#examples-tests-and-benchmarks) (C++) and [Building .NET Components](#building-net-components) (C#). **Note:** It is impossible to know how to use Microsoft SEAL correctly without studying examples 1–6. They are designed to provide the reader with the necessary conceptual background on homomorphic encryption. diff --git a/cmake/ExternalZLIB.cmake b/cmake/ExternalZLIB.cmake index ef35fd43a..dd66dc447 100644 --- a/cmake/ExternalZLIB.cmake +++ b/cmake/ExternalZLIB.cmake @@ -3,7 +3,7 @@ FetchContent_Declare( zlib GIT_REPOSITORY https://github.com/madler/zlib.git - GIT_TAG 04f42ceca40f73e2978b50e93806c2a18c1281fc # 1.2.13 + GIT_TAG 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf # 1.3.1 ) FetchContent_GetProperties(zlib) if(NOT zlib_POPULATED) diff --git a/cmake/ExternalZSTD.cmake b/cmake/ExternalZSTD.cmake index 05afa853a..031148191 100644 --- a/cmake/ExternalZSTD.cmake +++ b/cmake/ExternalZSTD.cmake @@ -4,7 +4,7 @@ FetchContent_Declare( zstd GIT_REPOSITORY https://github.com/facebook/zstd.git - GIT_TAG e47e674cd09583ff0503f0f6defd6d23d8b718d3 # 1.5.2 + GIT_TAG f8745da6ff1ad1e7bab384bd1f9d742439278e99 # 1.5.7 ) FetchContent_GetProperties(zstd) if(NOT zstd_POPULATED) diff --git a/native/examples/1_bfv_basics.cpp b/native/examples/1_bfv_basics.cpp index 0ef4e9f32..edf470d65 100644 --- a/native/examples/1_bfv_basics.cpp +++ b/native/examples/1_bfv_basics.cpp @@ -157,7 +157,7 @@ void example_bfv_basics() Note that KeyGenerator::create_public_key has another overload that takes no parameters and returns a Serializable object. We will discuss - this in `6_serialization.cpp'. + this in `7_serialization.cpp'. */ KeyGenerator keygen(context); SecretKey secret_key = keygen.secret_key(); @@ -168,7 +168,7 @@ void example_bfv_basics() To be able to encrypt we need to construct an instance of Encryptor. Note that the Encryptor only requires the public key, as expected. It is also possible to use Microsoft SEAL in secret-key mode by providing the Encryptor - the secret key instead. We will discuss this in `6_serialization.cpp'. + the secret key instead. We will discuss this in `7_serialization.cpp'. */ Encryptor encryptor(context, public_key); @@ -218,7 +218,7 @@ void example_bfv_basics() We then encrypt the plaintext, producing a ciphertext. We note that the Encryptor::encrypt function has another overload that takes as input only a plaintext and returns a Serializable object. We will discuss - this in `6_serialization.cpp'. + this in `7_serialization.cpp'. */ print_line(__LINE__); Ciphertext x_encrypted; diff --git a/native/examples/CMakeLists.txt b/native/examples/CMakeLists.txt index acb5ecc9c..317e40bb1 100644 --- a/native/examples/CMakeLists.txt +++ b/native/examples/CMakeLists.txt @@ -3,14 +3,16 @@ cmake_minimum_required(VERSION 3.13) -project(SEALExamples VERSION 4.1.1 LANGUAGES CXX) +project(SEALExamples VERSION 4.1.2 LANGUAGES CXX) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # If not called from root CMakeLists.txt if(NOT DEFINED SEAL_BUILD_EXAMPLES) set(SEAL_BUILD_EXAMPLES ON) # Import Microsoft SEAL - find_package(SEAL 4.1.1 EXACT REQUIRED) + find_package(SEAL 4.1.2 EXACT REQUIRED) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) endif() diff --git a/native/src/seal/context.cpp b/native/src/seal/context.cpp index 887a1312c..2ecb66b8b 100644 --- a/native/src/seal/context.cpp +++ b/native/src/seal/context.cpp @@ -438,7 +438,8 @@ namespace seal } // Add them to the context_data_map_ - context_data_map_.emplace(make_pair(next_parms_id, make_shared(move(next_context_data)))); + context_data_map_.emplace( + make_pair(next_parms_id, make_shared(std::move(next_context_data)))); // Add pointer to next context_data to the previous one (linked list) // Add pointer to previous context_data to the next one (doubly linked list) @@ -453,7 +454,7 @@ namespace seal SEALContext::SEALContext( EncryptionParameters parms, bool expand_mod_chain, sec_level_type sec_level, MemoryPoolHandle pool) - : pool_(move(pool)), sec_level_(sec_level) + : pool_(std::move(pool)), sec_level_(sec_level) { if (!pool_) { diff --git a/native/src/seal/decryptor.cpp b/native/src/seal/decryptor.cpp index 08f0c17c4..ed5f071bc 100644 --- a/native/src/seal/decryptor.cpp +++ b/native/src/seal/decryptor.cpp @@ -291,7 +291,7 @@ namespace seal // Acquire new array secret_key_array_size_ = new_size; - secret_key_array_.acquire(move(secret_key_array)); + secret_key_array_.acquire(std::move(secret_key_array)); } // Compute c_0 + c_1 *s + ... + c_{count-1} * s^{count-1} mod q. diff --git a/native/src/seal/evaluator.cpp b/native/src/seal/evaluator.cpp index dabd3babe..ba6d19f82 100644 --- a/native/src/seal/evaluator.cpp +++ b/native/src/seal/evaluator.cpp @@ -852,15 +852,15 @@ namespace seal switch (context_data_ptr->parms().scheme()) { case scheme_type::bfv: - bfv_square(encrypted, move(pool)); + bfv_square(encrypted, std::move(pool)); break; case scheme_type::ckks: - ckks_square(encrypted, move(pool)); + ckks_square(encrypted, std::move(pool)); break; case scheme_type::bgv: - bgv_square(encrypted, move(pool)); + bgv_square(encrypted, std::move(pool)); break; default: @@ -897,7 +897,7 @@ namespace seal // Optimization implemented currently only for size 2 ciphertexts if (encrypted_size != 2) { - bfv_multiply(encrypted, encrypted, move(pool)); + bfv_multiply(encrypted, encrypted, std::move(pool)); return; } @@ -1036,7 +1036,7 @@ namespace seal // Optimization implemented currently only for size 2 ciphertexts if (encrypted_size != 2) { - ckks_multiply(encrypted, encrypted, move(pool)); + ckks_multiply(encrypted, encrypted, std::move(pool)); return; } @@ -1097,7 +1097,7 @@ namespace seal // Optimization implemented currently only for size 2 ciphertexts if (encrypted_size != 2) { - bgv_multiply(encrypted, encrypted, move(pool)); + bgv_multiply(encrypted, encrypted, std::move(pool)); return; } @@ -1402,16 +1402,16 @@ namespace seal { case scheme_type::bfv: // Modulus switching with scaling - mod_switch_scale_to_next(encrypted, destination, move(pool)); + mod_switch_scale_to_next(encrypted, destination, std::move(pool)); break; case scheme_type::ckks: // Modulus switching without scaling - mod_switch_drop_to_next(encrypted, destination, move(pool)); + mod_switch_drop_to_next(encrypted, destination, std::move(pool)); break; case scheme_type::bgv: - mod_switch_scale_to_next(encrypted, destination, move(pool)); + mod_switch_scale_to_next(encrypted, destination, std::move(pool)); break; default: @@ -1503,7 +1503,7 @@ namespace seal case scheme_type::ckks: // Modulus switching with scaling - mod_switch_scale_to_next(encrypted, destination, move(pool)); + mod_switch_scale_to_next(encrypted, destination, std::move(pool)); break; default: @@ -1682,7 +1682,7 @@ namespace seal multiply(encrypteds[i], encrypteds[i + 1], temp); } relinearize_inplace(temp, relin_keys, pool); - product_vec.emplace_back(move(temp)); + product_vec.emplace_back(std::move(temp)); } if (encrypteds.size() & 1) { @@ -1695,7 +1695,7 @@ namespace seal Ciphertext temp(context_, context_data.parms_id(), pool); multiply(product_vec[i], product_vec[i + 1], temp); relinearize_inplace(temp, relin_keys, pool); - product_vec.emplace_back(move(temp)); + product_vec.emplace_back(std::move(temp)); } destination = product_vec.back(); @@ -1731,7 +1731,7 @@ namespace seal // Create a vector of copies of encrypted vector exp_vector(static_cast(exponent), encrypted); - multiply_many(exp_vector, relin_keys, encrypted, move(pool)); + multiply_many(exp_vector, relin_keys, encrypted, std::move(pool)); } void Evaluator::add_plain_inplace(Ciphertext &encrypted, const Plaintext &plain, MemoryPoolHandle pool) const @@ -1823,7 +1823,7 @@ namespace seal multiply_poly_scalar_coeffmod( plain.data(), plain.coeff_count(), encrypted.correction_factor(), parms.plain_modulus(), plain_copy.data()); - transform_to_ntt_inplace(plain_copy, encrypted.parms_id(), move(pool)); + transform_to_ntt_inplace(plain_copy, encrypted.parms_id(), std::move(pool)); RNSIter encrypted_iter(encrypted.data(), coeff_count); ConstRNSIter plain_iter(plain_copy.data(), coeff_count); add_poly_coeffmod(encrypted_iter, plain_iter, coeff_modulus_size, coeff_modulus, encrypted_iter); @@ -1931,7 +1931,7 @@ namespace seal multiply_poly_scalar_coeffmod( plain.data(), plain.coeff_count(), encrypted.correction_factor(), parms.plain_modulus(), plain_copy.data()); - transform_to_ntt_inplace(plain_copy, encrypted.parms_id(), move(pool)); + transform_to_ntt_inplace(plain_copy, encrypted.parms_id(), std::move(pool)); RNSIter encrypted_iter(encrypted.data(), coeff_count); ConstRNSIter plain_iter(plain_copy.data(), coeff_count); sub_poly_coeffmod(encrypted_iter, plain_iter, coeff_modulus_size, coeff_modulus, encrypted_iter); @@ -1972,12 +1972,12 @@ namespace seal } else if (!encrypted.is_ntt_form() && !plain.is_ntt_form()) { - multiply_plain_normal(encrypted, plain, move(pool)); + multiply_plain_normal(encrypted, plain, std::move(pool)); } else if (encrypted.is_ntt_form() && !plain.is_ntt_form()) { Plaintext plain_copy = plain; - transform_to_ntt_inplace(plain_copy, encrypted.parms_id(), move(pool)); + transform_to_ntt_inplace(plain_copy, encrypted.parms_id(), std::move(pool)); multiply_plain_ntt(encrypted, plain_copy); } else @@ -2493,7 +2493,7 @@ namespace seal if (galois_keys.has_key(galois_tool->get_elt_from_step(steps))) { // Perform rotation and key switching - apply_galois_inplace(encrypted, galois_tool->get_elt_from_step(steps), galois_keys, move(pool)); + apply_galois_inplace(encrypted, galois_tool->get_elt_from_step(steps), galois_keys, std::move(pool)); } else { diff --git a/native/src/seal/kswitchkeys.cpp b/native/src/seal/kswitchkeys.cpp index e02d063f8..ae69ea2a0 100644 --- a/native/src/seal/kswitchkeys.cpp +++ b/native/src/seal/kswitchkeys.cpp @@ -124,7 +124,7 @@ namespace seal { PublicKey key(pool_); key.unsafe_load(context, stream); - new_keys[index].emplace_back(move(key)); + new_keys[index].emplace_back(std::move(key)); } } } diff --git a/native/src/seal/util/croots.cpp b/native/src/seal/util/croots.cpp index a6c803d26..da3946ab2 100644 --- a/native/src/seal/util/croots.cpp +++ b/native/src/seal/util/croots.cpp @@ -15,7 +15,7 @@ namespace seal constexpr double ComplexRoots::PI_; ComplexRoots::ComplexRoots(size_t degree_of_roots, MemoryPoolHandle pool) - : degree_of_roots_(degree_of_roots), pool_(move(pool)) + : degree_of_roots_(degree_of_roots), pool_(std::move(pool)) { #ifdef SEAL_DEBUG int power = util::get_power_of_two(degree_of_roots_); diff --git a/native/src/seal/util/galois.cpp b/native/src/seal/util/galois.cpp index b86922644..93580284d 100644 --- a/native/src/seal/util/galois.cpp +++ b/native/src/seal/util/galois.cpp @@ -47,7 +47,7 @@ namespace seal { return; } - result.acquire(move(temp)); + result.acquire(std::move(temp)); } uint32_t GaloisTool::get_elt_from_step(int step) const diff --git a/native/src/seal/util/iterator.h b/native/src/seal/util/iterator.h index 8d076b4b5..44821e55c 100644 --- a/native/src/seal/util/iterator.h +++ b/native/src/seal/util/iterator.h @@ -1837,7 +1837,8 @@ namespace seal IterTuple() = default; - IterTuple(SEALIter first, IterTuple rest) : first_(first), rest_(rest){}; + IterTuple(SEALIter first, IterTuple rest) : first_(first), rest_(rest) + {} IterTuple(SEALIter first, Rest... rest) : first_(first), rest_(rest...) {} @@ -2061,7 +2062,8 @@ namespace seal using iterator_category = std::random_access_iterator_tag; using difference_type = std::ptrdiff_t; - IterTuple(){}; + IterTuple() + {} IterTuple(SEALIter first) : first_(first) {} diff --git a/native/src/seal/util/mempool.h b/native/src/seal/util/mempool.h index 574b386a1..3142b9c2c 100644 --- a/native/src/seal/util/mempool.h +++ b/native/src/seal/util/mempool.h @@ -228,7 +228,8 @@ namespace seal class MemoryPoolMT : public MemoryPool { public: - MemoryPoolMT(bool clear_on_destruction = false) : clear_on_destruction_(clear_on_destruction){}; + MemoryPoolMT(bool clear_on_destruction = false) : clear_on_destruction_(clear_on_destruction) + {} ~MemoryPoolMT() noexcept override; @@ -257,7 +258,8 @@ namespace seal class MemoryPoolST : public MemoryPool { public: - MemoryPoolST(bool clear_on_destruction = false) : clear_on_destruction_(clear_on_destruction){}; + MemoryPoolST(bool clear_on_destruction = false) : clear_on_destruction_(clear_on_destruction) + {} ~MemoryPoolST() noexcept override; diff --git a/native/src/seal/util/ntt.cpp b/native/src/seal/util/ntt.cpp index 2297f24aa..68694a6cd 100644 --- a/native/src/seal/util/ntt.cpp +++ b/native/src/seal/util/ntt.cpp @@ -179,7 +179,7 @@ namespace intel if (ntt_it == ntt_cache_.end()) { hexl::NTT ntt(N, modulus, root, seal::MemoryManager::GetPool(), hexl::SimpleThreadSafePolicy{}); - ntt_it = ntt_cache_.emplace(move(key), move(ntt)).first; + ntt_it = ntt_cache_.emplace(std::move(key), std::move(ntt)).first; } return ntt_it->second; } @@ -226,7 +226,8 @@ namespace seal { namespace util { - NTTTables::NTTTables(int coeff_count_power, const Modulus &modulus, MemoryPoolHandle pool) : pool_(move(pool)) + NTTTables::NTTTables(int coeff_count_power, const Modulus &modulus, MemoryPoolHandle pool) + : pool_(std::move(pool)) { #ifdef SEAL_DEBUG if (!pool_) @@ -316,7 +317,7 @@ namespace seal // Other constructors NTTTablesCreateIter(int coeff_count_power, vector modulus, MemoryPoolHandle pool) - : coeff_count_power_(coeff_count_power), modulus_(modulus), pool_(move(pool)) + : coeff_count_power_(coeff_count_power), modulus_(modulus), pool_(std::move(pool)) {} // Require copy and move constructors and assignments diff --git a/native/src/seal/util/numth.cpp b/native/src/seal/util/numth.cpp index 8bc63183a..9d9eb02b4 100644 --- a/native/src/seal/util/numth.cpp +++ b/native/src/seal/util/numth.cpp @@ -298,7 +298,7 @@ namespace seal Modulus new_mod(value); if (new_mod.is_prime()) { - destination.emplace_back(move(new_mod)); + destination.emplace_back(std::move(new_mod)); count--; } value -= factor; diff --git a/native/src/seal/util/rns.cpp b/native/src/seal/util/rns.cpp index fce3dabdb..c1d944428 100644 --- a/native/src/seal/util/rns.cpp +++ b/native/src/seal/util/rns.cpp @@ -16,7 +16,7 @@ namespace seal namespace util { RNSBase::RNSBase(const vector &rnsbase, MemoryPoolHandle pool) - : pool_(move(pool)), size_(rnsbase.size()) + : pool_(std::move(pool)), size_(rnsbase.size()) { if (!size_) { @@ -56,7 +56,7 @@ namespace seal } } - RNSBase::RNSBase(const RNSBase ©, MemoryPoolHandle pool) : pool_(move(pool)), size_(copy.size_) + RNSBase::RNSBase(const RNSBase ©, MemoryPoolHandle pool) : pool_(std::move(pool)), size_(copy.size_) { if (!pool_) { @@ -564,7 +564,7 @@ namespace seal RNSTool::RNSTool( size_t poly_modulus_degree, const RNSBase &coeff_modulus, const Modulus &plain_modulus, MemoryPoolHandle pool) - : pool_(move(pool)) + : pool_(std::move(pool)) { #ifdef SEAL_DEBUG if (!pool_) diff --git a/native/src/seal/util/ztools.cpp b/native/src/seal/util/ztools.cpp index 59e9c10bf..5735bc6b5 100644 --- a/native/src/seal/util/ztools.cpp +++ b/native/src/seal/util/ztools.cpp @@ -34,14 +34,14 @@ namespace seal class PointerStorage { public: - PointerStorage(MemoryPoolHandle pool) : pool_(move(pool)) + PointerStorage(MemoryPoolHandle pool) : pool_(std::move(pool)) {} void *allocate(size_t size) { auto ptr = util::allocate(size, pool_); void *addr = reinterpret_cast(ptr.get()); - ptr_storage_[addr] = move(ptr); + ptr_storage_[addr] = std::move(ptr); return addr; } @@ -392,7 +392,7 @@ namespace seal { Serialization::SEALHeader &header = *reinterpret_cast(header_ptr); - auto ret = zlib_deflate_array_inplace(in, move(pool)); + auto ret = zlib_deflate_array_inplace(in, std::move(pool)); if (Z_OK != ret) { stringstream ss; @@ -752,7 +752,7 @@ namespace seal { Serialization::SEALHeader &header = *reinterpret_cast(header_ptr); - auto ret = zstd_deflate_array_inplace(in, move(pool)); + auto ret = zstd_deflate_array_inplace(in, std::move(pool)); if (ZSTD_error_no_error != ret) { stringstream ss; diff --git a/native/tests/CMakeLists.txt b/native/tests/CMakeLists.txt index 4ab8358bf..f25adb9b2 100644 --- a/native/tests/CMakeLists.txt +++ b/native/tests/CMakeLists.txt @@ -3,14 +3,14 @@ cmake_minimum_required(VERSION 3.13) -project(SEALTest VERSION 4.1.1 LANGUAGES CXX C) +project(SEALTest VERSION 4.1.2 LANGUAGES CXX C) # If not called from root CMakeLists.txt if(NOT DEFINED SEAL_BUILD_TESTS) set(SEAL_BUILD_TESTS ON) # Import Microsoft SEAL - find_package(SEAL 4.1.1 EXACT REQUIRED) + find_package(SEAL 4.1.2 EXACT REQUIRED) # Must define these variables and include macros set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${OUTLIB_PATH})