From b5252a2cd22faa3d53644f0a44a5779eb567cc03 Mon Sep 17 00:00:00 2001 From: Wei Dai Date: Tue, 10 Nov 2020 16:09:10 -0800 Subject: [PATCH 1/3] Updated Changes.md. --- CHANGES.md | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c926d2dd..5ad4785f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,15 +2,23 @@ ## Version 3.6.0 -### New features +### New Features - Added support for [Zstandard](https://github.com/facebook/zstd) compression as a much more efficient alternative to ZLIB. The performance improvement should be expected to be around 20-30x. -- Added support for Shake256 XOF for pseudo-random number generation. -The user can choose to change the default from Blake2xb (faster) to Shake256 (FIPS-202) when configuring the build system. -There is slight change in how seeded ciphertexts and public keys are serialized due to the flexibility of supporting multiple hash functions. -Microsoft SEAL 3.6 is backwards compatible with 3.4 and 3.5 when deserializing, but it does not support serializing in the old formats. -- Added support for iOS. +- Added support for Shake256 (FIPS-202) XOF for pseudo-random number generation in addition to the default Blake2xb (faster). +- Microsoft SEAL 3.6 is backwards compatible with 3.4 and 3.5 when deserializing, but it does not support serializing in the old formats. +- Added support for iOS in the [NuGet package of Microsoft SEAL](https://www.nuget.org/packages/Microsoft.Research.SEALNet). +- The build system is unified for all platforms. +There is no longer a Visual Studio solution file (`seal.sln`) for Windows. +There is a separate solution file for the dotnet library ([dotnet/SEALNet.sln](dotnet/SEALNet.sln)). + +### New Build Configurations + +- `SEAL_BUILD_DEPS` controls whether dependencies are downloaded and built into Microsoft SEAL or searched from the system. +- Only a shared library will be built when `BUILD_SHARED_LIBS` is set to `ON`. Previously a static library was always built. +- Error is sampled from a centered binomial distribution by default unless `SEAL_USE_GAUSSIAN_NOISE` is set to `ON`. +- Blake2xb is used as XOF for PRNG by default unless `SEAL_DEFAULT_PRNG` is set to `"Shake256"`. ### API Changes @@ -49,11 +57,17 @@ This is used internally to route deserialization logic to correct functions depe Renamed files and directories: - `native/src/seal/intarray.h` to [native/src/seal/dynarray.h](native/src/seal/dynarray.h) +- `dotnet/tests/SEALNetTest.csproj` to [dotnet/tests/SEALNetTest.csproj.in](dotnet/tests/SEALNetTest.csproj.in) +- `dotnet/examples/SEALNetExamples.csproj` to [dotnet/examples/SEALNetExamples.csproj.in](dotnet/examples/SEALNetExamples.csproj.in) New files: - [native/src/seal/util/dwthandler.h](native/src/seal/util/dwthandler.h) +- [native/src/seal/util/fips202.h](native/src/seal/util/fips202.h) +- [native/src/seal/util/fips202.c](native/src/seal/util/fips202.c) - [native/src/seal/version.h](native/src/seal/version.h) +- [dotnet/SEALNet.sln](dotnet/SEALNet.sln) +- [.pre-commit-config.yaml](.pre-commit-config.yaml) Removed files: @@ -61,12 +75,24 @@ Removed files: - `dotnet/src/IntegerEncoder.cs` - `dotnet/tests/BigUIntTests.cs` - `dotnet/tests/IntegerEncoderTests.cs` +- `native/examples/SEALExamples.vcxproj` +- `native/examples/SEALExamples.vcxproj.filters` +- `native/src/CMakeConfig.cmd` +- `native/src/SEAL_C.vcxproj` +- `native/src/SEAL_C.vcxproj.filters` +- `native/src/SEAL.vcxproj` +- `native/src/SEAL.vcxproj.filters` - `native/src/seal/biguint.h` - `native/src/seal/biguint.cpp` - `native/src/seal/intencoder.h` - `native/src/seal/intencoder.cpp` +- `native/tests/packages.config` +- `native/tests/SEALTest.vcxproj` +- `native/tests/SEALTest.vcxproj.filters` - `native/tests/seal/biguint.cpp` - `native/tests/seal/intencoder.cpp` +- `thirdparty/` +- `SEAL.sln` ## Version 3.5.9 From 20182669f95f1d9e17bf6594fa5c325b7df36721 Mon Sep 17 00:00:00 2001 From: Wei Dai Date: Tue, 10 Nov 2020 16:44:55 -0800 Subject: [PATCH 2/3] Updated README.md. --- README.md | 164 ++++++++++++++++++++++++++---------------------------- 1 file changed, 79 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index d8efe31b..277d10ee 100644 --- a/README.md +++ b/README.md @@ -7,66 +7,71 @@ For more information about the Microsoft SEAL project, see [sealcrypto.org](http This document pertains to Microsoft SEAL version 3.6. Users of previous versions of the library should look at the [list of changes](CHANGES.md). +### Correct Use of Microsoft SEAL + +Decryptions of Microsoft SEAL ciphertexts should be treated as private information only available to the secret key owner. Sharing information directly or indirectly about a decryption should be thought of as equivalent to sharing information about the secret key itself. If it is absolutely necessary to share information about the decryption of a ciphertext, the number of bits shared should be kept to a minimum, and no more decryptions under the same secret key should be performed. We strongly recommend any commercial applications of Microsoft SEAL to be reviewed by cryptography experts familiar with these matters. + ## Contents - [Microsoft SEAL](#microsoft-seal) + - [Correct Use of Microsoft SEAL](#correct-use-of-microsoft-seal) - [Contents](#contents) - [Introduction](#introduction) - + - [Microsoft SEAL](#microsoft-seal-1) - [Building Microsoft SEAL](#building-microsoft-seal) - [Optional Dependencies](#optional-dependencies) - - - [Windows](#windows) - + - [Building with CMake](#building-with-cmake) - [Building Microsoft SEAL](#building-microsoft-seal-1) - - [[Optional] Debug and Release builds](#optional-debug-and-release-builds) - - [[Optional] Microsoft GSL](#optional-microsoft-gsl) - - [[Optional] ZLIB](#optional-zlib) - - [[Optional] Zstandard](#optional-zstandard) - - [Building Examples](#building-examples) - - [Building Unit Tests](#building-unit-tests) --> - - [Linux, macOS, and FreeBSD](#linux-macos-and-freebsd) - - - [Android](#android) + - [Android and iOS](#android-and-ios) - [Microsoft SEAL for .NET](#microsoft-seal-for-net) - [From NuGet package](#from-nuget-package) - [Windows](#windows-1) - + - [Building Your Own NuGet Package](#building-your-own-nuget-package) - [Linux and macOS](#linux-and-macos) - - - [Android](#android-1) + - [Using Microsoft SEAL for .NET in Your Own Application](#using-microsoft-seal-for-net-in-your-own-application-1) + - [Android and iOS](#android-and-ios-1) - [Getting Started](#getting-started) - [Contributing](#contributing) - [Citing Microsoft SEAL](#citing-microsoft-seal) - + - [Version 3.0](#version-30) ## Introduction @@ -155,67 +160,11 @@ In Microsoft SEAL >= 3.6.0 [Zstandard](https://github.com/facebook/zstd) is supp It is easy to compile Microsoft SEAL to support one or both of the compression libraries. This will ensure that any received ciphertext can be decompressed and used. -### Windows +#### GoogleTest -Microsoft SEAL comes with a Microsoft Visual Studio 2019 solution file `SEAL.sln` that can be used to conveniently build the library, examples, and unit tests. -Visual Studio 2019 is required to build Microsoft SEAL. - -#### Platform - -The Visual Studio solution `SEAL.sln` is configured to build Microsoft SEAL both for `Win32` and `x64` platforms. Please choose the right platform before building Microsoft SEAL. -The `SEAL_C` project and the .NET wrapper library `SEALNet` can only be built for `x64`. - -#### Building Microsoft SEAL - -Build the SEAL project `native\src\SEAL.vcxproj` from `SEAL.sln`. -This results in the static library `seal.lib` to be created in `lib\$(Platform)\$(Configuration)`. -When linking with applications, you need to add `native\src\` (full path) as an include directory for Microsoft SEAL header files. - -#### [Optional] Debug and Release builds - -You can easily switch from Visual Studio build configuration menu whether Microsoft SEAL should be built in `Debug` mode (no optimizations) or in `Release` mode. -Please note that `Debug` mode should not be used except for debugging Microsoft SEAL itself, as the performance will be orders of magnitude worse than in `Release` mode. - -#### [Optional] Microsoft GSL - -By default Microsoft GSL is downloaded as part of Microsoft SEAL library. -Microsoft GSL's header files are copied to `native\src\GSL` to be portable with Microsoft SEAL at the time of installation. -You can disable the dependency on Microsoft GSL by commenting out `#cmakedefine SEAL_USE_MSGSL` in [native\src\seal\util\config.h.in](native\src\seal\util\config.h.in). - -#### [Optional] ZLIB - -By default ZLIB is downloaded and compiled as part of Microsoft SEAL library. -ZLIB's static archive is included in Microsoft SEAL's static or shared target object. -You can disable the dependency on ZLIB by commenting out `#cmakedefine SEAL_USE_ZLIB` in [native\src\seal\util\config.h.in](native\src\seal\util\config.h.in). - -#### [Optional] Zstandard - -By default Zstandard is downloaded and compiled as part of Microsoft SEAL library. -Zstandard's static archive is included in Microsoft SEAL's static or shared target object. -You can disable the dependency on Zstandard by commenting out `#cmakedefine SEAL_USE_ZSTD` in [native\src\seal\util\config.h.in](native\src\seal\util\config.h.in). - -#### Building Examples - -Build the SEALExamples project `native\examples\SEALExamples.vcxproj` from `SEAL.sln`. -This results in an executable `sealexamples.exe` to be created in `bin\$(Platform)\$(Configuration)`. - -#### Building Unit Tests - -The unit tests require the Google Test framework to be installed. -The appropriate NuGet package is already listed in `native\tests\packages.config`, so once you attempt to build the SEALTest project `native\tests\SEALTest.vcxproj` from `SEAL.sln` Visual Studio will automatically download and install it for you. - -### Linux, macOS, and FreeBSD - -Microsoft SEAL is very easy to configure and build in Linux and macOS using CMake (>= 3.12). -A modern version of GNU G++ (>= 6.0) or Clang++ (>= 5.0) is needed. -In macOS the Xcode toolchain (>= 9.3) will work. - -In macOS you will need CMake with command line tools. For this, you can either - -1. install the cmake package with [Homebrew](https://brew.sh), or -1. download CMake directly from [cmake.org/download](https://cmake.org/download) and -[enable command line tools](https://stackoverflow.com/questions/30668601/installing-cmake-command-line-tools-on-a-mac). +### Building with CMake +We recommend using out-of-source build although in-source build works. Below we give instructions for how to configure, build, and install Microsoft SEAL either system-wide (global install), or for a single user (local install). A system-wide install requires elevated (root) privileges. @@ -348,7 +297,52 @@ cd cmake . -DCMAKE_PREFIX_PATH=~/mylibs ``` -### Android +### VCPKG + +### Linux, macOS, and FreeBSD + +Microsoft SEAL is very easy to configure and build in Linux and macOS using CMake (>= 3.12). +A modern version of GNU G++ (>= 6.0) or Clang++ (>= 5.0) is needed. +In macOS the Xcode toolchain (>= 9.3) will work. + +In macOS you will need CMake with command line tools. For this, you can either + +1. install the cmake package with [Homebrew](https://brew.sh), or +1. download CMake directly from [cmake.org/download](https://cmake.org/download) and +[enable command line tools](https://stackoverflow.com/questions/30668601/installing-cmake-command-line-tools-on-a-mac). + +### Windows + +Microsoft SEAL comes with a Microsoft Visual Studio 2019 solution file `SEAL.sln` that can be used to conveniently build the library, examples, and unit tests. +Visual Studio 2019 is required to build Microsoft SEAL. + +#### Platform + +The Visual Studio solution `SEAL.sln` is configured to build Microsoft SEAL both for `Win32` and `x64` platforms. Please choose the right platform before building Microsoft SEAL. +The `SEAL_C` project and the .NET wrapper library `SEALNet` can only be built for `x64`. + +#### Building Microsoft SEAL + +Build the SEAL project `native\src\SEAL.vcxproj` from `SEAL.sln`. +This results in the static library `seal.lib` to be created in `lib\$(Platform)\$(Configuration)`. +When linking with applications, you need to add `native\src\` (full path) as an include directory for Microsoft SEAL header files. + +#### [Optional] Debug and Release builds + +You can easily switch from Visual Studio build configuration menu whether Microsoft SEAL should be built in `Debug` mode (no optimizations) or in `Release` mode. +Please note that `Debug` mode should not be used except for debugging Microsoft SEAL itself, as the performance will be orders of magnitude worse than in `Release` mode. + +#### Building Examples + +Build the SEALExamples project `native\examples\SEALExamples.vcxproj` from `SEAL.sln`. +This results in an executable `sealexamples.exe` to be created in `bin\$(Platform)\$(Configuration)`. + +#### Building Unit Tests + +The unit tests require the Google Test framework to be installed. +The appropriate NuGet package is already listed in `native\tests\packages.config`, so once you attempt to build the SEALTest project `native\tests\SEALTest.vcxproj` from `SEAL.sln` Visual Studio will automatically download and install it for you. + +### Android and iOS Microsoft SEAL can be compiled for Android. Under the `android` directory of the source tree you will find an [Android Studio](https://developer.android.com/studio) project that you can use to compile the library for Android. This project is meant only to generate native libraries that can then be called through the .NET library described in the following sections. Specifically, it does not contain any wrappers that can be used from the Java language. @@ -477,7 +471,7 @@ To use Microsoft SEAL for .NET in your own application you need to: 1. ensure the native shared library is available for your application when run. The easiest way to ensure this is to copy the native shared library to the same directory where your application's executable is located. -### Android +### Android and iOS You can use [Android Studio](https://developer.android.com/studio) to build the native shared library used by the .NET Standard wrapper library. However, the easiest and recommended way to use Microsoft SEAL in Android is through the multiplatform NuGet package you can find at [NuGet.org](https://www.nuget.org/packages/Microsoft.Research.SEALNet). Just add this package to your [Xamarin](https://dotnet.microsoft.com/apps/xamarin) project in order to develop mobile applications using Microsoft SEAL and .NET. The native shared library and the .NET wrapper compile only for 64 bits, so only `arm64-v8a` and `x86_64` Android ABIs are supported. From 2c9c7b14acb47326a615f79e471808b08608c26d Mon Sep 17 00:00:00 2001 From: Kim Laine Date: Tue, 10 Nov 2020 16:53:45 -0800 Subject: [PATCH 3/3] Installing MSGSL header files in Windows --- CMakeLists.txt | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c765b8d..e343c418 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -460,10 +460,8 @@ install( # Install the pkg-config file install( - FILES - ${SEAL_PKGCONFIG_FILENAME} - DESTINATION - ${SEAL_PKGCONFIG_INSTALL_DIR}) + FILES ${SEAL_PKGCONFIG_FILENAME} + DESTINATION ${SEAL_PKGCONFIG_INSTALL_DIR}) # We export SEALTargets from the build tree so it can be used by other projects # without requiring an install. @@ -472,21 +470,20 @@ export( NAMESPACE SEAL:: FILE ${SEAL_TARGETS_FILENAME}) -# In UNIX-like platforms install MSGSL header files if SEAL_BUILD_DEPS is ON -if(SEAL_USE_MSGSL AND SEAL_BUILD_DEPS AND NOT WIN32) +# Install MSGSL header files if SEAL_BUILD_DEPS is ON +if(SEAL_USE_MSGSL AND SEAL_BUILD_DEPS) install( - DIRECTORY - ${msgsl_SOURCE_DIR}/include/gsl - DESTINATION - ${SEAL_INCLUDES_INSTALL_DIR} - ) + DIRECTORY ${msgsl_SOURCE_DIR}/include/gsl + DESTINATION ${SEAL_INCLUDES_INSTALL_DIR}) endif() # Create pkg-config file -configure_file( - ${CMAKE_CURRENT_LIST_DIR}/pkgconfig/seal.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seal-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR}.pc - @ONLY) +if(NOT WIN32) + configure_file( + ${CMAKE_CURRENT_LIST_DIR}/pkgconfig/seal.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seal-${SEAL_VERSION_MAJOR}.${SEAL_VERSION_MINOR}.pc + @ONLY) +endif() ##################### # SEAL C++ examples #