1234567891011121314151617181920212223242526272829303132333435 |
- #ifndef __OBLIV_HPP__
- #define __OBLIV_HPP__
- #include <vector>
- // Routines for processing private data obliviously
- // Obliviously tally the number of messages in the given buffer destined
- // for each storage node. Each message is of size msg_size bytes.
- // There are num_msgs messages in the buffer. There are
- // num_storage_nodes storage nodes in total. The destination storage
- // node of each message is determined by looking at the top
- // DEST_STORAGE_NODE_BITS bits of the (little-endian) 32-bit word at the
- // beginning of the message; this will be a number between 0 and
- // num_storage_nodes-1, which is not necessarily the node number of the
- // storage node, which may be larger if, for example, there are a bunch
- // of routing or ingestion nodes that are not also storage nodes. The
- // return value is a vector of length num_storage_nodes containing the
- // tally.
- std::vector<uint32_t> obliv_tally_stg(const uint8_t *buf,
- uint32_t msg_size, uint32_t num_msgs, uint32_t num_storage_nodes);
- // Obliviously create padding messages destined for the various storage
- // nodes, using the (private) counts in the tally vector. The tally
- // vector may be modified by this function. tot_padding must be the sum
- // of the elements in tally, which need _not_ be private.
- void obliv_pad_stg(uint8_t *buf, uint32_t msg_size,
- std::vector<uint32_t> &tally, uint32_t tot_padding);
- // For each excess message, convert into padding for nodes that will need some.
- // Oblivious to contents of message buffer and tally vector. May modify message
- // buffer and tally vector.
- void obliv_excess_to_padding(uint8_t *buf, uint32_t msg_size, uint32_t num_msgs,
- std::vector<uint32_t> &tally, uint32_t msgs_per_stg);
- #endif
|