47 Commits

Author SHA1 Message Date
Roman Borschel
2c66f82b11
Consolidate keypairs in core. (#972)
* Consolidate keypairs in core.

Introduce the concept of a node's identity keypair in libp2p-core,
instead of only the public key:

  * New module: libp2p_core::identity with submodules for the currently
    supported key types. An identity::Keypair and identity::PublicKey
    support the creation and verification of signatures. The public key
    supports encoding/decoding according to the libp2p specs.

  * The secio protocol is simplified as a result of moving code to libp2p-core.

  * The noise protocol is slightly simplified by consolidating ed25519
    keypairs in libp2p-core and using x25519-dalek for DH. Furthermore,
    Ed25519 to X25519 keypair conversion is now complete and tested.

Generalise over the DH keys in the noise protocol.

Generalise over the DH keys and thus DH parameter in handshake patterns
of the Noise protocol, such that it is easy to support other DH schemes
in the future, e.g. X448.

* Address new review comments.
2019-03-11 13:42:53 +01:00
Pierre Krieger
040d8c8c9a
Bump to v0.4 (#964) 2019-02-20 16:39:30 +01:00
Roman Borschel
eeed66707b Address edition-2018 idioms. (#929) 2019-02-11 14:58:15 +01:00
Benjamin Kampmann
bf5ed98895
Update Dependencies (#931)
* update secio dependencies: ed25519-dalek, sha2, hmac
* Update websocket dependencies
* Update multiaddr dependencies
2019-02-08 08:56:31 +01:00
Pierre Krieger
fcb2ac36e6
Bump to v0.3.0 (#905) 2019-01-30 16:50:47 +01:00
Toralf Wittner
bbf56c6371
Update protobuf to version 2.3.0 (#904)
Initially I had hoped that the deprecated `#![allow(clippy)]` would no
longer be put into the generated rust files, but -- as of 2019-01-30 --
it still is (see [1] for details). Since we explicitly update the
protobuf files I decided to *manually edit the generated code* and
replace this with `#![allow(clippy:all)]`. Hopefully, by the time we do
the next upgrade, no such manual tweaking would be necessary anymore. I
think the benefit of a less polluted clippy output is worth it this
time.

[1]: https://github.com/stepancheg/rust-protobuf/pull/332
2019-01-30 16:25:45 +01:00
Toralf Wittner
e23b2733e2
Fix some rustc/clippy warnings. (#895) 2019-01-30 15:41:54 +01:00
Pierre Krieger
18db0e806b
Add SecioKeypair::ed25519_raw_key (#890) 2019-01-25 15:32:07 +01:00
Toralf Wittner
25433d6dd2
Update ring to version 0.14 (#885)
This release enables RSA signing by default, hence the `rsa_signing` feature has been removed.
2019-01-23 16:09:52 +01:00
Pierre Krieger
c3e29a2654
Update secio dependencies (#860)
* Update ciphers

* Update asn1_der
2019-01-17 11:31:46 +01:00
Pierre Krieger
1c1ce9a8aa
Bump libp2p-secio and libp2p-core-derive (#857) 2019-01-15 17:35:35 +01:00
Pierre Krieger
67a8e705a7
Cache the secp256k1 object in secio (#856)
* Cache the secp256k1 object in secio

* Fix feature flag disabled
2019-01-15 17:14:58 +01:00
Pierre Krieger
56c9e57fbd
Fix compilation of ring (#846) 2019-01-13 15:52:12 +01:00
Pierre Krieger
a980074b3f
Add some benchmarks for secio (#847)
* Add some benchmarks for secio

* Switch to criterion

* Fix wrong data size
2019-01-11 12:11:43 +01:00
Pierre Krieger
e39d6d8bd2
Version 0.2 (#841) 2019-01-10 13:27:45 +01:00
Pierre Krieger
dbff125df2
Add an Error associated type to transports (#835)
* Add an Error associated type to transports

* Improve raw swarm a bit

* Rename map_other to map

* Use source() instead of cause()

* RawSwarmIncErr -> IncomingError
2019-01-10 11:27:06 +01:00
Toralf Wittner
f55a8bc2f3 Update ring to 0.13 (#674) 2019-01-10 11:17:44 +01:00
Pierre Krieger
9ca215b1a3
Test on wasm32-unknown-unknown (#806)
* Test on wasm32-unknown-unknown

* Fix compilation
2019-01-02 15:50:08 +01:00
Pierre Krieger
e2ff74994c
Upgrade secio to the 2018 edition (#774)
* Upgrade secio to the 2018 edition

* Fix build with features on

* Fix emscripten build
2018-12-13 18:54:28 +01:00
Toralf Wittner
a152e18821
Simplify handling of upgrade information. (#761) 2018-12-11 15:13:10 +01:00
Pierre Krieger
2dce4294a0
Add version numbers in the deps in Cargo.toml (#768) 2018-12-11 14:54:44 +01:00
Pierre Krieger
a8a6438fbc
Rename libp2p-tcp-transport to libp2p-tcp (#762) 2018-12-10 13:39:11 +01:00
Pierre Krieger
2ef4d779ca
Add metadata to all the Cargo.toml (#743) 2018-12-06 19:22:06 +01:00
Pierre Krieger
95ebee5841
Update some dependencies (#686)
* Update many dependencies

* Upgrade some secio deps
2018-11-27 10:35:47 +01:00
Toralf Wittner
a5fee2dbac
secio: Defer nonce verification. (#667) 2018-11-21 10:39:48 +01:00
Toralf Wittner
2e549884ef Split ConnectionUpgrade. (#642)
Introduce `InboundUpgrade` and `OutboundUpgrade`.
2018-11-15 17:41:11 +01:00
David
3e1eca16d7 Use upstream rust-secp256k1 (#616) 2018-11-09 15:02:27 +01:00
Pierre Krieger
4627f21180
Use paritytech/rust-secp256k1 (#598) 2018-10-31 11:17:12 +01:00
James Ray
45cd7db6e9 Remove spaces before semicolons (#591) 2018-10-29 10:38:32 +01:00
jamartin9
490ae980c7 #399 remove tokio_current_thread tests (#577)
* remove tokio_current_thread tests

* Review changes:
Removed newline
Moved uds tokio test crate to top to avoid self and keep with convention of other test crates
Removed sleep from uds test and block until all futures are completed.
2018-10-25 11:26:37 +02:00
Pierre Krieger
5d1c54cc10
New core (#568)
* New core

* Fix lifetime requirements

* Remove identify transport

* Address &mut & ref ref mut

* Fix whitespaces
2018-10-17 10:17:40 +01:00
Pierre Krieger
68632ce26b
Fix secio compied with --no-default-features (#545) 2018-10-09 11:21:35 +02:00
Toralf Wittner
f2c3a149d7
Model HandshakeContext with explicit state transitions. (#532)
Instead of having one struct with uninitialised fields
which are mutated, have explicit states and ensure that the types
show that there is no ambiguity which data is available or not.
Consequently, this removes quite a few `unwrap`/`expect` calls.
2018-10-08 14:37:36 +02:00
Pierre Krieger
e3efc2dc9a
Make secio almost compile for asmjs/wasm (#519)
* Use the sha2 crate in the handshake

* Return a Digest in algo_support instead of a ring ref

* Switch to ed25519-dalek for keys

* Make ring more or less optional

* Switch to ed25519_dalek for the verification

* Extract the key exchange to its own module

* Remove the ring RNG from the handshake

* Some warning fixes and forgot file

* Move key exchange to own module

* Remove usage of ring::digest

* Remove ring from handshake entirely

* Implement ECDH for WebCrypto

* Remove the libp2p-secio feature

* Fix ring being included

* Address some concerns

* Provde some panics in WebCrypto

* Prove the Hmac panic

* Prove more panics
2018-10-01 15:42:40 +02:00
Toralf Wittner
7fb09fbf20
secio: keep ciphertext if start_send is not ready (#494)
* secio: keep ciphertext if start_send is not ready

Otherwise ciphertext may be thrown away and once sent, the cipher states
have diverged, resulting in nonsense messages on decryption side.

* Also attempt to send pending data `Sink::close`.

* Inline `send_pending`.
2018-09-18 22:51:13 +02:00
Pierre Krieger
0c43c76965
Implement close() from Sink (#492) 2018-09-17 15:01:37 +02:00
Pierre Krieger
d719ac6037
Revert "Revert "remove rustc-serialize (#359) (#386)" (#466)" (#477)
This reverts commit 0a3d4cdfade1656d72ca99751e94e179bdaec221.
2018-09-17 10:05:37 +02:00
Toralf Wittner
0614b0d44e
secio: don't panic in agree_ephemeral. (#480)
Given that echoing back our local key and nonce would result in equal
digest values, we should treat this as an error instead of panicking.
2018-09-14 11:37:40 +02:00
Arkadiy Paronyan
5980a4538e
Secp256k1 key generation (#474) 2018-09-13 10:26:52 +02:00
Toralf Wittner
6a5681aed7
secio: Add NULL cipher and allow more configuration. (#468)
* Introduce NULL cipher and allow more configuration.

* Back to using the hash-code for handshake.

Using `Endpoint` would be incompatible with the existing protocol.

* Add comments.
2018-09-12 09:10:05 +02:00
Pierre Krieger
0a3d4cdfad
Revert "remove rustc-serialize (#359) (#386)" (#466)
This reverts commit 73996885cb2d645ee91361204c33e7039290aabc.
2018-09-07 14:05:42 +02:00
Pierre Krieger
e45dce2d9a
Switch to twofish by default (#465) 2018-09-06 17:35:25 +02:00
Pierre Krieger
601de6ab70
Minor fix for concat_comma (#464) 2018-09-06 16:31:15 +02:00
Pierre Krieger
ea1f172397
Implement Send everywhere (#458) 2018-09-06 09:54:35 +02:00
Pierre Krieger
e2960b4317
Add support for twofish cipher (#457) 2018-09-05 02:15:16 +02:00
Pierre Krieger
02576eecf1
Downgrade ring to 0.12 (#448) 2018-09-03 20:44:55 +02:00
Benjamin Kampmann
2ea49718f3
Clean up directory structure (#426)
* Remove unused circular-buffer crate
* Move transports into subdirectory
* Move misc into subdirectory
* Move stores into subdirectory
* Move multiplexers
* Move protocols
* Move libp2p top layer
* Fix Test: skip doctest if secio isn't enabled
2018-08-29 11:24:44 +02:00