|
SASC-NG
DVBSoftCAM
|
Inheritance diagram for cTripleDes:Protected Member Functions | |
| void | ScheduleKey (void) |
| int | PadMessage (unsigned char *data, int len) |
| void | Expand (unsigned char *expanded, const unsigned char *normal) |
| void | Decrypt (unsigned char *data, int len) |
| const unsigned char * | Encrypt (const unsigned char *data, int len, unsigned char *crypt) |
Protected Attributes | |
| unsigned char | desKey [16] |
| void cTripleDes::Decrypt | ( | unsigned char * | data, |
| int | len | ||
| ) | [protected] |
Definition at line 112 of file newcamd.c.
References L_CC_NEWCAMD, and PRINTF.
{
if((len-2) % 8 || (len-2)<16) {
PRINTF(L_CC_NEWCAMD,"warning: encrypted data size mismatch");
return;
}
DES_cblock ivec;
len-=sizeof(ivec); memcpy(ivec, data+len, sizeof(ivec));
DES_ede2_cbc_encrypt(data+2,data+2,len-2,&ks1,&ks2,(DES_cblock *)ivec,DES_DECRYPT);
}
| const unsigned char * cTripleDes::Encrypt | ( | const unsigned char * | data, |
| int | len, | ||
| unsigned char * | crypt | ||
| ) | [protected] |
| void cTripleDes::Expand | ( | unsigned char * | expanded, |
| const unsigned char * | normal | ||
| ) | [protected] |
Definition at line 65 of file newcamd.c.
Referenced by cCardClientNewCamd::Login().
{
expand[0] = normal[0] & 0xfe;
expand[1] = ((normal[0] << 7) | (normal[1] >> 1)) & 0xfe;
expand[2] = ((normal[1] << 6) | (normal[2] >> 2)) & 0xfe;
expand[3] = ((normal[2] << 5) | (normal[3] >> 3)) & 0xfe;
expand[4] = ((normal[3] << 4) | (normal[4] >> 4)) & 0xfe;
expand[5] = ((normal[4] << 3) | (normal[5] >> 5)) & 0xfe;
expand[6] = ((normal[5] << 2) | (normal[6] >> 6)) & 0xfe;
expand[7] = normal[6] << 1;
expand[8] = normal[7] & 0xfe;
expand[9] = ((normal[7] << 7) | (normal[8] >> 1)) & 0xfe;
expand[10] = ((normal[8] << 6) | (normal[9] >> 2)) & 0xfe;
expand[11] = ((normal[9] << 5) | (normal[10] >> 3)) & 0xfe;
expand[12] = ((normal[10] << 4) | (normal[11] >> 4)) & 0xfe;
expand[13] = ((normal[11] << 3) | (normal[12] >> 5)) & 0xfe;
expand[14] = ((normal[12] << 2) | (normal[13] >> 6)) & 0xfe;
expand[15] = normal[13] << 1;
SetOddParity(expand);
}
| int cTripleDes::PadMessage | ( | unsigned char * | data, |
| int | len | ||
| ) | [protected] |
Definition at line 86 of file newcamd.c.
References CWS_NETMSGSIZE, L_CC_NEWCAMD, PRINTF, and XorSum().
{
DES_cblock padBytes;
unsigned char noPadBytes;
noPadBytes = (8 - ((len - 1) % 8)) % 8;
if(len+noPadBytes+1 >= CWS_NETMSGSIZE-8) {
PRINTF(L_CC_NEWCAMD,"message overflow in cTripleDes::PadMessage");
return -1;
}
DES_random_key((DES_cblock *)padBytes);
memcpy(data+len,padBytes,noPadBytes); len+=noPadBytes;
data[len]=XorSum(data+2,len-2);
return len+1;
}
| void cTripleDes::ScheduleKey | ( | void | ) | [protected] |
unsigned char cTripleDes::desKey[16] [protected] |
Definition at line 44 of file newcamd.c.
Referenced by cCardClientNewCamd::Login(), and ScheduleKey().