Skip to content

Commit c469702

Browse files
committed
Refactor crypto provider flags
1 parent 0fbb3ad commit c469702

Some content is hidden

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

42 files changed

+609
-241
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"rust-analyzer.cargo.features": "all"
3+
}

src/_internal_test_exports/fuzz.rs

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub fn rtp_packet(data: &[u8]) -> Option<()> {
5656
let mut session = Session::new(&config);
5757
session.set_keying_material(
5858
KeyingMaterial::new(rng.slice(16)?.to_vec()),
59+
&crate::crypto::SrtpCrypto::new_openssl(),
5960
SrtpProfile::PassThrough,
6061
rng.bool()?,
6162
);

src/bwe.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,25 @@ impl<'a> Bwe<'a> {
3636
/// Staring at the lower layer, call:
3737
///
3838
/// ```
39+
/// # #[cfg(feature = "openssl")] {
3940
/// # use str0m::{Rtc, bwe::Bitrate};
4041
/// let mut rtc = Rtc::new();
4142
///
4243
/// rtc.bwe().set_current_bitrate(Bitrate::kbps(250));
43-
/// ````
44+
/// # }
45+
/// ```
4446
///
4547
/// When a new estimate is made available that indicates a switch to the medium layer is
4648
/// possible, make the switch and then update the configuration:
4749
///
4850
/// ```
51+
/// # #[cfg(feature = "openssl")] {
4952
/// # use str0m::{Rtc, bwe::Bitrate};
5053
/// let mut rtc = Rtc::new();
5154
///
5255
/// rtc.bwe().set_current_bitrate(Bitrate::kbps(750));
53-
/// ````
56+
/// # }
57+
/// ```
5458
///
5559
/// ## Accuracy
5660
///

src/change/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,3 @@ pub use sdp::{SdpAnswer, SdpApi, SdpOffer, SdpPendingOffer};
1818

1919
mod direct;
2020
pub use direct::DirectApi;
21-
22-
pub use crate::crypto::Fingerprint;
23-
pub use crate::dtls::DtlsCert;

src/change/sdp.rs

+16
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ impl<'a> SdpApi<'a> {
193193
/// If changes have been made, nothing happens until we call [`SdpApi::apply()`].
194194
///
195195
/// ```
196+
/// # #[cfg(feature = "openssl")] {
196197
/// # use str0m::{Rtc, media::MediaKind, media::Direction};
197198
/// let mut rtc = Rtc::new();
198199
///
@@ -201,6 +202,7 @@ impl<'a> SdpApi<'a> {
201202
///
202203
/// let mid = changes.add_media(MediaKind::Audio, Direction::SendRecv, None, None);
203204
/// assert!(changes.has_changes());
205+
/// # }
204206
/// ```
205207
pub fn has_changes(&self) -> bool {
206208
!self.changes.0.is_empty()
@@ -218,12 +220,14 @@ impl<'a> SdpApi<'a> {
218220
/// CNAME in the RTP SDES.
219221
///
220222
/// ```
223+
/// # #[cfg(feature = "openssl")] {
221224
/// # use str0m::{Rtc, media::MediaKind, media::Direction};
222225
/// let mut rtc = Rtc::new();
223226
///
224227
/// let mut changes = rtc.sdp_api();
225228
///
226229
/// let mid = changes.add_media(MediaKind::Audio, Direction::SendRecv, None, None);
230+
/// # }
227231
/// ```
228232
pub fn add_media(
229233
&mut self,
@@ -322,12 +326,14 @@ impl<'a> SdpApi<'a> {
322326
/// useful when multiple channels are in use at the same time.
323327
///
324328
/// ```
329+
/// # #[cfg(feature = "openssl")] {
325330
/// # use str0m::Rtc;
326331
/// let mut rtc = Rtc::new();
327332
///
328333
/// let mut changes = rtc.sdp_api();
329334
///
330335
/// let cid = changes.add_channel("my special channel".to_string());
336+
/// # }
331337
/// ```
332338
pub fn add_channel(&mut self, label: String) -> ChannelId {
333339
self.add_channel_with_config(ChannelConfig {
@@ -341,6 +347,7 @@ impl<'a> SdpApi<'a> {
341347
/// Refer to `add_channel` for more details.
342348
///
343349
/// ```
350+
/// # #[cfg(feature = "openssl")] {
344351
/// # use str0m::{channel::{ChannelConfig, Reliability}, Rtc};
345352
/// let mut rtc = Rtc::new();
346353
///
@@ -352,6 +359,7 @@ impl<'a> SdpApi<'a> {
352359
/// ordered: false,
353360
/// ..Default::default()
354361
/// });
362+
/// # }
355363
/// ```
356364
pub fn add_channel_with_config(&mut self, config: ChannelConfig) -> ChannelId {
357365
let has_media = self.rtc.session.app().is_some();
@@ -405,11 +413,13 @@ impl<'a> SdpApi<'a> {
405413
/// the current [`SdpPendingOffer`].
406414
///
407415
/// ```
416+
/// # #[cfg(feature = "openssl")] {
408417
/// # use str0m::Rtc;
409418
/// let mut rtc = Rtc::new();
410419
///
411420
/// let changes = rtc.sdp_api();
412421
/// assert!(changes.apply().is_none());
422+
/// # }
413423
/// ```
414424
pub fn apply(self) -> Option<(SdpOffer, SdpPendingOffer)> {
415425
if self.changes.is_empty() {
@@ -1558,6 +1568,8 @@ mod test {
15581568

15591569
#[test]
15601570
fn test_out_of_order_error() {
1571+
crate::init_crypto_default();
1572+
15611573
let mut rtc1 = Rtc::new();
15621574
let mut rtc2 = Rtc::new();
15631575

@@ -1580,6 +1592,8 @@ mod test {
15801592

15811593
#[test]
15821594
fn sdp_api_merge_works() {
1595+
crate::init_crypto_default();
1596+
15831597
let mut rtc = Rtc::new();
15841598
let mut changes = rtc.sdp_api();
15851599
changes.add_media(MediaKind::Audio, Direction::SendOnly, None, None);
@@ -1596,6 +1610,8 @@ mod test {
15961610

15971611
#[test]
15981612
fn test_rtp_payload_priority() {
1613+
crate::init_crypto_default();
1614+
15991615
let mut rtc1 = Rtc::builder()
16001616
.clear_codecs()
16011617
.enable_h264(true)

0 commit comments

Comments
 (0)