Changeset 823 for trunk/reader-dre.c


Ignore:
Timestamp:
Dec 14, 2009, 2:02:29 PM (10 years ago)
Author:
dingo35
Message:

Add DreCrypt? Unique EMM cmd42 style

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/reader-dre.c

    r521 r823  
    270270    if ((dre_cmd (ecmcmd41))) { //ecm request
    271271      if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
    272     return 0;       //exit if response is not 90 00
     272                return 0;       //exit if response is not 90 00
    273273      memcpy (er->cw, cta_res + 11, 8);
    274274      memcpy (er->cw + 8, cta_res + 3, 8);
     
    292292    if ((dre_cmd (ecmcmd51))) { //ecm request
    293293      if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
    294     return 0;       //exit if response is not 90 00
     294                return 0;       //exit if response is not 90 00
    295295      memcpy (er->cw, cta_res + 11, 8);
    296296      memcpy (er->cw + 8, cta_res + 3, 8);
     
    317317      emmcmd52[0x39] = provider;
    318318      if ((dre_cmd (emmcmd52)))
    319     if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
    320       return 0;     //exit if response is not 90 00
    321     }
     319                if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
     320                return 0;       //exit if response is not 90 00
     321        }
    322322  }
    323323  else {
     
    329329      0x56, 0x58, 0x11
    330330    };
    331     memcpy (emmcmd42 + 1, ep->emm + 6, 48);
    332     emmcmd42[51] = provider;
    333     //emmcmd42[50] = ecmcmd42[2]; //TODO package nr could also be fixed 0x58
    334     emmcmd42[50] = 0x58;
    335     emmcmd42[49] = ep->emm[5];  //keynr
    336     /* response:
    337        59 05 A2 02 05 01 5B
    338        90 00 */
    339     if ((dre_cmd (emmcmd42))) { //first emm request
    340       if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
    341     return 0;       //exit if response is not 90 00
    342 
    343       memcpy (emmcmd42 + 1, ep->emm + 55, 7);   //TODO OR next two lines?
    344       /*memcpy (emmcmd42 + 1, ep->emm + 55, 7);  //FIXME either I cant count or my EMM log contains errors
    345          memcpy (emmcmd42 + 8, ep->emm + 67, 41); */
    346       emmcmd42[51] = provider;
    347       //emmcmd42[50] = ecmcmd42[2]; //TODO package nr could also be fixed 0x58
    348       emmcmd42[50] = 0x58;
    349       emmcmd42[49] = ep->emm[54];   //keynr
    350       if ((dre_cmd (emmcmd42))) {   //second emm request
    351     if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
    352       return 0;     //exit if response is not 90 00
    353       }
    354     }
     331        switch (ep->emm[0]) {
     332            case 0x87: //unique EMM
     333                memcpy (emmcmd42 + 4, ep->emm + 3, 45);
     334                emmcmd42[3] = 0x00; //not sure about this
     335                emmcmd42[49] = ep->emm[41]; //keynr
     336                emmcmd42[50] = 0x58 + ep->emm[40]; //package nr
     337            emmcmd42[51] = provider;
     338            if ((dre_cmd (emmcmd42))) {
     339              if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
     340                        return 0;       //exit if response is not 90 00
     341                }
     342                break;
     343            case 0x89: //shared EMM
     344            default:
     345            memcpy (emmcmd42 + 1, ep->emm + 6, 48);
     346            emmcmd42[51] = provider;
     347            //emmcmd42[50] = ecmcmd42[2]; //TODO package nr could also be fixed 0x58
     348            emmcmd42[50] = 0x58;
     349            emmcmd42[49] = ep->emm[5];  //keynr
     350            /* response:
     351               59 05 A2 02 05 01 5B
     352               90 00 */
     353            if ((dre_cmd (emmcmd42))) { //first emm request
     354              if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
     355                        return 0;       //exit if response is not 90 00
     356       
     357              memcpy (emmcmd42 + 1, ep->emm + 55, 7);   //TODO OR next two lines?
     358              /*memcpy (emmcmd42 + 1, ep->emm + 55, 7);  //FIXME either I cant count or my EMM log contains errors
     359                 memcpy (emmcmd42 + 8, ep->emm + 67, 41); */
     360              emmcmd42[51] = provider;
     361              //emmcmd42[50] = ecmcmd42[2]; //TODO package nr could also be fixed 0x58
     362              emmcmd42[50] = 0x58;
     363              emmcmd42[49] = ep->emm[54];   //keynr
     364              if ((dre_cmd (emmcmd42))) {   //second emm request
     365                        if ((cta_res[cta_lr - 2] != 0x90) || (cta_res[cta_lr - 1] != 0x00))
     366                            return 0;       //exit if response is not 90 00
     367              }
     368            }
     369        }
    355370  }
    356371  return 1;         //success
Note: See TracChangeset for help on using the changeset viewer.