Skip to main content

str0m_aws_lc_rs/
lib.rs

1//! AWS-LC-RS implementation of cryptographic functions.
2//! DTLS via dimpl with AWS-LC-RS as crypto backend.
3
4mod dtls;
5mod sha1;
6mod sha256;
7mod srtp;
8
9use dtls::AwsLcRsDtlsProvider;
10use sha1::AwsLcRsSha1HmacProvider;
11use sha256::AwsLcRsSha256Provider;
12use srtp::AwsLcRsSrtpProvider;
13use str0m_proto::crypto::CryptoProvider;
14
15/// Create the default AWS-LC-RS crypto provider.
16///
17/// This provider implements all cryptographic operations required for WebRTC:
18/// - DTLS 1.2 for secure key exchange (using dimpl protocol + AWS-LC-RS)
19/// - SRTP for encrypted media
20/// - SHA1-HMAC for STUN message integrity
21/// - SHA-256 for certificate fingerprints
22///
23/// # Supported SRTP Profiles
24///
25/// - `SRTP_AES128_CM_SHA1_80`
26/// - `SRTP_AEAD_AES_128_GCM`
27/// - `SRTP_AEAD_AES_256_GCM`
28pub fn default_provider() -> CryptoProvider {
29    static SRTP: AwsLcRsSrtpProvider = AwsLcRsSrtpProvider;
30    static SHA1_HMAC: AwsLcRsSha1HmacProvider = AwsLcRsSha1HmacProvider;
31    static SHA256: AwsLcRsSha256Provider = AwsLcRsSha256Provider;
32    static DTLS: AwsLcRsDtlsProvider = AwsLcRsDtlsProvider;
33
34    CryptoProvider {
35        srtp_provider: &SRTP,
36        sha1_hmac_provider: &SHA1_HMAC,
37        sha256_provider: &SHA256,
38        dtls_provider: &DTLS,
39    }
40}