SASC-NG
DVBSoftCAM

cryptoworks.c File Reference

#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <byteswap.h>
#include "system-common.h"
#include "data.h"
#include "helper.h"
#include "crypto.h"
#include "misc.h"
#include "log-sys.h"
#include "version.h"

Go to the source code of this file.

Classes

class  cCwDes
class  cCryptoworks
class  cPlainKeyCryptoworks
class  cSystemCryptoworks
class  cSystemLinkCryptoworks

Defines

#define SYSTEM_CRYPTOWORKS   0x0D00
#define SYSTEM_NAME   "Cryptoworks"
#define SYSTEM_PRI   -10
#define SYSTEM_CAN_HANDLE(x)   ((x)==SYSTEM_CRYPTOWORKS)
#define L_SYS   4
#define L_SYS_ALL   LALL(L_SYS_LASTDEF)
#define DUMPNANO(t, p, n)
#define shiftin(V, R, n)   ((V<<1)+(((R)>>(n))&1))
#define rol28(V, n)   (V<<(n) | ((V&0x0fffffffL)>>(28-(n))))
#define ror28(V, n)   (V>>(n) | ((V&0xfffffff0L)<<(28-(n))))
#define DESROUND(C, D, T)
#define PLAINLEN_CW_D   16
#define PLAINLEN_CW_CC   6
#define PLAINLEN_CW_R   64
#define CCTYP   0x00
#define CCID   0xFF
#define PROV(keynr)   (((keynr)>>16)&0xFF)
#define TYPE(keynr)   (((keynr)>> 8)&0xFF)
#define ID(keynr)   (((keynr) )&0xFF)
#define KEYSET(prov, typ, id)   ((((prov)&0xFF)<<16)|(((typ)&0xFF)<<8)|((id)&0xFF))
#define ECM_ALGO_TYP   5
#define ECM_DATA_START   ECM_ALGO_TYP
#define ECM_NANO_LEN   7
#define ECM_NANO_START   8

Functions

 SCAPIVERSTAG ()

Variables

static struct LogModule lm_sys
static const unsigned char cryptoPC1 []
static const unsigned char cryptoPC2 []
static cPlainKeyTypeReg
< cPlainKeyCryptoworks,'W'> 
KeyReg
static cSystemLinkCryptoworks staticInit

Define Documentation

#define CCID   0xFF
#define CCTYP   0x00
#define DESROUND (   C,
  D,
  T 
)
Value:
{ \
   unsigned int s=0; \
   for(int j=7, k=0; j>=0; j--) { \
     unsigned int v=0, K=0; \
     for(int t=5; t>=0; t--, k++) { \
       v=shiftin(v,T,E[k]); \
       if(PC2[k]<33) K=shiftin(K,C,32-PC2[k]); \
       else          K=shiftin(K,D,64-PC2[k]); \
       } \
     s=(s<<4) + S[7-j][v^K]; \
     } \
   T=0; \
   for(int j=31; j>=0; j--) T=shiftin(T,s,P[j]); \
   }

Definition at line 90 of file cryptoworks.c.

Referenced by cCwDes::CwDes(), cCwDes::CwL2Des(), and cCwDes::CwR2Des().

#define DUMPNANO (   t,
  p,
  n 
)
Value:
LBSTART(L_SYS_VERBOSE); \
  LBPUT("%s",(t)); \
  unsigned char *__p=(unsigned char *)(p); \
  int __n=(n); \
  for(int i=0; i<__n;) { \
    LBFLUSH(); \
    LBPUT("%02X %02X -",__p[i],__p[i+1]); \
    i+=2; \
    for(int l=__p[i-1]; l>0; l--) { LBPUT(" %02X",__p[i]); i++; }\
    if(i>__n) { LBFLUSH(); LBPUT("length exceeded %d != %d",i,__n); } \
    } \
  LBEND();

Definition at line 52 of file cryptoworks.c.

Referenced by cSystemCryptoworks::ProcessECM().

#define ECM_ALGO_TYP   5

Definition at line 404 of file cryptoworks.c.

Referenced by cSystemCryptoworks::ProcessECM().

#define ECM_DATA_START   ECM_ALGO_TYP

Definition at line 405 of file cryptoworks.c.

Referenced by cSystemCryptoworks::ProcessECM().

#define ECM_NANO_LEN   7

Definition at line 406 of file cryptoworks.c.

Referenced by cSystemCryptoworks::ProcessECM().

#define ECM_NANO_START   8

Definition at line 407 of file cryptoworks.c.

Referenced by cSystemCryptoworks::ProcessECM().

#define ID (   keynr)    (((keynr) )&0xFF)

Definition at line 339 of file cryptoworks.c.

Referenced by cPlainKeyIrd::PrintKeyNr(), and cPlainKeyCryptoworks::PrintKeyNr().

#define L_SYS   4

Definition at line 41 of file cryptoworks.c.

#define L_SYS_ALL   LALL(L_SYS_LASTDEF)

Definition at line 42 of file cryptoworks.c.

#define PLAINLEN_CW_CC   6

Definition at line 331 of file cryptoworks.c.

Referenced by cPlainKeyCryptoworks::Parse().

#define PLAINLEN_CW_D   16

Definition at line 330 of file cryptoworks.c.

Referenced by cPlainKeyCryptoworks::Parse().

#define PLAINLEN_CW_R   64

Definition at line 332 of file cryptoworks.c.

Referenced by cPlainKeyCryptoworks::Parse().

#define PROV (   keynr)    (((keynr)>>16)&0xFF)
#define rol28 (   V,
  n 
)    (V<<(n) | ((V&0x0fffffffL)>>(28-(n))))

Definition at line 87 of file cryptoworks.c.

Referenced by cCwDes::CwDes(), cCwDes::CwL2Des(), and cCwDes::CwR2Des().

#define ror28 (   V,
  n 
)    (V>>(n) | ((V&0xfffffff0L)<<(28-(n))))

Definition at line 88 of file cryptoworks.c.

Referenced by cCwDes::CwDes(), and cCwDes::CwR2Des().

#define shiftin (   V,
  R,
  n 
)    ((V<<1)+(((R)>>(n))&1))

Definition at line 86 of file cryptoworks.c.

#define SYSTEM_CAN_HANDLE (   x)    ((x)==SYSTEM_CRYPTOWORKS)

Definition at line 39 of file cryptoworks.c.

Referenced by cSystemLinkCryptoworks::CanHandle().

#define SYSTEM_CRYPTOWORKS   0x0D00

Definition at line 35 of file cryptoworks.c.

#define SYSTEM_NAME   "Cryptoworks"

Definition at line 37 of file cryptoworks.c.

#define SYSTEM_PRI   -10

Definition at line 38 of file cryptoworks.c.

#define TYPE (   keynr)    (((keynr)>> 8)&0xFF)

Function Documentation

SCAPIVERSTAG ( )

Variable Documentation

const unsigned char cryptoPC1[] [static]
Initial value:
 {
   53,46,39,32,50,43,36,29,
   22,15, 8, 1,51,44,37,30,
   23,16, 9, 2,52,45,38,31,
   24,17,10, 3,53,46,39,32,
   25,18,11, 4,56,49,42,35,
   28,21,14, 7,55,48,41,34,
   27,20,13, 6,54,47,40,33,
   26,19,12, 5,25,18,11, 4
  }

Definition at line 68 of file cryptoworks.c.

const unsigned char cryptoPC2[] [static]
Initial value:
 {
  18,21,15,28, 5, 9,   7,32,19,10,25,14,
  27,23,16, 8,30,12,  20,11,31,24,17, 6,
  49,60,39,45,55,63,  38,48,59,53,41,56,
  52,57,47,64,42,61,  54,50,58,44,37,40,
  }

Definition at line 79 of file cryptoworks.c.

Definition at line 352 of file cryptoworks.c.

struct LogModule lm_sys [static]
Initial value:

Definition at line 44 of file cryptoworks.c.

Definition at line 548 of file cryptoworks.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines