From 802d12806a00a7a4be9779a9bb7e4722fbe8bd11 Mon Sep 17 00:00:00 2001 From: haurog <36535774+haurog@users.noreply.github.com> Date: Sat, 27 Jul 2024 17:43:14 +0200 Subject: [PATCH 1/4] Use newer version for rcgen enable RISC-V builds. --- Cargo.lock | 22 +++++++++++++++++----- Cargo.toml | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3fda6b57aa8..b90959e39a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3383,7 +3383,7 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-yamux", - "rcgen", + "rcgen 0.12.1", "ring 0.17.8", "rustls 0.23.11", "rustls-webpki 0.101.7", @@ -3436,7 +3436,7 @@ dependencies = [ "multihash", "quickcheck", "rand 0.8.5", - "rcgen", + "rcgen 0.12.1", "serde", "stun 0.6.0", "thiserror", @@ -3504,7 +3504,7 @@ dependencies = [ "libp2p-tcp", "parking_lot", "pin-project-lite", - "rcgen", + "rcgen 0.12.1", "rw-stream-sink", "soketto", "thiserror", @@ -4756,6 +4756,18 @@ dependencies = [ "yasna", ] +[[package]] +name = "rcgen" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48406db8ac1f3cbc7dcdb56ec355343817958a356ff430259bb07baf7607e1e1" +dependencies = [ + "pem", + "ring 0.17.8", + "time", + "yasna", +] + [[package]] name = "redis" version = "0.24.0" @@ -6673,7 +6685,7 @@ dependencies = [ "log", "pem", "rand 0.8.5", - "rcgen", + "rcgen 0.11.3", "regex", "ring 0.16.20", "rtcp", @@ -6737,7 +6749,7 @@ dependencies = [ "pem", "rand 0.8.5", "rand_core 0.6.4", - "rcgen", + "rcgen 0.11.3", "ring 0.16.20", "rustls 0.21.11", "sec1", diff --git a/Cargo.toml b/Cargo.toml index 55fc43d5b5a..b6fab33df3e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -130,7 +130,7 @@ tracing-subscriber = "0.3" futures = "0.3.30" web-time = "1.1.0" ring = "0.17.8" -rcgen = "0.11.3" +rcgen = "0.12.1" [patch.crates-io] From 0cf1ccb7b84194e8f19ddae23950ae21230a8a55 Mon Sep 17 00:00:00 2001 From: haurog <36535774+haurog@users.noreply.github.com> Date: Sat, 27 Jul 2024 17:43:57 +0200 Subject: [PATCH 2/4] Fix deprecation warnings for errors due to move to newer rcgen --- transports/tls/src/certificate.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transports/tls/src/certificate.rs b/transports/tls/src/certificate.rs index 65b373bcf9b..c0e1a043b27 100644 --- a/transports/tls/src/certificate.rs +++ b/transports/tls/src/certificate.rs @@ -158,7 +158,7 @@ pub struct P2pExtension { #[derive(Debug, thiserror::Error)] #[error(transparent)] -pub struct GenError(#[from] rcgen::RcgenError); +pub struct GenError(#[from] rcgen::Error); #[derive(Debug, thiserror::Error)] #[error(transparent)] @@ -244,7 +244,7 @@ fn parse_unverified(der_input: &[u8]) -> Result { fn make_libp2p_extension( identity_keypair: &identity::Keypair, certificate_keypair: &rcgen::KeyPair, -) -> Result { +) -> Result { // The peer signs the concatenation of the string `libp2p-tls-handshake:` // and the public key that it used to generate the certificate carrying // the libp2p Public Key Extension, using its private host key. @@ -255,7 +255,7 @@ fn make_libp2p_extension( identity_keypair .sign(&msg) - .map_err(|_| rcgen::RcgenError::RingUnspecified)? + .map_err(|_| rcgen::Error::RingUnspecified)? }; // The public host key and the signature are ANS.1-encoded From 80fc4fe9442930dcaeb054c66aa18a6a023aa85a Mon Sep 17 00:00:00 2001 From: haurog <36535774+haurog@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:52:58 +0200 Subject: [PATCH 3/4] Fix rcgen version in webrtc --- Cargo.lock | 2 +- transports/webrtc/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f4e4f074ce1..b52ce3b373b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3473,7 +3473,7 @@ dependencies = [ "multihash", "quickcheck", "rand 0.8.5", - "rcgen 0.12.1", + "rcgen 0.11.3", "serde", "stun 0.6.0", "thiserror", diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index fc2748d93c3..8e9c8f054f7 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -23,7 +23,7 @@ libp2p-identity = { workspace = true } libp2p-webrtc-utils = { workspace = true } multihash = { workspace = true } rand = "0.8" -rcgen = { workspace = true } +rcgen = "0.11" serde = { version = "1.0", features = ["derive"] } stun = "0.6" thiserror = "1" From 2cdc51c6f8f5f923a08c1c873dd38bd1a2fd004b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Thu, 9 Jan 2025 15:17:23 +0000 Subject: [PATCH 4/4] update webrtc crate --- Cargo.lock | 418 ++++++--------------- Cargo.toml | 2 +- transports/tls/src/certificate.rs | 14 +- transports/webrtc/Cargo.toml | 4 +- transports/webrtc/src/tokio/certificate.rs | 9 +- 5 files changed, 116 insertions(+), 331 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 32c801b314f..7447bdae039 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,30 +158,14 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" -[[package]] -name = "asn1-rs" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" -dependencies = [ - "asn1-rs-derive 0.4.0", - "asn1-rs-impl 0.1.0", - "displaydoc", - "nom", - "num-traits", - "rusticata-macros", - "thiserror 1.0.69", - "time", -] - [[package]] name = "asn1-rs" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5493c3bedbacf7fd7382c6346bbd66687d12bbaad3a89a2d2c303ee6cf20b048" dependencies = [ - "asn1-rs-derive 0.5.1", - "asn1-rs-impl 0.2.0", + "asn1-rs-derive", + "asn1-rs-impl", "displaydoc", "nom", "num-traits", @@ -190,18 +174,6 @@ dependencies = [ "time", ] -[[package]] -name = "asn1-rs-derive" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "synstructure 0.12.6", -] - [[package]] name = "asn1-rs-derive" version = "0.5.1" @@ -211,18 +183,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.95", - "synstructure 0.13.1", -] - -[[package]] -name = "asn1-rs-impl" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", + "synstructure", ] [[package]] @@ -636,12 +597,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -1267,27 +1222,13 @@ dependencies = [ "zeroize", ] -[[package]] -name = "der-parser" -version = "8.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" -dependencies = [ - "asn1-rs 0.5.2", - "displaydoc", - "nom", - "num-bigint", - "num-traits", - "rusticata-macros", -] - [[package]] name = "der-parser" version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" dependencies = [ - "asn1-rs 0.6.2", + "asn1-rs", "displaydoc", "nom", "num-bigint", @@ -1696,7 +1637,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" dependencies = [ "futures-io", - "rustls 0.23.20", + "rustls", "rustls-pki-types", ] @@ -2183,7 +2124,7 @@ dependencies = [ "http 1.2.0", "hyper", "hyper-util", - "rustls 0.23.20", + "rustls", "rustls-pki-types", "tokio", "tokio-rustls", @@ -2481,21 +2422,22 @@ checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" [[package]] name = "interceptor" -version = "0.10.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5927883184e6a819b22d5e4f5f7bc7ca134fde9b2026fbddd8d95249746ba21e" +checksum = "e5ab04c530fd82e414e40394cabe5f0ebfe30d119f10fe29d6e3561926af412e" dependencies = [ "async-trait", "bytes", "log", + "portable-atomic", "rand 0.8.5", "rtcp", - "rtp 0.9.0", + "rtp", "thiserror 1.0.69", "tokio", "waitgroup", "webrtc-srtp", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] @@ -2935,7 +2877,7 @@ dependencies = [ "quick-protobuf", "quickcheck-ext", "rand 0.8.5", - "ring 0.17.8", + "ring", "rmp-serde", "sec1", "serde", @@ -3195,8 +3137,8 @@ dependencies = [ "quickcheck", "quinn", "rand 0.8.5", - "ring 0.17.8", - "rustls 0.23.20", + "ring", + "rustls", "socket2", "thiserror 2.0.10", "tokio", @@ -3405,13 +3347,13 @@ dependencies = [ "libp2p-identity", "libp2p-swarm", "libp2p-yamux", - "rcgen 0.12.1", - "ring 0.17.8", - "rustls 0.23.20", + "rcgen", + "ring", + "rustls", "rustls-webpki 0.101.7", "thiserror 2.0.10", "tokio", - "x509-parser 0.16.0", + "x509-parser", "yasna", ] @@ -3457,8 +3399,8 @@ dependencies = [ "multihash", "quickcheck", "rand 0.8.5", - "rcgen 0.12.1", - "stun 0.7.0", + "rcgen", + "stun", "thiserror 2.0.10", "tokio", "tokio-util", @@ -3522,7 +3464,7 @@ dependencies = [ "libp2p-tcp", "parking_lot", "pin-project-lite", - "rcgen 0.12.1", + "rcgen", "rw-stream-sink", "soketto", "thiserror 2.0.10", @@ -4085,22 +4027,13 @@ dependencies = [ "memchr", ] -[[package]] -name = "oid-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" -dependencies = [ - "asn1-rs 0.5.2", -] - [[package]] name = "oid-registry" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d8034d9489cdaf79228eb9f6a3b8d7bb32ba00d6645ebd48eef4077ceb5bd9" dependencies = [ - "asn1-rs 0.6.2", + "asn1-rs", ] [[package]] @@ -4690,7 +4623,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.20", + "rustls", "socket2", "thiserror 2.0.10", "tokio", @@ -4706,9 +4639,9 @@ dependencies = [ "bytes", "getrandom 0.2.15", "rand 0.8.5", - "ring 0.17.8", + "ring", "rustc-hash", - "rustls 0.23.20", + "rustls", "rustls-pki-types", "slab", "thiserror 2.0.10", @@ -4833,26 +4766,15 @@ dependencies = [ [[package]] name = "rcgen" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52c4f3084aa3bc7dfbba4eff4fab2a54db4324965d8872ab933565e6fbd83bc6" -dependencies = [ - "pem", - "ring 0.16.20", - "time", - "x509-parser 0.15.1", - "yasna", -] - -[[package]] -name = "rcgen" -version = "0.12.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48406db8ac1f3cbc7dcdb56ec355343817958a356ff430259bb07baf7607e1e1" +checksum = "75e669e5202259b5314d1ea5397316ad400819437857b90861765f24c4cf80a2" dependencies = [ "pem", - "ring 0.17.8", + "ring", + "rustls-pki-types", "time", + "x509-parser", "yasna", ] @@ -4989,7 +4911,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.20", + "rustls", "rustls-pemfile", "rustls-pki-types", "serde", @@ -5030,21 +4952,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", -] - [[package]] name = "ring" version = "0.17.8" @@ -5055,8 +4962,8 @@ dependencies = [ "cfg-if", "getrandom 0.2.15", "libc", - "spin 0.9.8", - "untrusted 0.9.0", + "spin", + "untrusted", "windows-sys 0.52.0", ] @@ -5093,13 +5000,13 @@ dependencies = [ [[package]] name = "rtcp" -version = "0.10.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33648a781874466a62d89e265fee9f17e32bc7d05a256e6cca41bf97eadcd8aa" +checksum = "8306430fb118b7834bbee50e744dc34826eca1da2158657a3d6cbc70e24c2096" dependencies = [ "bytes", "thiserror 1.0.69", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] @@ -5123,28 +5030,17 @@ dependencies = [ [[package]] name = "rtp" -version = "0.9.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e60482acbe8afb31edf6b1413103b7bca7a65004c423b3c3993749a083994fbe" -dependencies = [ - "bytes", - "rand 0.8.5", - "serde", - "thiserror 1.0.69", - "webrtc-util 0.8.1", -] - -[[package]] -name = "rtp" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47fca9bd66ae0b1f3f649b8f5003d6176433d7293b78b0fce7e1031816bdd99d" +checksum = "e68baca5b6cb4980678713f0d06ef3a432aa642baefcbfd0f4dd2ef9eb5ab550" dependencies = [ "bytes", + "memchr", + "portable-atomic", "rand 0.8.5", "serde", "thiserror 1.0.69", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] @@ -5226,18 +5122,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "log", - "ring 0.17.8", - "rustls-webpki 0.101.7", - "sct", -] - [[package]] name = "rustls" version = "0.23.20" @@ -5245,7 +5129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "once_cell", - "ring 0.17.8", + "ring", "rustls-pki-types", "rustls-webpki 0.102.8", "subtle", @@ -5276,8 +5160,8 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", + "ring", + "untrusted", ] [[package]] @@ -5286,9 +5170,9 @@ version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ - "ring 0.17.8", + "ring", "rustls-pki-types", - "untrusted 0.9.0", + "untrusted", ] [[package]] @@ -5352,21 +5236,11 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - [[package]] name = "sdp" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13254db766b17451aced321e7397ebf0a446ef0c8d2942b6e67a95815421093f" +checksum = "02a526161f474ae94b966ba622379d939a8fe46c930eebbadb73e339622599d5" dependencies = [ "rand 0.8.5", "substring", @@ -5647,7 +5521,7 @@ dependencies = [ "chacha20poly1305", "curve25519-dalek", "rand_core 0.6.4", - "ring 0.17.8", + "ring", "rustc_version", "sha2 0.10.8", "subtle", @@ -5678,12 +5552,6 @@ dependencies = [ "sha1", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -5763,25 +5631,6 @@ dependencies = [ "syn 2.0.95", ] -[[package]] -name = "stun" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3f371788132e9d623e6eab4ba28aac083763a4133f045e6ebaee5ceb869803d" -dependencies = [ - "base64 0.21.7", - "crc", - "lazy_static", - "md-5", - "rand 0.8.5", - "ring 0.17.8", - "subtle", - "thiserror 1.0.69", - "tokio", - "url", - "webrtc-util 0.8.1", -] - [[package]] name = "stun" version = "0.7.0" @@ -5793,12 +5642,12 @@ dependencies = [ "lazy_static", "md-5", "rand 0.8.5", - "ring 0.17.8", + "ring", "subtle", "thiserror 1.0.69", "tokio", "url", - "webrtc-util 0.10.0", + "webrtc-util", ] [[package]] @@ -5847,18 +5696,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "unicode-xid", -] - [[package]] name = "synstructure" version = "0.13.1" @@ -6160,7 +5997,7 @@ version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ - "rustls 0.23.20", + "rustls", "tokio", ] @@ -6458,22 +6295,23 @@ dependencies = [ [[package]] name = "turn" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb2ac4f331064513ad510b7a36edc0df555bd61672986607f7c9ff46f98f415" +checksum = "0044fdae001dd8a1e247ea6289abf12f4fcea1331a2364da512f9cd680bbd8cb" dependencies = [ "async-trait", - "base64 0.21.7", + "base64 0.22.1", "futures", "log", "md-5", + "portable-atomic", "rand 0.8.5", - "ring 0.17.8", - "stun 0.5.1", + "ring", + "stun", "thiserror 1.0.69", "tokio", "tokio-util", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] @@ -6506,12 +6344,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - [[package]] name = "universal-hash" version = "0.5.1" @@ -6532,12 +6364,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -6812,9 +6638,9 @@ dependencies = [ [[package]] name = "webrtc" -version = "0.9.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91e7cf018f7185552bf6a5dd839f4ed9827aea33b746763c9a215f84a0d0b34" +checksum = "30367074d9f18231d28a74fab0120856b2b665da108d71a12beab7185a36f97b" dependencies = [ "arc-swap", "async-trait", @@ -6825,19 +6651,20 @@ dependencies = [ "lazy_static", "log", "pem", + "portable-atomic", "rand 0.8.5", - "rcgen 0.11.3", + "rcgen", "regex", - "ring 0.16.20", + "ring", "rtcp", - "rtp 0.9.0", - "rustls 0.21.12", + "rtp", + "rustls", "sdp", "serde", "serde_json", "sha2 0.10.8", "smol_str", - "stun 0.5.1", + "stun", "thiserror 1.0.69", "time", "tokio", @@ -6851,28 +6678,29 @@ dependencies = [ "webrtc-media", "webrtc-sctp", "webrtc-srtp", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] name = "webrtc-data" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c08e648e10572b9edbe741074e0f4d3cb221aa7cdf9a814ee71606de312f33" +checksum = "dec93b991efcd01b73c5b3503fa8adba159d069abe5785c988ebe14fcf8f05d1" dependencies = [ "bytes", "log", + "portable-atomic", "thiserror 1.0.69", "tokio", "webrtc-sctp", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] name = "webrtc-dtls" -version = "0.8.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b140b953f986e97828aa33ec6318186b05d862bee689efbc57af04a243e832" +checksum = "b7c9b89fc909f9da0499283b1112cd98f72fec28e55a54a9e352525ca65cd95c" dependencies = [ "aes", "aes-gcm", @@ -6881,18 +6709,19 @@ dependencies = [ "byteorder", "cbc", "ccm", - "der-parser 8.2.0", + "der-parser", "hkdf", "hmac 0.12.1", "log", "p256", "p384", "pem", + "portable-atomic", "rand 0.8.5", "rand_core 0.6.4", - "rcgen 0.11.3", - "ring 0.16.20", - "rustls 0.21.12", + "rcgen", + "ring", + "rustls", "sec1", "serde", "sha1", @@ -6900,25 +6729,26 @@ dependencies = [ "subtle", "thiserror 1.0.69", "tokio", - "webrtc-util 0.8.1", + "webrtc-util", "x25519-dalek", - "x509-parser 0.15.1", + "x509-parser", ] [[package]] name = "webrtc-ice" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66eb4b85646f1c52225779db3e1e7e873dede6db68cc9be080b648f1713083a3" +checksum = "0348b28b593f7709ac98d872beb58c0009523df652c78e01b950ab9c537ff17d" dependencies = [ "arc-swap", "async-trait", "crc", "log", + "portable-atomic", "rand 0.8.5", "serde", "serde_json", - "stun 0.5.1", + "stun", "thiserror 1.0.69", "tokio", "turn", @@ -6926,57 +6756,58 @@ dependencies = [ "uuid", "waitgroup", "webrtc-mdns", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] name = "webrtc-mdns" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce981f93104a8debb3563bb0cedfe4aa2f351fdf6b53f346ab50009424125c08" +checksum = "e6dfe9686c6c9c51428da4de415cb6ca2dc0591ce2b63212e23fd9cccf0e316b" dependencies = [ "log", "socket2", "thiserror 1.0.69", "tokio", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] name = "webrtc-media" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280017b6b9625ef7329146332518b339c3cceff231cc6f6a9e0e6acab25ca4af" +checksum = "e153be16b8650021ad3e9e49ab6e5fa9fb7f6d1c23c213fd8bbd1a1135a4c704" dependencies = [ "byteorder", "bytes", "rand 0.8.5", - "rtp 0.10.0", + "rtp", "thiserror 1.0.69", ] [[package]] name = "webrtc-sctp" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df75ec042002fe995194712cbeb2029107a60a7eab646f1b789eb1be94d0e367" +checksum = "5faf3846ec4b7e64b56338d62cbafe084aa79806b0379dff5cc74a8b7a2b3063" dependencies = [ "arc-swap", "async-trait", "bytes", "crc", "log", + "portable-atomic", "rand 0.8.5", "thiserror 1.0.69", "tokio", - "webrtc-util 0.8.1", + "webrtc-util", ] [[package]] name = "webrtc-srtp" -version = "0.11.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db1f36c1c81e4b1e531c0b9678ba0c93809e196ce62122d87259bb71c03b9f" +checksum = "771db9993712a8fb3886d5be4613ebf27250ef422bd4071988bf55f1ed1a64fa" dependencies = [ "aead", "aes", @@ -6987,32 +6818,12 @@ dependencies = [ "hmac 0.12.1", "log", "rtcp", - "rtp 0.9.0", + "rtp", "sha1", "subtle", "thiserror 1.0.69", "tokio", - "webrtc-util 0.8.1", -] - -[[package]] -name = "webrtc-util" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e85154ef743d9a2a116d104faaaa82740a281b8b4bed5ee691a2df6c133d873" -dependencies = [ - "async-trait", - "bitflags 1.3.2", - "bytes", - "ipnet", - "lazy_static", - "libc", - "log", - "nix", - "rand 0.8.5", - "thiserror 1.0.69", - "tokio", - "winapi", + "webrtc-util", ] [[package]] @@ -7430,36 +7241,19 @@ dependencies = [ "zeroize", ] -[[package]] -name = "x509-parser" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7069fba5b66b9193bd2c5d3d4ff12b839118f6bcbef5328efafafb5395cf63da" -dependencies = [ - "asn1-rs 0.5.2", - "data-encoding", - "der-parser 8.2.0", - "lazy_static", - "nom", - "oid-registry 0.6.1", - "ring 0.16.20", - "rusticata-macros", - "thiserror 1.0.69", - "time", -] - [[package]] name = "x509-parser" version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" dependencies = [ - "asn1-rs 0.6.2", + "asn1-rs", "data-encoding", - "der-parser 9.0.0", + "der-parser", "lazy_static", "nom", - "oid-registry 0.7.1", + "oid-registry", + "ring", "rusticata-macros", "thiserror 1.0.69", "time", @@ -7541,7 +7335,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.95", - "synstructure 0.13.1", + "synstructure", ] [[package]] @@ -7583,7 +7377,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.95", - "synstructure 0.13.1", + "synstructure", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 08202709424..48ff39c20a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,7 +132,7 @@ multistream-select = { version = "0.13.0", path = "misc/multistream-select" } prometheus-client = "0.22.2" quick-protobuf-codec = { version = "0.3.1", path = "misc/quick-protobuf-codec" } quickcheck = { package = "quickcheck-ext", path = "misc/quickcheck-ext" } -rcgen = "0.12.1" +rcgen = "0.13" ring = "0.17.8" rw-stream-sink = { version = "0.4.0", path = "misc/rw-stream-sink" } thiserror = "2" diff --git a/transports/tls/src/certificate.rs b/transports/tls/src/certificate.rs index c3b8bdcce7c..9bbc158e4fb 100644 --- a/transports/tls/src/certificate.rs +++ b/transports/tls/src/certificate.rs @@ -40,10 +40,6 @@ const P2P_EXT_OID: [u64; 9] = [1, 3, 6, 1, 4, 1, 53594, 1, 1]; /// in possession of the private host key at the time the certificate was signed. const P2P_SIGNING_PREFIX: [u8; 21] = *b"libp2p-tls-handshake:"; -// Certificates MUST use the NamedCurve encoding for elliptic curve parameters. -// Similarly, hash functions with an output length less than 256 bits MUST NOT be used. -static P2P_SIGNATURE_ALGORITHM: &rcgen::SignatureAlgorithm = &rcgen::PKCS_ECDSA_P256_SHA256; - #[derive(Debug)] pub(crate) struct AlwaysResolvesCert(Arc); @@ -99,24 +95,22 @@ pub fn generate( // Endpoints MAY generate a new key and certificate // for every connection attempt, or they MAY reuse the same key // and certificate for multiple connections. - let certificate_keypair = rcgen::KeyPair::generate(P2P_SIGNATURE_ALGORITHM)?; + let certificate_keypair = rcgen::KeyPair::generate()?; let rustls_key = rustls::pki_types::PrivateKeyDer::from( rustls::pki_types::PrivatePkcs8KeyDer::from(certificate_keypair.serialize_der()), ); let certificate = { - let mut params = rcgen::CertificateParams::new(vec![]); + let mut params = rcgen::CertificateParams::new(vec![])?; params.distinguished_name = rcgen::DistinguishedName::new(); params.custom_extensions.push(make_libp2p_extension( identity_keypair, &certificate_keypair, )?); - params.alg = P2P_SIGNATURE_ALGORITHM; - params.key_pair = Some(certificate_keypair); - rcgen::Certificate::from_params(params)? + params.self_signed(&certificate_keypair)? }; - let rustls_certificate = rustls::pki_types::CertificateDer::from(certificate.serialize_der()?); + let rustls_certificate = rustls::pki_types::CertificateDer::from(certificate.der().to_vec()); Ok((rustls_certificate, rustls_key)) } diff --git a/transports/webrtc/Cargo.toml b/transports/webrtc/Cargo.toml index d43be5720d4..eca6c34870d 100644 --- a/transports/webrtc/Cargo.toml +++ b/transports/webrtc/Cargo.toml @@ -28,8 +28,8 @@ thiserror = { workspace = true } tokio = { workspace = true, features = ["net"], optional = true } tokio-util = { version = "0.7", features = ["compat"], optional = true } tracing = { workspace = true } -webrtc = { version = "0.9.0", optional = true } -webrtc-ice = "=0.10.0" # smoke tests only work with this version +webrtc = { version = "0.12.0", optional = true } +webrtc-ice = "0.12.0" [features] tokio = ["dep:tokio", "dep:tokio-util", "dep:webrtc", "if-watch/tokio"] diff --git a/transports/webrtc/src/tokio/certificate.rs b/transports/webrtc/src/tokio/certificate.rs index 7ff35d46bdd..7cc4c82c87a 100644 --- a/transports/webrtc/src/tokio/certificate.rs +++ b/transports/webrtc/src/tokio/certificate.rs @@ -18,7 +18,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -use rand::{distributions::DistString, CryptoRng, Rng}; +use rand::{CryptoRng, Rng}; use webrtc::peer_connection::certificate::RTCCertificate; use crate::tokio::fingerprint::Fingerprint; @@ -37,12 +37,9 @@ impl Certificate { where R: CryptoRng + Rng, { - let mut params = rcgen::CertificateParams::new(vec![ - rand::distributions::Alphanumeric.sample_string(&mut rand::thread_rng(), 16) - ]); - params.alg = &rcgen::PKCS_ECDSA_P256_SHA256; + let keypair = rcgen::KeyPair::generate().expect("keypair to be able to be generated"); Ok(Self { - inner: RTCCertificate::from_params(params).expect("default params to work"), + inner: RTCCertificate::from_key_pair(keypair).expect("default params to work"), }) }