Changeset 4059 for trunk/reader-viaccess.c
- Timestamp:
- 12/08/10 07:56:51 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/reader-viaccess.c
r3893 r4059 292 292 int D2KeyID=0; 293 293 int curnumber_ecm=0; 294 //nanoD2 d2 02 0d 02 -> D2 nano, len 2 295 // 0d -> post AES decrypt CW 296 // 0b -> pre AES decrypt CW 297 int nanoD2 = 0; // 0x0b = 1 0x0d = 2 294 298 295 299 memset(DE04, 0, sizeof(DE04)); //fix dorcel de04 bug … … 319 323 // d2 02 0d 02 -> D2 nano, len 2, select the AES key to be used 320 324 if(ecm88Data[0]==0xd2) { 325 // test if need post or pre AES decrypt 326 if(ecm88Data[2]==0x0b) 327 { 328 nanoD2 = 1; 329 cs_debug("[viaccess-reader] ECM: nano D2 0x0b"); 330 } 331 if(ecm88Data[2]==0x0d) 332 { 333 nanoD2 = 2; 334 cs_debug("[viaccess-reader] ECM: nano D2 0x0d"); 335 } 321 336 // use the d2 arguments to get the key # to be used 322 337 int len = ecm88Data[1] + 2; … … 407 422 write_cmd(insa4, ident); // set provider 408 423 } 424 425 //Nano D2 0x0b Pre AES decrypt CW 426 if ( hasD2 && nanoD2 == 1) 427 { 428 const uchar *ecm88DataCW = ecm88Data; 429 int cwStart = 0; 430 int cwStartRes = 0; 431 int exit = 0; 432 // find CW start 433 while(cwStart < curEcm88len -1 && !exit) 434 { 435 if(ecm88Data[cwStart] == 0xEA && ecm88Data[cwStart+1] == 0x10) 436 { 437 ecm88DataCW = ecm88DataCW + cwStart + 2; 438 exit = 1; 439 } 440 cwStart++; 441 } 442 // use AES from list to decrypt CW 443 if(reader->aes_list) 444 { 445 cs_debug("Decoding CW : using AES key id %d for provider %06x",D2KeyID, (provid & 0xFFFFF0)); 446 rc=aes_decrypt_from_list(reader->aes_list,0x500, (uint32) (provid & 0xFFFFF0), D2KeyID, &ecm88DataCW[0], 16); 447 if( rc == 0 ) 448 snprintf( er->msglog, MSGLOGSIZE, "AES Decrypt : key id %d not found for CAID %04X , provider %06lx", D2KeyID, 0x500, (provid & 0xFFFFF0) ); 449 } 450 else 451 { 452 aes_decrypt(&ecm88DataCW[0], 16); 453 } 454 } 409 455 410 456 while(ecm88Len>0 && ecm88Data[0]<0xA0) … … 475 521 } 476 522 477 if ( hasD2 && !check_crc(er->cw) ) {523 if ( hasD2 && !check_crc(er->cw) && nanoD2 == 2) { 478 524 if(reader->aes_list) { 479 525 cs_debug("Decoding CW : using AES key id %d for provider %06x",D2KeyID, (provid & 0xFFFFF0));
Note:
See TracChangeset
for help on using the changeset viewer.