Skip to content

Commit

Permalink
Rename all files related to cryptocontext generation (#524)
Browse files Browse the repository at this point in the history
* Renamed files to generate cryptocontext for CKKS

* Renamed files with code generating cryptocontext for BGV

* Renamed files with code generating cryptocontext for BFV

* Renamed files with code with params to generate cryptocontext

---------

Co-authored-by: Dmitriy Suponitskiy <dsuponitskiy@dualitytech.com>
  • Loading branch information
dsuponitskiy and dsuponitskiy-duality authored Sep 22, 2023
1 parent fb43185 commit 367e397
Show file tree
Hide file tree
Showing 30 changed files with 64 additions and 74 deletions.
2 changes: 1 addition & 1 deletion benchmark/src/bfv-mult-method-benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#define PROFILE
#define _USE_MATH_DEFINES
#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "gen-cryptocontext.h"

#include "benchmark/benchmark.h"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/compare-bfv-hps-leveled-vs-behz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#define PROFILE
#define _USE_MATH_DEFINES
#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "gen-cryptocontext.h"

#include "benchmark/benchmark.h"
Expand Down
4 changes: 2 additions & 2 deletions benchmark/src/compare-bfvrns-vs-bgvrns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

#define PROFILE
#define _USE_MATH_DEFINES
#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bgvrns/cryptocontext-bgvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "scheme/bgvrns/gen-cryptocontext-bgvrns.h"
#include "gen-cryptocontext.h"

#include "benchmark/benchmark.h"
Expand Down
6 changes: 3 additions & 3 deletions benchmark/src/lib-benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

#define PROFILE
#define _USE_MATH_DEFINES
#include "scheme/ckksrns/cryptocontext-ckksrns.h"
#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bgvrns/cryptocontext-bgvrns.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "scheme/bgvrns/gen-cryptocontext-bgvrns.h"
#include "gen-cryptocontext.h"

#include "benchmark/benchmark.h"
Expand Down
6 changes: 3 additions & 3 deletions benchmark/src/mult-vs-square.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
* using EvalMult and EvalSquare operations.
*/

#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bgvrns/cryptocontext-bgvrns.h"
#include "scheme/ckksrns/cryptocontext-ckksrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "scheme/bgvrns/gen-cryptocontext-bgvrns.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns.h"
#include "gen-cryptocontext.h"

#include "benchmark/benchmark.h"
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/serialize-ckks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "cryptocontext-ser.h"
#include "ciphertext-ser.h"
#include "scheme/ckksrns/ckksrns-ser.h"
#include "scheme/ckksrns/cryptocontext-ckksrns.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns.h"
#include "gen-cryptocontext.h"

using namespace lbcrypto;
Expand Down
2 changes: 1 addition & 1 deletion src/pke/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Now your code should look like this:
## Description of the CryptoContext parameters
Choosing the CryptoContext parameters is important for obtaining the best performance for your encrypted application, while maintaining the desired level of security. We strongly recommend that you specify the security level and have OpenFHE automatically select the other parameters, unless you are an expert in homomorphic encryption. If you would like to modify the parameters to understand how they affect noise growth and performance, we provide descriptions below.

The default values for all the parameters can be found in [cryptocontextparams-defaults.h](../include/scheme/cryptocontextparams-defaults.h)
The default values for all the parameters can be found in [gen-cryptocontext-params-defaults.h](../include/scheme/gen-cryptocontext-params-defaults.h)

**PlaintextModulus ptModulus** - plaintext modulus(for BGV/BFV), which impacts noise growth

Expand Down
6 changes: 3 additions & 3 deletions src/pke/include/openfhe.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
#include "scheme/ckksrns/ckksrns-scheme.h"

#include "gen-cryptocontext.h"
#include "scheme/ckksrns/cryptocontext-ckksrns.h"
#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bgvrns/cryptocontext-bgvrns.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "scheme/bgvrns/gen-cryptocontext-bgvrns.h"

#endif /* SRC_LIB_OPENFHE_H_ */
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
Parameter class to generate BFVRNS crypto context
*/

#ifndef _CRYPTOCONTEXTPARAMS_BFVRNS_H_
#define _CRYPTOCONTEXTPARAMS_BFVRNS_H_
#ifndef __GEN_CRYPTOCONTEXT_BFVRNS_PARAMS_H__
#define __GEN_CRYPTOCONTEXT_BFVRNS_PARAMS_H__

#include "scheme/cryptocontextparams-base.h"
#include "scheme/gen-cryptocontext-params.h"

#include <string>
#include <vector>
Expand All @@ -63,4 +63,4 @@ class CCParams<CryptoContextBFVRNS> : public Params {

} // namespace lbcrypto

#endif // _CRYPTOCONTEXTPARAMS_BFVRNS_H_
#endif // __GEN_CRYPTOCONTEXT_BFVRNS_PARAMS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
* API to generate BFVRNS crypto context
*/

#ifndef _CRYPTOCONTEXT_BFVRNS_H_
#define _CRYPTOCONTEXT_BFVRNS_H_
#ifndef __GEN_CRYPTOCONTEXT_BFVRNS_H__
#define __GEN_CRYPTOCONTEXT_BFVRNS_H__

#include "scheme/bfvrns/gen-cryptocontext-bfvrns-internal.h"
#include "scheme/bfvrns/cryptocontextparams-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns-params.h"
#include "scheme/bfvrns/bfvrns-scheme.h"
#include "scheme/bfvrns/bfvrns-cryptoparameters.h"
#include "cryptocontext-fwd.h"
Expand All @@ -64,4 +64,4 @@ class CryptoContextBFVRNS {

} // namespace lbcrypto

#endif // _CRYPTOCONTEXT_BFVRNS_H_
#endif // __GEN_CRYPTOCONTEXT_BFVRNS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
Parameter class to generate BGVRNS crypto context
*/

#ifndef _CRYPTOCONTEXTPARAMS_BGVRNS_H_
#define _CRYPTOCONTEXTPARAMS_BGVRNS_H_
#ifndef __GEN_CRYPTOCONTEXT_BGVRNS_PARAMS_H__
#define __GEN_CRYPTOCONTEXT_BGVRNS_PARAMS_H__

#include "scheme/cryptocontextparams-base.h"
#include "scheme/gen-cryptocontext-params.h"

#include <string>
#include <vector>
Expand All @@ -63,4 +63,4 @@ class CCParams<CryptoContextBGVRNS> : public Params {

} // namespace lbcrypto

#endif // _CRYPTOCONTEXTPARAMS_BGVRNS_H_
#endif // __GEN_CRYPTOCONTEXT_BGVRNS_PARAMS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
API to generate BGV crypto context
*/

#ifndef _CRYPTOCONTEXT_BGVRNS_H_
#define _CRYPTOCONTEXT_BGVRNS_H_
#ifndef __GEN_CRYPTOCONTEXT_BGVRNS_H__
#define __GEN_CRYPTOCONTEXT_BGVRNS_H__

#include "scheme/bgvrns/gen-cryptocontext-bgvrns-internal.h"
#include "scheme/bgvrns/cryptocontextparams-bgvrns.h"
#include "scheme/bgvrns/gen-cryptocontext-bgvrns-params.h"
#include "scheme/bgvrns/bgvrns-scheme.h"
#include "scheme/bgvrns/bgvrns-cryptoparameters.h"
#include "cryptocontext-fwd.h"
Expand All @@ -64,4 +64,4 @@ class CryptoContextBGVRNS {

} // namespace lbcrypto

#endif // _CRYPTOCONTEXT_BGVRNS_H_
#endif // __GEN_CRYPTOCONTEXT_BGVRNS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
Parameter class to generate CKKSRNS crypto context
*/

#ifndef _CRYPTOCONTEXTPARAMS_CKKSRNS_H_
#define _CRYPTOCONTEXTPARAMS_CKKSRNS_H_
#ifndef __GEN_CRYPTOCONTEXT_CKKSRNS_PARAMS_H__
#define __GEN_CRYPTOCONTEXT_CKKSRNS_PARAMS_H__

#include "scheme/cryptocontextparams-base.h"
#include "scheme/gen-cryptocontext-params.h"

#include <string>
#include <vector>
Expand All @@ -63,4 +63,4 @@ class CCParams<CryptoContextCKKSRNS> : public Params {

} // namespace lbcrypto

#endif // _CRYPTOCONTEXTPARAMS_CKKSRNS_H_
#endif // __GEN_CRYPTOCONTEXT_CKKSRNS_PARAMS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
API to generate CKKSRNS crypto context
*/

#ifndef _CRYPTOCONTEXT_CKKSRNS_H_
#define _CRYPTOCONTEXT_CKKSRNS_H_
#ifndef __GEN_CRYPTOCONTEXT_CKKSRNS_H__
#define __GEN_CRYPTOCONTEXT_CKKSRNS_H__

#include "lattice/lat-hal.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns-internal.h"
#include "scheme/ckksrns/cryptocontextparams-ckksrns.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns-params.h"
#include "scheme/ckksrns/ckksrns-cryptoparameters.h"
#include "scheme/ckksrns/ckksrns-scheme.h"
#include "cryptocontextfactory.h"
Expand All @@ -61,4 +61,4 @@ class CryptoContextCKKSRNS {

} // namespace lbcrypto

#endif // _CRYPTOCONTEXT_CKKSRNS_H_
#endif // __GEN_CRYPTOCONTEXT_CKKSRNS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
Collection of parameter default values for different schemes
*/

#ifndef _CRYPTOCONTEXTPARAMS_DEFAULTS_H_
#define _CRYPTOCONTEXTPARAMS_DEFAULTS_H_
#ifndef __GEN_CRYPTOCONTEXT_PARAMS_DEFAULTS_H__
#define __GEN_CRYPTOCONTEXT_PARAMS_DEFAULTS_H__

#include "lattice/stdlatticeparms.h" // SecurityLevel
#include "scheme/scheme-id.h" // SCHEME
Expand Down Expand Up @@ -161,4 +161,4 @@ constexpr COMPRESSION_LEVEL interactiveBootCompressionLevel = SLACK;

} // namespace lbcrypto

#endif // _CRYPTOCONTEXTPARAMS_DEFAULTS_H_
#endif // __GEN_CRYPTOCONTEXT_PARAMS_DEFAULTS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
Scheme parameter default class
*/

#ifndef _CRYPTOCONTEXTPARAMS_BASE_H_
#define _CRYPTOCONTEXTPARAMS_BASE_H_
#ifndef __GEN_CRYPTOCONTEXT_PARAMS_H__
#define __GEN_CRYPTOCONTEXT_PARAMS_H__

// Had to include cryptocontext.h as the includes below give a compiler error.
// Those headers probably depend on some order/sequence.
Expand Down Expand Up @@ -426,4 +426,4 @@ class Params {

} // namespace lbcrypto

#endif // _CRYPTOCONTEXTPARAMS_BASE_H_
#endif // __GEN_CRYPTOCONTEXT_PARAMS_H__
9 changes: 1 addition & 8 deletions src/pke/lib/scheme/ckksrns/ckksrns-schemeswitching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,8 @@

#include "cryptocontext.h"
#include "gen-cryptocontext.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns.h"

#include "scheme/ckksrns/ckksrns-cryptoparameters.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns-internal.h"
#include "scheme/ckksrns/cryptocontext-ckksrns.h"
#include "scheme/ckksrns/cryptocontextparams-ckksrns.h"

#include "scheme/ckksrns/ckksrns-scheme.h"
#include "cryptocontextfactory.h"
#include "schemebase/base-scheme.h"
#include "math/dftransform.h"

namespace lbcrypto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
Definitions for scheme parameter default class
*/

#include "scheme/cryptocontextparams-base.h"
#include "scheme/cryptocontextparams-defaults.h"
#include "scheme/gen-cryptocontext-params.h"
#include "scheme/gen-cryptocontext-params-defaults.h"
#include "utils/exception.h"

#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/UnitTestEvalMultMany.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==================================================================================

#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "gen-cryptocontext.h"

#include <fstream>
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/UnitTestMultihopPRE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
unit tests for Proxy Re-Encryption. Demo software for multiparty proxy reencryption operations for various schemes
*/

#include "scheme/bgvrns/cryptocontext-bgvrns.h"
#include "scheme/bgvrns/gen-cryptocontext-bgvrns.h"
#include "gen-cryptocontext.h"

#include "include/gtest/gtest.h"
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/utbfvrns/UnitTestBFVrnsAutomorphism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==================================================================================

#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "gen-cryptocontext.h"

#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/utbfvrns/UnitTestBFVrnsCRTOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==================================================================================

#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "gen-cryptocontext.h"

#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/utbfvrns/UnitTestBFVrnsDecrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==================================================================================

#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "gen-cryptocontext.h"

#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/utbfvrns/UnitTestBFVrnsInnerProduct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==================================================================================

#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "gen-cryptocontext.h"

#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/utbfvrns/UnitTestBFVrnsSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "gtest/gtest.h"

#include "scheme/bfvrns/bfvrns-ser.h"
#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "gen-cryptocontext.h"

using namespace lbcrypto;
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/utckksrns/UnitTestCKKSrnsInnerProduct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//==================================================================================

#include "scheme/ckksrns/cryptocontext-ckksrns.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns.h"
#include "gen-cryptocontext.h"

#include <vector>
Expand Down
3 changes: 0 additions & 3 deletions src/pke/unittest/utckksrns/UnitTestNoiseFlooding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@
Unit tests for the CKKS scheme
*/

#include "openfhe.h"
#include "UnitTestUtils.h"
#include "UnitTestCCParams.h"
#include "UnitTestCryptoContext.h"
#include "utils/demangle.h"
#include "scheme/ckksrns/ckksrns-utils.h"
#include "scheme/ckksrns/cryptocontext-ckksrns.h"

#include <iostream>
#include <vector>
Expand Down
8 changes: 4 additions & 4 deletions src/pke/unittest/utils/BaseTestCase.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
#define __BASETESTCASE_H__

#include "config_core.h"
#include "scheme/ckksrns/cryptocontext-ckksrns.h"
#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bgvrns/cryptocontext-bgvrns.h"
#include "scheme/cryptocontextparams-base.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "scheme/bgvrns/gen-cryptocontext-bgvrns.h"
#include "scheme/gen-cryptocontext-params.h"

#include "utils/exception.h"

Expand Down
6 changes: 3 additions & 3 deletions src/pke/unittest/utils/UnitTestCryptoContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
//==================================================================================

#include "UnitTestCryptoContext.h"
#include "scheme/ckksrns/cryptocontext-ckksrns.h"
#include "scheme/bfvrns/cryptocontext-bfvrns.h"
#include "scheme/bgvrns/cryptocontext-bgvrns.h"
#include "scheme/ckksrns/gen-cryptocontext-ckksrns.h"
#include "scheme/bfvrns/gen-cryptocontext-bfvrns.h"
#include "scheme/bgvrns/gen-cryptocontext-bgvrns.h"
#include "gen-cryptocontext.h"

using namespace lbcrypto;
Expand Down
2 changes: 1 addition & 1 deletion src/pke/unittest/utils/UnitTestReadCSVData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//==================================================================================
#include "UnitTestReadCSVData.h"

#include "scheme/cryptocontextparams-base.h"
#include "scheme/gen-cryptocontext-params.h"
#include "utils/exception.h"

#include <fstream>
Expand Down

0 comments on commit 367e397

Please sign in to comment.