Refactor key derivation code to be more explicit and testable

Open
#766 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
c

Research direction

Start by reading srtp_stream_init_keys and the related RTP/RTCP key-derivation paths. Identify applicable RFC test vectors and use them to check the function's output; the issue does not name specific test files. Done means key and salt are passed separately, input lengths are explicit, cipher compatibility is checked, and the result can be tested against those vectors.

Written by the indexing model from the issue text.

Description

The function srtp_stream_init_keys has been the cause of several bugs, the latest being #763 / #765 . The code there uses heuristics to determine key lengths but there should be no need as this should be explicit for each cipher type.

Input key and salt length should be passed in to prevent reading out of bounds.
Key and Salt should be passed in separately.
RTCP & RTP share the kdf even though there is no check they are the same cipher.
The result of this function should be testable as there exists test vectors in a lot of RFC's.

Any public API changes should be done before 3.0 .

Dominant language
C
Stars
1.4k
Forks
523
Avg merge
3d 23h
Merged PRs (30d)
14

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cisco/libsrtp

All issues in cisco/libsrtp

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.