feat: generate runtime context at Argument creation

This commit is contained in:
youben11
2021-08-30 09:25:19 +01:00
committed by Quentin Bourgerie
parent d1332dfd9a
commit c6b1480cc6
2 changed files with 10 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
extern "C" {
#include "concrete-ffi.h"
#include "zamalang/Runtime/context.h"
}
#include "zamalang/Support/ClientParameters.h"
@@ -40,6 +41,12 @@ public:
CircuitGate inputGate(size_t pos) { return std::get<0>(inputs[pos]); }
CircuitGate outputGate(size_t pos) { return std::get<0>(outputs[pos]); }
void generateRuntimeContext() {
auto ksk = std::get<1>(this->keyswitchKeys["ksk_v0"]);
auto bsk = std::get<1>(this->bootstrapKeys["bsk_v0"]);
setGlobalRuntimeContext(createRuntimeContext(ksk, bsk));
}
protected:
llvm::Error generateSecretKey(LweSecretKeyID id, LweSecretKeyParam param,
SecretRandomGenerator *generator);

View File

@@ -234,6 +234,9 @@ JITLambda::Argument::Argument(KeySet &keySet) : keySet(keySet) {
for (auto i = inputs.size(); i < rawArg.size(); i++) {
rawArg[i] = &outputs[i - inputs.size()];
}
// Setup runtime context with appropriate keys
keySet.generateRuntimeContext();
}
JITLambda::Argument::~Argument() {