Skip to content

Commit aa8a86e

Browse files
authored
Merge pull request #1044 from openfheorg/dev
Updates to v1.4
2 parents 3236208 + d6eda50 commit aa8a86e

116 files changed

Lines changed: 7797 additions & 3986 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.User.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.5.1)
1+
cmake_minimum_required(VERSION 3.16.3)
22

33
### To use gcc/g++ on a Macintosh, you must set the Compilers
44
### here, not inside the project

CMakeLists.txt

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
## An option has the value of ON or OFF
99
## See below for the list of options
1010

11-
cmake_minimum_required(VERSION 3.5.1)
11+
cmake_minimum_required(VERSION 3.16.3)
1212

1313
find_program(CCACHE_PROGRAM ccache)
1414
if(CCACHE_PROGRAM)
@@ -26,8 +26,8 @@ endif()
2626
project (OpenFHE C CXX)
2727

2828
set(OPENFHE_VERSION_MAJOR 1)
29-
set(OPENFHE_VERSION_MINOR 3)
30-
set(OPENFHE_VERSION_PATCH 1)
29+
set(OPENFHE_VERSION_MINOR 4)
30+
set(OPENFHE_VERSION_PATCH 0)
3131
set(OPENFHE_VERSION ${OPENFHE_VERSION_MAJOR}.${OPENFHE_VERSION_MINOR}.${OPENFHE_VERSION_PATCH})
3232

3333
set(CMAKE_CXX_STANDARD 17)
@@ -147,24 +147,41 @@ if("${isSystemDir}" STREQUAL "-1")
147147
endif("${isSystemDir}" STREQUAL "-1")
148148

149149
# Compiler flags
150+
set(C_COMPILE_FLAGS "-Wall -Werror -DOPENFHE_VERSION=${OPENFHE_VERSION}")
151+
set(CXX_COMPILE_FLAGS "-Wall -Werror -DOPENFHE_VERSION=${OPENFHE_VERSION}")
152+
if(WITH_NATIVEOPT)
153+
string(APPEND C_COMPILE_FLAGS " -march=native")
154+
string(APPEND CXX_COMPILE_FLAGS " -march=native")
155+
endif()
150156

151-
# Added -Wno-parentheses for compatibility with g++
152-
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
157+
set(IGNORE_WARNINGS "") # initialize IGNORE_WARNINGS
158+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
159+
# Add -Wno-parentheses for compatibility with g++
153160
set (IGNORE_WARNINGS "-Wno-parentheses")
154161
# we can use GNU built-in functions provided by GCC for debugging. ex: __builtin_LINE (), __builtin_FUNCTION (), __builtin_FILE ()
155162
add_definitions(-DBUILTIN_INFO_AVAILABLE)
156163
message(STATUS "BUILTIN_INFO_AVAILABLE is defined")
164+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
165+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
166+
set(IGNORE_WARNINGS "-Wno-unused-private-field -Wno-shift-op-parentheses")
167+
endif()
168+
endif()
169+
if(IGNORE_WARNINGS)
170+
# for C++ only
171+
string(APPEND CXX_COMPILE_FLAGS " ${IGNORE_WARNINGS}")
157172
endif()
158173

159-
if(WITH_NATIVEOPT)
160-
set(NATIVE_OPT "-march=native")
174+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
175+
set(CMAKE_C_FLAGS_RELEASE "-O0 -DNDEBUG")
176+
set(CMAKE_CXX_FLAGS_RELEASE "-O0 -DNDEBUG")
177+
178+
set(C_COMPILE_FLAGS "${C_COMPILE_FLAGS} -O0 -g")
179+
set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -O0 -g")
161180
else()
162-
set(NATIVE_OPT "")
181+
set(C_COMPILE_FLAGS "${C_COMPILE_FLAGS} -O3")
182+
set(CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -O3")
163183
endif()
164184

165-
set(C_COMPILE_FLAGS "-Wall -Werror -O3 ${NATIVE_OPT} -DOPENFHE_VERSION=${OPENFHE_VERSION}")
166-
set(CXX_COMPILE_FLAGS "-Wall -Werror -O3 ${NATIVE_OPT} -DOPENFHE_VERSION=${OPENFHE_VERSION} ${IGNORE_WARNINGS}")
167-
168185
if(EMSCRIPTEN)
169186
set(EMSCRIPTEN_IGNORE_WARNINGS "-Wno-unused-but-set-variable -Wno-unknown-warning-option")
170187
set(C_COMPILE_FLAGS "${C_COMPILE_FLAGS} ${EMSCRIPTEN_IGNORE_WARNINGS}")
@@ -677,9 +694,26 @@ add_subdirectory(src/pke)
677694
add_subdirectory(src/binfhe)
678695

679696
### build the google test handlers
680-
###if(BUILD_UNITTESTS)
681-
### add_subdirectory(third-party/google-test EXCLUDE_FROM_ALL)
682-
###endif()
697+
if(BUILD_UNITTESTS)
698+
add_subdirectory(third-party/google-test EXCLUDE_FROM_ALL)
699+
##############################################################################################################
700+
### Handle third-party/google-test/googletest's uninitialized variable dummy. Remove
701+
### add_compile_options(-Wno-error=maybe-uninitialized)
702+
### once googletest has been updated to v1.11.0 or later.
703+
##############################################################################################################
704+
### 1. This applies to gtest only
705+
### 2. Build does not fail because of "uninitialized error"
706+
### 3. We still see a warning if the variable is truly uninitialized
707+
### 4. All other warnings still remain errors
708+
##############################################################################################################
709+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
710+
target_compile_options(gtest PRIVATE -Wno-error=maybe-uninitialized)
711+
target_compile_options(gtest_main PRIVATE -Wno-error=maybe-uninitialized)
712+
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
713+
target_compile_options(gtest PRIVATE -Wno-uninitialized)
714+
target_compile_options(gtest_main PRIVATE -Wno-uninitialized)
715+
endif()
716+
endif()
683717

684718
### build the google benchmark handlers (just the parts we need)
685719
if(BUILD_BENCHMARKS)

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ OpenFHE is an open-source FHE library that includes efficient implementations of
88
* Cheon-Kim-Kim-Song (CKKS) scheme for real-number arithmetic (includes approximate bootstrapping)
99
* Ducas-Micciancio (DM/FHEW), Chillotti-Gama-Georgieva-Izabachene (CGGI/TFHE), and Lee-Micciancio-Kim-Choi-Deryabin-Eom-Yoo (LMKCDEY) schemes for evaluating Boolean circuits and arbitrary functions over larger plaintext spaces using lookup tables
1010

11+
OpenFHE also supports hybrid vectorized schemes, with the goal of enabling the FHEW/TFHE-like functional bootstrapping capability for schemes such as CKKS and BFV. In particular, OpenFHE supports
12+
* Switching between CKKS and FHEW/TFHE to evaluate non-smooth functions, e.g., comparison, using (scalar) FHEW/TFHE functional bootstrapping
13+
* Switching between RLWE (a scheme equivalent to the coefficient-encoded additive BFV scheme) and CKKS to evaluate arbitrary lookup tables over vectors of integers, e.g., modular reduction, comparison or S-box, using vectorized functional bootstrapping implemented in CKKS
14+
1115
OpenFHE also includes the following multiparty extensions of FHE:
1216
* Threshold FHE for BGV, BFV, and CKKS schemes
1317
* Interactive bootstrapping for Threshold CKKS
1418
* Proxy Re-Encryption for BGV, BFV, and CKKS schemes
1519

16-
OpenFHE also supports switching between CKKS and FHEW/TFHE to evaluate non-smooth functions, e.g., comparison, using FHEW/TFHE functional bootstrapping.
17-
1820
OpenFHE supports any GNU C++ compiler version 9 or above and clang C++ compiler version 10 or above. To achieve the best runtime performance, we recommend following the
1921
guidelines outlined in [building OpenFHE for best performance](https://github.com/openfheorg/openfhe-development/blob/main/docs/static_docs/Best_Performance.md).
2022

@@ -76,6 +78,8 @@ To get familiar with the main API of OpenFHE, we recommend looking at the code o
7678
4. [Small-Precison Arbitrary Function Evaluation](src/binfhe/examples/eval-function.cpp)
7779
1. Scheme Switching:
7880
1. [Examples with Scheme Switching between CKKS and FHEW/TFHE](src/pke/examples/scheme-switching.cpp)
81+
1. Functional Bootstrapping over integers (RLWE and CKKS):
82+
1. [Examples with Functional Bootstrapping using CKKS for lookup table evaluation, sign extraction and multivalue bootstrapping](src/pke/examples/functional-bootstrapping-ckks.cpp)
7983
1. Threshold FHE:
8084
1. [Code Example for BGV, BFV, and CKKS](src/pke/examples/threshold-fhe.cpp)
8185
1. [2-party Interactive Bootstrapping Examples](src/pke/examples/interactive-bootstrapping.cpp)

benchmark/src/Lattice.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static void BM_add_LATTICE(benchmark::State& state) {
242242
E a;
243243
E b;
244244

245-
if (state.thread_index == 0) {
245+
if (state.thread_index() == 0) {
246246
a = TestParameters.GetPoly<E>(state.range(0), 0);
247247
b = TestParameters.GetPoly<E>(state.range(0), 1);
248248
}
@@ -262,7 +262,7 @@ static void BM_addeq_LATTICE(benchmark::State& state) {
262262
E a;
263263
E b;
264264

265-
if (state.thread_index == 0) {
265+
if (state.thread_index() == 0) {
266266
b = TestParameters.GetPoly<E>(state.range(0), 1);
267267
a = TestParameters.GetPoly<E>(state.range(0), 0);
268268
}
@@ -282,7 +282,7 @@ template <class E>
282282
static void BM_mult_LATTICE(benchmark::State& state) {
283283
E a, b;
284284

285-
if (state.thread_index == 0) {
285+
if (state.thread_index() == 0) {
286286
a = TestParameters.GetPoly<E>(state.range(0), 0);
287287
b = TestParameters.GetPoly<E>(state.range(0), 1);
288288
}
@@ -301,7 +301,7 @@ template <class E>
301301
static void BM_multeq_LATTICE(benchmark::State& state) {
302302
E a, b;
303303

304-
if (state.thread_index == 0) {
304+
if (state.thread_index() == 0) {
305305
b = TestParameters.GetPoly<E>(state.range(0), 1);
306306
a = TestParameters.GetPoly<E>(state.range(0), 0);
307307
}

docs/index.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ OpenFHE is an open-source FHE library that includes efficient implementations of
99
- Brakerski/Fan-Vercauteren (BFV) scheme for integer arithmetic
1010
- Brakerski-Gentry-Vaikuntanathan (BGV) scheme for integer arithmetic
1111
- Cheon-Kim-Kim-Song (CKKS) scheme for real-number arithmetic (includes approximate bootstrapping)
12-
- Ducas-Micciancio (DM/FHEW) and Chillotti-Gama-Georgieva-Izabachene (CGGI/TFHE), and Lee-Micciancio-Kim-Choi-Deryabin-Eom-Yoo (LMKCDEY) schemes for evaluating Boolean circuits and arbitrary functions over larger plaintext spaces using lookup tables
12+
- Ducas-Micciancio (DM/FHEW), Chillotti-Gama-Georgieva-Izabachene (CGGI/TFHE), and Lee-Micciancio-Kim-Choi-Deryabin-Eom-Yoo (LMKCDEY) schemes for evaluating Boolean circuits and arbitrary functions over larger plaintext spaces using lookup tables
13+
14+
OpenFHE also supports hybrid vectorized schemes, with the goal of enabling the FHEW/TFHE-like functional bootstrapping capability for schemes such as CKKS and BFV. In particular, OpenFHE supports
15+
- Switching between CKKS and FHEW/TFHE to evaluate non-smooth functions, e.g., comparison, using (scalar) FHEW/TFHE functional bootstrapping
16+
- Switching between RLWE (a scheme equivalent to the coefficient-encoded additive BFV scheme) and CKKS to evaluate arbitrary lookup tables over vectors of integers, e.g., modular reduction, comparison or S-box, using vectorized functional bootstrapping implemented in CKKS
1317

1418
OpenFHE also includes the following multiparty extensions of FHE:
1519
- Threshold FHE for BGV, BFV, and CKKS schemes
20+
- Interactive bootstrapping for Threshold CKKS
1621
- Proxy Re-Encryption for BGV, BFV, and CKKS schemes
1722

18-
OpenFHE also supports switching between CKKS and FHEW/TFHE to evaluate non-smooth functions, e.g., comparison, using FHEW/TFHE functional bootstrapping.
19-
2023
OpenFHE supports any GNU C++ compiler version 9 or above and clang C++ compiler version 10 or above.
2124

2225
A major focus is on the usability of the schemes. For instance, all HE schemes with packing use the same common API, and are implemented using runtime polymorphism.

docs/sphinx_rsts/modules/pke/pke_keys.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ Key Class File Listings
3939

4040
- Get and set relinearization elements
4141

42-
- Get and set key switches for ``BinDCRT`` and ``DCRT``
43-
4442
- Inherits from ``Eval Key``
4543

4644
`Key (key.h) <https://github.com/openfheorg/openfhe-development/blob/main/src/pke/include/key/key.h>`_

docs/static_docs/Release_Notes.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
08/18/2025: OpenFHE 1.4.0 (development) is released
2+
3+
* Adds general functional bootstrapping using CKKS proposed in https://eprint.iacr.org/2024/1623 (#954)
4+
* Enables the sparse-secret encapsulation mode from https://eprint.iacr.org/2022/024 for regular and functional CKKS bootstrapping (#1001)
5+
* Adds optimized implementation (without checks) for selected homomorphic addition and multiplication operations (#991)
6+
* Updates google submodules (#1036)
7+
* Fixes several bugs
8+
9+
The detailed list of changes is available at https://github.com/openfheorg/openfhe-development/issues?q=is%3Aissue+milestone%3A%22Release+1.4.0%22
10+
111
07/11/2025: OpenFHE 1.3.1 (stable) is released
212

313
* Updates the noise estimation models for BGV and BFV, making them slightly more conservative (roughly 1 extra bit is added for each multiplicative level) (#1004)

src/binfhe/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ if(BUILD_UNITTESTS)
5454
file(GLOB BINFHE_TEST_SRC_FILES CONFIGURE_DEPENDS unittest/*.cpp)
5555
add_executable(binfhe_tests ${BINFHE_TEST_SRC_FILES} ${UNITTESTMAIN})
5656
set_property(TARGET binfhe_tests PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/unittest)
57+
target_link_libraries(binfhe_tests PRIVATE gtest gtest_main)
5758
target_link_libraries(binfhe_tests ${BINFHELIBS} ${ADDITIONAL_LIBS})
5859
if(NOT ${WITH_OPENMP} AND NOT EMSCRIPTEN)
5960
target_link_libraries(binfhe_tests PRIVATE Threads::Threads)

src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ if(BUILD_UNITTESTS)
5959
set(CORE_TEST_SRC_FILES ${CORE_TEST_SRC_FILES})
6060
add_executable(core_tests ${CORE_TEST_SRC_FILES} ${UNITTESTMAIN})
6161
set_property(TARGET core_tests PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/unittest)
62+
target_link_libraries(core_tests PRIVATE gtest gtest_main)
6263
target_link_libraries(core_tests ${CORELIBS} ${ADDITIONAL_LIBS})
6364
if(NOT ${WITH_OPENMP} AND NOT EMSCRIPTEN)
6465
target_link_libraries(core_tests PRIVATE Threads::Threads)

src/core/include/lattice/constants-lattice.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,27 @@
3232
#ifndef _CONSTANTS_LATTICE_H_
3333
#define _CONSTANTS_LATTICE_H_
3434

35+
#include <cstdint>
3536
#include <iosfwd>
3637
#include <string>
37-
#include <cstdint>
3838

3939
namespace lbcrypto {
4040

4141
/**
4242
* @brief Lists all modes for RLWE schemes, such as BGV and BFV, and for LWE schemes, such as DM and TFHE
4343
*/
4444
enum SecretKeyDist {
45-
GAUSSIAN = 0,
46-
UNIFORM_TERNARY = 1, // Default value, all schemes support this key distribution
47-
SPARSE_TERNARY = 2,
48-
// BINARY = 3, // Future implementation
45+
GAUSSIAN = 0,
46+
UNIFORM_TERNARY = 1, // Default value, all schemes support this key distribution
47+
SPARSE_TERNARY = 2,
48+
SPARSE_ENCAPSULATED = 3, // For more effient bootstrapping in SIMD schemes
49+
// (has been used for CKKS and BFV bootstrapping in literature)
50+
// BINARY = X, // Future implementation
4951
};
52+
5053
SecretKeyDist convertToSecretKeyDist(const std::string& str);
5154
SecretKeyDist convertToSecretKeyDist(uint32_t num);
55+
5256
std::ostream& operator<<(std::ostream& s, SecretKeyDist m);
5357

5458
} // namespace lbcrypto

0 commit comments

Comments
 (0)