[rtmpdump] r172 - in trunk: log.h rtmp.c rtmpsuck.c streams.c

hyc subversion at mplayerhq.hu
Sun Jan 3 00:46:00 CET 2010


Author: hyc
Date: Sun Jan  3 00:45:59 2010
New Revision: 172

Log:
Cleanup CRYPTO dependencies

Modified:
   trunk/log.h
   trunk/rtmp.c
   trunk/rtmpsuck.c
   trunk/streams.c

Modified: trunk/log.h
==============================================================================
--- trunk/log.h	Sun Jan  3 00:25:45 2010	(r171)
+++ trunk/log.h	Sun Jan  3 00:45:59 2010	(r172)
@@ -29,7 +29,7 @@ extern "C" {
 #endif
 /* Enable this to get full debugging output */
 /* #define _DEBUG */
-#define CRYPTO
+/*#define CRYPTO */
 
 #ifdef _DEBUG
 #undef NODEBUG

Modified: trunk/rtmp.c
==============================================================================
--- trunk/rtmp.c	Sun Jan  3 00:25:45 2010	(r171)
+++ trunk/rtmp.c	Sun Jan  3 00:45:59 2010	(r172)
@@ -252,6 +252,7 @@ RTMP_SetupStream(RTMP * r,
   Log(LOGDEBUG, "live     : %s", bLiveStream ? "yes" : "no");
   Log(LOGDEBUG, "timeout  : %d sec", timeout);
 
+#ifdef CRYPTO
   if (swfSHA256Hash != NULL && swfSize > 0)
     {
       r->Link.SWFHash = *swfSHA256Hash;
@@ -266,6 +267,7 @@ RTMP_SetupStream(RTMP * r,
       r->Link.SWFHash.av_val = NULL;
       r->Link.SWFSize = 0;
     }
+#endif
 
   if (sockshost)
     {
@@ -1798,6 +1800,7 @@ HandleCtrl(RTMP * r, const RTMPPacket * 
   if (nType == 0x1A)
     {
       Log(LOGDEBUG, "%s, SWFVerification ping received: ", __FUNCTION__);
+#ifdef CRYPTO
       //LogHex(packet.m_body, packet.m_nBodySize);
 
       // respond with HMAC SHA256 of decompressed SWF, key is the 30byte player key, also the last 30 bytes of the server handshake are applied
@@ -1811,6 +1814,11 @@ HandleCtrl(RTMP * r, const RTMPPacket * 
 	      "%s: Ignoring SWFVerification request, use --swfhash and --swfsize!",
 	      __FUNCTION__);
 	}
+#else
+      Log(LOGWARNING,
+       "%s: Ignoring SWFVerification request, no CRYPTO support!",
+	      __FUNCTION__);
+#endif
     }
 }
 

Modified: trunk/rtmpsuck.c
==============================================================================
--- trunk/rtmpsuck.c	Sun Jan  3 00:25:45 2010	(r171)
+++ trunk/rtmpsuck.c	Sun Jan  3 00:45:59 2010	(r172)
@@ -208,14 +208,16 @@ ServeInvoke(STREAMING_SERVER *server, RT
             }
           else if (AVMATCH(&pname, &av_swfUrl))
             {
+#ifdef CRYPTO
               unsigned char hash[HASHLEN];
-              server->rc.Link.swfUrl = pval;
               if (RTMP_HashSWF(pval.av_val, &server->rc.Link.SWFSize, hash, 0) == 0)
                 {
                   server->rc.Link.SWFHash.av_val = malloc(HASHLEN);
                   memcpy(server->rc.Link.SWFHash.av_val, hash, HASHLEN);
                   server->rc.Link.SWFHash.av_len = HASHLEN;
                 }
+#endif
+              server->rc.Link.swfUrl = pval;
               pval.av_val = NULL;
             }
           else if (AVMATCH(&pname, &av_tcUrl))
@@ -821,11 +823,17 @@ void doServe(STREAMING_SERVER * server,	
                   {
                     short nType = AMF_DecodeInt16(pc.m_body);
                     /* SWFverification */
-                    if (nType == 0x1a && server->rc.Link.SWFHash.av_len)
+                    if (nType == 0x1a)
+#ifdef CRYPTO
+                      if (server->rc.Link.SWFHash.av_len)
                       {
                         RTMP_SendCtrl(&server->rc, 0x1b, 0, 0);
                         sendit = 0;
                       }
+#else
+                      /* The session will certainly fail right after this */
+                      Log(LOGERROR, "%s, server requested SWF verification, need CRYPTO support! ", __FUNCTION__);
+#endif
                   }
                 else if (server->out && (
                      pc.m_packetType == 0x08 ||

Modified: trunk/streams.c
==============================================================================
--- trunk/streams.c	Sun Jan  3 00:25:45 2010	(r171)
+++ trunk/streams.c	Sun Jan  3 00:45:59 2010	(r172)
@@ -876,6 +876,7 @@ ParseOption(char opt, char *arg, RTMP_RE
 {
   switch (opt)
     {
+#ifdef CRYPTO
     case 'w':
       {
 	int res = hex2bin(arg, &req->swfHash.av_val);
@@ -914,6 +915,7 @@ ParseOption(char opt, char *arg, RTMP_RE
           }
       }
       break;
+#endif
     case 'b':
       {
 	int32_t bt = atol(arg);


More information about the rtmpdump mailing list