Skip to content

update policy config api#790

Merged
pabuhler merged 15 commits into
cisco:mainfrom
pabuhler:policy-api
May 11, 2026
Merged

update policy config api#790
pabuhler merged 15 commits into
cisco:mainfrom
pabuhler:policy-api

Conversation

@pabuhler

@pabuhler pabuhler commented Feb 8, 2026

Copy link
Copy Markdown
Member

As part of the API changes for 3.0, would like to simplify the policy API as well as making it easier to extend in the future. The current API has far to many details and can be cumbersome to set up and validate.

Main changes:

  • move from a public struct to a opaque handle
  • use profiles to initialize crypto policy
  • remove detailed config options, can be added if needed
  • use explicit key size's
  • remove policy list
  • add tests

Either a single policy can be used with srtp_create() or else multiple policies can be used with multiple calls to srtp_add_stream() .

A minimal example would be

srtp_policy_t policy;
srtp_policy_create(&policy);
srtp_policy_set_ssrc(policy, (srtp_ssrc_t){ ssrc_any_outbound, 0 });
srtp_policy_set_profile(policy, srtp_profile_aes128_cm_sha1_80);
srtp_policy_set_key(policy, master_key, sizeof(master_key), master_salt, sizeof(master_salt));
srtp_create(&srtp, policy); 

It could be nice to remove the set_ssrc() function if a suitable default behavior could be found.

@pabuhler pabuhler added this to the Version 3.0 milestone Feb 8, 2026
@pabuhler

pabuhler commented Feb 8, 2026

Copy link
Copy Markdown
Member Author

The implementation is currently just a new front end to the existing srtp_policy_t API, the intention would be to eventually remove the old structure and functions from the public API.

@pabuhler pabuhler mentioned this pull request Feb 8, 2026
16 tasks

@paulej paulej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review

Comment thread include/srtp.h Outdated
Comment thread include/srtp.h Outdated
Comment thread srtp/srtp_policy.c Outdated
Comment thread srtp/srtp_policy.c Outdated
Comment thread srtp/srtp_policy.c Outdated
Comment thread srtp/srtp_policy.c Outdated

@paulej paulej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review

@paulej paulej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review

Includes a minima implementation and unit tests.
Fully replace old policy struct with new policy API.
Update SRTP core policy validation/stream init to consume the new policy layout, including MKI/key handling and null-null policy behavior.
Only validate policy once where it is passed in.
Remove policy lists, multiple policies now need to be add via srtp_add_stream API.
Migrate tests, fuzzer, and docs to the new API and expand policy API test coverage.
@pabuhler

Copy link
Copy Markdown
Member Author

@paulej , I have update with the major changes still some small things to sort out but progress can be reviewed, feedback appreciated.

pabuhler added 6 commits May 3, 2026 21:28
Use add and remove in the same way as the keys api.
The new policy api replaces the need for public srtp_crypto_policy_t.
If for some reason there is a need to explicitly set key lengths etc it
can be add to the policy api later.
It is a little unclear is a key should be provided or not.
Keep current behavior for now.
Add explicit policy tests for srtp_profile_null_sha1_80 and
srtp_profile_null_sha1_32. The tests verify that both profiles require a
16-byte master key and 14-byte salt.

@paulej paulej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thing is really long. My eyes glazed over. :) I didn't see anything that screamed of trouble.

Comment thread fuzzer/fuzzer.c
Comment thread fuzzer/fuzzer.c
Comment thread fuzzer/fuzzer.c
Comment thread include/srtp.h Outdated
Comment thread srtp/srtp_policy.c Outdated
Comment thread srtp/srtp_policy.c Outdated
@pabuhler pabuhler marked this pull request as ready for review May 7, 2026 11:55
@pabuhler

pabuhler commented May 7, 2026

Copy link
Copy Markdown
Member Author

All major planned changes are completed to support the new config/policy API, the API can be polished later once the main part has been accepted.

@pabuhler pabuhler merged commit 6e23ad8 into cisco:main May 11, 2026
46 checks passed
@pabuhler

Copy link
Copy Markdown
Member Author

This change changes the config api completely, there will likely be follow changes as the API is used issues discovered. A review before 3.0 release will be done as part of #672 .

@pabuhler pabuhler deleted the policy-api branch May 11, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants