summaryrefslogtreecommitdiff
path: root/ext/srtp/gstsrtp.c
diff options
context:
space:
mode:
authorAleix Conchillo Flaqué <aleix@oblong.com>2013-12-13 14:16:49 -0800
committerOlivier Crête <olivier.crete@collabora.com>2013-12-13 17:51:18 -0500
commitfefd021ee2916531b8c0698c14787c2e810e9324 (patch)
treebe2c820d99243f7dedd668f62dee8984eb189dac /ext/srtp/gstsrtp.c
parentb3910cabaf3cc0e606a307411e496c9136dbfccc (diff)
downloadgstreamer-plugins-bad-fefd021ee2916531b8c0698c14787c2e810e9324.tar.gz
srtp: add 256-bit key support
* ext/srtp/gstsrtp.[ch]: added GST_SRTP_CIPHER_AES_256_ICM to GstSrtpCipherType and new function cipher_key_size. * ext/srtp/gstsrtpenc.c: maximum key size is now 46 characters (14 for the salt plus the key). If different ciphers are chosen for RTP and RTCP the maximum needed key size is expected. * ext/srtp/gstsrtpdec.c: minor documentation updates. https://bugzilla.gnome.org/show_bug.cgi?id=720434
Diffstat (limited to 'ext/srtp/gstsrtp.c')
-rw-r--r--ext/srtp/gstsrtp.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/ext/srtp/gstsrtp.c b/ext/srtp/gstsrtp.c
index 427db7cf5..0f0a77fa0 100644
--- a/ext/srtp/gstsrtp.c
+++ b/ext/srtp/gstsrtp.c
@@ -177,9 +177,13 @@ set_crypto_policy_cipher_auth (GstSrtpCipherType cipher,
{
switch (cipher) {
case GST_SRTP_CIPHER_AES_128_ICM:
- policy->cipher_type = AES_128_ICM;
+ policy->cipher_type = AES_ICM;
policy->cipher_key_len = 30;
break;
+ case GST_SRTP_CIPHER_AES_256_ICM:
+ policy->cipher_type = AES_ICM;
+ policy->cipher_key_len = 46;
+ break;
case GST_SRTP_CIPHER_NULL:
policy->cipher_type = NULL_CIPHER;
policy->cipher_key_len = 0;
@@ -216,6 +220,28 @@ set_crypto_policy_cipher_auth (GstSrtpCipherType cipher,
policy->sec_serv = sec_serv_conf_and_auth;
}
+guint
+cipher_key_size (GstSrtpCipherType cipher)
+{
+ guint size = 0;
+
+ switch (cipher) {
+ case GST_SRTP_CIPHER_AES_128_ICM:
+ size = 30;
+ break;
+ case GST_SRTP_CIPHER_AES_256_ICM:
+ size = 46;
+ break;
+ case GST_SRTP_CIPHER_NULL:
+ size = 0;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ return size;
+}
+
static gboolean
plugin_init (GstPlugin * plugin)
{