BFV API design
This commit is contained in:
parent
3886aa7fcc
commit
7bcec991ae
@ -3,21 +3,35 @@
|
||||
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
|
||||
};
|
||||
|
||||
class device {
|
||||
// ...
|
||||
public:
|
||||
virtual handle make_context() = 0;
|
||||
virtual handle allocate_plaintext() = 0;
|
||||
virtual handle allocate_ciphertext() = 0;
|
||||
virtual void enqueue_op() = 0;
|
||||
virtual void process_queue() = 0;
|
||||
};
|
||||
/*
|
||||
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)
|
||||
bfv::vector<...>
|
||||
-> can be plaintext or ciphertext
|
||||
-> can be base (owns plain-/ciphertext) or component (view to part of base)
|
||||
-> can be local or remote
|
||||
-> can be a single vector or multiple vectors/components (variadic)
|
||||
-> arithmetic with component masks it out
|
||||
-> arithmetic with base does operation on all components
|
||||
-> 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.)
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user