webrtc_srtp_kdf (webrtc v0.1.0)
View SourceSRTP key derivation (RFC 3711 §4.3) with the AES-CM PRF (RFC 3711 §4.3.3, RFC 6188 §7 for AES-256 master keys).
The key derivation rate is always 0 (RFC 5764 §4.1.2, RFC 7714 §11), so index DIV kdr is 0 and each session key is derived exactly once, when the context is created.
Master salts shorter than 112 bits (the 96-bit AES-GCM salt of RFC 7714) are extended with trailing zero octets before the XOR with the key id. This is the layout used by libsrtp and therefore by browsers; see docs/compliance/srtp.md (SRTP-KDF-4).
Summary
Functions
Derive Len octets for Label with kdr = 0 (RFC 3711 §4.3.1): x = (Label || 0^48) XOR master_salt, then PRF_n(k_master, x).
Len octets of AES counter mode keystream starting at block IV (RFC 3711 §4.1.1).
AES-CM PRF (RFC 3711 §4.3.3): AES counter mode keyed with the master key, IV = x * 2^16, output truncated to Len octets.
Derive all session keys of a profile from a master key and salt. For AEAD profiles the authentication keys are empty binaries.
Types
Functions
-spec derive(0..255, binary(), binary(), non_neg_integer()) -> binary().
Derive Len octets for Label with kdr = 0 (RFC 3711 §4.3.1): x = (Label || 0^48) XOR master_salt, then PRF_n(k_master, x).
-spec keystream(binary(), <<_:128>>, non_neg_integer()) -> binary().
Len octets of AES counter mode keystream starting at block IV (RFC 3711 §4.1.1).
-spec prf(binary(), <<_:112>>, non_neg_integer()) -> binary().
AES-CM PRF (RFC 3711 §4.3.3): AES counter mode keyed with the master key, IV = x * 2^16, output truncated to Len octets.
-spec session_keys(webrtc_srtp_profile:profile(), binary(), binary()) -> session_keys().
Derive all session keys of a profile from a master key and salt. For AEAD profiles the authentication keys are empty binaries.