Changeset 8784
 Timestamp:
 07/30/13 19:03:56 (8 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/modulewebif.c
r8782 r8784 5453 5453 } 5454 5454 #endif 5455 } 5456 5457 if (!do_ipv6) { 5455 } else { 5458 5456 len = sizeof(struct sockaddr_in); 5459 5457 if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { 
trunk/readerviaccess.c
r8702 r8784 227 227 } 228 228 229 int32_t hdSurEncBasicCrypt(int32_t Value, int32_t XorVal){ 230 int32_t i = (Value << 13)  Value + 0x1B59; 231 i = (i * Value) + 0x07CF; 232 return (i ^ XorVal); 233 } 234 235 int32_t hdSurEncCryptLookup(uint8_t Value, uint8_t AddrInd){ 236 static const uint8_t lookup[] = { 237 0x94, 0xB2, 0xA9, 0x79, 0xC4, 0xC7, 0x0D, 0x36, 0x6F, 0x24, 0x11, 0xD1, 0xDB, 0x59, 0xD2, 0xA5, 238 0xE1, 0x00, 0xD4, 0x97, 0xA3, 0x2B, 0x11, 0xFA, 0x5F, 0xF1, 0xC1, 0x44, 0xBF, 0x9B, 0x5A, 0xC8, 239 0xF1, 0xE1, 0x99, 0x82, 0x0E, 0xB2, 0x01, 0x09, 0x0C, 0xC8, 0xB3, 0x3B, 0xD1, 0x80, 0x50, 0xE8, 240 0xF5, 0x52, 0x4C, 0xE6, 0x82, 0xAC, 0x58, 0x40, 0xD4, 0x71, 0x87, 0x52, 0x06, 0xEA, 0xA6, 0x27, 241 0xB7, 0xFE, 0x6C, 0x49, 0x47, 0x3B, 0x70, 0x6C, 0xEB, 0xCD, 0xC5, 0x0B, 0x8C, 0x31, 0x29, 0x42, 242 0x4E, 0x10, 0x2B, 0x2D, 0x46, 0xEC, 0x39, 0xA3, 0x90, 0x4B, 0x25, 0x60, 0x9C, 0x62, 0xD4, 0x20, 243 0xF6, 0x16, 0xA8, 0x9C, 0xE4, 0x20, 0xED, 0xC7, 0xBA, 0x5E, 0xB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 0xAD, 0x05, 0x9F, 0xEC, 0x8F, 0xD0, 389 0xBE, 0xB5, 0x58, 0xF4, 0xF6, 0xBE, 0x08, 0x73, 0x96, 0x19, 0x05, 0x25, 0xEC, 0x3D, 0x26, 0xF4, 390 0x93, 0xDB, 0x9F, 0x56, 0x48, 0x4C, 0xBC, 0xD0, 0x02, 0x59, 0xD1, 0x40, 0x4C, 0xA6, 0x06, 0x41, 391 0xE8, 0x7D, 0x47, 0xAE, 0x3A, 0x9E, 0x1A, 0x71, 0x52, 0xD4, 0x67, 0xC1, 0x14, 0x7E, 0x40, 0x6F, 392 0x1C, 0x75, 0x30, 0x7B, 0x70, 0x3A, 0xE0, 0x37, 0xB7, 0x41, 0x7F, 0xCB, 0x4A, 0xBA, 0xA7, 0xCE, 393 0x56, 0x54, 0xC5, 0x46, 0x65, 0x6F, 0xB4, 0xB6, 0xF0, 0x57, 0xCE, 0x2E, 0x4F, 0xA9, 0xF0, 0x14, 394 0x50, 0xC3, 0x30, 0xC5, 0xBA, 0xE1, 0x5E, 0xD6, 0xDC, 0xC5, 0x78, 0x55, 0x32, 0xAA, 0xCB, 0x29, 395 0x35, 0x81, 0x46, 0x5E, 0x92, 0xE7, 0xDE, 0xCC, 0x92, 0x29, 0x86, 0xE0, 0x8F, 0x91, 0x3C, 0x74, 396 0x97, 0x79, 0x63, 0x97, 0x4A, 0xCC, 0x88, 0xB5, 0xA3, 0x7A, 0xF0, 0xF0, 0x33, 0x87, 0xCD, 0xBD 397 }; 398 uint8_t b = Value ^ hdSurEncBasicCrypt(Value, lookup[(((AddrInd * 2) + 0 ) * 256) + Value]); 399 return (Value ^ hdSurEncBasicCrypt(b, lookup[(((AddrInd * 2) + 1) * 256) + b])); 400 } 401 402 void hdSurEncPhase1(uint8_t* CWs){ 403 static const uint8_t lookup1[] = { 404 0x16, 0x71, 0xCA, 0x14, 0xC4, 0xF4, 0xA3, 0x5A, 0x9D, 0x5F, 0x85, 0x8B, 0xA6, 0x77, 0xFD, 0x3C, 405 0x5F, 0x13, 0x2A, 0x5F, 0x61, 0x36, 0xE4, 0xDC, 0x0D, 0x82, 0x92, 0xC5, 0x25, 0xE1, 0x7A, 0x1C, 406 0x29, 0x19, 0x94, 0x2F, 0xC5, 0xD2, 0xDC, 0xBA, 0x86, 0x60, 0x64, 0x60, 0x86, 0x92, 0xA3, 0x4E, 407 0x3D, 0x9B, 0xCC, 0x16, 0xBB, 0xBA, 0xD2, 0xF0, 0x6A, 0xD3, 0x2F, 0x07, 0x75, 0xBD, 0x28, 0xDB 408 }; 409 static const int8_t lookup2[] = {1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 4}; 410 static const int8_t CAddrIndex[] = {0, 1, 3, 4}; 411 int32_t i, j, i1, i2, i3; 412 413 for(i = 3; i >= 0; i){ 414 for(j = 0; j <= 15; ++j){ 415 CWs[j] = CWs[j] ^ hdSurEncBasicCrypt(j , lookup1 [(16*i) + j]); 416 } 417 418 uint8_t Buffer[16]; 419 uint32_t k; 420 for(i1 = 0; i1 <= 3; ++i1){ 421 for(i2 = 0; i2 <= 3; ++i2){ 422 k = 0; 423 for(i3 = 0; i3 <= 3; ++i3){ 424 k = k + (CWs[(i2*4) + i3] * lookup2[(i3*4) + i1]); 425 Buffer[(i2 * 4) + i1] = (uint8_t)k; 426 } 427 } 428 } 429 memcpy (CWs, Buffer, 16); 430 431 // CW positions are mixed around here 432 uint8_t a4[4]; 433 for(i1 = 1; i1 <= 3; ++i1){ 434 for(i2 = 0; i2 <= 3; ++i2){ 435 a4[i2] = i1 + (i2*4); 436 } 437 for(i2 = 0; i2 <= i1  1; ++i2){ // the given code in Func1_3 seems to be wrong here(3 instead of i11)! 438 uint8_t tmp = CWs[a4[0]]; 439 for(i3 = 1; i3 <= 3; ++i3){ 440 CWs[a4[i31]] = CWs[a4[i3]]; 441 } 442 CWs[a4[3]] = tmp; 443 } 444 } 445 446 for(i1 = 0; i1 <= 15; ++i1){ 447 CWs[i1] = hdSurEncCryptLookup(CWs[i1], CAddrIndex[i1 & 3]); 448 } 449 } 450 } 451 452 void hdSurEncPhase2_sub(uint8_t* CWa, uint8_t* CWb, uint8_t AddrInd ){ 453 uint8_t Buffer[8]; 454 uint8_t tmp, i; 455 for(i = 0; i <= 7; ++i){ 456 Buffer[i] = hdSurEncCryptLookup(CWb[i], AddrInd); 457 } 458 459 // some bitshifting 460 tmp = Buffer[7]; 461 for(i = 7; i >= 1; i){ 462 Buffer[i] = ((Buffer[1] >> 4) & 0xFF)  ((Buffer[i  1] << 4) & 0xFF); 463 } 464 Buffer[0] = ((Buffer[0] >> 4) & 0xFF )  ((tmp << 4) & 0xFF); 465 466 // saving the result 467 for(i = 0; i <= 7; ++i){ 468 CWa[i] = CWa[i] ^ Buffer[i]; 469 } 470 } 471 472 void hdSurEncPhase2(uint8_t* CWs){ 473 hdSurEncPhase2_sub(CWs, CWs + 8, 0); 474 hdSurEncPhase2_sub(CWs + 8, CWs, 1); 475 hdSurEncPhase2_sub(CWs, CWs + 8, 2); 476 hdSurEncPhase2_sub(CWs + 8, CWs, 3); 477 hdSurEncPhase2_sub(CWs, CWs + 8, 4); 478 } 479 229 480 static int32_t viaccess_card_init(struct s_reader * reader, ATR *newatr) 230 481 { … … 360 611 int32_t curnumber_ecm=0; 361 612 //nanoD2 d2 02 0d 02 > D2 nano, len 2 362 // 0d > post AES decrypt CW363 // 0b > pre AES decrypt CW364 int32_t nanoD2 = 0; // 0x0b = 1 0x0d = 2 613 // 0d, 0f > post AES decrypt CW 614 // 0b, 11 > pre AES decrypt CW 615 int32_t nanoD2 = 0; // 0x0b = 1 0x0d = 2 0x0f = 3 0x11 = 4 365 616 366 617 memset(DE04, 0, sizeof(DE04)); //fix dorcel de04 bug … … 402 653 nanoD2 = 2; 403 654 rdr_debug_mask(reader, D_READER, "ECM: nano D2 0x0d"); 655 } 656 if(ecm88Data[2]==0x0f) 657 { 658 nanoD2 = 3; 659 rdr_debug_mask(reader, D_READER, "ECM: nano D2 0x0f"); 660 } 661 if(ecm88Data[2]==0x11) 662 { 663 nanoD2 = 4; 664 rdr_debug_mask(reader, D_READER, "ECM: nano D2 0x11"); 404 665 } 405 666 // use the d2 arguments to get the key # to be used … … 495 756 } 496 757 497 //Nano D2 0x0b Pre AES decrypt CW498 if ( hasD2 && nanoD2 == 1)758 //Nano D2 0x0b and 0x0f Pre AES decrypt CW 759 if ( hasD2 && (nanoD2 == 1  nanoD2 == 3)) 499 760 { 500 761 uchar *ecm88DataCW = ecm88Data; … … 512 773 cwStart++; 513 774 } 775 if(nanoD2 == 3){ 776 hdSurEncPhase1(ecm88DataCW); 777 hdSurEncPhase2(ecm88DataCW); 778 } 514 779 // use AES from list to decrypt CW 515 780 rdr_debug_mask(reader, D_READER, "Decoding CW : using AES key id %d for provider %06x",D2KeyID, (provid & 0xFFFFF0)); 516 781 if (aes_decrypt_from_list(reader>aes_list,0x500, (uint32_t) (provid & 0xFFFFF0), D2KeyID, &ecm88DataCW[0], 16) == 0) 517 782 snprintf( ea>msglog, MSGLOGSIZE, "AES Decrypt : key id %d not found for CAID %04X , provider %06x", D2KeyID, 0x500, (provid & 0xFFFFF0) ); 783 if(nanoD2 == 3){ 784 hdSurEncPhase1(ecm88DataCW); 785 } 518 786 } 519 787 … … 591 859 } 592 860 593 if ( hasD2 && !dcw_crc(ea>cw) && nanoD2 == 2) { 861 if ( hasD2 && !dcw_crc(ea>cw) && (nanoD2 == 2  nanoD2 == 4)) { 862 if(nanoD2 == 4){ 863 hdSurEncPhase1(ea>cw); 864 hdSurEncPhase2(ea>cw); 865 } 594 866 rdr_debug_mask(reader, D_READER, "Decoding CW : using AES key id %d for provider %06x",D2KeyID, (provid & 0xFFFFF0)); 595 867 rc=aes_decrypt_from_list(reader>aes_list,0x500, (uint32_t) (provid & 0xFFFFF0), D2KeyID,ea>cw, 16); 596 868 if( rc == 0 ) 597 869 snprintf( ea>msglog, MSGLOGSIZE, "AES Decrypt : key id %d not found for CAID %04X , provider %06x", D2KeyID, 0x500, (provid & 0xFFFFF0) ); 870 if(nanoD2 == 4){ 871 hdSurEncPhase1(ea>cw); 872 } 598 873 } 599 874
Note:
See TracChangeset
for help on using the changeset viewer.