]> www.vanbest.org Git - sasc-ng.git/commitdiff
enforce constness of data in EMM processing chain
authorleslie <unknown>
Mon, 14 Sep 2009 12:30:12 +0000 (20:30 +0800)
committerleslie <unknown>
Mon, 14 Sep 2009 12:30:12 +0000 (20:30 +0800)
12 files changed:
cam.c
system-common.c
system-common.h
system.h
systems/cardclient/cc.c
systems/irdeto/irdeto1.c
systems/irdeto/irdeto2.c
systems/nagra/nagra1.c
systems/nagra/nagra2.c
systems/seca/seca.c
systems/shl/shl.c
systems/viaccess/viaccess.c

diff --git a/cam.c b/cam.c
index f822cefeb078d2b72d87fd76c00b2738f8c6f000..422273608e66d0edd5a1ca1e221c38a7063f305a 100644 (file)
--- a/cam.c
+++ b/cam.c
@@ -288,7 +288,7 @@ public:
   cSimpleList<cSystem> systems;
   //
   cLogChain(int CardNum, bool soft, int src, int tr);
-  void Process(int pid, unsigned char *data);
+  void Process(int pid, const unsigned char *data);
   bool Parse(const unsigned char *cat);
   };
 
@@ -298,7 +298,7 @@ cLogChain::cLogChain(int CardNum, bool soft, int src, int tr)
   active=delayed=false;
 }
 
-void cLogChain::Process(int pid, unsigned char *data)
+void cLogChain::Process(int pid, const unsigned char *data)
 {
   if(active) {
     for(cSystem *sys=systems.First(); sys; sys=systems.Next(sys))
index e7bea941bf6b683f1a86b33b39ff991ad08f91fe..749d1aa091877223792e1ca58cebb61d8f35c6cc 100644 (file)
@@ -173,7 +173,7 @@ bool cSystemScCore::ProcessECM(const cEcmInfo *ecm, unsigned char *source)
   return res;
 }
 
-void cSystemScCore::ProcessEMM(int pid, int caid, unsigned char *buffer)
+void cSystemScCore::ProcessEMM(int pid, int caid, const unsigned char *buffer)
 {
   cSmartCard *card=smartcards.LockCard(scId);
   if(card) {
index efe2a89f6e3774ccf062c891fb827b88909a6dde..f31c9746c6311f4c957ae08f07654abb69bbc8fd 100644 (file)
@@ -106,7 +106,7 @@ private:
 public:
   cSystemScCore(const char *Name, int Pri, int ScId, const char *ScName);
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *data);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *data);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *data);
   };
 
 #endif //___SYSTEM_COMMON_H
index 56c920e48754f61a5e59e2285eb951ac9206b89c..6a405d1600e39b22026d563015812ce4c70902b0 100644 (file)
--- a/system.h
+++ b/system.h
@@ -116,7 +116,7 @@ public:
   virtual int CheckECM(const cEcmInfo *ecm, const unsigned char *data, bool sync);
   virtual void CheckECMResult(const cEcmInfo *ecm, const unsigned char *data, bool result);
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *buffer)=0;
-  virtual void ProcessEMM(int pid, int caid, unsigned char *buffer) {};
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *buffer) {};
   virtual void ParseCADescriptor(cSimpleList<cEcmInfo> *ecms, unsigned short sysId, int source, const unsigned char *data, int len);
   virtual void ParseCAT(cPids *pids, const unsigned char *buffer, int source, int transponder);
   unsigned char *CW(void) { return cw; }
index f38ed71ac6b0828b89c2b72a0aaaa3be1500097c..3532e08ebc5e67c38af6e77f29c6a076003a1bed 100644 (file)
@@ -193,7 +193,7 @@ private:
 public:
   cSystemCardClient(void);
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *data);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *buffer);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *buffer);
   };
 
 cSystemCardClient::cSystemCardClient(void)
@@ -237,7 +237,7 @@ bool cSystemCardClient::ProcessECM(const cEcmInfo *ecm, unsigned char *data)
   return false;
 }
 
-void cSystemCardClient::ProcessEMM(int pid, int caid, unsigned char *buffer)
+void cSystemCardClient::ProcessEMM(int pid, int caid, const unsigned char *buffer)
 {
   cCardClient *cc=0;
   while((cc=staticCcl.FindBySysId(caid,cc)))
index ceaf7185d99fa83c9a294e0cd376d9fec580af8b..81b89aa7edb5b9ad0e188c637e5f602d2b3bfac6 100644 (file)
@@ -221,7 +221,7 @@ private:
 public:
   cSystemIrd(void);
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *source);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *buffer);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *buffer);
   };
 
 cSystemIrd::cSystemIrd(void)
@@ -277,17 +277,14 @@ bool cSystemIrd::ProcessECM(const cEcmInfo *ecm, unsigned char *source)
   return false;
 }
 
-void cSystemIrd::ProcessEMM(int pid, int caid, unsigned char *buffer)
+void cSystemIrd::ProcessEMM(int pid, int caid, const unsigned char *data)
 {
   int i, numKeys=0, date=0;
   unsigned char adr[10], id[4], *pk[4], prov, *mk=0, prvId[3]={0,0,0};
 
-  int n=SCT_LEN(buffer);
-  unsigned char savebuf[4096];
-  if(n>(int)sizeof(savebuf)) {
-    PRINTF(L_SYS_EMM,"%d: paket size %d to big for savebuffer in IrdetoLog",CardNum(),n);
-    return;
-    }
+  int n=SCT_LEN(data);
+  unsigned char *buffer=AUTOMEM(n);
+  memcpy(buffer,data,n);
 
   int index=cParseIrdeto::AddrLen(buffer);
   memset(adr,0,sizeof(adr));
@@ -387,7 +384,6 @@ void cSystemIrd::ProcessEMM(int pid, int caid, unsigned char *buffer)
 
   // lastKey: save cpu time if we get bursts of the same key
   if((numKeys>0 && (id[0]!=lastKey || numKeys>1)) || mk) {
-    memcpy(savebuf,buffer,n); // save the buffer
     cIrdCardInfo *ci=Icards.First();
     unsigned char *chkkey=AUTOMEM(max(sizeof(ci->PMK),sizeof(ci->HMK)));
     while(ci) {
@@ -436,7 +432,7 @@ void cSystemIrd::ProcessEMM(int pid, int caid, unsigned char *buffer)
           }
         LBEND();
 
-        memcpy(buffer,savebuf,n); // restore the buffer
+        memcpy(buffer,data,n); // restore the buffer
         }
       ci=Icards.Next(ci);
       }
index 56b6df6a2ce0d20b5250a16904e4284df7b746f6..4251b7284309391c4aef576e7e53f55bb639d625 100644 (file)
@@ -123,7 +123,7 @@ private:
 public:
   cSystemIrd2(void);
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *data);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *data);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *data);
   };
 
 cSystemIrd2::cSystemIrd2(void)
@@ -204,7 +204,7 @@ bool cSystemIrd2::ProcessECM(const cEcmInfo *ecm, unsigned char *data)
   return false;
 }
 
-void cSystemIrd2::ProcessEMM(int pid, int caid, unsigned char *data)
+void cSystemIrd2::ProcessEMM(int pid, int caid, const unsigned char *data)
 {
   int prov=0; //XXX how to get provider here??
 
index 941319968d71d8adb621afda8ccc7580e7e16af1..0ef777158d2a8a7c7de6b571d05f2bbda7931e52 100644 (file)
@@ -691,7 +691,7 @@ public:
   cSystemNagra(void);
   virtual ~cSystemNagra();
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *data);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *buffer);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *buffer);
   };
 
 cSystemNagra::cSystemNagra(void)
@@ -863,7 +863,7 @@ bool cSystemNagra::ProcessECM(const cEcmInfo *ecm, unsigned char *data)
   return true;
 }
   
-void cSystemNagra::ProcessEMM(int pid, int caid, unsigned char *buffer)
+void cSystemNagra::ProcessEMM(int pid, int caid, const unsigned char *buffer)
 {
   const int id=buffer[10]*256+buffer[11];
   static const unsigned char tester[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x4B };
index 056490e2488e20e75972e8187c6a431ad79933f4..20b4eef6bc566811ca3ff8380287b35d2fdf5dfd 100644 (file)
@@ -1264,7 +1264,7 @@ public:
   cSystemNagra2(void);
   ~cSystemNagra2();
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *data);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *buffer);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *buffer);
   };
 
 cSystemNagra2::cSystemNagra2(void)
@@ -1400,7 +1400,7 @@ bool cSystemNagra2::ProcessECM(const cEcmInfo *ecm, unsigned char *data)
   return true;
 }
 
-void cSystemNagra2::ProcessEMM(int pid, int caid, unsigned char *buffer)
+void cSystemNagra2::ProcessEMM(int pid, int caid, const unsigned char *buffer)
 {
   int cmdLen=buffer[9]-5;
   int id=buffer[10]*256+buffer[11];
index 78d11fc0039764c8417c66baf8dbaa7591a6cd93..0a84b8e6c1e1dd9be56ed58551199c5c0c3792e3 100644 (file)
@@ -1177,7 +1177,7 @@ public:
   cSystemSeca(void);
   virtual ~cSystemSeca();
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *data);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *buffer);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *buffer);
   };
 
 cSystemSeca::cSystemSeca(void)
@@ -1561,7 +1561,7 @@ void cSystemSeca::Permute(unsigned char *data, const unsigned char *pdata, const
   for(int i=7; i>=0; i--) data[i] = P[i] ? pdata[P[i]] : 0;
 }
 
-void cSystemSeca::ProcessEMM(int pid, int caid, unsigned char *buffer)
+void cSystemSeca::ProcessEMM(int pid, int caid, const unsigned char *buffer)
 {
   if(buffer[0]!=0x84) return; // we only support shared updates
 
index af42e4b3d059fcfd1bedc65c279bcbcd4dc4d4c0..d5e7fa343a4b12a379918a6db83891f17d891341 100644 (file)
@@ -421,7 +421,7 @@ public:
   cSystemShl(void);
   virtual ~cSystemShl();
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *source);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *buffer);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *buffer);
   };
 
 cSystemShl::cSystemShl(void)
@@ -602,7 +602,7 @@ void cSystemShl::ProcessCw(const unsigned char *data, int prvId, const unsigned
     }
 }
 
-void cSystemShl::ProcessEMM(int pid, int caid, unsigned char *buffer)
+void cSystemShl::ProcessEMM(int pid, int caid, const unsigned char *buffer)
 {
   int n=SCT_LEN(buffer)-3;
   buffer+=3;
index dcb99522a8c9ff9e8212f325655f3151a6c1a5d9..01f5b5437503ea40a122843bec704efaf3e1fbfb 100644 (file)
@@ -356,7 +356,7 @@ private:
 public:
   cSystemViaccess(void);
   virtual bool ProcessECM(const cEcmInfo *ecm, unsigned char *data);
-  virtual void ProcessEMM(int pid, int caid, unsigned char *data);
+  virtual void ProcessEMM(int pid, int caid, const unsigned char *data);
   virtual void ParseCADescriptor(cSimpleList<cEcmInfo> *ecms, unsigned short sysId, int source, const unsigned char *data, int len);
   };
 
@@ -410,7 +410,7 @@ bool cSystemViaccess::ProcessECM(const cEcmInfo *ecm, unsigned char *data)
   return false;
 }
 
-void cSystemViaccess::ProcessEMM(int pid, int caid, unsigned char *data)
+void cSystemViaccess::ProcessEMM(int pid, int caid, const unsigned char *data)
 {
   for(cViaccessCardInfo *mkey=Vcards.First(); mkey; mkey=Vcards.Next(mkey)) {
     int updtype;