Fix usage of libsrtp2

This commit is contained in:
Marvin W 2021-11-09 22:06:21 +01:00 committed by fiaxh
parent 3dc4d7f155
commit 4c56a84303
2 changed files with 6 additions and 2 deletions

View File

@ -81,7 +81,7 @@ public class Session {
case ErrorStatus.ok: case ErrorStatus.ok:
break; break;
default: default:
throw new Error.UNKNOWN(@"SRTP decrypt failed: $res"); throw new Error.UNKNOWN(@"SRTCP decrypt failed: $res");
} }
uint8[] ret = new uint8[buf_use]; uint8[] ret = new uint8[buf_use];
GLib.Memory.copy(ret, buf, buf_use); GLib.Memory.copy(ret, buf, buf_use);
@ -105,6 +105,7 @@ public class Session {
policy.key = new uint8[key.length + salt.length]; policy.key = new uint8[key.length + salt.length];
Memory.copy(policy.key, key, key.length); Memory.copy(policy.key, key, key.length);
Memory.copy(((uint8*)policy.key) + key.length, salt, salt.length); Memory.copy(((uint8*)policy.key) + key.length, salt, salt.length);
policy.next = null;
encrypt_context.add_stream(ref policy); encrypt_context.add_stream(ref policy);
has_encrypt = true; has_encrypt = true;
} }
@ -115,6 +116,7 @@ public class Session {
policy.key = new uint8[key.length + salt.length]; policy.key = new uint8[key.length + salt.length];
Memory.copy(policy.key, key, key.length); Memory.copy(policy.key, key, key.length);
Memory.copy(((uint8*)policy.key) + key.length, salt, salt.length); Memory.copy(((uint8*)policy.key) + key.length, salt, salt.length);
policy.next = null;
decrypt_context.add_stream(ref policy); decrypt_context.add_stream(ref policy);
has_decrypt = true; has_decrypt = true;
} }

View File

@ -42,9 +42,11 @@ public struct Policy {
public uint8[] key; public uint8[] key;
public ulong num_master_keys; public ulong num_master_keys;
public ulong window_size; public ulong window_size;
public int allow_repeat_tx; [CCode (ctype = "int")]
public bool allow_repeat_tx;
[CCode (array_length_cname = "enc_xtn_hdr_count")] [CCode (array_length_cname = "enc_xtn_hdr_count")]
public int[] enc_xtn_hdr; public int[] enc_xtn_hdr;
public Policy* next;
} }
[CCode (cname = "srtp_crypto_policy_t")] [CCode (cname = "srtp_crypto_policy_t")]