Skip to content

Failure to update key after mki failure #710

@pbodilis

Description

@pbodilis

As a receiver, I fail to update srtp keys with MKI using the srtp_stream_update
This is new to master, this works fine with version 2.6.0

scenario:

  1. init srtp with ssrc_any_inbound, use_mki is true
  2. try to unprotect a packet with ssrc0 and associated mki0 => failure
  3. add srtp key with matching mki0 => success
  4. try to unprotect a packet with ssrc0 and associated mki0 => success
  5. try to unprotect a packet with ssrc1 and associated mki1 => failure
  6. add srtp key with matching mki1 => failure
  7. update srtp with srtp key with matching mki1 => failure

I suspect the bug to be around update_template_stream_cb or srtp_stream_remove.

srtp_unprotect creates a new stream with srtp_stream_clone, ssrc is stored in network order


static bool update_template_stream_cb(srtp_stream_t stream, void *raw_data)
{
    struct update_template_stream_data *data =
        (struct update_template_stream_data *)raw_data;
    srtp_t session = data->session;
    uint32_t ssrc = stream->ssrc; // ssrc is in network order
...


    /* remove stream */
    data->status = srtp_stream_remove(session, ssrc);
    if (data->status) {
        return false;
    }



but then, srtp_strp_remove expect ssrc to be given in host order

so possible fix can be to replace the call in update_template_stream_cb to be consistent with the changes made in the API:
data->status = srtp_stream_remove(session, ntohl(ssrc));

PR: #711

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions