aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2019-07-02 03:00:31 -0400
committerDeterminant <ted.sybil@gmail.com>2019-07-02 03:00:31 -0400
commitc1bb07e65f550e043d9a387d3978e651a1b7a15d (patch)
tree610d501e893c1eead667e558fb58ee85109fd82f /include
parent7e91de67703a3a3eb292d1a2422acb15a10d4b95 (diff)
enable TLS for replica-replica connections
Diffstat (limited to 'include')
-rw-r--r--include/hotstuff/hotstuff.h17
-rw-r--r--include/hotstuff/type.h2
2 files changed, 15 insertions, 4 deletions
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<uint256_t> 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<std::pair<NetAddr, pubkey_bt>> &&replicas, bool ec_loop = false);
+ void start(std::vector<std::tuple<NetAddr, pubkey_bt, uint256_t>> &&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<std::pair<NetAddr, bytearray_t>> &replicas, bool ec_loop = false) {
- std::vector<std::pair<NetAddr, pubkey_bt>> reps;
+ void start(const std::vector<std::tuple<NetAddr, bytearray_t, bytearray_t>> &replicas, bool ec_loop = false) {
+ std::vector<std::tuple<NetAddr, pubkey_bt, uint256_t>> 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<salticidae::PKey>;
+using tls_x509_bt = BoxObj<salticidae::X509>;
}