aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2021-11-09 22:06:48 +0100
committerfiaxh <git@lightrise.org>2021-11-10 11:05:34 +0100
commitdfda2f25f0b1d0b7e0cecf269265ca81ae1d506b (patch)
tree4574288fa31454692e1e881ee454d804a8290489 /plugins
parentea19a9c5cbbb6a8b9ed99627c8732005bf8854b9 (diff)
downloaddino-dfda2f25f0b1d0b7e0cecf269265ca81ae1d506b.tar.gz
dino-dfda2f25f0b1d0b7e0cecf269265ca81ae1d506b.zip
DTLS: throw exceptions from SRTP
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ice/src/dtls_srtp.vala34
1 files changed, 12 insertions, 22 deletions
diff --git a/plugins/ice/src/dtls_srtp.vala b/plugins/ice/src/dtls_srtp.vala
index ca398e69..91c11eee 100644
--- a/plugins/ice/src/dtls_srtp.vala
+++ b/plugins/ice/src/dtls_srtp.vala
@@ -37,40 +37,30 @@ public class Handler {
this.own_fingerprint = creds.own_fingerprint;
}
- public uint8[]? process_incoming_data(uint component_id, uint8[] data) {
+ public uint8[]? process_incoming_data(uint component_id, uint8[] data) throws Crypto.Error {
if (srtp_session.has_decrypt) {
- try {
- if (component_id == 1) {
- if (data.length >= 2 && data[1] >= 192 && data[1] < 224) {
- return srtp_session.decrypt_rtcp(data);
- }
- return srtp_session.decrypt_rtp(data);
+ if (component_id == 1) {
+ if (data.length >= 2 && data[1] >= 192 && data[1] < 224) {
+ return srtp_session.decrypt_rtcp(data);
}
- if (component_id == 2) return srtp_session.decrypt_rtcp(data);
- } catch (Error e) {
- warning("%s (%d)", e.message, e.code);
- return null;
+ return srtp_session.decrypt_rtp(data);
}
+ if (component_id == 2) return srtp_session.decrypt_rtcp(data);
} else if (component_id == 1) {
on_data_rec(data);
}
return null;
}
- public uint8[]? process_outgoing_data(uint component_id, uint8[] data) {
+ public uint8[]? process_outgoing_data(uint component_id, uint8[] data) throws Crypto.Error {
if (srtp_session.has_encrypt) {
- try {
- if (component_id == 1) {
- if (data.length >= 2 && data[1] >= 192 && data[1] < 224) {
- return srtp_session.encrypt_rtcp(data);
- }
- return srtp_session.encrypt_rtp(data);
+ if (component_id == 1) {
+ if (data.length >= 2 && data[1] >= 192 && data[1] < 224) {
+ return srtp_session.encrypt_rtcp(data);
}
- if (component_id == 2) return srtp_session.encrypt_rtcp(data);
- } catch (Error e) {
- warning("%s (%d)", e.message, e.code);
- return null;
+ return srtp_session.encrypt_rtp(data);
}
+ if (component_id == 2) return srtp_session.encrypt_rtcp(data);
}
return null;
}