|
SASC
DVBSoftCAM
|
Inheritance diagram for cSeca:Protected Member Functions | |
| void | Decrypt (unsigned char *data, const unsigned char *key, const unsigned char *T1, const unsigned char *T2) |
| void | Encrypt (unsigned char *data, const unsigned char *key, const unsigned char *T1, const unsigned char *T2) |
| void | CalcSignature (const unsigned char *buff, int len, unsigned char *signature, const unsigned char *k, const unsigned char *T1, const unsigned char *T2) |
| void | AdditionalAlgo (unsigned char *data, const unsigned char *key, const int mode) |
| void | Decrypt (unsigned char *data, const unsigned char *key, const unsigned char *T1, const unsigned char *T2) |
| void | Encrypt (unsigned char *data, const unsigned char *key, const unsigned char *T1, const unsigned char *T2) |
| void | CalcSignature (const unsigned char *buff, int len, unsigned char *signature, const unsigned char *k, const unsigned char *T1, const unsigned char *T2) |
| void | AdditionalAlgo (unsigned char *data, const unsigned char *key, const int mode) |
Protected Attributes | |
| static const unsigned char | T2_S1 [] |
Static Protected Attributes | |
| static const unsigned char | T1_S1 [] |
| void cSeca::AdditionalAlgo | ( | unsigned char * | data, |
| const unsigned char * | key, | ||
| const int | mode | ||
| ) | [protected] |
Definition at line 342 of file seca.c.
References i, k, L_SYS_VERBOSE, PRINTF, rol16, and ror16.
{
static const unsigned int adders[] = {
0x0000,0xe555,0xafff,0x5ffe,0xf552,0x6ffb,0xcff9,0x154c,
0x3ff4,0x4ff1,0x4543,0x1fea,0xdfe6,0x8537,0x0fdd,0x7fd8
};
const unsigned short * const k = (const unsigned short *)key;
unsigned short * const dd = (unsigned short *)data;
unsigned int d1=dd[0], d2=dd[1], d3=dd[2], d4=dd[3];
PRINTF(L_SYS_VERBOSE,"additional algo: %s",!mode?"encrypt":"decrypt");
if(!mode) {
for(int i=0; i<0x10; i++) {
const unsigned int adder = adders[i];
d1 += (k[0] + d3 + adder) ^ (k[1] + d4 + adder);
d2 += (k[2] + d3 + adder) ^ (k[3] + d4 + adder);
d1 = ror16(d1,5);
d2 = rol16(d2,3);
d3 += (k[0] + d1 + adder) ^ (k[1] + d2 + adder);
d4 += (k[2] + d1 + adder) ^ (k[3] + d2 + adder);
d3 = rol16(d3,3);
d4 = ror16(d4,5);
}
}
else {
for(int i=0xf; i>=0; i--) {
const unsigned int adder = adders[i];
d4 = rol16(d4,5);
d3 = ror16(d3,3);
d4 -= (k[2] + d1 + adder) ^ (k[3] + d2 + adder);
d3 -= (k[0] + d1 + adder) ^ (k[1] + d2 + adder);
d2 = ror16(d2,3);
d1 = rol16(d1,5);
d2 -= (k[2] + d3 + adder) ^ (k[3] + d4 + adder);
d1 -= (k[0] + d3 + adder) ^ (k[1] + d4 + adder);
}
}
dd[0]=d1; dd[1]=d2; dd[2]=d3; dd[3]=d4;
}
| void cSeca::AdditionalAlgo | ( | unsigned char * | data, |
| const unsigned char * | key, | ||
| const int | mode | ||
| ) | [protected] |
| void cSeca::CalcSignature | ( | const unsigned char * | buff, |
| int | len, | ||
| unsigned char * | signature, | ||
| const unsigned char * | k, | ||
| const unsigned char * | T1, | ||
| const unsigned char * | T2 | ||
| ) | [protected] |
| void cSeca::CalcSignature | ( | const unsigned char * | buff, |
| int | len, | ||
| unsigned char * | signature, | ||
| const unsigned char * | k, | ||
| const unsigned char * | T1, | ||
| const unsigned char * | T2 | ||
| ) | [protected] |
| void cSeca::Decrypt | ( | unsigned char * | data, |
| const unsigned char * | key, | ||
| const unsigned char * | T1, | ||
| const unsigned char * | T2 | ||
| ) | [protected] |
| void cSeca::Decrypt | ( | unsigned char * | data, |
| const unsigned char * | key, | ||
| const unsigned char * | T1, | ||
| const unsigned char * | T2 | ||
| ) | [protected] |
Definition at line 298 of file seca.c.
References i, j, k, and swap8_4.
Referenced by cSeca2Prov::DecryptSE(), cSystemSeca::ProcessECM(), and cSystemSeca::ProcessEMM().
{
unsigned char k[16],D[4];
memcpy(k,key,sizeof(k));
unsigned char C=0xff;
for(int j=0; j<4; ++j) {
for(int i=0; i<16; ++i) {
if((i&3)==0) ++C;
k[i]^=T1[(k[(15+i)&0xf]^k[(i+1)&0xf]^C)&0xff];
}
}
int j=0;
for(int i=0; i<16; ++i) {
for(int l=0; l<4; ++l) D[l]=d[l+4];
j=(j+12)&0xf;
Fase(D,&k[j&0xc],T1,T2);
for(int l=0; l<4; ++l) d[l]^=T2[D[TD[l]]&0xff];
for(int l=3; l>=0; --l) k[(j+l)&0xf]^=T1[(k[(j+l+1)&0xf]^k[(j+l+15)&0xf]^(15-i))&0xff];
if(i<15) swap8_4(d);
}
}
| void cSeca::Encrypt | ( | unsigned char * | data, |
| const unsigned char * | key, | ||
| const unsigned char * | T1, | ||
| const unsigned char * | T2 | ||
| ) | [protected] |
| void cSeca::Encrypt | ( | unsigned char * | data, |
| const unsigned char * | key, | ||
| const unsigned char * | T1, | ||
| const unsigned char * | T2 | ||
| ) | [protected] |
Definition at line 320 of file seca.c.
Referenced by CalcSignature(), cSystemSeca::ProcessECM(), and cSystemSeca::ProcessEMM().
{
unsigned char D[4],kk[16];
memcpy(kk, key, sizeof(kk));
for(int j=0, i=0; i<16; ++i, j=(j+4)&0xf) {
for(int l=0; l<4; ++l) kk[(j+l)&0xf] ^= T1[(kk[(j+l+1)&0xf]^kk[(j+l+15)&0xf]^i)&0xff];
if(i>0) swap8_4(d);
for(int l=0; l<4; ++l) D[l]=d[l+4];
Fase(D,&kk[j&0xc],T1,T2);
for(int l=0; l<4; ++l) d[l]^=T2[D[TD[l]]&0xff];
}
}
const unsigned char cSeca::T1_S1 [static, protected] |
{
0x2a,0xe1,0x0b,0x13,0x3e,0x6e,0x32,0x48, 0xd3,0x31,0x08,0x8c,0x8f,0x95,0xbd,0xd0,
0xe4,0x6d,0x50,0x81,0x20,0x30,0xbb,0x75, 0xf5,0xd4,0x7c,0x87,0x2c,0x4e,0xe8,0xf4,
0xbe,0x24,0x9e,0x4d,0x80,0x37,0xd2,0x5f, 0xdb,0x04,0x7a,0x3f,0x14,0x72,0x67,0x2d,
0xcd,0x15,0xa6,0x4c,0x2e,0x3b,0x0c,0x41, 0x62,0xfa,0xee,0x83,0x1e,0xa2,0x01,0x0e,
0x7f,0x59,0xc9,0xb9,0xc4,0x9d,0x9b,0x1b, 0x9c,0xca,0xaf,0x3c,0x73,0x1a,0x65,0xb1,
0x76,0x84,0x39,0x98,0xe9,0x53,0x94,0xba, 0x1d,0x29,0xcf,0xb4,0x0d,0x05,0x7d,0xd1,
0xd7,0x0a,0xa0,0x5c,0x91,0x71,0x92,0x88, 0xab,0x93,0x11,0x8a,0xd6,0x5a,0x77,0xb5,
0xc3,0x19,0xc1,0xc7,0x8e,0xf9,0xec,0x35, 0x4b,0xcc,0xd9,0x4a,0x18,0x23,0x9f,0x52,
0xdd,0xe3,0xad,0x7b,0x47,0x97,0x60,0x10, 0x43,0xef,0x07,0xa5,0x49,0xc6,0xb3,0x55,
0x28,0x51,0x5d,0x64,0x66,0xfc,0x44,0x42, 0xbc,0x26,0x09,0x74,0x6f,0xf7,0x6b,0x4f,
0x2f,0xf0,0xea,0xb8,0xae,0xf3,0x63,0x6a, 0x56,0xb2,0x02,0xd8,0x34,0xa4,0x00,0xe6,
0x58,0xeb,0xa3,0x82,0x85,0x45,0xe0,0x89, 0x7e,0xfd,0xf2,0x3a,0x36,0x57,0xff,0x06,
0x69,0x54,0x79,0x9a,0xb6,0x6c,0xdc,0x8b, 0xa7,0x1f,0x90,0x03,0x17,0x1c,0xed,0xd5,
0xaa,0x5e,0xfe,0xda,0x78,0xb0,0xbf,0x12, 0xa8,0x22,0x21,0x3d,0xc2,0xc0,0xb7,0xa9,
0xe7,0x33,0xfb,0xf1,0x70,0xe5,0x17,0x96, 0xf8,0x8d,0x46,0xa1,0x86,0xe2,0x40,0x38,
0xf6,0x68,0x25,0x16,0xac,0x61,0x27,0xcb, 0x5b,0xc8,0x2b,0x0f,0x99,0xde,0xce,0xc5
}
Definition at line 234 of file seca.c.
Referenced by cSystemSeca::ProcessECM(), and cSystemSeca::ProcessEMM().
const unsigned char cSeca::T2_S1 [protected] |
{
0xbf,0x11,0x6d,0xfa,0x26,0x7f,0xf3,0xc8, 0x9e,0xdd,0x3f,0x16,0x97,0xbd,0x08,0x80,
0x51,0x42,0x93,0x49,0x5b,0x64,0x9b,0x25, 0xf5,0x0f,0x24,0x34,0x44,0xb8,0xee,0x2e,
0xda,0x8f,0x31,0xcc,0xc0,0x5e,0x8a,0x61, 0xa1,0x63,0xc7,0xb2,0x58,0x09,0x4d,0x46,
0x81,0x82,0x68,0x4b,0xf6,0xbc,0x9d,0x03, 0xac,0x91,0xe8,0x3d,0x94,0x37,0xa0,0xbb,
0xce,0xeb,0x98,0xd8,0x38,0x56,0xe9,0x6b, 0x28,0xfd,0x84,0xc6,0xcd,0x5f,0x6e,0xb6,
0x32,0xf7,0x0e,0xf1,0xf8,0x54,0xc1,0x53, 0xf0,0xa7,0x95,0x7b,0x19,0x21,0x23,0x7d,
0xe1,0xa9,0x75,0x3e,0xd6,0xed,0x8e,0x6f, 0xdb,0xb7,0x07,0x41,0x05,0x77,0xb4,0x2d,
0x45,0xdf,0x29,0x22,0x43,0x89,0x83,0xfc, 0xd5,0xa4,0x88,0xd1,0xf4,0x55,0x4f,0x78,
0x62,0x1e,0x1d,0xb9,0xe0,0x2f,0x01,0x13, 0x15,0xe6,0x17,0x6a,0x8d,0x0c,0x96,0x7e,
0x86,0x27,0xa6,0x0d,0xb5,0x73,0x71,0xaa, 0x36,0xd0,0x06,0x66,0xdc,0xb1,0x2a,0x5a,
0x72,0xbe,0x3a,0xc5,0x40,0x65,0x1b,0x02, 0x10,0x9f,0x3b,0xf9,0x2b,0x18,0x5c,0xd7,
0x12,0x47,0xef,0x1a,0x87,0xd2,0xc2,0x8b, 0x99,0x9c,0xd3,0x57,0xe4,0x76,0x67,0xca,
0x3c,0xfb,0x90,0x20,0x14,0x48,0xc9,0x60, 0xb0,0x70,0x4e,0xa2,0xad,0x35,0xea,0xc4,
0x74,0xcb,0x39,0xde,0xe7,0xd4,0xa3,0xa5, 0x04,0x92,0x8c,0xd9,0x7c,0x1c,0x7a,0xa8,
0x52,0x79,0xf2,0x33,0xba,0x1f,0x30,0x9a, 0x00,0x50,0x4c,0xff,0xe5,0xcf,0x59,0xc3,
0xe3,0x0a,0x85,0xb3,0xae,0xec,0x0b,0xfe, 0xe2,0xab,0x4a,0xaf,0x69,0x6c,0x2c,0x5d
}
Definition at line 234 of file seca.c.
Referenced by cSystemSeca::ProcessECM(), and cSystemSeca::ProcessEMM().