From 357eb4e722961cf15054f13b4c896e322982e26d Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 6 Sep 2016 10:24:11 +0200 Subject: [PATCH] Fixed strict compliance V3 RTMP clients (e.g. Mishira) --- lib/rtmpchunks.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/rtmpchunks.cpp b/lib/rtmpchunks.cpp index ce83ccdc..c1d9582f 100644 --- a/lib/rtmpchunks.cpp +++ b/lib/rtmpchunks.cpp @@ -537,9 +537,14 @@ bool RTMPStream::doHandshake() { Secure::hmac_sha256bin(pTempBuffer, 1504, genuineFMSKey, 36, (char*)Server + serverDigestOffset); //SECOND 1536 bytes for server response - char pTempHash[32]; - Secure::hmac_sha256bin((char*)Client + keyChallengeIndex, 32, genuineFMSKey, 68, pTempHash); - Secure::hmac_sha256bin((char*)Server + 1536, 1536 - 32, pTempHash, 32, (char*)Server + 1536 * 2 - 32); + if (_validationScheme == 5 && Version == 3){ + //copy exactly from client + memcpy(Server+1536, Client, 1536); + }else{ + char pTempHash[32]; + Secure::hmac_sha256bin((char*)Client + keyChallengeIndex, 32, genuineFMSKey, 68, pTempHash); + Secure::hmac_sha256bin((char*)Server + 1536, 1536 - 32, pTempHash, 32, (char*)Server + 1536 * 2 - 32); + } Server[ -1] = Version; RTMPStream::snd_cnt += 3073;