BFV API design

This commit is contained in:
York Jasper Niebuhr 2025-11-20 23:24:34 +01:00
parent 3886aa7fcc
commit 7bcec991ae

View File

@ -3,21 +3,35 @@
namespace homcert::bfv { namespace homcert::bfv {
/* /*
Note -> Ciphertexts track what parts of them are actually utilized! TODO
Device handles pluggability of implementations (e.g. SEAL vs. GPU)
Operations are queued on device so the device can parallelize ops
*/ */
class handle { /*
// handles reference counting and garbage collection No device class at all, just the context class which is handed to system as shared_ptr
}; activate_context(std::shared_ptr<bfv::context> ctx) -> thread local pointer is set
Raw ciphertext and plaintext classes always have the full 8192 coefficients (defined in context as static constexpr)
class device { bfv::vector<...>
// ... -> can be plaintext or ciphertext
public: -> can be base (owns plain-/ciphertext) or component (view to part of base)
virtual handle make_context() = 0; -> can be local or remote
virtual handle allocate_plaintext() = 0; -> can be a single vector or multiple vectors/components (variadic)
virtual handle allocate_ciphertext() = 0; -> arithmetic with component masks it out
virtual void enqueue_op() = 0; -> arithmetic with base does operation on all components
virtual void process_queue() = 0; -> tracks multiplicative depth
}; -> warning/error if multiplicative depth exceeds limit
-> use bootstrap member function to handle the warnings/errors
-> callbacks to reach peer in context
-> bootstrap_client (unchecked, just raw bootstrap, checks happen at an upper layer using other callbacks)
-> bootstrap_server_await (waits for client to make request)
-> bootstrap_server_serve (called immediately after request received with value to be returned)
-> automatically does secure reveal when cipher is transformed to plain
-> queues operations until used (cast to plaintext, communication with peer)
Programs are defined TWICE
-> local stuff is executed
-> remote stuff is hosted (e.g. bootstrapping server)
-> defined once from each side (differ e.g. in the plaintext inputs etc.)
*/
} }