зеркало из https://github.com/microsoft/SEAL.git
Merge branch 'master' of ssh.dev.azure.com:v3/msrcrypto/SEAL/SEAL
This commit is contained in:
Коммит
0dbdd3fdc6
|
@ -130,12 +130,14 @@ set(SEAL_USE_MSGSL_OPTION_STR "Use Microsoft GSL")
|
|||
option(SEAL_USE_MSGSL ${SEAL_USE_MSGSL_OPTION_STR} ON)
|
||||
if(SEAL_USE_MSGSL)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
message(STATUS "Download Microsoft GSL ...")
|
||||
message(STATUS "Microsoft GSL: download ...")
|
||||
include(ExternalMSGSL)
|
||||
else()
|
||||
find_package(Microsoft.GSL CONFIG)
|
||||
find_package(Microsoft.GSL 3 CONFIG)
|
||||
if(NOT Microsoft.GSL_FOUND)
|
||||
message(FATAL_ERROR "Failed to find Microsoft GSL")
|
||||
message(FATAL_ERROR "Microsoft GSL: not found")
|
||||
else()
|
||||
message(STATUS "Microsoft GSL: found")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -145,13 +147,15 @@ set(SEAL_USE_ZLIB_OPTION_STR "Use ZLIB for compressed serialization")
|
|||
option(SEAL_USE_ZLIB ${SEAL_USE_ZLIB_OPTION_STR} ON)
|
||||
if(SEAL_USE_ZLIB)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
message(STATUS "Download ZLIB ...")
|
||||
message(STATUS "ZLIB: download ...")
|
||||
include(ExternalZLIB)
|
||||
set(zlib "zlibstatic")
|
||||
else()
|
||||
find_package(ZLIB 1.2.11)
|
||||
if(NOT ZLIB_FOUND)
|
||||
message(FATAL_ERROR "Failed to find ZLIB")
|
||||
message(FATAL_ERROR "ZLIB: not found")
|
||||
else()
|
||||
message(STATUS "ZLIB: found")
|
||||
endif()
|
||||
set(zlib "ZLIB::ZLIB")
|
||||
endif()
|
||||
|
@ -162,22 +166,23 @@ set(SEAL_USE_ZSTD_OPTION_STR "Use Zstandard for compressed serialization")
|
|||
option(SEAL_USE_ZSTD ${SEAL_USE_ZSTD_OPTION_STR} ON)
|
||||
if(SEAL_USE_ZSTD)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
message(STATUS "Download Zstandard ...")
|
||||
message(STATUS "Zstandard: download ...")
|
||||
include(ExternalZSTD)
|
||||
set(zstd_static "libzstd_static")
|
||||
else()
|
||||
find_package(zstd CONFIG)
|
||||
if(NOT zstd_FOUND)
|
||||
message(FATAL_ERROR "Failed to find Zstandard")
|
||||
message(FATAL_ERROR "Zstandard: not found")
|
||||
endif()
|
||||
if(TARGET zstd::libzstd_static)
|
||||
set(zstd_static "zstd::libzstd_static")
|
||||
elseif(TARGET libzstd)
|
||||
get_target_property(libzstd_type libzstd TYPE)
|
||||
if(libzstd_type STREQUAL "STATIC")
|
||||
if(libzstd_type STREQUAL "STATIC_LIBRARY")
|
||||
set(zstd_static "libzstd")
|
||||
message(STATUS "Zstandard: found")
|
||||
else()
|
||||
message(FATAL_ERROR "Zstandard must be static")
|
||||
message(FATAL_ERROR "Zstandard: must be static")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
@ -367,19 +372,11 @@ else()
|
|||
endif()
|
||||
|
||||
if(SEAL_USE_ZLIB)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
target_link_libraries(seal_shared PRIVATE ${zlib})
|
||||
else()
|
||||
target_link_libraries(seal_shared PRIVATE ${zlib})
|
||||
endif()
|
||||
target_link_libraries(seal_shared PRIVATE ${zlib})
|
||||
endif()
|
||||
|
||||
if(SEAL_USE_ZSTD)
|
||||
if(SEAL_BUILD_DEPS)
|
||||
target_link_libraries(seal_shared PRIVATE ${zstd_static})
|
||||
else()
|
||||
target_link_libraries(seal_shared PRIVATE ${zstd_static})
|
||||
endif()
|
||||
target_link_libraries(seal_shared PRIVATE ${zstd_static})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
70
README.md
70
README.md
|
@ -34,32 +34,26 @@ Commercial applications of Microsoft SEAL, or any homomorphic encryption library
|
|||
- [Requirements](#requirements)
|
||||
- [Building Microsoft SEAL](#building-microsoft-seal)
|
||||
- [Installing Microsoft SEAL](#installing-microsoft-seal)
|
||||
- [Building on Windows](#building-on-windows)
|
||||
- [Android and iOS](#android-and-ios)
|
||||
- [Building and Installing on Windows](#building-and-installing-on-windows)
|
||||
- [Building for Android and iOS](#building-for-android-and-ios)
|
||||
- [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 and Tests](#examples-and-tests)
|
||||
- [Building .NET Components](#building-net-components)
|
||||
- [Windows](#windows)
|
||||
- [Windows, Linux, and macOS](#windows-linux-and-macos)
|
||||
- [Android and iOS](#android-and-ios)
|
||||
- [Using Microsoft SEAL for .NET in Your Own Application](#using-microsoft-seal-for-net-in-your-own-application)
|
||||
- [Building Your Own NuGet Package](#building-your-own-nuget-package)
|
||||
- [Linux and macOS](#linux-and-macos)
|
||||
- [Native Library](#native-library)
|
||||
- [.NET Library](#net-library)
|
||||
- [.NET Examples](#net-examples)
|
||||
- [.NET Unit Tests](#net-unit-tests)
|
||||
- [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)
|
||||
- [Contributing](#contributing)
|
||||
- [Citing Microsoft SEAL](#citing-microsoft-seal)
|
||||
- [Version 3.6](#version-36)
|
||||
<!-- - [Version 3.6](#version-36)
|
||||
- [Version 3.5](#version-35)
|
||||
- [Version 3.4](#version-34)
|
||||
- [Version 3.3](#version-33)
|
||||
- [Version 3.2](#version-32)
|
||||
- [Version 3.1](#version-31)
|
||||
- [Version 3.0](#version-30)
|
||||
- [Version 3.0](#version-30) -->
|
||||
|
||||
## Introduction
|
||||
|
||||
|
@ -232,7 +226,7 @@ We assume that Microsoft SEAL has been cloned into a directory called `SEAL` and
|
|||
|
||||
You can build Microsoft SEAL library (out-of-source) for your machine by executing the following commands:
|
||||
|
||||
```bash
|
||||
```PowerShell
|
||||
cmake -S . -B build
|
||||
cmake --build build
|
||||
```
|
||||
|
@ -246,7 +240,7 @@ These are decribed below in sections [Basic CMake Options](#basic-cmake-options)
|
|||
|
||||
If you have root access to the system you can install Microsoft SEAL globally as follows:
|
||||
|
||||
```bash
|
||||
```PowerShell
|
||||
cmake -S . -B build
|
||||
cmake --build build
|
||||
sudo cmake --install build
|
||||
|
@ -254,7 +248,7 @@ sudo cmake --install build
|
|||
|
||||
To instead install Microsoft SEAL locally, e.g., to `~/mylibs/`, do the following:
|
||||
|
||||
```bash
|
||||
```PowerShell
|
||||
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=~/mylibs
|
||||
cmake --build build
|
||||
sudo cmake --install build
|
||||
|
@ -262,20 +256,34 @@ sudo cmake --install build
|
|||
|
||||
#### Building and Installing on Windows
|
||||
|
||||
On Windows the same scripts above work in a developer command prompt for Visual Studio.
|
||||
The right x64 or x86 version of command prompt ...
|
||||
On Windows the same scripts above work in a developer command prompt for Visual Studio, using either the `Ninja` or `Visual Studio 16 2019` generators.
|
||||
|
||||
Ninja/Visual Studio generators.
|
||||
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`.
|
||||
With Ninja generator ...
|
||||
With Visual Studio generator, a specific architecture flag `-A x64` or `-A x86` should be provided.
|
||||
When using the `Ninja` generator, please use the appropriate command prompt depending on the platform you want to build for. If you want to build for x64, please use the `x64 Native Tools Command Prompt for Visual Studio 2019` command prompt to configure and build the library. If you want to build for x86, please use the `x86 Native Tools Command Prompt for Visual Studio 2019` command prompt to configure and build the library:
|
||||
|
||||
Visual Studio / Visual Stuido Code open as CMake project.
|
||||
```PowerShell
|
||||
cmake -S . -B build -GNinja
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
Replace `sudo` with administrator.
|
||||
When using the `Visual Studio 16 2019` generator you can use the `Developer Command Prompt for VS 2019` command prompt to configure and build the library. By default the generated platform will be `x64`. You can specify the desired platform using the architecture flag `-A`:
|
||||
|
||||
This results in the static library `seal.lib` to be created in `lib\$(Platform)\$(Configuration)`.
|
||||
```PowerShell
|
||||
# Generate and build for x64
|
||||
cmake -S . -B build -G "Visual Studio 16 2019" -A x64
|
||||
cmake --build build
|
||||
|
||||
# Generate and build for x86
|
||||
cmake -S . -B build -G "Visual Studio 16 2019" -A Win32
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
**Note**: The `SEAL_C` project and the .NET wrapper library `SEALNet` can only be built for the `x64` platform.
|
||||
|
||||
Installing the library in Windows works as well. Instead of using the `sudo` command, however, you need to run `cmake --install build` from a command prompt with Administrator permissions. Files will be installed by default to `C:\Program Files (x86)\SEAL`.
|
||||
|
||||
Visual Studio 2019 provides support for CMake-based projects. You can select the menu option `File / Open / Folder...` and navigate to the folder where the Microsoft SEAL repository is located. After opening the folder, Visual Studio will detect that this is a CMake-based project and will enable the menu command `Project / CMake settings for SEAL`. This will open the CMake settings editor that provides a user interface where you can create different configurations and set different CMake variables.
|
||||
|
||||
This results in the static library `seal.lib` to be created in `build\lib\$(Configuration)`.
|
||||
When linking with applications, you need to add `native\src\` (full path) as an include directory for Microsoft SEAL header files.
|
||||
|
||||
#### Building for Android and iOS
|
||||
|
@ -285,7 +293,7 @@ Under the [android/](android/) directory of the source tree you will find an [An
|
|||
|
||||
To build the library for iOS, use the following scripts:
|
||||
|
||||
```bash
|
||||
```PowerShell
|
||||
# Configure CMake
|
||||
cmake -S . -B build -GXcode -DSEAL_BUILD_SEAL_C=ON -DSEAL_BUILD_STATIC_SEAL_C=ON -DCMAKE_SYSTEM_NAME=iOS "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" -C cmake/memset_s.iOS.cmake
|
||||
|
||||
|
@ -327,7 +335,7 @@ The following options can be used with CMake to configure the build. The default
|
|||
|
||||
As usual, these options can be passed to CMake with the `-D` flag.
|
||||
For example, one could run
|
||||
```bash
|
||||
```PowerShell
|
||||
cmake -S . -B build -DSEAL_BUILD_EXAMPLES=ON
|
||||
```
|
||||
to configure a release build of a static Microsoft SEAL library and also build the examples.
|
||||
|
@ -348,7 +356,7 @@ The following options can be used with CMake to further configure the build. Mos
|
|||
It is very easy to link your own applications and libraries with Microsoft SEAL if you use CMake.
|
||||
Simply add the following to your `CMakeLists.txt`:
|
||||
|
||||
```bash
|
||||
```PowerShell
|
||||
find_package(SEAL 3.6 REQUIRED)
|
||||
target_link_libraries(<your target> SEAL::seal)
|
||||
```
|
||||
|
@ -356,7 +364,7 @@ target_link_libraries(<your target> SEAL::seal)
|
|||
If Microsoft SEAL was installed globally, the above `find_package` command will likely find the library automatically.
|
||||
To link with a Microsoft SEAL installed locally, e.g., installed in `~/mylibs` as described above, you may need to tell CMake where to look for Microsoft SEAL when you configure your application by running:
|
||||
|
||||
```bash
|
||||
```PowerShell
|
||||
cd <directory containing your CMakeLists.txt>
|
||||
cmake . -DCMAKE_PREFIX_PATH=~/mylibs
|
||||
```
|
||||
|
@ -369,7 +377,7 @@ When building Microsoft SEAL, examples and tests can be built by setting `SEAL_B
|
|||
Alternatively, both [examples](native/examples/CMakeLists.txt) and [tests](native/tests/CMakeLists.txt) can be built as standalone CMake projects linked with Microsoft SEAL (installed in `~/mylibs`), by following the commands below.
|
||||
Omit setting `SEAL_ROOT` if the library is installed globally.
|
||||
|
||||
```bash
|
||||
```PowerShell
|
||||
cd native/<examples|tests>
|
||||
cmake -S . -B build -DSEAL_ROOT=~/mylibs
|
||||
cmake --build build
|
||||
|
@ -389,7 +397,7 @@ Building the SEAL_C library with CMake will generates project files for the .NET
|
|||
The SEAL_C library must be discoverable when running a .NET application, e.g., be present in the same directory as your executable, which is taken care of by the .NET examples and tests project files.
|
||||
Run the following scripts to build each project:
|
||||
|
||||
```bash
|
||||
```PowerShell
|
||||
dotnet build dotnet/src --configuration <Debug|Release> # Build .NET wrapper library
|
||||
dotnet test dotnet/tests # Build and run .NET unit tests
|
||||
dotnet run -p dotnet/examples # Build and run .NET examples
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
<file src="$NUGET_ANDROIDX64_SEAL_C_PATH$" target="runtimes/android-x64/" />
|
||||
<file src="$NUGET_IOS64_SEAL_C_PATH$" target="runtimes/ios64/" />
|
||||
<file src="$NUGET_IOS64_SEAL_PATH$" target="runtimes/ios64/" />
|
||||
<file src="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/dotnet/$configuration$/netstandard2.0/SEALNet.dll" target="lib/netstandard2.0/" />
|
||||
<file src="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/dotnet/$configuration$/SEALNet.xml" target="lib/netstandard2.0/" />
|
||||
<file src="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/dotnet/ios/$configuration$/netstandard2.0/SEALNet.dll" target="lib/Xamarin.iOS10/" />
|
||||
<file src="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/dotnet/ios/$configuration$/SEALNet.xml" target="lib/Xamarin.iOS10/" />
|
||||
<file src="../../build/bin/dotnet/$configuration$/netstandard2.0/SEALNet.dll" target="lib/netstandard2.0/" />
|
||||
<file src="../../build/bin/dotnet/$configuration$/SEALNet.xml" target="lib/netstandard2.0/" />
|
||||
<file src="../../build/bin/dotnet/ios/$configuration$/netstandard2.0/SEALNet.dll" target="lib/Xamarin.iOS10/" />
|
||||
<file src="../../build/bin/dotnet/ios/$configuration$/SEALNet.xml" target="lib/Xamarin.iOS10/" />
|
||||
<file src="../../LICENSE" target="LICENSE" />
|
||||
</files>
|
||||
</package>
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
<file src="@SEAL_WINDOWS_SEAL_C_PATH@" target="runtimes/win10-x64" />
|
||||
<file src="@SEAL_LINUX_SEAL_C_PATH@" target="runtimes/linux-x64" />
|
||||
<file src="@SEAL_MACOS_SEAL_C_PATH@" target="runtimes/macos-x64" />
|
||||
<file src="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/dotnet/$configuration$/netstandard2.0/SEALNet.dll" target="lib/netstandard2.0/" />
|
||||
<file src="@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/dotnet/$configuration$/SEALNet.xml" target="lib/netstandard2.0/" />
|
||||
<file src="../../build/bin/dotnet/$configuration$/netstandard2.0/SEALNet.dll" target="lib/netstandard2.0/" />
|
||||
<file src="../../build/bin/dotnet/$configuration$/SEALNet.xml" target="lib/netstandard2.0/" />
|
||||
<file src="../../LICENSE" target="LICENSE" />
|
||||
</files>
|
||||
</package>
|
||||
|
|
|
@ -35,13 +35,15 @@ if(SEAL_BUILD_TESTS)
|
|||
mark_as_advanced(FETCHCONTENT_FULLY_DISCONNECTED)
|
||||
mark_as_advanced(FETCHCONTENT_UPDATES_DISCONNECTED)
|
||||
mark_as_advanced(FETCHCONTENT_QUIET)
|
||||
message(STATUS "Download GoogleTest ...")
|
||||
message(STATUS "GoogleTest: download ...")
|
||||
include(ExternalGTest)
|
||||
add_library(GTest::gtest ALIAS gtest)
|
||||
else()
|
||||
find_package(GTest 1.10.0 CONFIG)
|
||||
if(NOT GTest_FOUND)
|
||||
message(FATAL_ERROR "Failed to find GoogleTest")
|
||||
message(FATAL_ERROR "GoogleTest: not found")
|
||||
else()
|
||||
message(STATUS "GoogleTest: found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ steps:
|
|||
displayName: 'ESRP Add Strong Name'
|
||||
inputs:
|
||||
ConnectedServiceName: 'ESRP CodeSigning'
|
||||
FolderPath: bin/dotnet/${{ parameters.configuration }}/netstandard2.0
|
||||
FolderPath: build/bin/dotnet/${{ parameters.configuration }}/netstandard2.0
|
||||
Pattern: '*.dll'
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: |
|
||||
|
@ -141,7 +141,7 @@ steps:
|
|||
displayName: 'ESRP Add Strong Name to iOS assembly'
|
||||
inputs:
|
||||
ConnectedServiceName: 'ESRP CodeSigning'
|
||||
FolderPath: bin/dotnet/ios/${{ parameters.configuration }}/netstandard2.0
|
||||
FolderPath: build/bin/dotnet/ios/${{ parameters.configuration }}/netstandard2.0
|
||||
Pattern: '*.dll'
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: |
|
||||
|
@ -167,7 +167,7 @@ steps:
|
|||
displayName: 'ESRP CodeSigning .NET Standard 2.0'
|
||||
inputs:
|
||||
ConnectedServiceName: 'ESRP CodeSigning'
|
||||
FolderPath: bin/dotnet/${{ parameters.configuration }}/netstandard2.0
|
||||
FolderPath: build/bin/dotnet/${{ parameters.configuration }}/netstandard2.0
|
||||
Pattern: '*.dll'
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: |
|
||||
|
@ -198,7 +198,7 @@ steps:
|
|||
displayName: 'ESRP CodeSigning .NET Standard 2.0 for iOS assembly'
|
||||
inputs:
|
||||
ConnectedServiceName: 'ESRP CodeSigning'
|
||||
FolderPath: bin/dotnet/ios/${{ parameters.configuration }}/netstandard2.0
|
||||
FolderPath: build/bin/dotnet/ios/${{ parameters.configuration }}/netstandard2.0
|
||||
Pattern: '*.dll'
|
||||
signConfigType: inlineSignParams
|
||||
inlineOperation: |
|
||||
|
|
Загрузка…
Ссылка в новой задаче