Skip to content

Commit

Permalink
Merge pull request #271 from openfheorg/270-hotfix-patch-for-main
Browse files Browse the repository at this point in the history
Hotfix patch v1.0.2 for main
  • Loading branch information
yspolyakov authored Dec 23, 2022
2 parents c48c41c + 2fee782 commit 83a5274
Show file tree
Hide file tree
Showing 22 changed files with 116 additions and 83 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.User.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cmake_minimum_required (VERSION 3.5.1)
### If you need your application to be linked statically, then run "cmake .. -DBUILD_STATIC=ON"

project(demo CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
option( BUILD_STATIC "Set to ON to include static versions of the library" OFF)

find_package(OpenFHE)
Expand Down
39 changes: 22 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ endif()
### To use gcc/g++ on a Macintosh, you must set the Compilers
### here, not inside the project
##if(APPLE)
## set(CMAKE_C_COMPILER "/usr/local/bin/gcc-7")
## set(CMAKE_CXX_COMPILER "/usr/local/bin/g++-7")
## set(CMAKE_C_COMPILER "/usr/local/bin/gcc-10")
## set(CMAKE_CXX_COMPILER "/usr/local/bin/g++-10")
##endif()
### TODO: for now, we use CLang for Mac

project (OpenFHE C CXX)

set(OPENFHE_VERSION_MAJOR 1)
set(OPENFHE_VERSION_MINOR 0)
set(OPENFHE_VERSION_PATCH 1)
set(OPENFHE_VERSION_PATCH 2)
set(OPENFHE_VERSION ${OPENFHE_VERSION_MAJOR}.${OPENFHE_VERSION_MINOR}.${OPENFHE_VERSION_PATCH})

set(CMAKE_CXX_STANDARD 17)
Expand Down Expand Up @@ -270,7 +270,11 @@ else()
endif()

if(ARCHITECTURE)
message(STATUS "Architecture is " ${ARCHITECTURE})
if (${ARCHITECTURE} MATCHES "i386")
message(SEND_ERROR "The " ${ARCHITECTURE} " architecture is not supported")
else()
message(STATUS "Architecture is " ${ARCHITECTURE})
endif()
endif()

# Size checks
Expand Down Expand Up @@ -361,20 +365,21 @@ install(FILES ${CMAKE_BINARY_DIR}/src/core/config_core.h DESTINATION include/ope
find_program(TAR "gtar")
find_program(TAR "tar")

### several of the third-party tools use auto-make and autoconf
### we need to make sure that they are installed
execute_process(COMMAND autogen --version OUTPUT_VARIABLE AUTOGEN_VER)
# execute_process in MINGW by default does not run in a shell
if(MINGW)
execute_process(COMMAND sh autoconf --version OUTPUT_VARIABLE AUTOCONF_VER)
else()
execute_process(COMMAND autoconf --version OUTPUT_VARIABLE AUTOCONF_VER)
endif()

string(LENGTH "${AUTOCONF_VER}" AUTOCONF_VER_LEN)
if(WITH_TCM OR WITH_NTL)
### tcmalloc, NTL and GMP require autoconf/automake/libtool to be installed.
### we need to make sure that they are:
execute_process(COMMAND autogen --version OUTPUT_VARIABLE AUTOGEN_VER)
# execute_process in MINGW by default does not run in a shell
if(MINGW)
execute_process(COMMAND sh autoconf --version OUTPUT_VARIABLE AUTOCONF_VER)
else()
execute_process(COMMAND autoconf --version OUTPUT_VARIABLE AUTOCONF_VER)
endif()

if( ${AUTOCONF_VER_LEN} EQUAL 0 )
message(SEND_ERROR "Autoconf is not installed.")
string(LENGTH "${AUTOCONF_VER}" AUTOCONF_VER_LEN)
if( ${AUTOCONF_VER_LEN} EQUAL 0 )
message(SEND_ERROR "Autoconf is not installed.")
endif()
endif()

#--------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ OpenFHE also includes the following multiparty extensions of FHE:
* Threshold FHE for BGV, BFV, and CKKS schemes
* Proxy Re-Encryption for BGV, BFV, and CKKS schemes

OpenFHE supports any GNU C++ compiler version 9 or above and clang C++ compiler version 10 or above.

## Links and Resources

* [OpenFHE documentation](https://openfhe-development.readthedocs.io/en/latest/)
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx_rsts/intro/directory_structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The descriptions of library components are as follows:

"benchmark","Code for benchmarking OpenFHE library components, using the Google Benchmark frameworks"
"build","Binaries and build scripts (this folder is created by the user)"
"doc","Documentation of library components, including doxygen documentation generated by the make process."
"doc","Documentation of library components."
"docker","Docker file and documentation."
"src","Library source code. Each subcomponent has four or five subdirectories: include (for library header files), lib (for library source files), unittest (for google test cases), examples (for code samples), and optionally extras (for additional code samples)."
"third-party","Code for distributions from third parties (includes NTL/GMP + git submodules for tcmalloc, cereal, google test, and google benchmark)"
Expand Down
21 changes: 20 additions & 1 deletion docs/sphinx_rsts/intro/installation/gmp_ntl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,32 @@
Instructions for installing GMP and NTL
=======================================

This section describes how to install GMP and NTL onto your system, and how to use them in OpenFHE.
This section describes how to install GMP and NTL onto your system, and how to use them in OpenFHE. Install ``autoconf`` if it is not already present:
.. topic:: on Linux

::

sudo apt-get install autoconf

.. topic:: on MacOS

::

brew install autoconf

.. topic:: on Windows

::

pacman -S autoconf


.. note:: scroll to the bottom for an all-in-one install script

The standard binary install using tools like ``apt-get`` will not work, and manual installation of GMP and NTL from the source code is needed. The steps are detailed below.

Installing GMP and NTL for OpenFHE:

1. First, download gmp-6.1.2.tar.lz from https://ftp.gnu.org/gnu/gmp/

::
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx_rsts/intro/installation/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Welcome to the OpenFHE installation instructions! For OS-specific instructions,

Build Instructions
##################
We use CMake to build OpenFHE.
We use CMake to build OpenFHE. OpenFHE supports any GNU C++ compiler version 9 or above and clang C++ compiler version 10 or above.


1. Install system prerequisites (if not already installed), including a C++ compiler with OMP support, cmake, make, and autoconf.
1. Install system prerequisites (if not already installed), including a C++ compiler with OMP support, cmake, make.

2. Clone the OpenFHE repo to your local machine.

Expand Down
36 changes: 16 additions & 20 deletions docs/sphinx_rsts/intro/installation/linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Installing OpenFHE on Linux
sudo yum install cmake3
ln -s /usr/bin/cmake3 ~/bin/cmake

If you need to install a specific version of gcc, do the following (this example is for g++ v7):
``sudo yum install devtoolset-7-gcc-c++``
If you need to install a specific version of gcc, do the following (this example is for g++ v10):
``sudo yum install devtoolset-10-gcc-c++``

1. Install pre-requisites (if not already installed) and set the default compiler.

Expand All @@ -22,21 +22,20 @@ Installing OpenFHE on Linux
Note that ``sudo apt-get install g++-<version>`` can be used to install a specific version of the compiler. You can use "g++ --version" to check the version of g++ that is found by the system.


Install ``g++``, ``cmake``, ``make``, and ``autoconf``. Sample commands using apt-get are listed below. It is possible that these are already installed
Install ``g++``, ``cmake`` and ``make``. Sample commands using apt-get are listed below. It is possible that these are already installed

::

sudo apt-get install build-essential #this already includes g++
sudo apt-get install cmake
sudo apt-get install autoconf

.. topic:: clang

Typically g++ is the default compiler for Linux but clang++ can also be installed.

First install clang++, e.g., ``sudo apt-get install clang-9`` to install clang 9.
First install clang++, e.g., ``sudo apt-get install clang-11`` to install clang 11.

If installing an older version of clang, e.g., v6, you may also need to install OpenMP. The commands for this case are
If installing an older version of clang, you may also need to install OpenMP. The commands for this case are

::

Expand All @@ -45,12 +44,12 @@ Installing OpenFHE on Linux
sudo apt-get install libomp-dev


Then run the following two commands to configure clang/clang++ as the default compiler for C and C++ (default paths are used here). For clang 9:
Then run the following two commands to configure clang/clang++ as the default compiler for C and C++ (default paths are used here). For clang 11:

::

export CC=/usr/bin/clang-9
export CXX=/usr/bin/clang++-9
export CC=/usr/bin/clang-11
export CXX=/usr/bin/clang++-11


For a default version of clang, e.g., v6 in Ubuntu 20.04:
Expand All @@ -75,7 +74,14 @@ Installing OpenFHE on Linux
.. note:: Note that cmake will check for any system dependencies that are needed for the build process.


4. The OpenFHE distribution includes some external libraries, such as ``GMP``. ``NTL`` and ``tcmalloc``. If you want to use any of these libraries, enable them when you run cmake to force them to build (see instructions on cmake options).
4. The OpenFHE distribution includes some external libraries, such as ``GMP``, ``NTL`` and ``tcmalloc``. If you want to use any of these libraries:
a) install ``autoconf``:

::

sudo apt-get install autoconf

b) enable them when you run cmake to force them to build (see instructions on cmake options).

5. Build OpenFHE by running the following command (this will take few minutes; using the ``-j <threads>`` command-line flag is suggested to speed up the build)

Expand Down Expand Up @@ -114,13 +120,3 @@ To remove the files built by make, you can execute
make clean

To change the compiler, e.g., from g++ to clang++, or completely remove any cmake/make build files, delete the "build" folder and recreate it.

Installing pre-requisites for doxygen
-------------------------------------

To generate doxygen documentation, doxygen and graphviz dot need to be installed:

::

sudo apt-get install doxygen
sudo apt-get install graphviz
14 changes: 10 additions & 4 deletions docs/sphinx_rsts/intro/installation/macos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ These instructions were tested in macOS Mojave but should also work for other re

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

2. Install pre-requisites ``cmake``, ``autoconf``, and ``OpenMP`` library using Homebrew:
2. Install pre-requisites ``cmake`` and ``OpenMP`` library using Homebrew:

::

brew install cmake
brew install autoconf
brew install libomp

3. Clone the repo.
Expand All @@ -40,7 +39,14 @@ Cmake will check for any system dependencies that are needed for the build proce

If you get an error about OMP asking to rerun cmake, just run "cmake .." once more.

5. The OpenFHE distribution includes some external libraries, such as GMP. NTL and tcmalloc. If you want to use any of these libraries, enable them when you run cmake to force them to build (see instructions on cmake options).
5. The OpenFHE distribution includes some external libraries, such as ``GMP``, ``NTL`` and ``tcmalloc``. If you want to use any of these libraries:
a) install ``autoconf`` using Homebrew:

::

brew install autoconf

b) enable them when you run cmake to force them to build (see instructions on cmake options)

6. Build OpenFHE by running the following command (this will take few minutes; using the ``-j #`` make command-line flag is suggested to speed up the build, where # is the number of cores on your machine).

Expand Down Expand Up @@ -76,4 +82,4 @@ To remove the files built by make, you can execute

::

make clean
make clean
20 changes: 9 additions & 11 deletions docs/sphinx_rsts/intro/installation/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ to update all packages (you may need to run it twice as it often fails the first

pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-cmake
pacman -S autoconf
pacman -S make
pacman -S git

Expand All @@ -32,7 +31,15 @@ to update all packages (you may need to run it twice as it often fails the first

Note that cmake will check for any system dependencies that are needed for the build process.

4. The OpenFHE distribution includes some external libraries, such as ``GMP`` and ``NTL``. If you want to use any of these libraries, enable them when you run cmake to force them to build (see instructions on cmake options).
4. The OpenFHE distribution includes some external libraries, such as ``GMP`` and ``NTL``. If you want to use any of these libraries:

a) install ``autoconf``:

::

pacman -S autoconf

b) enable them when you run cmake to force them to build (see instructions on cmake options).

5. Build OpenFHE by running the following command (this will take few minutes; using the ``-j <threads>`` make command-line flag is suggested to speed up the build where threads is typically the number of cores or threads on your machine)

Expand Down Expand Up @@ -87,12 +94,3 @@ To remove the files built by make, you can execute
::

make clean

Installing pre-requisites for doxygen
-------------------------------------
To generate doxygen documentation, doxygen and graphviz dot need to be installed:

::

pacman -S doxygen
pacman -S mingw-w64-x86_64-graphviz
4 changes: 4 additions & 0 deletions docs/sphinx_rsts/misc/contributors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ We gratefully acknowledge intellectual and software contributions to the library

* Daniele Micciancio (University of California San Diego, Duality Technologies)

* Rener Oliveira (BOCOM BBM Bank)

* Antonis Papadimitriou (Duality Technologies)

* Nishanth Pasham (New Jersey Institute of Technology)
Expand All @@ -67,6 +69,8 @@ We gratefully acknowledge intellectual and software contributions to the library

* Ian Quah (Duality Technologies)

* Bastiaan Quast (International Telecommunication Union)

* Saraswathy Ramanathapuram Vancheeswaran (Duality Technologies)

* Kurt Rohloff (Duality Technologies)
Expand Down
14 changes: 7 additions & 7 deletions docs/sphinx_rsts/misc/publications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ Homomorphic Encryption

- Liu, Z., Micciancio, D., and Polyakov, Y., “Large-Precision
Homomorphic Sign Evaluation using FHEW/TFHE Bootstrapping”,
[https://eprint.iacr.org/2021/1337].
ASIACRYPT 2022 [https://eprint.iacr.org/2021/1337].

- Kim, A., Papadimitriou, A., and Polyakov, Y., “Approximate
Homomorphic Encryption with Reduced Approximation Error”,
CT-RSA 2022 [https://eprint.iacr.org/2020/1118].

- Kim, A., Polyakov, Y., and Zucca, V., “Revisiting Homomorphic
Encryption Schemes for Finite Fields”, ASIACRYPT 2021
[https://eprint.iacr.org/2021/204].

- Kim, A., Papadimitriou, A., and Polyakov, Y., “Approximate
Homomorphic Encryption with Reduced Approximation Error”,
[https://eprint.iacr.org/2020/1118].

- Micciancio, D. and Polyakov, Y., “Bootstrapping in FHEW-like
Cryptosystems”, WAHC 2021 – 9th Workshop on Encrypted Computing &
Applied Homomorphic Cryptography [https://eprint.iacr.org/2020/086].

- Al Badawi, A., Polyakov, Y., Mi Mi Aung, K., Veeravalli, B., and
Rohloff, K., “Implementation and Performance Evaluation of RNS
Variants of the BFV Homomorphic Encryption Scheme”, IEEE Transactions
on Emerging Topics in Computing (IEEE TETC), to appear
on Emerging Topics in Computing (IEEE TETC), 2021, Vol. 9, No. 2., pp. 941-956
[https://eprint.iacr.org/2018/589].

- Blatt, M., Gusev, A., Polyakov, Y., Rohloff, K., and Vaikuntanathan,
V., “Optimized Homomorphic Encryption Solution for Secure Genome-Wide
Association Studies”, BMC Medical Genomics, to appear
Association Studies”, BMC Medical Genomics, 2020, Vol. 13, Suppl. 7, No. 83
[https://eprint.iacr.org/2019/223].

- Halevi, S., Polyakov, Y., and Shoup, V., “An Improved RNS Variant of
Expand Down
5 changes: 5 additions & 0 deletions docs/static_docs/Release_Notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
12/23/2022: OpenFHE 1.0.2 (stable) is released

* Fixes several compilation errors affecting selected environments
* Includes several documentation fixes

11/30/2022: OpenFHE 1.0.1 (stable) is released

* Fixed the serialization bug affecting DM/CGGI schemes (binfhe module)
Expand Down
2 changes: 1 addition & 1 deletion src/binfhe/include/binfhe-base-scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef struct {

/**
* @brief Ring GSW accumulator schemes described in
* https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/08
* https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/086
*/
class BinFHEScheme {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/binfhe/include/rgsw-acc-cggi.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace lbcrypto {

/**
* @brief Ring GSW accumulator schemes described in
* https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/08
* https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/086
*/
class RingGSWAccumulatorCGGI : public RingGSWAccumulator {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/binfhe/include/rgsw-acc-dm.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace lbcrypto {

/**
* @brief Ring GSW accumulator schemes described in
* https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/08
* https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/086
*/
class RingGSWAccumulatorDM : public RingGSWAccumulator {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/binfhe/include/rgsw-acc.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace lbcrypto {

/**
* @brief Ring GSW accumulator schemes described in
* https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/08
* https://eprint.iacr.org/2014/816 and https://eprint.iacr.org/2020/086
*/
class RingGSWAccumulator {
public:
Expand Down
Loading

0 comments on commit 83a5274

Please sign in to comment.