Skip to content

Commit 6e8388d

Browse files
authored
Merge branch 'master' into stop-pc-bug
2 parents b15f1cb + 71b2875 commit 6e8388d

File tree

97 files changed

+448
-588
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+448
-588
lines changed

.github/workflows/cargo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
matrix:
2121
os: ["ubuntu-latest", "macos-latest"]
2222
toolchain:
23-
- 1.63.0 # min supported version (https://github.com/webrtc-rs/webrtc/#toolchain)
23+
- 1.65.0 # min supported version (https://github.com/webrtc-rs/webrtc/#toolchain)
2424
- stable
2525
runs-on: ${{ matrix.os }}
2626
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ This project is still in active and early development stage, please refer to the
105105

106106
### Toolchain
107107

108-
**Minimum Supported Rust Version:** `1.63.0`
108+
**Minimum Supported Rust Version:** `1.65.0`
109109

110110
Our minimum supported rust version(MSRV) policy is to support versions of the compiler released within the last six months. We don't eagerly bump the minimum version we support, instead the minimum will be bumped on a needed by needed basis, usually because downstream dependencies force us to.
111111

dtls/Cargo.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "webrtc-dtls"
3-
version = "0.7.1"
3+
version = "0.7.2"
44
authors = ["Rain Liu <[email protected]>"]
55
edition = "2021"
66
description = "A pure Rust implementation of DTLS"
@@ -17,11 +17,7 @@ util = { version = "0.7.0", path = "../util", package = "webrtc-util", default-f
1717

1818
byteorder = "1"
1919
rand_core = "0.6.3"
20-
elliptic-curve = { version = "0.12.1", features = ["default", "ecdh"] }
21-
# required because elliptic-curve requires "0.12", but "0.12.0" does not compile.
2220
hkdf = "~0.12.1"
23-
# required because elliptic-curve requires "3", but "3.0.0" does not compile.
24-
curve25519-dalek = "3.2"
2521
p256 = { version = "0.11.1", features = ["default", "ecdh", "ecdsa"] }
2622
p384 = "0.11.2"
2723
rand = "0.8.5"
@@ -35,8 +31,7 @@ aes-gcm = "0.10.1"
3531
ccm = "0.3.0"
3632
tokio = { version = "1.19", features = ["full"] }
3733
async-trait = "0.1.56"
38-
x25519-dalek = "2.0.0-pre.1"
39-
signature = "1.2.2"
34+
x25519-dalek = { version = "2.0.0-rc.2", features = ["static_secrets"] }
4035
x509-parser = "0.13.2"
4136
der-parser = "8.1"
4237
rcgen = "0.10.0"

dtls/src/config.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,36 +134,26 @@ pub(crate) type PskCallback = Arc<dyn (Fn(&[u8]) -> Result<Vec<u8>>) + Send + Sy
134134

135135
// ClientAuthType declares the policy the server will follow for
136136
// TLS Client Authentication.
137-
#[derive(Copy, Clone, PartialEq, Eq)]
137+
#[derive(Default, Copy, Clone, PartialEq, Eq)]
138138
pub enum ClientAuthType {
139+
#[default]
139140
NoClientCert = 0,
140141
RequestClientCert = 1,
141142
RequireAnyClientCert = 2,
142143
VerifyClientCertIfGiven = 3,
143144
RequireAndVerifyClientCert = 4,
144145
}
145146

146-
impl Default for ClientAuthType {
147-
fn default() -> Self {
148-
ClientAuthType::NoClientCert
149-
}
150-
}
151-
152147
// ExtendedMasterSecretType declares the policy the client and server
153148
// will follow for the Extended Master Secret extension
154-
#[derive(PartialEq, Eq, Copy, Clone)]
149+
#[derive(Default, PartialEq, Eq, Copy, Clone)]
155150
pub enum ExtendedMasterSecretType {
151+
#[default]
156152
Request = 0,
157153
Require = 1,
158154
Disable = 2,
159155
}
160156

161-
impl Default for ExtendedMasterSecretType {
162-
fn default() -> Self {
163-
ExtendedMasterSecretType::Request
164-
}
165-
}
166-
167157
pub(crate) fn validate_config(is_client: bool, config: &Config) -> Result<()> {
168158
if is_client && config.psk.is_some() && config.psk_identity_hint.is_none() {
169159
return Err(Error::ErrPskAndIdentityMustBeSetForClient);

dtls/src/content.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ use crate::error::*;
77
use std::io::{Read, Write};
88

99
// https://tools.ietf.org/html/rfc4346#section-6.2.1
10-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
10+
#[derive(Default, Copy, Clone, PartialEq, Eq, Debug)]
1111
pub enum ContentType {
1212
ChangeCipherSpec = 20,
1313
Alert = 21,
1414
Handshake = 22,
1515
ApplicationData = 23,
16+
#[default]
1617
Invalid,
1718
}
1819

@@ -28,12 +29,6 @@ impl From<u8> for ContentType {
2829
}
2930
}
3031

31-
impl Default for ContentType {
32-
fn default() -> Self {
33-
ContentType::Invalid
34-
}
35-
}
36-
3732
#[derive(PartialEq, Debug, Clone)]
3833
pub enum Content {
3934
ChangeCipherSpec(ChangeCipherSpec),

dtls/src/curve/named_curve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn elliptic_curve_keypair(curve: NamedCurve) -> Result<NamedCurveKeypair> {
5454
)
5555
}
5656
NamedCurve::X25519 => {
57-
let secret_key = x25519_dalek::StaticSecret::new(OsRng);
57+
let secret_key = x25519_dalek::StaticSecret::random_from_rng(OsRng);
5858
let public_key = x25519_dalek::PublicKey::from(&secret_key);
5959
(
6060
public_key.as_bytes().to_vec(),

dtls/src/handshake/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use handshake_message_server_hello_done::*;
3434
use handshake_message_server_key_exchange::*;
3535

3636
// https://tools.ietf.org/html/rfc5246#section-7.4
37-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
37+
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq, Hash)]
3838
pub enum HandshakeType {
3939
HelloRequest = 0,
4040
ClientHello = 1,
@@ -47,6 +47,7 @@ pub enum HandshakeType {
4747
CertificateVerify = 15,
4848
ClientKeyExchange = 16,
4949
Finished = 20,
50+
#[default]
5051
Invalid,
5152
}
5253

@@ -88,12 +89,6 @@ impl From<u8> for HandshakeType {
8889
}
8990
}
9091

91-
impl Default for HandshakeType {
92-
fn default() -> Self {
93-
HandshakeType::Invalid
94-
}
95-
}
96-
9792
#[derive(PartialEq, Debug, Clone)]
9893
pub enum HandshakeMessage {
9994
//HelloRequest(errNotImplemented),

examples/examples/play-from-disk-h264/play-from-disk-h264.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async fn main() -> Result<()> {
172172
// Open a H264 file and start reading using our H264Reader
173173
let file = File::open(&video_file_name)?;
174174
let reader = BufReader::new(file);
175-
let mut h264 = H264Reader::new(reader);
175+
let mut h264 = H264Reader::new(reader, 1_048_576);
176176

177177
// Wait for connection established
178178
notify_video.notified().await;

examples/examples/signal/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ edition = "2021"
88
[dependencies]
99
tokio = { version = "1.15.0", features = ["full"] }
1010
anyhow = "1.0.52"
11-
base64 = "0.13.0"
11+
base64 = "0.21.2"
1212
lazy_static = "1.4"
1313
hyper = { version = "0.14.16", features = ["full"] }

examples/examples/signal/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#![allow(dead_code)]
33

44
use anyhow::Result;
5+
use base64::prelude::BASE64_STANDARD;
6+
use base64::Engine;
57
use hyper::service::{make_service_fn, service_fn};
68
use hyper::{Body, Method, Request, Response, Server, StatusCode};
79
use std::net::SocketAddr;
@@ -92,13 +94,13 @@ pub fn encode(b: &str) -> String {
9294
// b = zip(b)
9395
//}
9496

95-
base64::encode(b)
97+
BASE64_STANDARD.encode(b)
9698
}
9799

98100
/// decode decodes the input from base64
99101
/// It can optionally unzip the input after decoding
100102
pub fn decode(s: &str) -> Result<String> {
101-
let b = base64::decode(s)?;
103+
let b = BASE64_STANDARD.decode(s)?;
102104

103105
//if COMPRESS {
104106
// b = unzip(b)

0 commit comments

Comments
 (0)