|
@@ -66,6 +66,8 @@ void compute_CW(cw_construction computecw_array, size_t ind, size_t layer,tcp::s
|
|
|
|
|
|
//exchange blinded shares for OSWAP.
|
|
//exchange blinded shares for OSWAP.
|
|
boost::asio::write(sout, boost::asio::buffer(&blinds_sent, sizeof(BlindsCW)));
|
|
boost::asio::write(sout, boost::asio::buffer(&blinds_sent, sizeof(BlindsCW)));
|
|
|
|
+ communication_cost += sizeof(__m128i);
|
|
|
|
+
|
|
boost::asio::read(sout, boost::asio::buffer(&blinds_recv, sizeof(BlindsCW)));
|
|
boost::asio::read(sout, boost::asio::buffer(&blinds_recv, sizeof(BlindsCW)));
|
|
|
|
|
|
blinded_bit_read = blinds_recv.blinded_bit;
|
|
blinded_bit_read = blinds_recv.blinded_bit;
|
|
@@ -88,11 +90,11 @@ void compute_CW(cw_construction computecw_array, size_t ind, size_t layer,tcp::s
|
|
|
|
|
|
boost::asio::write(sout, boost::asio::buffer(&cwsent, sizeof(cwsent)));
|
|
boost::asio::write(sout, boost::asio::buffer(&cwsent, sizeof(cwsent)));
|
|
boost::asio::read(sout, boost::asio::buffer(&cwrecv, sizeof(cwrecv)));
|
|
boost::asio::read(sout, boost::asio::buffer(&cwrecv, sizeof(cwrecv)));
|
|
|
|
+ communication_cost += sizeof(__m128i);
|
|
cwrecv.cw ^= cwsent.cw;
|
|
cwrecv.cw ^= cwsent.cw;
|
|
cwrecv.cwbit[0] ^= (cwsent.cwbit[0] ^ 1);
|
|
cwrecv.cwbit[0] ^= (cwsent.cwbit[0] ^ 1);
|
|
cwrecv.cwbit[1] ^= (cwsent.cwbit[1]);
|
|
cwrecv.cwbit[1] ^= (cwsent.cwbit[1]);
|
|
|
|
|
|
-
|
|
|
|
cwt_L = cwrecv.cwbit[0];
|
|
cwt_L = cwrecv.cwbit[0];
|
|
cwt_R = cwrecv.cwbit[1];
|
|
cwt_R = cwrecv.cwbit[1];
|
|
CW = cwrecv.cw;
|
|
CW = cwrecv.cw;
|
|
@@ -157,17 +159,16 @@ static inline void traverse(const prgkey_t & prgkey, const node_t & seed, node_t
|
|
* @param party Party
|
|
* @param party Party
|
|
* @param socket_no
|
|
* @param socket_no
|
|
*/
|
|
*/
|
|
-inline void create_dpfs ( bool reading, size_t db_nitems, const AES_KEY& prgkey, uint8_t target_share[64], std::vector<socket_t>& socketsPb, std::vector<socket_t>& socketsP2,
|
|
|
|
- const size_t from, const size_t to, __m128i * output, int8_t * _t, __m128i& final_correction_word,
|
|
|
|
- cw_construction computecw_array, dpfP2 * dpf_instance,
|
|
|
|
- bool party, size_t socket_no, size_t ind = 0)
|
|
|
|
-{
|
|
|
|
-
|
|
|
|
- const size_t bits_per_leaf = std::is_same<leaf_t, bool>::value ? 1 : sizeof(leaf_t) * CHAR_BIT;
|
|
|
|
|
|
+inline void create_dpfs (bool reading, size_t db_nitems, const AES_KEY& prgkey,
|
|
|
|
+ uint8_t target_share[64], std::vector<socket_t>& socketsPb, std::vector<socket_t>& socketsP2, const size_t from, const size_t to, __m128i * output, int8_t * _t, __m128i& final_correction_word,
|
|
|
|
+ cw_construction computecw_array, dpfP2 * dpf_instance,
|
|
|
|
+ bool party, size_t socket_no, size_t ind = 0)
|
|
|
|
+{
|
|
|
|
+ const size_t bits_per_leaf = std::is_same<leaf_t, bool>::value ? 1 : sizeof(leaf_t) * CHAR_BIT;
|
|
const bool is_packed = (sizeof(leaf_t) < sizeof(node_t));
|
|
const bool is_packed = (sizeof(leaf_t) < sizeof(node_t));
|
|
const size_t nodes_per_leaf = is_packed ? 1 : std::ceil(static_cast<double>(bits_per_leaf) / (sizeof(node_t) * CHAR_BIT));
|
|
const size_t nodes_per_leaf = is_packed ? 1 : std::ceil(static_cast<double>(bits_per_leaf) / (sizeof(node_t) * CHAR_BIT));
|
|
|
|
|
|
- const size_t depth = std::ceil(std::log2(db_nitems));
|
|
|
|
|
|
+ const size_t depth = std::ceil(std::log2(db_nitems));
|
|
const size_t nbits = std::ceil(std::log2(db_nitems));
|
|
const size_t nbits = std::ceil(std::log2(db_nitems));
|
|
const size_t nodes_in_interval = db_nitems-1;
|
|
const size_t nodes_in_interval = db_nitems-1;
|
|
|
|
|
|
@@ -175,7 +176,7 @@ inline void create_dpfs ( bool reading, size_t db_nitems, const AES_KEY& prgkey
|
|
|
|
|
|
arc4random_buf(&root, sizeof(root));
|
|
arc4random_buf(&root, sizeof(root));
|
|
|
|
|
|
- root = set_lsb(root, party);
|
|
|
|
|
|
+ root = set_lsb(root, party);
|
|
|
|
|
|
const size_t from_node = std::floor(static_cast<double>(from) / nodes_per_leaf);
|
|
const size_t from_node = std::floor(static_cast<double>(from) / nodes_per_leaf);
|
|
|
|
|
|
@@ -238,7 +239,6 @@ inline void create_dpfs ( bool reading, size_t db_nitems, const AES_KEY& prgkey
|
|
traverse(prgkey, s[1-curlayer][j], &s[curlayer][i]);
|
|
traverse(prgkey, s[1-curlayer][j], &s[curlayer][i]);
|
|
L ^= s[curlayer][i];
|
|
L ^= s[curlayer][i];
|
|
R ^= s[curlayer][i+1];
|
|
R ^= s[curlayer][i+1];
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|