Skip to content

Commit 060d36d

Browse files
authored
Merge pull request #413 from helibproject/master
Public Dev Sync-7 December 2020
2 parents d50e701 + c2e0b88 commit 060d36d

File tree

22 files changed

+293
-258
lines changed

22 files changed

+293
-258
lines changed

CHANGES.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
HElib 1.3.1, December 2020
2+
=========================
3+
(tagged as v1.3.1)
4+
5+
* Refactoring of CKKS Mitigation
6+
* Re-instated `Ctxt` isCorrect
7+
* Ctxt Conjugation fix
8+
* Added GMP and NTL alternative download locations
9+
110
HElib 1.3.0, December 2020
211
=========================
312
(tagged as v1.3.0)
413

514
November-December 2020
615
---------------------
716
* Mitigation for the CKKS vulnerability recently [observed](https://eprint.iacr.org/2020/1533.pdf) by Li and Micciancio
8-
* Context Builder unsing builder pattern
17+
* Context Builder using builder pattern
918
* HElib now requires C++17
1019

1120
HElib 1.2.0, November 2020

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ endif ()
173173
if (PACKAGE_BUILD)
174174
# Setting up dependencies versions
175175
# GMP version to be used (and eventually downloaded) if PACKAGE_BUILD
176-
set(FETCHED_GMP_VERSION "6.2.0")
176+
set(FETCHED_GMP_VERSION "6.2.1")
177177
# NTL version to be used (and eventually downloaded) if PACKAGE_BUILD
178178
set(FETCHED_NTL_VERSION "11.4.3")
179179
# Setting up default compilation output directory

benchmarks/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ endif (NOT CMAKE_BUILD_TYPE)
4747
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
4848
"Debug" "RelWithDebInfo" "Release" "MinSizeRel")
4949

50-
find_package(helib 1.3.0 EXACT REQUIRED)
50+
find_package(helib 1.3.1 EXACT REQUIRED)
5151
find_package(benchmark REQUIRED)
5252

5353
# Targets are simply associated with their source files.

dependencies/gmp/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ ExternalProject_Add(
2626
gmp_fetched
2727
DEPENDS "setup_install_dir"
2828
URL "https://gmplib.org/download/gmp/gmp-${FETCHED_GMP_VERSION}.tar.bz2"
29+
"https://ftp.gnu.org/gnu/gmp/gmp-${FETCHED_GMP_VERSION}.tar.bz2"
2930
URL_HASH
3031
# NOTE: hash of version 6.2.0
31-
SHA256=f51c99cb114deb21a60075ffb494c1a210eb9d7cb729ed042ddb7de9534451ea
32+
SHA256=eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c
3233
DOWNLOAD_NO_PROGRESS 1
3334
UPDATE_COMMAND ""
3435
CONFIGURE_COMMAND

dependencies/ntl/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ set(fetched_ntl_includedir
5959
ExternalProject_Add(
6060
ntl_fetched
6161
DEPENDS "${ntl_superbuild_dependencies}"
62-
URL "https://www.shoup.net/ntl/ntl-${FETCHED_NTL_VERSION}.tar.gz"
62+
URL "https://libntl.org/ntl-${FETCHED_NTL_VERSION}.tar.gz"
63+
"https://www.shoup.net/ntl/ntl-${FETCHED_NTL_VERSION}.tar.gz"
6364
URL_HASH
6465
# NOTE: hash of version 11.4.3
6566
SHA256=b7c1ccdc64840e6a24351eb4a1e68887d29974f03073a1941c906562c0b83ad2

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
3131
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
3232
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
3333

34-
find_package(helib 1.3.0 EXACT REQUIRED)
34+
find_package(helib 1.3.1 EXACT REQUIRED)
3535

3636
add_subdirectory(BGV_binary_arithmetic)
3737
add_subdirectory(BGV_country_db_lookup)

include/helib/Ctxt.h

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,22 +1184,8 @@ class Ctxt
11841184
return true;
11851185
}
11861186

1187-
#if 0
1188-
// VJS-NOTE: this is incorrectly defined, so I took it out
1189-
// for now. It is currently only used in a nonessential
1190-
// way in Test_extractDigits.cpp and GTestExtractDigits.cpp,
1191-
// and I commented out those usages.
1192-
// For a correct implementation that takes into account
1193-
// both the total noise bound and the relation between
1194-
// relevant norms, see the code in SecKey::Decrypt.
1195-
11961187
//! @brief Would this ciphertext be decrypted without errors?
1197-
bool isCorrect() const
1198-
{
1199-
NTL::ZZ q = context.productOfPrimes(primeSet);
1200-
return NTL::to_xdouble(q) > noiseBound * 2;
1201-
}
1202-
#endif
1188+
bool isCorrect() const;
12031189

12041190
const Context& getContext() const { return context; }
12051191
const PubKey& getPubKey() const { return pubKey; }
@@ -1252,7 +1238,9 @@ class Ctxt
12521238
// plaintext leakage attacks, as in the paper
12531239
// "On the Security of Homomorphic Encryption on Approximate Numbers",
12541240
// by Li and Micciancio.
1255-
void addNoiseForCKKSDecryption(const SecKey& sk, double eps);
1241+
void addedNoiseForCKKSDecryption(const SecKey& sk,
1242+
double eps,
1243+
NTL::ZZX& noise) const;
12561244
};
12571245

12581246
// set out=prod_{i=0}^{n-1} v[j], takes depth log n and n-1 products
@@ -1298,6 +1286,27 @@ inline Ctxt innerProduct(const std::vector<Ctxt>& v1,
12981286
return ret;
12991287
}
13001288

1289+
//! frobeniusAutomorph: free function version of frobeniusAutomorph method
1290+
inline void frobeniusAutomorph(Ctxt& ctxt, long j)
1291+
{
1292+
ctxt.frobeniusAutomorph(j);
1293+
}
1294+
1295+
//! conjugate: free function that is equivalent to frobeniusAutomorph(ctxt, 1)
1296+
inline void conjugate(Ctxt& ctxt) { frobeniusAutomorph(ctxt, 1); }
1297+
1298+
//! Free functions to extract real and imaginary parts.
1299+
//! Unlike the corresponding Ctxt method, extractImPart is thread safe.
1300+
//! NOTES: (1) these will raise an error for BGV ciphertexts.
1301+
void extractRealPart(Ctxt& c);
1302+
void extractImPart(Ctxt& c);
1303+
1304+
//! power: free function version of power method
1305+
inline void power(Ctxt& ctxt, long e) { ctxt.power(e); }
1306+
1307+
//! negate: free function version of negate method
1308+
inline void negate(Ctxt& ctxt) { ctxt.negate(); }
1309+
13011310
//! print to cerr some info about ciphertext
13021311
void CheckCtxt(const Ctxt& c, const char* label);
13031312

include/helib/EncryptedArray.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,6 +2116,9 @@ void frobeniusAutomorph(const EncryptedArray& ea,
21162116
PlaintextArray& pa,
21172117
const NTL::Vec<long>& vec);
21182118

2119+
void extractRealPart(const EncryptedArray& ea, PlaintextArray& pa);
2120+
void extractImPart(const EncryptedArray& ea, PlaintextArray& pa);
2121+
21192122
void applyPerm(const EncryptedArray& ea,
21202123
PlaintextArray& pa,
21212124
const NTL::Vec<long>& pi);
@@ -2442,6 +2445,12 @@ inline void frobeniusAutomorph(PtxtArray& a, const NTL::Vec<long>& vec)
24422445
frobeniusAutomorph(a.ea, a.pa, vec);
24432446
}
24442447

2448+
inline void conjugate(PtxtArray& a) { frobeniusAutomorph(a, 1); }
2449+
2450+
inline void extractRealPart(PtxtArray& a) { extractRealPart(a.ea, a.pa); }
2451+
2452+
inline void extractImPart(PtxtArray& a) { extractImPart(a.ea, a.pa); }
2453+
24452454
inline void applyPerm(PtxtArray& a, const NTL::Vec<long>& pi)
24462455
{
24472456
applyPerm(a.ea, a.pa, pi);

misc/psi/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1313

14-
## Use -std=c++14 as default.
14+
## Use -std=c++17 as default.
1515
set(CMAKE_CXX_STANDARD 17)
1616
## Disable C++ extensions
1717
set(CMAKE_CXX_EXTENSIONS OFF)
@@ -31,7 +31,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
3131
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
3232
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
3333

34-
find_package(helib 1.3.0 EXACT REQUIRED)
34+
find_package(helib 1.3.1 EXACT REQUIRED)
3535

3636
add_subdirectory(scoring)
3737
add_subdirectory(lookup)

misc/psi/lookup/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1313

14-
## Use -std=c++14 as default.
15-
set(CMAKE_CXX_STANDARD 14)
14+
## Use -std=c++17 as default.
15+
set(CMAKE_CXX_STANDARD 17)
1616
## Disable C++ extensions
1717
set(CMAKE_CXX_EXTENSIONS OFF)
1818
## Require full C++ standard
1919
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2020

2121
project(lookup LANGUAGES CXX)
2222

23-
find_package(helib 1.1.0 EXACT REQUIRED)
23+
find_package(helib 1.3.1 EXACT REQUIRED)
2424

2525
add_executable(lookup lookup.cpp)
2626

0 commit comments

Comments
 (0)