SASC-NG
DVBSoftCAM

cMap4101 Class Reference

Inheritance diagram for cMap4101:

List of all members.

Protected Member Functions

virtual bool Map (int f, unsigned char *data, int l)

Detailed Description

Definition at line 28 of file nagra2-4101.c.


Member Function Documentation

bool cMap4101::Map ( int  f,
unsigned char *  data,
int  l 
) [protected, virtual]

Reimplemented from cMapCore.

Definition at line 33 of file nagra2-4101.c.

References cMapCore::AddP(), b, cMapCore::CurveInit(), cMapMath::D, cMapCore::DoMap(), cMapCore::DoubleP(), cBN::GetLE(), cMapReg::GetLE(), i, cBN::PutLE(), cMapCore::Px, cMapCore::Py, cMapCore::Qx, cMapCore::Qy, cMapMath::scalar, cMapMath::sctx, cMapCore::ToAffine(), cMapCore::ToProjective(), and UINT32_LE.

{
  switch(f) {
    case 0x58:
      {
      cBN a, b, x, y, scalar;
      D.GetLE(data+0x00,16);
      x.GetLE(data+0x10,16);
      y.GetLE(data+0x20,16);
      b.GetLE(data+0x30,16);
      a.GetLE(data+0x40,16);
      scalar.GetLE(data+0x50,16);
      int scalarbits=BN_num_bits(scalar);
      if(scalarbits>=2 && !BN_is_zero(x) && !BN_is_zero(y) && !BN_is_zero(b)) {
        CurveInit(a);
        ToProjective(0,x,y);
        BN_copy(Qx,Px);
        BN_copy(Qy,Py);
        for(int i=scalarbits-2; i>=0; i--) {
          DoubleP(0);
          if(BN_is_bit_set(scalar,i)) AddP(0);
          }
        ToAffine();
        }
      memset(data,0,64);
      Px.PutLE(&data[0],16);
      Py.PutLE(&data[32],16);
      break;
      }
    case 0x44:
      sctx.h4=UINT32_LE(data);
      sctx.h3=UINT32_LE(data+4);
      sctx.h2=UINT32_LE(data+8);
      sctx.h1=UINT32_LE(data+12);
      sctx.h0=UINT32_LE(data+16);
      cMapCore::DoMap(0x44,data);
      break;
    default:
      return false;
    }
  return true;
}

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