Skip to content

Conversation

@RRRadicalEdward
Copy link
Contributor

This PR adds Aes256CmHmacSha1_80 and Aes256CmHmacSha1_32 protection profiles. They're defined in RFC6188. I didn't implement a new struct for handling them, but extended CipherAesCmHmacSha1 to not only support AES CM 128.

This PR adds `Aes256CmHmacSha1_80` and `Aes256CmHmacSha1_32` protection
profiles. They're defined in [RFC6188](https://datatracker.ietf.org/doc/html/rfc6188).
I didn't implement a new struct for handling them, but extended `CipherAesCmHmacSha1` to not only support AES CM 128.
#[default]
Aes128CmHmacSha1_80 = 0x0001,
Aes128CmHmacSha1_32 = 0x0002,
Aes256CmHmacSha1_80 = 0x0003,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aes256CmHmacSha1_80 and Aes256CmHmacSha1_32 don't have IANA-assigned IDs. I found this note in the Pion implementation, and assigned the same IDs they have for the items.

assert_eq!(profile.key_len(), AES::key_size());
assert_eq!(profile.salt_len(), master_salt.len());

type Kdf = fn(u8, &[u8], &[u8], usize, usize) -> Result<Vec<u8>>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved this type to srtp/src/mod.rs, because I found myself doing the same in my implementation. So instead of code duplication, I reused this type.

}

#[test]
fn test_encrypt_aes_256_cm_rtp() {
Copy link
Contributor Author

@RRRadicalEdward RRRadicalEdward Dec 21, 2025

Choose a reason for hiding this comment

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

I don't know how many tests are needed. Let me know if it's not enough. I think I could work on providing more if needed 😄

@rainliu rainliu merged commit c8e977e into webrtc-rs:master Dec 21, 2025
4 checks passed
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