summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Paris <mparisdiaz@gmail.com>2020-04-01 18:08:45 +0200
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-09-29 09:16:34 +0000
commit5128cbd398f2855cda82c0166c47481e59d48db9 (patch)
treedcd5e59e46cc05d7ec8042a6af1fc21c17a33811
parent432bc35d5737492000ea60470400ff176071aabb (diff)
downloadgstreamer-plugins-bad-5128cbd398f2855cda82c0166c47481e59d48db9.tar.gz
dtlsconnection: do not set keys_exported flag if actually not exported
keys_exported flag should be set only if keys are actually exported. For that the next conditions are needed: 1 - SSL_export_keying_material on success 2 - SSL_get_selected_srtp_profile returns a valid profile 3 - The profile ID is SRTP_AES128_CM_SHA1_80 or SRTP_AES128_CM_SHA1_32 Also don't crash if NULL is returned as profile. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1612>
-rw-r--r--ext/dtls/gstdtlsconnection.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/dtls/gstdtlsconnection.c b/ext/dtls/gstdtlsconnection.c
index ee0296aa5..8cf34e0b5 100644
--- a/ext/dtls/gstdtlsconnection.c
+++ b/ext/dtls/gstdtlsconnection.c
@@ -675,6 +675,12 @@ export_srtp_keys (GstDtlsConnection * self)
profile = SSL_get_selected_srtp_profile (self->priv->ssl);
+ if (!profile) {
+ GST_WARNING_OBJECT (self,
+ "no srtp capabilities negotiated during handshake");
+ return;
+ }
+
GST_INFO_OBJECT (self, "keys received, profile is %s", profile->name);
switch (profile->id) {
@@ -688,7 +694,7 @@ export_srtp_keys (GstDtlsConnection * self)
break;
default:
GST_WARNING_OBJECT (self, "invalid crypto suite set by handshake");
- goto beach;
+ return;
}
client_key.key = exported_keys.client_key;
@@ -708,7 +714,6 @@ export_srtp_keys (GstDtlsConnection * self)
auth);
}
-beach:
self->priv->keys_exported = TRUE;
}