|
SASC-NG
DVBSoftCAM
|
#include <byteswap.h>Go to the source code of this file.
Defines | |
| #define | UINT32_BE(a) bswap_32(get_misalign((unsigned int *)(a))) |
| #define | UINT16_BE(a) bswap_16(get_misalign((unsigned short *)(a))) |
| #define | UINT8_BE(a) *((unsigned char *)a) |
| #define | BYTE4_BE(a, b) put_misalign(bswap_32(b),(unsigned int *)(a)) |
| #define | BYTE2_BE(a, b) put_misalign(bswap_16(b),(unsigned short *)(a)) |
| #define | BYTE1_BE(a, b) *(unsigned char *)(a)=(b) |
| #define | UINT32_LE(a) get_misalign((unsigned int *)(a)) |
| #define | UINT16_LE(a) get_misalign((unsigned short *)(a)) |
| #define | UINT8_LE(a) *((unsigned char *)a) |
| #define | BYTE4_LE(a, b) put_misalign(b,(unsigned int *)(a)) |
| #define | BYTE2_LE(a, b) put_misalign(b,(unsigned short *)(a)) |
| #define | BYTE1_LE(a, b) *(unsigned char *)(a)=(b) |
| #define | __ror16_const(x, xx) ((((x)&0xFFFF)>>(xx)) | ((x)<<(16-(xx)))) |
| #define | __rol16_const(x, xx) (((x)<<(xx)) | (((x)&0xFFFF)>>(16-(xx)))) |
| #define | __sn8_const(b) ((((b)>>4)&0xf) + (((b)&0xf)<<4)) |
| #define | ror16(x, xx) __ror16_const(x,xx) |
| #define | rol16(x, xx) __rol16_const(x,xx) |
| #define | sn8(b) __sn8_const(b) |
| #define | xxor(d, l, v1, v2) __xxor(d,l,v1,v2) |
Functions | |
| template<class T > | |
| T | get_misalign (T *p) |
| template<class T > | |
| void | put_misalign (unsigned int v, T *p) |
| static void | __xxor (unsigned char *data, int len, const unsigned char *v1, const unsigned char *v2) |
| #define __rol16_const | ( | x, | |
| xx | |||
| ) | (((x)<<(xx)) | (((x)&0xFFFF)>>(16-(xx)))) |
| #define __ror16_const | ( | x, | |
| xx | |||
| ) | ((((x)&0xFFFF)>>(xx)) | ((x)<<(16-(xx)))) |
Definition at line 48 of file helper.h.
Referenced by cST20::WriteByte().
Definition at line 40 of file helper.h.
Referenced by cCardClientCCcam2::ProcessECM(), and cCardClientCCcam2::ProcessEMM().
Definition at line 47 of file helper.h.
Referenced by cST20::WriteShort().
Definition at line 39 of file helper.h.
Referenced by cCwDes::CwDes(), cCwDes::CwL2Des(), cCwDes::CwR2Des(), cCamCryptNagra::DecryptDT08(), cDes::Des(), cCardClientCCcam2::ProcessECM(), and cCardClientCCcam2::ProcessEMM().
Definition at line 46 of file helper.h.
Referenced by cST20::WriteWord().
| #define rol16 | ( | x, | |
| xx | |||
| ) | __rol16_const(x,xx) |
Definition at line 72 of file helper.h.
Referenced by cSeca::AdditionalAlgo().
| #define ror16 | ( | x, | |
| xx | |||
| ) | __ror16_const(x,xx) |
Definition at line 71 of file helper.h.
Referenced by cSeca::AdditionalAlgo().
Definition at line 73 of file helper.h.
Referenced by cN2Prov0101::ReadHandler().
| #define UINT16_BE | ( | a | ) | bswap_16(get_misalign((unsigned short *)(a))) |
Definition at line 37 of file helper.h.
Referenced by cOpenTVModule::Id(), and cSmartCardDataNagra::Parse().
| #define UINT16_LE | ( | a | ) | get_misalign((unsigned short *)(a)) |
Definition at line 44 of file helper.h.
Referenced by cST20::ReadShort().
| #define UINT32_BE | ( | a | ) | bswap_32(get_misalign((unsigned int *)(a))) |
Definition at line 36 of file helper.h.
Referenced by cShare::CheckAddProv(), cCwDes::CwDes(), cCwDes::CwL2Des(), cCwDes::CwR2Des(), cDes::Des(), cSmartCardNagra::Init(), cOpenTVModule::Length(), cOpenTVModule::Offset(), and cSmartCardDataNagra::Parse().
| #define UINT32_LE | ( | a | ) | get_misalign((unsigned int *)(a)) |
Definition at line 43 of file helper.h.
Referenced by cMap4101::Map(), and cST20::ReadWord().
| #define UINT8_LE | ( | a | ) | *((unsigned char *)a) |
Definition at line 45 of file helper.h.
Referenced by cST20::ReadByte().
| #define xxor | ( | d, | |
| l, | |||
| v1, | |||
| v2 | |||
| ) | __xxor(d,l,v1,v2) |
Definition at line 93 of file helper.h.
Referenced by cIrdeto2::CalculateHash(), cNagra2::CreatePQ(), cIrdeto2::Decrypt(), cCryptoworks::DecryptRSA(), cIrdeto2::Encrypt(), cN2Prov::ExpandInput(), main(), cSmartCardDataNagra::Parse(), cSeca2ProvPL::PreCW(), cSystemFakeNDS::ProcessECM(), and cNagraDES::SigCheck().
| static void __xxor | ( | unsigned char * | data, |
| int | len, | ||
| const unsigned char * | v1, | ||
| const unsigned char * | v2 | ||
| ) | [inline, static] |
Definition at line 77 of file helper.h.
{
switch(len) { // looks ugly, but the compiler can optimize it very well ;)
case 16:
*((unsigned int *)data+3) = *((unsigned int *)v1+3) ^ *((unsigned int *)v2+3);
*((unsigned int *)data+2) = *((unsigned int *)v1+2) ^ *((unsigned int *)v2+2);
case 8:
*((unsigned int *)data+1) = *((unsigned int *)v1+1) ^ *((unsigned int *)v2+1);
case 4:
*((unsigned int *)data+0) = *((unsigned int *)v1+0) ^ *((unsigned int *)v2+0);
break;
default:
while(len--) *data++ = *v1++ ^ *v2++;
break;
}
}
| T get_misalign | ( | T * | p | ) | [inline] |
Definition at line 29 of file helper.h.
References __attribute__.
{ struct s { T v; } __attribute__((packed)); return ((s *)p)->v; }
| void put_misalign | ( | unsigned int | v, |
| T * | p | ||
| ) | [inline] |
Definition at line 32 of file helper.h.
References __attribute__.
{ struct s { T v; } __attribute__((packed)); ((s *)p)->v = v; }