summaryrefslogtreecommitdiff
path: root/lib/ext/srtp.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2012-11-05 21:35:50 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2012-11-05 21:35:50 +0100
commit970c5454e453d470d93715d96078c820043282dd (patch)
tree8fcbb42ee93b1367a9fc0161275039e453267c68 /lib/ext/srtp.c
parent6fd98c0e5d558c9d00a51185799c8a1ec1ef929f (diff)
downloadgnutls-970c5454e453d470d93715d96078c820043282dd.tar.gz
simplified profile selection
Diffstat (limited to 'lib/ext/srtp.c')
-rw-r--r--lib/ext/srtp.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/lib/ext/srtp.c b/lib/ext/srtp.c
index 7cc41d8bf6..485d429154 100644
--- a/lib/ext/srtp.c
+++ b/lib/ext/srtp.c
@@ -171,15 +171,14 @@ static int
_gnutls_srtp_recv_params (gnutls_session_t session,
const uint8_t *data, size_t _data_size)
{
- unsigned int i, j;
+ unsigned int i;
int ret;
const uint8_t *p = data;
int len;
ssize_t data_size = _data_size;
srtp_ext_st *priv;
extension_priv_data_t epriv;
- uint16_t profiles[MAX_SRTP_PROFILES];
- unsigned int profiles_size = 0;
+ uint16_t profile;
ret =
_gnutls_ext_get_session_data (session, GNUTLS_EXTENSION_SRTP,
@@ -195,24 +194,19 @@ _gnutls_srtp_recv_params (gnutls_session_t session,
while (len > 0)
{
- DECR_LENGTH_RET (data_size, 2, 0);
- if (profiles_size < MAX_SRTP_PROFILES)
- profiles_size++;
- profiles[profiles_size - 1] = _gnutls_read_uint16 (p);
- p += 2;
- len -= 2;
- }
+ DECR_LEN (data_size, 2);
+ profile = _gnutls_read_uint16 (p);
- for (i = 0; i < priv->profiles_size && priv->selected_profile == 0; i++)
- {
- for (j = 0; j < profiles_size; j++)
+ for (i = 0; i < priv->profiles_size;i++)
{
- if (priv->profiles[i] == profiles[j])
+ if (priv->profiles[i] == profile)
{
- priv->selected_profile = profiles[j];
+ priv->selected_profile = profile;
break;
}
}
+ p += 2;
+ len -= 2;
}
return 0;