Skip to content

Commit 7fc41a7

Browse files
authored
Use any available curve for dtls connection (#654)
1 parent ffead9f commit 7fc41a7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dtls/src/flight/flight0.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use super::flight2::*;
88
use super::*;
99
use crate::config::*;
1010
use crate::conn::*;
11+
use crate::curve::named_curve::NamedCurve;
1112
use crate::error::Error;
1213
use crate::extension::*;
1314
use crate::handshake::*;
@@ -111,7 +112,12 @@ impl Flight for Flight0 {
111112
Some(Error::ErrNoSupportedEllipticCurves),
112113
));
113114
}
114-
state.named_curve = e.elliptic_curves[0];
115+
for curve in e.elliptic_curves.iter() {
116+
if curve != &NamedCurve::Unsupported {
117+
state.named_curve = *curve;
118+
break;
119+
}
120+
}
115121
}
116122
Extension::UseSrtp(e) => {
117123
if let Ok(profile) = find_matching_srtp_profile(

0 commit comments

Comments
 (0)