this fixes rtcp auth problems against libsrtp based clients

taking rfc 3711 literally, this seems to be incorrect.
git.mgm/mediaproxy-ng/github/master
Richard Fuchs 13 years ago
parent f6d91122af
commit cf5e4fab3e

@ -323,13 +323,13 @@ static inline int check_session_keys(struct crypto_context *c) {
goto error;
str_init_len(&s, c->session_key, c->crypto_suite->session_key_len);
if (crypto_gen_session_key(c, &s, 0x03, 4))
if (crypto_gen_session_key(c, &s, 0x03, 6))
goto error;
str_init_len(&s, c->session_auth_key, c->crypto_suite->srtcp_auth_key_len);
if (crypto_gen_session_key(c, &s, 0x04, 4))
if (crypto_gen_session_key(c, &s, 0x04, 6))
goto error;
str_init_len(&s, c->session_salt, c->crypto_suite->session_salt_len);
if (crypto_gen_session_key(c, &s, 0x05, 4))
if (crypto_gen_session_key(c, &s, 0x05, 6))
goto error;
c->have_session_key = 1;

@ -218,9 +218,9 @@ sub gen_rtp_session_keys {
sub gen_rtcp_session_keys {
my ($master_key, $master_salt) = @_;
my $session_key = prf_n(128, $master_key, xor_112($master_salt, "\3\0\0\0\0"));
my $auth_key = prf_n(160, $master_key, xor_112($master_salt, "\4\0\0\0\0"));
my $session_salt = prf_n(112, $master_key, xor_112($master_salt, "\5\0\0\0\0"));
my $session_key = prf_n(128, $master_key, xor_112($master_salt, "\3\0\0\0\0\0\0"));
my $auth_key = prf_n(160, $master_key, xor_112($master_salt, "\4\0\0\0\0\0\0"));
my $session_salt = prf_n(112, $master_key, xor_112($master_salt, "\5\0\0\0\0\0\0"));
# print("RTCP keys generated for master key " . unpack("H8", $master_key) . "... and salt " .
# unpack("H8", $master_salt) . "... are: " .
# unpack("H8", $session_key) . "..., " .

Loading…
Cancel
Save