From 7feb004fb6ad78e8b448cfea834087d046b31da8 Mon Sep 17 00:00:00 2001 From: hyc Date: Thu, 28 Jan 2010 05:36:58 +0000 Subject: [PATCH] Prep for FlashPlayer10 handshake support. (Probably should choose offset based on plaintext vs encrypted...) Only 128 bits are needed for DH key, not 1024. git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@242 400ebc74-4327-4243-bc38-086b20814532 --- handshake.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/handshake.h b/handshake.h index e137e62..75317e6 100644 --- a/handshake.h +++ b/handshake.h @@ -288,9 +288,14 @@ HandShake(RTMP * r, bool FP9HandShake) if (FP9HandShake) { /* set version to at least 9.0.115.0 */ +#ifdef FP10 + clientsig[4] = 128; + clientsig[6] = 3; +#else clientsig[4] = 9; - clientsig[5] = 0; clientsig[6] = 124; +#endif + clientsig[5] = 0; clientsig[7] = 2; Log(LOGDEBUG, "%s: Client type: %02X\n", __FUNCTION__, clientsig[-1]); @@ -315,7 +320,7 @@ HandShake(RTMP * r, bool FP9HandShake) if (encrypted) { /* generate Diffie-Hellmann parameters */ - r->Link.dh = DHInit(1024); + r->Link.dh = DHInit(128); /* 1024 */ if (!r->Link.dh) { Log(LOGERROR, "%s: Couldn't initialize Diffie-Hellmann!", @@ -323,7 +328,11 @@ HandShake(RTMP * r, bool FP9HandShake) return false; } +#ifdef FP10 + dhposClient = GetDHOffset2(clientsig, RTMP_SIG_SIZE); +#else dhposClient = GetDHOffset1(clientsig, RTMP_SIG_SIZE); +#endif Log(LOGDEBUG, "%s: DH pubkey position: %d", __FUNCTION__, dhposClient); if (!DHGenerateKey(r->Link.dh)) @@ -341,7 +350,11 @@ HandShake(RTMP * r, bool FP9HandShake) } } +#ifdef FP10 + digestPosClient = GetDigestOffset2(clientsig, RTMP_SIG_SIZE); +#else digestPosClient = GetDigestOffset1(clientsig, RTMP_SIG_SIZE); /* reuse this value in verification */ +#endif Log(LOGDEBUG, "%s: Client digest offset: %d", __FUNCTION__, digestPosClient); @@ -468,6 +481,12 @@ HandShake(RTMP * r, bool FP9HandShake) __FUNCTION__); LogHex(LOGDEBUG, digestResp, SHA256_DIGEST_LENGTH); +#ifdef FP10 + if (type == 8 || type == 9) + { + /* encrypt signatureResp */ + } +#endif Log(LOGDEBUG, "%s: Client signature calculated:", __FUNCTION__); LogHex(LOGDEBUG, signatureResp, SHA256_DIGEST_LENGTH); } @@ -645,7 +664,7 @@ SHandShake(RTMP * r) if (encrypted) { /* generate Diffie-Hellmann parameters */ - r->Link.dh = DHInit(1024); + r->Link.dh = DHInit(128); if (!r->Link.dh) { Log(LOGERROR, "%s: Couldn't initialize Diffie-Hellmann!", -- 2.40.0