From f93d52bbd0053574fb35d72b85c4b299dc1f3ee5 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Sat, 12 Nov 2016 13:48:30 +0100 Subject: Fixes decryption share calculation, adds lots of debugging statements. --- node/node.hpp | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'node/node.hpp') diff --git a/node/node.hpp b/node/node.hpp index a4c7992..b166c71 100644 --- a/node/node.hpp +++ b/node/node.hpp @@ -14,11 +14,23 @@ #include #include +#include +#include /*! * \file */ +#ifndef NDEBUG +inline std::string to_string(GroupElement el, CMixContext const& ctx) { + std::string ret; + ret.resize(get_group_element_array_size(&ctx)); + + element_to_buffer(&ctx, &ret[0], el); + return ret; +} +#endif + /*! * \brief The NodeNetworkSettings struct */ @@ -30,29 +42,17 @@ struct NodeNetworkSettings { std::string certdir; ///< Directory containing trusted certificate authorities. }; -struct MixData { - GroupElement r; - GroupElement s; - std::string client_handle; - size_t new_location; - - ~MixData(){ - Api api = get_implementation(); - api.free_group_element(r); - api.free_group_element(s); - } -}; - /*! * \brief The Node class */ class Node { struct CMixClientData { - SharedKey shared_value; + GroupElement shared_value; }; boost::asio::io_service io_service; + boost::asio::deadline_timer timer; std::shared_ptr ssl_ctx; Server server; @@ -63,6 +63,8 @@ class Node ClientConnections clients; typedef std::map ClientData; ClientData data; + typedef std::map> ClientMessages; + ClientMessages messages; NodeNetworkSettings network_settings; @@ -71,26 +73,29 @@ class Node CMixContext cmix_ctx; - std::vector precomputation_data; - std::map index_map; + std::map index_map; bool shutting_down; void accept_handler(std::unique_ptr>&& socket, std::shared_ptr ctx); void connect_to_next_node(); - void start_precomputation(); void start_initialisation(); + void start_precomputation(); + void start_realtime_phase(); void handle_node_initialization(cmix_proto::Initialization const& init); void handle_node_secretkey(cmix_proto::SecretKey const& secret); void handle_node_prepre(cmix_proto::PrePre const& prepre); void handle_node_premix(cmix_proto::PreMix const& premix); void handle_node_prepost(cmix_proto::PrePost const& prepost); + void handle_node_realpre(cmix_proto::RealPre const& realpre); + void handle_node_realmix(cmix_proto::RealMix const& realmix); void handle_node_message(cmix_proto::CMixMessage message); void handle_client_keyexchange(ClientConnections::key_type handle, cmix_proto::KeyExchange const& ke); void handle_client_bye(ClientConnections::key_type handle, cmix_proto::Bye const&); + void handle_client_usermessage(ClientConnections::key_type handle, cmix_proto::UserMessage const& um); void handle_client_message(ClientConnections::key_type handle, cmix_proto::CMixMessage message); void handle_imanode(Purgatory::iterator handle, cmix_proto::ImANode const&); -- cgit v1.2.3-70-g09d2