SASC-NG
DVBSoftCAM

cTPSDecrypt Class Reference

#include <tps.h>

Inheritance diagram for cTPSDecrypt:

List of all members.

Protected Member Functions

void TpsDecrypt (unsigned char *data, short mode, const unsigned char *key)

Static Protected Member Functions

static bool RegisterAlgo3 (const unsigned char *data, int cb1, int cb2, int cb3, int len)
static unsigned char * DumpAlgo3 (int &len, int &cb1, int &cb2, int &cb3)
static bool Handle80008003 (const unsigned char *src, int len, unsigned char *dest)

Detailed Description

Definition at line 37 of file tps.h.


Member Function Documentation

unsigned char * cTPSDecrypt::DumpAlgo3 ( int &  len,
int &  cb1,
int &  cb2,
int &  cb3 
) [static, protected]

Definition at line 1075 of file tps.c.

References MALLOC.

Referenced by cTpsKeys::PostSave().

{
  cMutexLock lock(&st20Mutex);
  if(!mem) return 0;
  unsigned char *buff=MALLOC(unsigned char,memLen);
  if(!buff) return 0;
  memcpy(buff,mem,memLen);
  len=memLen; cb1=cb1off; cb2=cb2off; cb3=cb3off;
  return buff;
}
bool cTPSDecrypt::Handle80008003 ( const unsigned char *  src,
int  len,
unsigned char *  dest 
) [static, protected]

Definition at line 1097 of file tps.c.

References cST20::Decode(), FLASHS, cST20::Init(), L_SYS_TPSAU, PRINTF, RAMS, cST20::ReadByte(), cST20::SetCallFrame(), cST20::WriteByte(), cST20::WriteShort(), and cST20::WriteWord().

{
  cMutexLock lock(&st20Mutex);
  if(cb1off && InitST20()) {
    for(int i=0; i<len; i++) st20.WriteByte(RAMS+0x400+i,src[i]);
    st20.WriteShort(RAMS+0x0,0x8000);
    st20.WriteShort(RAMS+0x2,0x8003);
    st20.WriteWord(RAMS+0x8,RAMS+0x400);
    st20.Init(FLASHS+cb1off,RAMS+0xF000);
    st20.SetCallFrame(0,RAMS,0,0);
    int err=st20.Decode(1000);
    if(err<0) {
      PRINTF(L_SYS_TPSAU,"ST20 processing failed in callback1 (%d)",err);
      return false;
      }
    for(int i=0; i<0x2D; i++) dest[i]=st20.ReadByte(RAMS+0x400+i);
    return true;
    }
  return false;
}
bool cTPSDecrypt::RegisterAlgo3 ( const unsigned char *  data,
int  cb1,
int  cb2,
int  cb3,
int  len 
) [static, protected]

Definition at line 1063 of file tps.c.

References free, L_SYS_TPSAU, MALLOC, and PRINTF.

Referenced by cTpsKeys::ParseLinePlain().

{
  cMutexLock lock(&st20Mutex);
  free(mem);
  if(!(mem=MALLOC(unsigned char,len))) return false;
  memcpy(mem,data,len);
  memLen=len; cb1off=cb1; cb2off=cb2; cb3off=cb3;
  st20Inited=false;
  PRINTF(L_SYS_TPSAU,"registered callbacks for algo 3");
  return true;
}
void cTPSDecrypt::TpsDecrypt ( unsigned char *  data,
short  mode,
const unsigned char *  key 
) [protected]

Definition at line 1047 of file tps.c.

References cAES::Decrypt(), L_SYS_TPS, PRINTF, and cAES::SetKey().

Referenced by cTPS::Decrypt(), and cTPS::PostProc().

{
  switch(mode) {
    case 0: break;
    case 1: cAES::SetKey(key); cAES::Decrypt(data,16); break;
    case 2: cRC6::SetKey(key,16); cRC6::Decrypt(data); break;
    case 3: if(mem) {
              if(!DecryptAlgo3(key,data))
                PRINTF(L_SYS_TPS,"decrypt failed in algo 3");
              }
            else PRINTF(L_SYS_TPS,"no callbacks for algo 3 registered");
            break;
    default: PRINTF(L_SYS_TPS,"unknown TPS decryption algo %d",mode); break;
    }
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines