[PATCH 1/2] Correct the length of base64 digests
From: Björn Axelsson <bjorn.axelsson@intinor.se> This was broken in e42b5d09. This makes adobe auth against akamai servers work again. --- librtmp/rtmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c index b966710..d64a0bb 100644 --- a/librtmp/rtmp.c +++ b/librtmp/rtmp.c @@ -2514,8 +2514,8 @@ PublisherAuth(RTMP *r, AVal *description) #define RESPONSE_LEN 32 #define CHALLENGE2_LEN 16 #define SALTED2_LEN (32+8+8+8) -#define B64DIGEST_LEN 22 /* 16 byte digest => 22 b64 chars */ -#define B64INT_LEN 6 /* 4 byte int => 6 b64 chars */ +#define B64DIGEST_LEN 24 /* 16 byte digest => 22 b64 chars + 2 chars padding */ +#define B64INT_LEN 8 /* 4 byte int => 6 b64 chars + 2 chars padding */ #define HEXHASH_LEN (2*MD5_DIGEST_LENGTH) char response[RESPONSE_LEN]; char challenge2[CHALLENGE2_LEN]; -- 1.7.9.4
Some servers (akamai) only include a 'challenge' parameter, no 'opaque' parameter, while others (wowza) include both 'opaque' and 'challenge'. If 'opaque' is provided, it should be used here, otherwise 'challenge', but never both. After this patch, adobe auth works against both wowza and akamai servers. --- librtmp/rtmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c index d64a0bb..7f1c7ff 100644 --- a/librtmp/rtmp.c +++ b/librtmp/rtmp.c @@ -2609,7 +2609,7 @@ PublisherAuth(RTMP *r, AVal *description) /* response = base64enc(md5(hash1 + opaque + challenge2)) */ if (opaque.av_len) MD5_Update(&md5ctx, opaque.av_val, opaque.av_len); - if (challenge.av_len) + else if (challenge.av_len) MD5_Update(&md5ctx, challenge.av_val, challenge.av_len); MD5_Update(&md5ctx, challenge2, B64INT_LEN); MD5_Final(md5sum_val, &md5ctx); -- 1.7.9.4
sön 2012-12-30 klockan 14:09 +0200 skrev Martin Storsjo:
Some servers (akamai) only include a 'challenge' parameter, no 'opaque' parameter, while others (wowza) include both 'opaque' and 'challenge'. If 'opaque' is provided, it should be used here, otherwise 'challenge', but never both.
After this patch, adobe auth works against both wowza and akamai servers.
Thank you. I can confirm that this patch still works for me on wowza 2.2. I don't have access to any akamai account to test on. -- Björn Axelsson Phone: +46-(0)90-349 39 02 Intinor AB Fax: +46-(0)90-349 39 04 www.intinor.se Mobile: +46-(0)70-397 04 17 Broadcast Video & Digital Media Distribution
participants (2)
-
Björn Axelsson -
Martin Storsjo