mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
rtsp: update for MIKEY API changes
This commit is contained in:
parent
0d22b798ae
commit
248db04720
2 changed files with 22 additions and 9 deletions
|
@ -1484,13 +1484,14 @@ handle_mikey_data (GstRTSPClient * client, GstRTSPContext * ctx,
|
||||||
guint i, n_cs;
|
guint i, n_cs;
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
GstMIKEYPayloadKEMAC *kemac;
|
GstMIKEYPayloadKEMAC *kemac;
|
||||||
|
const GstMIKEYPayloadKeyData *pkd;
|
||||||
GstBuffer *key;
|
GstBuffer *key;
|
||||||
|
|
||||||
/* the MIKEY message contains a CSB or crypto session bundle. It is a
|
/* the MIKEY message contains a CSB or crypto session bundle. It is a
|
||||||
* set of Crypto Sessions protected with the same master key.
|
* set of Crypto Sessions protected with the same master key.
|
||||||
* In the context of SRTP, an RTP and its RTCP stream is part of a
|
* In the context of SRTP, an RTP and its RTCP stream is part of a
|
||||||
* crypto session */
|
* crypto session */
|
||||||
if ((msg = gst_mikey_message_new_from_data (data, size)) == NULL)
|
if ((msg = gst_mikey_message_new_from_data (data, size, NULL, NULL)) == NULL)
|
||||||
goto parse_failed;
|
goto parse_failed;
|
||||||
|
|
||||||
/* we can only handle SRTP crypto sessions for now */
|
/* we can only handle SRTP crypto sessions for now */
|
||||||
|
@ -1513,10 +1514,13 @@ handle_mikey_data (GstRTSPClient * client, GstRTSPContext * ctx,
|
||||||
|| kemac->mac_alg != GST_MIKEY_MAC_NULL)
|
|| kemac->mac_alg != GST_MIKEY_MAC_NULL)
|
||||||
goto unsupported_encryption;
|
goto unsupported_encryption;
|
||||||
|
|
||||||
/* FIXME get Key data sub-payload */
|
/* get Key data sub-payload */
|
||||||
|
pkd = (const GstMIKEYPayloadKeyData *)
|
||||||
|
gst_mikey_payload_kemac_get_sub (&kemac->pt, 0);
|
||||||
|
|
||||||
key =
|
key =
|
||||||
gst_buffer_new_wrapped (g_memdup (kemac->enc_data, kemac->enc_len),
|
gst_buffer_new_wrapped (g_memdup (pkd->key_data, pkd->key_len),
|
||||||
kemac->enc_len);
|
pkd->key_len);
|
||||||
|
|
||||||
/* go over all crypto sessions and create the security policy for each
|
/* go over all crypto sessions and create the security policy for each
|
||||||
* SSRC */
|
* SSRC */
|
||||||
|
|
|
@ -180,7 +180,7 @@ make_media (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPMedia * media,
|
||||||
const GValue *val;
|
const GValue *val;
|
||||||
const gchar *srtpcipher, *srtpauth, *srtcpcipher, *srtcpauth;
|
const gchar *srtpcipher, *srtpauth, *srtcpcipher, *srtcpauth;
|
||||||
GstMIKEYMessage *msg;
|
GstMIKEYMessage *msg;
|
||||||
GstMIKEYPayload *payload;
|
GstMIKEYPayload *payload, *pkd;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
GstMapInfo info;
|
GstMapInfo info;
|
||||||
const guint8 *data;
|
const guint8 *data;
|
||||||
|
@ -239,14 +239,23 @@ make_media (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPMedia * media,
|
||||||
&byte);
|
&byte);
|
||||||
gst_mikey_message_add_payload (msg, payload);
|
gst_mikey_message_add_payload (msg, payload);
|
||||||
|
|
||||||
/* add the key in KEMAC */
|
/* make unencrypted KEMAC */
|
||||||
|
payload = gst_mikey_payload_new (GST_MIKEY_PT_KEMAC);
|
||||||
|
gst_mikey_payload_kemac_set (payload, GST_MIKEY_ENC_NULL,
|
||||||
|
GST_MIKEY_MAC_NULL);
|
||||||
|
|
||||||
|
/* add the key in key data */
|
||||||
|
pkd = gst_mikey_payload_new (GST_MIKEY_PT_KEY_DATA);
|
||||||
gst_buffer_map (srtpkey, &info, GST_MAP_READ);
|
gst_buffer_map (srtpkey, &info, GST_MAP_READ);
|
||||||
gst_mikey_message_add_kemac (msg, GST_MIKEY_ENC_NULL, info.size, info.data,
|
gst_mikey_payload_key_data_set_key (pkd, GST_MIKEY_KD_TEK, info.size,
|
||||||
GST_MIKEY_MAC_NULL, NULL);
|
info.data);
|
||||||
gst_buffer_unmap (srtpkey, &info);
|
gst_buffer_unmap (srtpkey, &info);
|
||||||
|
/* add key data to KEMAC */
|
||||||
|
gst_mikey_payload_kemac_add_sub (payload, pkd);
|
||||||
|
gst_mikey_message_add_payload (msg, payload);
|
||||||
|
|
||||||
/* now serialize this to bytes */
|
/* now serialize this to bytes */
|
||||||
bytes = gst_mikey_message_to_bytes (msg);
|
bytes = gst_mikey_message_to_bytes (msg, NULL, NULL);
|
||||||
gst_mikey_message_free (msg);
|
gst_mikey_message_free (msg);
|
||||||
/* and make it into base64 */
|
/* and make it into base64 */
|
||||||
data = g_bytes_get_data (bytes, &size);
|
data = g_bytes_get_data (bytes, &size);
|
||||||
|
|
Loading…
Reference in a new issue