mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
chore: Use parameters curves generated files and expose security level options
This commit is contained in:
@@ -19,7 +19,7 @@ using ::concretelang::clientlib::ClientParameters;
|
||||
|
||||
llvm::Expected<ClientParameters>
|
||||
createClientParametersForV0(V0FHEContext context, llvm::StringRef functionName,
|
||||
mlir::ModuleOp module);
|
||||
mlir::ModuleOp module, int bitsOfSecurity);
|
||||
|
||||
} // namespace concretelang
|
||||
} // namespace mlir
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
|
||||
// Exceptions. See
|
||||
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
|
||||
// for license information.
|
||||
|
||||
#ifndef CONCRETELANG_SUPPORT_V0CURVES_H_
|
||||
#define CONCRETELANG_SUPPORT_V0CURVES_H_
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace mlir {
|
||||
namespace concretelang {
|
||||
|
||||
#define SECURITY_LEVEL_80 0
|
||||
#define SECURITY_LEVEL_128 1
|
||||
#define SECURITY_LEVEL_192 2
|
||||
#define SECURITY_LEVEL_256 3
|
||||
#define SECURITY_LEVEL_MAX 4
|
||||
|
||||
#define KEY_FORMAT_BINARY 0
|
||||
#define KEY_FORMAT_MAX 1
|
||||
|
||||
struct V0Curves {
|
||||
int securityLevel;
|
||||
double linearTerm1;
|
||||
double linearTerm2;
|
||||
int nAlpha;
|
||||
int keyFormat;
|
||||
V0Curves(int securityLevel, double linearTerm1, double linearTerm2,
|
||||
int nAlpha, int keyFormat)
|
||||
: securityLevel(securityLevel), linearTerm1(linearTerm1),
|
||||
linearTerm2(linearTerm2), nAlpha(nAlpha), keyFormat(keyFormat) {}
|
||||
|
||||
double getVariance(int glweDimension, int polynomialSize, int logQ) {
|
||||
auto a = std::pow(
|
||||
2, (linearTerm1 * glweDimension * polynomialSize + linearTerm2) * 2);
|
||||
auto b = std::pow(2, -2 * (logQ - 2));
|
||||
return a > b ? a : b;
|
||||
}
|
||||
};
|
||||
|
||||
V0Curves *getV0Curves(int securityLevel, int keyFormat);
|
||||
|
||||
} // namespace concretelang
|
||||
} // namespace mlir
|
||||
#endif
|
||||
Reference in New Issue
Block a user