Files
concrete/compilers/concrete-compiler/compiler/tests/tests_tools/keySetCache.h
aPere3 2728046ae7 chore(compiler): allows unsecure keyset caches to be generated
For debugging purpose, add a cmake variable that allows to generate
unsecure keycaches, that allows tracing ops to show the message in the
ciphertext body.
2023-03-28 09:15:04 +02:00

34 lines
961 B
C++

#ifndef TEST_TOOLS_KEYSETCACHE_H
#define TEST_TOOLS_KEYSETCACHE_H
#include "concretelang/ClientLib/KeySetCache.h"
#include "llvm/Support/Path.h"
#ifdef CONCRETELANG_TEST_KEYCACHE_PATH
#define CACHE_PATH CONCRETELANG_TEST_KEYCACHE_PATH
#else
#define CACHE_PATH "KeySetCache"
#endif
static inline std::optional<concretelang::clientlib::KeySetCache>
getTestKeySetCache() {
llvm::SmallString<0> cachePath;
llvm::sys::path::system_temp_directory(true, cachePath);
llvm::sys::path::append(cachePath, CACHE_PATH);
auto cachePathStr = std::string(cachePath);
std::cout << "Using KeySetCache dir: " << cachePathStr << "\n";
return std::optional<concretelang::clientlib::KeySetCache>(
concretelang::clientlib::KeySetCache(cachePathStr));
}
static inline std::shared_ptr<concretelang::clientlib::KeySetCache>
getTestKeySetCachePtr() {
return std::make_shared<concretelang::clientlib::KeySetCache>(
getTestKeySetCache().value());
}
#endif