remove use of pointers to 32bit values#667
Merged
pabuhler merged 2 commits intocisco:mainfrom Dec 20, 2023
Merged
Conversation
There is no reason to use pointers to 32bit values, all operations are based on bytes. So This removes alot of extra casting and potential pointer arithmetic errors. Also provide some functions for calculating header values to reduce duplication and improve readability.
6c2b8fb to
8f10fac
Compare
| #define octets_in_rtp_extn_hdr 4 | ||
| #define octets_in_rtp_xtn_hdr 4 | ||
|
|
||
| static uint32_t srtp_get_rtp_hdr_len(const srtp_hdr_t *hdr) |
There was a problem hiding this comment.
I don't think it's semantically right to use uint32_t for byte lengths? I'd suggest size_t. (Not that this matters practically.)
Member
Author
There was a problem hiding this comment.
I totally agree and plan to convert to size_t both in the public API and internally, at the moment the mix of size_t, uint32_t, int and unsigned int is just staggering in this project. But such a change in the public API needs a major version bump which is why I have been putting it off. I think it might be a goal for the Christmass break to start.
paulej
reviewed
Dec 19, 2023
srtp_get_rtp_xtn_hdr & srtp_get_rtp_xtn_hdr_len both assume that the caller has verified that the input arguments are valid, ie that there is an extension present by previously checking the x bit of the RTP header.
paulej
approved these changes
Dec 20, 2023
mwalbeck
pushed a commit
to mwalbeck/docker-janus-gateway
that referenced
this pull request
Feb 4, 2025
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [cisco/libsrtp](https://github.com/cisco/libsrtp) | minor | `v2.5.0` -> `v2.6.0` | --- ### Release Notes <details> <summary>cisco/libsrtp (cisco/libsrtp)</summary> ### [`v2.6.0`](https://github.com/cisco/libsrtp/releases/tag/v2.6.0): libSRTP 2.6.0 [Compare Source](cisco/libsrtp@v2.5.0...v2.6.0) #### What's Changed - cmake: Support configuring as subproject by [@​yangskyboxlabs](https://github.com/yangskyboxlabs) in cisco/libsrtp#640 - cmake: Rename TEST_APPS as LIBSRTP_TEST_APPS option by [@​yangskyboxlabs](https://github.com/yangskyboxlabs) in cisco/libsrtp#641 - Add a missing typedef for stream list ctx by [@​Lastique](https://github.com/Lastique) in cisco/libsrtp#643 - Add x86 SIMD optimizations to crypto datatypes by [@​Lastique](https://github.com/Lastique) in cisco/libsrtp#507 - fix typo by [@​uniontech-lilinjie](https://github.com/uniontech-lilinjie) in cisco/libsrtp#648 - iv length is constant so set only once by [@​pabuhler](https://github.com/pabuhler) in cisco/libsrtp#649 - Fix library version in Doxygen docs by [@​Lastique](https://github.com/Lastique) in cisco/libsrtp#654 - remove comma from srtp_profile_t enum value. by [@​melchi45](https://github.com/melchi45) in cisco/libsrtp#658 - meson.build: implement mbedtls support by [@​iameli](https://github.com/iameli) in cisco/libsrtp#660 - remove travis reference from README.md by [@​pabuhler](https://github.com/pabuhler) in cisco/libsrtp#661 - try to use ubuntu-latest by [@​pabuhler](https://github.com/pabuhler) in cisco/libsrtp#664 - Some srtp_driver fixes by [@​pabuhler](https://github.com/pabuhler) in cisco/libsrtp#662 - Some cipher_driver fixes by [@​pabuhler](https://github.com/pabuhler) in cisco/libsrtp#663 - start using const on internal arguments by [@​pabuhler](https://github.com/pabuhler) in cisco/libsrtp#665 - Cleaning up cmake and enabled more warnings. by [@​palerikm](https://github.com/palerikm) in cisco/libsrtp#666 - fix line break in stream_list.yml by [@​pabuhler](https://github.com/pabuhler) in cisco/libsrtp#668 - remove use of pointers to 32bit values by [@​pabuhler](https://github.com/pabuhler) in cisco/libsrtp#667 #### New Contributors - [@​yangskyboxlabs](https://github.com/yangskyboxlabs) made their first contribution in cisco/libsrtp#640 - [@​uniontech-lilinjie](https://github.com/uniontech-lilinjie) made their first contribution in cisco/libsrtp#648 - [@​melchi45](https://github.com/melchi45) made their first contribution in cisco/libsrtp#658 - [@​iameli](https://github.com/iameli) made their first contribution in cisco/libsrtp#660 - [@​palerikm](https://github.com/palerikm) made their first contribution in cisco/libsrtp#666 **Full Changelog**: cisco/libsrtp@v2.5.0...v2.6.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMDIuMSIsInVwZGF0ZWRJblZlciI6IjM5LjE1Ni4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> Reviewed-on: https://git.walbeck.it/walbeck-it/docker-janus-gateway/pulls/132 Co-authored-by: renovate-bot <bot@walbeck.it> Co-committed-by: renovate-bot <bot@walbeck.it>
seyednasermoravej
pushed a commit
to seyednasermoravej/libsrtp
that referenced
this pull request
Nov 9, 2025
remove use of pointers to 32bit values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is no reason to use pointers to 32bit values, all operations are based on bytes. So This removes alot of extra casting and potential pointer arithmetic errors.
Also provide some functions for calculating header values to reduce duplication and improve readability.