Skip to content

Commit fead3e7

Browse files
committed
crypto/tls: Import TLS code from libp2p
1 parent 1af6e3f commit fead3e7

23 files changed

+1239
-21
lines changed

Cargo.toml

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ edition = "2021"
99
prost-build = "0.11"
1010

1111
[dependencies]
12-
async-trait = "0.1.66"
1312
asynchronous-codec = "0.6.1"
13+
async-trait = "0.1.66"
1414
bs58 = "0.4.0"
1515
bytes = "1.4.0"
1616
ed25519-dalek = "1.0.1"
1717
futures = "0.3.27"
18+
futures-rustls = "0.22.2"
1819
lazy_static = "1.4.0"
1920
mockall = "0.11.4"
2021
multiaddr = "0.17.0"
@@ -23,6 +24,9 @@ pin-project = "1.1.0"
2324
prost = "0.11.8"
2425
protoc = "2.28.0"
2526
rand = { version = "0.7.0", features = ["getrandom"] }
27+
rcgen = "0.10.0"
28+
ring = "0.16.20"
29+
rustls = { version = "0.20.2", default-features = false }
2630
s2n-quic = "1.22.0"
2731
serde = "1.0.158"
2832
smallvec = "1.10.0"
@@ -33,8 +37,12 @@ tokio-stream = "0.1.12"
3337
tokio-util = { version = "0.7.7", features = ["compat", "io", "codec"] }
3438
tracing = { version = "0.1.37", features = ["log"] }
3539
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
40+
trust-dns-resolver = { version = "0.22.0", features = ["tokio"] }
3641
unsigned-varint = { path = "misc/unsigned-varint", features = ["codec", "tokio-util"] }
42+
webpki = "0.22.0"
43+
x509-parser = "0.15.0"
3744
yamux = "0.11.0"
45+
yasna = "0.5.0"
3846
zeroize = "1.5.7"
3947

4048
[dev-dependencies]

LICENSE

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Copyright 2017-2020 Parity Technologies (UK) Ltd.
2+
Copyright 2022-2023 Protocol Labs
23
Copyright 2023 litep2p developers
34

45
Permission is hereby granted, free of charge, to any person obtaining a copy of

src/crypto/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use crate::{error::*, peer_id::*};
2323

2424
pub mod ed25519;
2525
pub mod noise;
26+
pub mod tls;
2627
pub mod keys_proto {
2728
include!(concat!(env!("OUT_DIR"), "/keys_proto.rs"));
2829
}

src/crypto/tls/Cargo.toml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[package]
2+
name = "libp2p-tls"
3+
version = "0.1.0"
4+
edition = "2021"
5+
rust-version = "1.60.0"
6+
description = "TLS configuration based on libp2p TLS specs."
7+
repository = "https://github.com/libp2p/rust-libp2p"
8+
license = "MIT"
9+
exclude = ["src/test_assets"]
10+
11+
[dependencies]
12+
futures = { version = "0.3.27", default-features = false }
13+
futures-rustls = "0.22.2"
14+
libp2p-core = { version = "0.39.0", path = "../../core" }
15+
libp2p-identity = { version = "0.1.0", path = "../../identity" }
16+
rcgen = "0.10.0"
17+
ring = "0.16.20"
18+
thiserror = "1.0.40"
19+
webpki = "0.22.0"
20+
x509-parser = "0.15.0"
21+
yasna = "0.5.0"
22+
23+
# Exposed dependencies. Breaking changes to these are breaking changes to us.
24+
[dependencies.rustls]
25+
version = "0.20.7"
26+
default-features = false
27+
features = ["dangerous_configuration"] # Must enable this to allow for custom verification code.
28+
29+
[dev-dependencies]
30+
hex = "0.4.3"
31+
hex-literal = "0.3.4"
32+
libp2p-core = { path = "../../core" }
33+
libp2p-identity = { path = "../../identity", features = ["ed25519", "rsa", "secp256k1", "ecdsa"] }
34+
libp2p-swarm = { path = "../../swarm" }
35+
libp2p-yamux = { path = "../../muxers/yamux" }
36+
tokio = { version = "1.21.1", features = ["full"] }
37+
38+
# Passing arguments to the docsrs builder in order to properly document cfg's.
39+
# More information: https://docs.rs/about/builds#cross-compiling
40+
[package.metadata.docs.rs]
41+
all-features = true
42+
rustdoc-args = ["--cfg", "docsrs"]
43+
rustc-args = ["--cfg", "docsrs"]

0 commit comments

Comments
 (0)