Commit Graph

144 Commits

Author SHA1 Message Date
Vladimir Komendantskiy bf98f1271f removed protobuf support 2018-07-31 12:25:45 +01:00
Vladimir Komendantskiy 150389c591 allow for using Error with inside other errors outside this crate 2018-07-31 11:51:52 +01:00
Vladimir Komendantskiy b7ab849a16 converted errors from error_chain to failure 2018-07-31 11:02:22 +01:00
Vladimir Komendantskiy 394e4ce140 separated crypto module from hbbft crate 2018-07-30 23:52:34 +01:00
Andreas Fackler da3bc0b930 Remove output and message queue from HoneyBadger. 2018-07-30 23:52:34 +01:00
Andreas Fackler ec16c801ac Add more arithmetic ops to Poly. 2018-07-30 23:52:34 +01:00
Andreas Fackler 23e8ebe967 Accept more types in threshold crypto API.
This removes some unnecessary allocation and conversion by accepting
more primitive types and references as the index in threshold decryption
and signing, and as the argument to a polynomial.
2018-07-30 23:52:34 +01:00
Andreas Fackler a78a14fa9d Separate keys and key shares. 2018-07-30 23:52:34 +01:00
c0gent 368430be1c Add `Copy` to `PublicKey` derived impls. 2018-07-30 23:52:34 +01:00
Peter van Nostrand bd10494d5d Clear 'Poly' and 'BivarPoly' coeffs on drop. 2018-07-30 23:52:34 +01:00
Peter van Nostrand 77a5829c1d Replaced clear-on-drop with 'std::ptr::write_volatile'. 2018-07-30 23:52:34 +01:00
Marc Brinkmann 8af4b502ae Added `RandomAdversary` and the necessary auxiliary functions.
Random adversaries are created for `broadcast` and `honey_badger`.  Random value generation was added for all type-dependencies of these algorithms, causing the `Rand` trait to be implement for a large portion of the codebase.

Additionally, `MessageWithSender` turned into an actual struct, making it much easier to handle. Tuple-like construction is still available through `MessageWithSender::new()`.
2018-07-30 23:52:34 +01:00
Andreas Fackler 1f3768f2b6 Add coin docs, change parity computation.
This makes the signature parity computation take into account all bits,
not just the last one of each byte.
2018-07-30 23:52:34 +01:00
Marc Brinkmann b7d12585f8 Implemented `Rand` for `SecretKey`. 2018-07-30 23:52:34 +01:00
Andreas Fackler 51b87b8bae Add node transaction messages to Dynamic HB. 2018-07-30 23:52:34 +01:00
Andreas Fackler c0cef3b50b Avoid redundant key computations. 2018-07-30 23:52:34 +01:00
Andreas Fackler e3a401bcb9 Make SyncKeyGen NodeUid-aware.
This allows the caller to address nodes by ID instead of by index.

Also contains a few other minor changes that will be needed for
`DynamicHoneyBadger`.
2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy 17fdffa90f threshold encryption of proposals in HoneyBadger 2018-07-30 23:52:34 +01:00
Andreas Fackler 0c66e16010 Remove generic E: Engine from crypto. 2018-07-30 23:52:34 +01:00
Andreas Fackler 81cbe5a63b Implement SyncKeyGen.
This is a _synchronous_ key generation algorithm. We will use it in
`DynamicHoneyBadger`, on top of `HoneyBadger` to satisfy the synchrony
requirements.

It can also be used independently e.g. on top of a blockchain.
2018-07-30 23:52:34 +01:00
Peter van Nostrand 1c3afe85eb Fix formatting. 2018-07-30 23:52:34 +01:00
Peter van Nostrand 5bf57d5d1d Added clear-on-drop secret-keys to 'NetworkInfo'. 2018-07-30 23:52:34 +01:00
Andreas Fackler 34d642f709 Improve Hash impl for Ciphertext.
This formulation makes it harder to forget updating the `Hash`
implementation if the `Ciphertext` type changes.
2018-07-30 23:52:34 +01:00
Andreas Fackler db1de60237 Implement Hash for "public" cryptographic types.
This adds a `Hash` implementation for public keys, commitments,
ciphertexts and signatures — types that might make sense to be included
in special transactions. The `DynamicHoneyBadger` implementation will
require some of them.
2018-07-30 23:52:34 +01:00
Andreas Fackler cf1782b2cf Simplify serde implementations, add Ciphertext. 2018-07-30 23:52:34 +01:00
Andreas Fackler db2d84cabd Support serde by default.
This removes the `serialization-serde` feature, since serde is already
used internally and therefore a dependency anyway.
2018-07-30 23:52:34 +01:00
Andreas Fackler 78b2a008c1 Rename crypto::keygen to crypto::poly. 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy 36c32822ed review comment coverage 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy 28ec3c5824 note in the broadcast example about the use of keys 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy 16b3c045ca extended the common coin nonce with a global UID and the top-level epoch 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy 3592c13133 fixed propagation of common coin messages to the top level 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy 2faf2afa46 protobuf serialization 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy a1038d9fb3 updated the tests with key initialisation 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy a87bd6460b common coin implementation 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy 68b9da5a3d Common Coin module template; added keys in NetworkInfo 2018-07-30 23:52:34 +01:00
Andreas Fackler f6e01daa13 Implement polynomials for distributed key generation. 2018-07-30 23:52:34 +01:00
Andreas Fackler f8685b5367 Expand crypto tests. 2018-07-30 23:52:34 +01:00
Andreas Fackler 40196fae1d Implement threshold encryption. 2018-07-30 23:52:34 +01:00
Andreas Fackler 419aae5adc Implement simple encryption. 2018-07-30 23:52:34 +01:00
Andreas Fackler abff26a153 Make public keys and signatures serializable. 2018-07-30 23:52:34 +01:00
Andreas Fackler 12516d2716 Simplify hash_g2. 2018-07-30 23:52:34 +01:00
Andreas Fackler c830e8f605 Use SHA256 and byteorder in hash_g2. 2018-07-30 23:52:34 +01:00
Andreas Fackler 036548e6b8 Implement threshold signatures. 2018-07-30 23:52:34 +01:00
Vladimir Komendantskiy d3149b92f6
Initial commit 2018-07-30 13:29:55 +01:00