5 Commits

Author SHA1 Message Date
Ashley
8238fd2100
Switch noise from the RingResolver to the DefaultResolver (#1439)
* hmm...

* Switch snow resolver to default

* Fix documentation

* Use the sha2 crate for sha512 hashing

* Use ring on native

* Use different features on different targets

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-02-12 21:44:50 +01:00
Demi Obenour
979c82040e Bump most dependencies (#1268)
* Bump most dependencies

This actually builds 😊.

* Bump all dependencies

Includes the excellent work of @rschulman in #1265.

* Remove use of ed25519-dalek fork

* Monomorphize more dependencies

* Add compatibility hack for rand

Cargo allows a crate to depend on multiple versions of another, but
`cargo-web` panics in that situation.  Use a wrapper crate to work
around the panic.

* Use @tomaka’s idea for using a newer `rand`

instead of my own ugly hack.

* Switch to Parity master

as its dependency-bumping PR has been merged.

* Update some depenendencies again

* Remove unwraps and `#[allow(deprecated)]`.

* Remove spurious changes to dependencies

Bumping minor or patch versions is not needed, and increases likelyhood
of merge conflicts.

* Remove some redundant Cargo.toml changes

* Replace a retry loop with an expect

`ed25519::SecretKey::from_bytes` will never fail for 32-byte inputs.

* Revert changes that don’t belong in this PR
2019-10-31 18:30:17 +01:00
Ross Schulman
d683828f37 Update dependency versions (#1265)
* Update versions of many dependencies

* Bump version of rand

* Updates for changed APIs in rand, ring, and webpki

* Replace references to `snow::Session`

`Session` no longer exists in `snow` but the replacement is two structs `HandshakeState` and `TransportState`
Something will have to be done to harmonize `NoiseOutput.session`

* Add precise type for UnparsedPublicKey

* Update data structures/functions to match new snow's API

* Delete diff.diff

Remove accidentally committed diff file

* Remove commented lines in identity/rsa.rs

* Bump libsecp256k1 to 0.3.1
2019-10-11 10:19:35 +02:00
Roman Borschel
8537eb38b9
Integrate identity keys with libp2p-noise for authentication. (#1027)
* Integrate use of identity keys into libp2p-noise.

In order to make libp2p-noise usable with a `Swarm`, which requires a
`Transport::Output` that is a pair of a peer ID and an implementation
of `StreamMuxer`, it is necessary to bridge the gap between static
DH public keys and public identity keys from which peer IDs are derived.

Because the DH static keys and the identity keys need not be
related, it is thus generally necessary that the public identity keys are
exchanged as part of the Noise handshake, which the Noise protocol
accomodates for through the use of handshake message payloads.

The implementation of the existing (IK, IX, XX) handshake patterns is thus
changed to send the public identity keys in the handshake payloads.
Additionally, to facilitate the use of any identity keypair with Noise
handshakes, the static DH public keys are signed using the identity
keypairs and the signatures sent alongside the public identity key
in handshake payloads, unless the static DH public key is "linked"
to the public identity key by other means, e.g. when an Ed25519 identity
keypair is (re)used as an X25519 keypair.

* libp2p-noise doesn't build for wasm.

Thus the development transport needs to be still constructed with secio
for transport security when building for wasm.

* Documentation tweaks.

* For consistency, avoid wildcard enum imports.

* For consistency, avoid wildcard enum imports.

* Slightly simplify io:🤝:State::finish.

* Simplify creation of 2-byte arrays.

* Remove unnecessary cast and obey 100 char line limit.

* Update protocols/noise/src/protocol.rs

Co-Authored-By: romanb <romanb@users.noreply.github.com>

* Address more review comments.

* Cosmetics

* Cosmetics

* Give authentic DH keypairs a distinct type.

This has a couple of advantages:

  * Signing the DH public key only needs to happen once, before
    creating a `NoiseConfig` for an authenticated handshake.

  * The identity keypair only needs to be borrowed and can be
    dropped if it is not used further outside of the Noise
    protocol, since it is no longer needed during Noise handshakes.

  * It is explicit in the construction of a `NoiseConfig` for
    a handshake pattern, whether it operates with a plain `Keypair`
    or a keypair that is authentic w.r.t. a public identity key
    and future handshake patterns may be built with either.

  * The function signatures for constructing `NoiseConfig`s for
    handshake patterns are simplified and a few unnecessary trait
    bounds removed.

* Post-merge corrections.

* Add note on experimental status of libp2p-noise.
2019-05-07 10:22:42 +02:00
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