diff options
author | fiaxh <git@lightrise.org> | 2021-12-23 00:44:51 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2021-12-23 00:46:58 +0100 |
commit | d02c5bc55d4325de308a592e8980139aa0634215 (patch) | |
tree | 9cb91f86056dd29f863bd8e54580cccc625af60e /crypto-vala/src/srtp.vala | |
parent | 1378224444b1862ac95783ac2bae7d25a0a8862d (diff) | |
parent | f0c7dd0682fec8d72c644d8e54896de7bdc40ddb (diff) | |
download | dino-d02c5bc55d4325de308a592e8980139aa0634215.tar.gz dino-d02c5bc55d4325de308a592e8980139aa0634215.zip |
Merge branch groupcalls
Diffstat (limited to 'crypto-vala/src/srtp.vala')
-rw-r--r-- | crypto-vala/src/srtp.vala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto-vala/src/srtp.vala b/crypto-vala/src/srtp.vala index c7f45da3..22210e37 100644 --- a/crypto-vala/src/srtp.vala +++ b/crypto-vala/src/srtp.vala @@ -34,9 +34,8 @@ public class Session { if (res != ErrorStatus.ok) { throw new Error.UNKNOWN(@"SRTP encrypt failed: $res"); } - uint8[] ret = new uint8[buf_use]; - GLib.Memory.copy(ret, buf, buf_use); - return ret; + buf.length = buf_use; + return buf; } public uint8[] decrypt_rtp(uint8[] data) throws Error { @@ -65,9 +64,8 @@ public class Session { if (res != ErrorStatus.ok) { throw new Error.UNKNOWN(@"SRTCP encrypt failed: $res"); } - uint8[] ret = new uint8[buf_use]; - GLib.Memory.copy(ret, buf, buf_use); - return ret; + buf.length = buf_use; + return buf; } public uint8[] decrypt_rtcp(uint8[] data) throws Error { @@ -81,7 +79,7 @@ public class Session { case ErrorStatus.ok: break; default: - throw new Error.UNKNOWN(@"SRTP decrypt failed: $res"); + throw new Error.UNKNOWN(@"SRTCP decrypt failed: $res"); } uint8[] ret = new uint8[buf_use]; GLib.Memory.copy(ret, buf, buf_use); @@ -105,6 +103,7 @@ public class Session { policy.key = new uint8[key.length + salt.length]; Memory.copy(policy.key, key, key.length); Memory.copy(((uint8*)policy.key) + key.length, salt, salt.length); + policy.next = null; encrypt_context.add_stream(ref policy); has_encrypt = true; } @@ -115,6 +114,7 @@ public class Session { policy.key = new uint8[key.length + salt.length]; Memory.copy(policy.key, key, key.length); Memory.copy(((uint8*)policy.key) + key.length, salt, salt.length); + policy.next = null; decrypt_context.add_stream(ref policy); has_decrypt = true; } |