str0m's DTLS stack (dimpl) hard-codes the SRTP profile a DTLS server picks (AES-256-GCM first), with no way to configure it. Official TeamSpeak 6 clients use AES_CM_128_HMAC_SHA1_80, so we need to patch dimpl. This commit only vendors the crate as published and routes crates.io's dimpl to it; the change follows separately so it can be reviewed and dropped on its own. third_party is excluded from the workspace so dimpl's dev-dependencies and tests stay out of our builds, and own-crates.sh skips it like crates/proto. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
65 lines
1.5 KiB
Rust
65 lines
1.5 KiB
Rust
#![allow(unused)]
|
|
|
|
//! OpenSSL implementation of cryptographic functions.
|
|
|
|
/// Errors that can arise in DTLS.
|
|
#[derive(Debug)]
|
|
pub enum CryptoError {
|
|
/// Some error from OpenSSL layer (used for DTLS).
|
|
OpenSsl(openssl::error::ErrorStack),
|
|
|
|
/// Other IO errors.
|
|
Io(io::Error),
|
|
}
|
|
|
|
impl From<openssl::error::ErrorStack> for CryptoError {
|
|
fn from(value: openssl::error::ErrorStack) -> Self {
|
|
CryptoError::OpenSsl(value)
|
|
}
|
|
}
|
|
|
|
impl From<io::Error> for CryptoError {
|
|
fn from(value: io::Error) -> Self {
|
|
CryptoError::Io(value)
|
|
}
|
|
}
|
|
|
|
mod cert;
|
|
use std::io;
|
|
|
|
pub use cert::{DtlsCertOptions, DtlsPKeyType, Fingerprint, OsslDtlsCert};
|
|
|
|
pub mod io_buf;
|
|
mod stream;
|
|
|
|
mod dtls;
|
|
use dimpl::SrtpProfile;
|
|
pub use dtls::{OsslDtlsImpl, dtls_ssl_create};
|
|
|
|
pub use io_buf::DatagramSend;
|
|
use std::collections::VecDeque;
|
|
|
|
/// Targeted MTU
|
|
pub(crate) const DATAGRAM_MTU: usize = 1150;
|
|
|
|
/// Warn if any packet we are about to send is above this size.
|
|
pub(crate) const DATAGRAM_MTU_WARN: usize = 1280;
|
|
|
|
/// Events arising from a [`Dtls`] instance.
|
|
#[derive(Debug)]
|
|
pub enum DtlsEvent {
|
|
/// When the DTLS has finished handshaking.
|
|
Connected,
|
|
|
|
/// Keying material for SRTP encryption master key and the selected SRTP profile.
|
|
SrtpKeyingMaterial(Vec<u8>, SrtpProfile),
|
|
|
|
/// The fingerprint of the remote peer.
|
|
///
|
|
/// This should be checked against the fingerprint communicated in the SDP.
|
|
RemoteFingerprint(Fingerprint),
|
|
|
|
/// Decrypted data from incoming DTLS traffic.
|
|
Data(Vec<u8>),
|
|
}
|