Browse Source

reset DTLS and crypto params when endpoints change

pull/53/head
Richard Fuchs 11 years ago
parent
commit
50d1839ffe
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      daemon/call.c

+ 11
- 4
daemon/call.c View File

@ -1666,6 +1666,13 @@ static void __assign_stream_fds(struct call_media *media, GList *sfds) {
assert(sfds != NULL);
ps = l->data;
sfd = sfds->data;
/* if we switch local ports, we reset crypto params */
if (ps->sfd && ps->sfd != sfd) {
dtls_shutdown(ps);
crypto_reset(&ps->sfd->crypto);
}
ps->sfd = sfd;
sfd->stream = ps;
sfds = sfds->next;
@ -1718,11 +1725,11 @@ static int __num_media_streams(struct call_media *media, unsigned int num_ports)
static void __fill_stream(struct packet_stream *ps, const struct endpoint *ep, unsigned int port_off) {
ps->endpoint = *ep;
ps->endpoint.port += port_off;
/* we SHOULD remember the crypto contexts of previously used endpoints,
* but instead we reset it every time it changes, which is incompatible
* with what we're doing on our side (remembers in the stream_fd) */
if (memcmp(&ps->advertised_endpoint, &ps->endpoint, sizeof(ps->endpoint)))
/* we reset crypto params whenever the endpoint changes */
if (memcmp(&ps->advertised_endpoint, &ps->endpoint, sizeof(ps->endpoint))) {
crypto_reset(&ps->crypto);
dtls_shutdown(ps);
}
ps->advertised_endpoint = ps->endpoint;
PS_SET(ps, FILLED);
}


Loading…
Cancel
Save