From c1bb07e65f550e043d9a387d3978e651a1b7a15d Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 2 Jul 2019 03:00:31 -0400 Subject: enable TLS for replica-replica connections --- include/hotstuff/hotstuff.h | 17 +++++++++++++---- include/hotstuff/type.h | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/hotstuff/hotstuff.h b/include/hotstuff/hotstuff.h index 313511f..680abce 100644 --- a/include/hotstuff/hotstuff.h +++ b/include/hotstuff/hotstuff.h @@ -148,6 +148,7 @@ class HotStuffBase: public HotStuffCore { bool ec_loop; /** network stack */ Net pn; + std::unordered_set valid_tls_certs; #ifdef HOTSTUFF_BLK_PROFILE BlockProfiler blk_profiler; #endif @@ -189,6 +190,8 @@ class HotStuffBase: public HotStuffCore { /** receives a block */ inline void resp_blk_handler(MsgRespBlock &&, const Net::conn_t &); + inline bool conn_handler(const salticidae::ConnPool::conn_t &, bool); + void do_broadcast_proposal(const Proposal &) override; void do_vote(ReplicaID, const Vote &) override; void do_decide(Finality &&) override; @@ -215,7 +218,8 @@ class HotStuffBase: public HotStuffCore { /* Submit the command to be decided. */ void exec_command(uint256_t cmd_hash, commit_cb_t callback); - void start(std::vector> &&replicas, bool ec_loop = false); + void start(std::vector> &&replicas, + bool ec_loop = false); size_t size() const { return peers.size(); } PaceMaker &get_pace_maker() { return *pmaker; } @@ -284,10 +288,15 @@ class HotStuff: public HotStuffBase { nworker, netconfig) {} - void start(const std::vector> &replicas, bool ec_loop = false) { - std::vector> reps; + void start(const std::vector> &replicas, bool ec_loop = false) { + std::vector> reps; for (auto &r: replicas) - reps.push_back(std::make_pair(r.first, new PubKeyType(r.second))); + reps.push_back( + std::make_tuple( + std::get<0>(r), + new PubKeyType(std::get<1>(r)), + uint256_t(std::get<2>(r)) + )); HotStuffBase::start(std::move(reps), ec_loop); } }; diff --git a/include/hotstuff/type.h b/include/hotstuff/type.h index 1d5ac55..07c1e72 100644 --- a/include/hotstuff/type.h +++ b/include/hotstuff/type.h @@ -73,6 +73,8 @@ class Cloneable { using ReplicaID = uint16_t; using opcode_t = uint8_t; +using tls_pkey_bt = BoxObj; +using tls_x509_bt = BoxObj; } -- cgit v1.2.3