From 2cba686c66d1da3e65bd126f387dd54bbbacc3d7 Mon Sep 17 00:00:00 2001 From: Antoniu Pop Date: Mon, 20 Dec 2021 11:08:07 +0000 Subject: [PATCH] fix(runtime): enable concurrent key usage by cloning it on get operation. --- compiler/lib/Runtime/context.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compiler/lib/Runtime/context.c b/compiler/lib/Runtime/context.c index 8da6d7e4f..407b0da29 100644 --- a/compiler/lib/Runtime/context.c +++ b/compiler/lib/Runtime/context.c @@ -1,3 +1,4 @@ +#include "concrete-ffi.h" #include "zamalang/Runtime/context.h" #include @@ -6,5 +7,10 @@ LweKeyswitchKey_u64 *get_keyswitch_key(RuntimeContext *context) { } LweBootstrapKey_u64 *get_bootstrap_key(RuntimeContext *context) { - return context->bsk; + int err; + LweBootstrapKey_u64 *clone = + clone_lwe_bootstrap_key_u64(&err, context->bsk); + if (err != 0) + fprintf(stderr, "Runtime: cloning bootstrap key failed.\n"); + return clone; }