mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 15:08:48 +00:00
sdp: gstmikey: gst_mikey_message_to_caps: extract ROC from first crypto session
We need the ROC to decrypt a SRTP stream as the ROC is part of the AES IV. So look for first crypto session, from which we can get the ROC and find corresponding crypto policy. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3568>
This commit is contained in:
parent
befab7af72
commit
5678151799
1 changed files with 13 additions and 2 deletions
|
@ -2379,6 +2379,7 @@ gboolean
|
||||||
gst_mikey_message_to_caps (const GstMIKEYMessage * msg, GstCaps * caps)
|
gst_mikey_message_to_caps (const GstMIKEYMessage * msg, GstCaps * caps)
|
||||||
{
|
{
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
|
const GstMIKEYMapSRTP *srtp;
|
||||||
const GstMIKEYPayload *payload;
|
const GstMIKEYPayload *payload;
|
||||||
const gchar *srtp_cipher;
|
const gchar *srtp_cipher;
|
||||||
const gchar *srtp_auth;
|
const gchar *srtp_auth;
|
||||||
|
@ -2386,8 +2387,16 @@ gst_mikey_message_to_caps (const GstMIKEYMessage * msg, GstCaps * caps)
|
||||||
srtp_cipher = "aes-128-icm";
|
srtp_cipher = "aes-128-icm";
|
||||||
srtp_auth = "hmac-sha1-80";
|
srtp_auth = "hmac-sha1-80";
|
||||||
|
|
||||||
/* check the Security policy if any */
|
/* Look for first crypto session */
|
||||||
if ((payload = gst_mikey_message_find_payload (msg, GST_MIKEY_PT_SP, 0))) {
|
if (!(srtp = gst_mikey_message_get_cs_srtp (msg, 0))) {
|
||||||
|
GST_ERROR ("No crypto session found at index 0");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look for crypto policy corresponding to first crypto session */
|
||||||
|
if ((payload =
|
||||||
|
gst_mikey_message_find_payload (msg, GST_MIKEY_PT_SP,
|
||||||
|
(unsigned int) srtp->policy))) {
|
||||||
GstMIKEYPayloadSP *p = (GstMIKEYPayloadSP *) payload;
|
GstMIKEYPayloadSP *p = (GstMIKEYPayloadSP *) payload;
|
||||||
guint len, i;
|
guint len, i;
|
||||||
guint enc_alg = GST_MIKEY_ENC_NULL;
|
guint enc_alg = GST_MIKEY_ENC_NULL;
|
||||||
|
@ -2495,6 +2504,8 @@ gst_mikey_message_to_caps (const GstMIKEYMessage * msg, GstCaps * caps)
|
||||||
buf = gst_buffer_new_memdup (pkd->key_data, pkd->key_len);
|
buf = gst_buffer_new_memdup (pkd->key_data, pkd->key_len);
|
||||||
gst_caps_set_simple (caps, "srtp-key", GST_TYPE_BUFFER, buf, NULL);
|
gst_caps_set_simple (caps, "srtp-key", GST_TYPE_BUFFER, buf, NULL);
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
|
gst_caps_set_simple (caps, "roc", G_TYPE_UINT, srtp->roc, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_caps_set_simple (caps,
|
gst_caps_set_simple (caps,
|
||||||
|
|
Loading…
Reference in a new issue