[vlc-devel] commit: SRTP: fix parser ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Jun 15 21:05:00 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jun 15 21:23:55 2008 +0300| [8650df15a2468f76f2af570b32c5936f42c9cdb8]
SRTP: fix parser
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8650df15a2468f76f2af570b32c5936f42c9cdb8
---
libs/srtp/srtp.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libs/srtp/srtp.c b/libs/srtp/srtp.c
index 87a3c2e..dcde338 100644
--- a/libs/srtp/srtp.c
+++ b/libs/srtp/srtp.c
@@ -392,10 +392,10 @@ static ssize_t hexstring (const char *in, uint8_t *out, size_t outlen)
for (size_t i = 0; i < inlen; i += 2)
{
- int a = hexdigit (in[2 * i]), b = hexdigit (in[2 * i + 1]);
+ int a = hexdigit (in[i]), b = hexdigit (in[i + 1]);
if ((a == -1) || (b == -1))
- return EINVAL;
- out[i] = (a << 4) | b;
+ return -1;
+ out[i / 2] = (a << 4) | b;
}
return inlen / 2;
}
@@ -410,14 +410,14 @@ static ssize_t hexstring (const char *in, uint8_t *out, size_t outlen)
int
srtp_setkeystring (srtp_session_t *s, const char *key, const char *salt)
{
- uint8_t bkey[32]; /* TODO/NOTE: hard-coded for AES */
+ uint8_t bkey[16]; /* TODO/NOTE: hard-coded for AES */
uint8_t bsalt[14]; /* TODO/NOTE: hard-coded for the PRF-AES-CM */
ssize_t bkeylen = hexstring (key, bkey, sizeof (bkey));
ssize_t bsaltlen = hexstring (salt, bsalt, sizeof (bsalt));
if ((bkeylen == -1) || (bsaltlen == -1))
return EINVAL;
- return srtp_derive (s, bkey, bkeylen, bsalt, bsaltlen) ? EINVAL : 0;
+ return srtp_setkey (s, bkey, bkeylen, bsalt, bsaltlen) ? EINVAL : 0;
}
/**
More information about the vlc-devel
mailing list