SASC
DVBSoftCAM

cIrdeto Class Reference

Inheritance diagram for cIrdeto:

List of all members.

Protected Member Functions

void SessionKeyCrypt (unsigned char *data, const unsigned char *key, int date)
bool SignatureCheck (const unsigned char *data, int length, const unsigned char *key, int date, const unsigned char *signature, int keylen)
void DecryptIrd (unsigned char *data, unsigned char *key, int rounds, int offset)
void SessionKeyCrypt (unsigned char *data, const unsigned char *key, int date)
bool SignatureCheck (const unsigned char *data, int length, const unsigned char *key, int date, const unsigned char *signature, int keylen)
void DecryptIrd (unsigned char *data, unsigned char *key, int rounds, int offset)

Detailed Description

Definition at line 93 of file irdeto1.c.


Member Function Documentation

void cIrdeto::DecryptIrd ( unsigned char *  data,
unsigned char *  key,
int  rounds,
int  offset 
) [protected]

Definition at line 172 of file irdeto1.c.

References count, and k.

Referenced by cSystemIrd::ProcessEMM(), SessionKeyCrypt(), and SignatureCheck().

{
  for(int count=0; count<rounds; count++) {
    int index=count % 10;
    if(index==0) Rotate(key);
    unsigned char k=key[index];
    unsigned char d=data[T0[(count & 0x0f) + offset]] ^ k;
    d=(k&1) ? T1[d] : T2[d];
    data[T0[((count+1) & 0x0f) + offset]] ^= d;
    }
}
void cIrdeto::DecryptIrd ( unsigned char *  data,
unsigned char *  key,
int  rounds,
int  offset 
) [protected]
void cIrdeto::SessionKeyCrypt ( unsigned char *  data,
const unsigned char *  key,
int  date 
) [protected]
void cIrdeto::SessionKeyCrypt ( unsigned char *  data,
const unsigned char *  key,
int  date 
) [protected]

Definition at line 184 of file irdeto1.c.

References DecryptIrd().

Referenced by cSystemIrd::ProcessECM(), and cSystemIrd::ProcessEMM().

{
  MakeTempKey(key,date);
  DecryptIrd(data,tempKey,128,16);
}
bool cIrdeto::SignatureCheck ( const unsigned char *  data,
int  length,
const unsigned char *  key,
int  date,
const unsigned char *  signature,
int  keylen 
) [protected]

Definition at line 190 of file irdeto1.c.

References DecryptIrd(), i, and j.

Referenced by cSystemIrd::ProcessECM(), and cSystemIrd::ProcessEMM().

{
  unsigned char buffer[256];
  memcpy(buffer,data,length);
  int rounds;
  if((length%8)==0) rounds=40;
  else {
    int i=0x61;
    while((length%8)!=0) buffer[length++]=i++;
    rounds=104;
    }

  if(keylen==10) memcpy(tempKey,key,10);
  else MakeTempKey(key,date);

  int i=0;
  while(i<length-8) {
    DecryptIrd(buffer,tempKey,40,0);
    i+=8;
    for(int j=0; j<8; j++) buffer[j] ^= buffer[i+j];
    Rotate(tempKey);
    }
  DecryptIrd(buffer,tempKey,rounds,0);
  return memcmp(buffer,signature,5)==0;
}
bool cIrdeto::SignatureCheck ( const unsigned char *  data,
int  length,
const unsigned char *  key,
int  date,
const unsigned char *  signature,
int  keylen 
) [protected]

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