Changeset 3114
- Timestamp:
- 09/21/10 04:09:53 (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/reader-videoguard-common.c
r3103 r3114 6 6 #include "reader-videoguard-common.h" 7 7 8 void set_known_card_info(struct s_reader * reader) 8 void set_known_card_info(struct s_reader * reader) 9 9 { 10 10 /* Set to sensible default values */ … … 187 187 static void cCamCryptVG_Process_D1(const unsigned char *ins, unsigned char *data, const unsigned char *status); 188 188 static void cCamCryptVG_Decrypt_D3(unsigned char *ins, unsigned char *data, const unsigned char *status); 189 static void cCamCryptVG_PostProcess_Decrypt(unsigned char *buff, int len, unsigned char *cw 1, unsigned char *cw2);189 static void cCamCryptVG_PostProcess_Decrypt(unsigned char *buff, int len, unsigned char *cw); 190 190 191 191 struct CmdTab *cmd_table=NULL; 192 192 193 int cw_is_valid(unsigned char *cw ) //returns 1 if cw_is_valid, returns 0 if cw is all zeros194 { 195 int i; 196 for (i = 0; i <8; i++)193 int cw_is_valid(unsigned char *cw, int start) //returns 1 if cw_is_valid, returns 0 if cw is all zeros 194 { 195 int i; 196 for (i = start; i < start+8; i++) 197 197 if (cw[i] != 0) { //test if cw = 00 198 198 return OK; … … 272 272 } 273 273 274 static void cCamCryptVG_PostProcess_Decrypt(unsigned char *buff, int len, unsigned char *cw 1, unsigned char *cw2)274 static void cCamCryptVG_PostProcess_Decrypt(unsigned char *buff, int len, unsigned char *cw) 275 275 { 276 276 switch(buff[0]) { … … 284 284 cCamCryptVG_Decrypt_D3(buff,buff+5,buff+buff[4]+5); 285 285 if(buff[1]==0x54) { 286 memcpy(cw 1,buff+5,8);287 memset(cw 2,0,8); //set to 0 so client will know it is not valid if not overwritten with valid cw286 memcpy(cw+0,buff+5,8); 287 memset(cw+8,0,8); //set to 0 so client will know it is not valid if not overwritten with valid cw 288 288 int ind; 289 289 for(ind=15; ind<len+5-10; ind++) { // +5 for 5 ins bytes, -10 to prevent memcpy ind+3,8 from reading past buffer … … 291 291 if(buff[ind]==0x25) { 292 292 //memcpy(cw2,buff+5+ind+2,8); 293 memcpy(cw 2,buff+ind+3,8); //tested on viasat 093E, sky uk 0963, sky it 919 //don't care whether cw is 0 or not293 memcpy(cw+8,buff+ind+3,8); //tested on viasat 093E, sky uk 0963, sky it 919 //don't care whether cw is 0 or not 294 294 break; 295 295 } … … 500 500 } 501 501 502 void Manage_Tag(unsigned char *Answer) 503 { 504 unsigned char Tag,Len,Len2; 505 bool Valid_0x55=0; 506 unsigned char *Body; 507 unsigned char Buffer[0x10]; 508 int a=0x13; 509 Len2=Answer[4]; 510 while(a<Len2) 511 { 512 Tag=Answer[a]; 513 Len=Answer[a+1]; 514 Body=Answer+a+2; 515 switch(Tag) 516 { 517 case 0x55:{ 518 if(Body[0]==0x84) //Tag 0x56 has valid data... 519 Valid_0x55=1; 520 }break; 521 case 0x56:{ 522 memcpy(Buffer+8,Body,8); 523 }break; 524 } 525 a+=Len+2; 526 527 } 528 if(Valid_0x55) 529 { 530 memcpy(Buffer,Answer+5,8); //Copy original DW 531 AES_decrypt(Buffer,Buffer,&Astro_Key); //Astro_Key declared and filled before... 532 memcpy(CW1,Buffer,8); //Now copy calculated DW in right place 533 } 502 void manage_tag(unsigned char *rxbuff, unsigned char *cw) 503 { 504 unsigned char tag,len,len2; 505 bool valid_0x55=FALSE; 506 unsigned char *body; 507 unsigned char buffer[0x10]; 508 int a=0x13; 509 len2=rxbuff[4]; 510 while(a<len2-9) // -9 (body=8 len=1) to prevent memcpy(buffer+8,body,8) from reading past rxbuff 511 { 512 tag=rxbuff[a]; 513 len=rxbuff[a+1]; 514 body=rxbuff+a+2; 515 switch(tag) 516 { 517 case 0x55:{ 518 if(body[0]==0x84){ //Tag 0x56 has valid data... 519 valid_0x55=TRUE; 520 } 521 }break; 522 case 0x56:{ 523 memcpy(buffer+8,body,8); 524 }break; 525 } 526 a+=len+2; 527 } 528 if(valid_0x55){ 529 memcpy(buffer,rxbuff+5,8); //Copy original CW 530 AES_decrypt(buffer,buffer,&Astro_Key); //Astro_Key declared and filled before... 531 memcpy(cw+0,buffer,8); //Now copy calculated CW in right place 532 } 534 533 } 535 534 … … 574 573 } 575 574 576 int do_cmd(struct s_reader * reader, const unsigned char *ins, const unsigned char *txbuff, unsigned char *rxbuff, unsigned char * cta_res) 575 int do_cmd(struct s_reader * reader, const unsigned char *ins, const unsigned char *txbuff, unsigned char *rxbuff, 576 unsigned char *cw, unsigned char * cta_res) 577 577 { 578 578 ushort cta_lr; … … 604 604 } 605 605 606 cCamCryptVG_PostProcess_Decrypt(rxbuff,len, CW1,CW2);606 cCamCryptVG_PostProcess_Decrypt(rxbuff,len,cw); 607 607 608 608 // Start of suggested fix for 09ac cards … … 613 613 ///} 614 614 615 Manage_Tag(rxbuff);615 manage_tag(rxbuff, cw); 616 616 // End of suggested fix 617 617 return len; … … 634 634 unsigned char md5_digest[0x10]; 635 635 //ecm_header_data = 01 03 b0 01 01 636 if (!cw_is_valid(cw )) //if cw is all zero, keep it that way636 if (!cw_is_valid(cw,0)) //if cw is all zero, keep it that way 637 637 { 638 638 return; -
trunk/reader-videoguard-common.h
r3097 r3114 12 12 #define write_cmd_vg(cmd, data) (card_write(reader, cmd, data, cta_res, &cta_lr) == 0) 13 13 14 #define VG_EMMTYPE_MASK 0xC0 15 #define VG_EMMTYPE_G 0 16 #define VG_EMMTYPE_U 1 17 #define VG_EMMTYPE_S 2 14 #define VG_EMMTYPE_MASK 0xC0 15 #define VG_EMMTYPE_G 0 16 #define VG_EMMTYPE_U 1 17 #define VG_EMMTYPE_S 2 18 18 19 19 #define NDSUNKNOWN 0 … … 32 32 33 33 AES_KEY dkey, ekey, Astro_Key; 34 35 unsigned char CW1[8], CW2[8];36 34 37 35 extern int io_serial_need_dummy_char; … … 54 52 struct CmdTab *cmd_table; 55 53 56 extern int cw_is_valid(unsigned char *cw );54 extern int cw_is_valid(unsigned char *cw, int start); 57 55 extern void cAES_SetKey(const unsigned char *key); 58 56 extern int cAES_Encrypt(const unsigned char *data, int len, unsigned char *crypt); … … 67 65 68 66 extern void do_post_dw_hash(unsigned char *cw, unsigned char *ecm_header_data); 69 extern void Manage_Tag(unsigned char *Answer);67 extern void manage_tag(unsigned char *answer, unsigned char *cw); 70 68 extern int status_ok(const unsigned char *status); 71 69 … … 73 71 extern int cmd_exists(const unsigned char *cmd); 74 72 extern int read_cmd_len(struct s_reader * reader, const unsigned char *cmd); 75 extern int do_cmd(struct s_reader * reader, const unsigned char *ins, const unsigned char *txbuff, unsigned char *rxbuff, unsigned char * cta_res);76 73 extern int do_cmd(struct s_reader * reader, const unsigned char *ins, const unsigned char *txbuff, unsigned char *rxbuff, 74 unsigned char *cw, unsigned char * cta_res); 77 75 extern void rev_date_calc(const unsigned char *Date, int *year, int *mon, int *day, int *hh, int *mm, int *ss, int base_year); 78 76 extern void set_known_card_info(struct s_reader * reader); -
trunk/reader-videoguard1.c
r3097 r3114 277 277 l = vg1_do_cmd(reader, ins54, NULL, rbuff, cta_res); 278 278 if (l > 0 && status_ok(cta_res + l)) { 279 memcpy(CW1, rbuff + 5, 8); 280 //set to 0 so client will know it is not valid if not overwritten with valid cw 281 memset(CW2, 0, 8); 282 if (!cw_is_valid(CW1)) //sky cards report 90 00 = ok but send cw = 00 when channel not subscribed 279 if (!cw_is_valid(rbuff+5,0)) //sky cards report 90 00 = ok but send cw = 00 when channel not subscribed 283 280 { 284 cs_log("[videoguard1-reader] class48 ins54 status 90 00 but cw=00 -> channel not subscribed "); 285 return ERROR; 286 } 287 if (er->ecm[0] & 1) { 288 memcpy(er->cw + 8, CW1, 8); 289 memcpy(er->cw + 0, CW2, 8); 281 cs_log("[videoguard1-reader] class48 ins54 status 90 00 but cw=00 -> channel not subscribed"); 282 return ERROR; 283 } 284 285 if(er->ecm[0]&1) { 286 memset(er->cw+0, 0, 8); 287 memcpy(er->cw+8, rbuff + 5, 8); 290 288 } else { 291 memcpy(er->cw + 0, CW1, 8);292 memcpy(er->cw + 8, CW2, 8);289 memcpy(er->cw+0, rbuff + 5, 8); 290 memset(er->cw+8, 0, 8); 293 291 } 294 292 return OK; -
trunk/reader-videoguard12.c
r3097 r3114 8 8 static const unsigned char ins2a[5] = { 0x48,0x2a,0x00,0x00,0x00 }; 9 9 int l; 10 l=do_cmd(reader, ins2a,NULL,NULL,cta_res);10 l=do_cmd(reader,ins2a,NULL,NULL,NULL,cta_res); 11 11 if(l<0 || !status_ok(cta_res+l)) return; 12 12 static unsigned char ins76[5] = { 0x48,0x76,0x00,0x00,0x00 }; … … 22 22 for(i=0; i<num; i++) { 23 23 ins76[2]=i; 24 l=do_cmd(reader, ins76,NULL,NULL,cta_res);24 l=do_cmd(reader,ins76,NULL,NULL,NULL,cta_res); 25 25 if(l<0 || !status_ok(cta_res+l)) return; 26 26 if(cta_res[2]==0 && cta_res[3]==0) break; … … 132 132 /* we can try to get the boxid from the card */ 133 133 int boxidOK=0; 134 l=do_cmd(reader, ins36, NULL, buff,cta_res);134 l=do_cmd(reader,ins36,NULL,buff,NULL,cta_res); 135 135 if(l<13) 136 136 cs_log("[videoguard12-reader] ins36: too short answer"); … … 159 159 break; 160 160 case 0xF3: /* boxID */ 161 memcpy( &boxID,&buff[i+1],sizeof(boxID));161 memcpy(boxID,buff+i+1,sizeof(boxID)); 162 162 boxidOK=1; 163 163 i+=5; … … 214 214 //short int SWIRDstatus = cta_res[1]; 215 215 unsigned char ins58[5] = { 0x48,0x58,0x00,0x00,0x00 }; 216 l=do_cmd(reader, ins58, NULL, buff,cta_res);216 l=do_cmd(reader,ins58,NULL,buff,NULL,cta_res); 217 217 if(l<0) { 218 218 cs_log("[videoguard12-reader] cmd ins58 failed"); … … 252 252 unsigned char tbuff[64]; 253 253 cCamCryptVG_GetCamKey(tbuff); 254 l=do_cmd(reader, insB4, tbuff,NULL,cta_res);254 l=do_cmd(reader,insB4,tbuff,NULL,NULL,cta_res); 255 255 if(l<0 || !status_ok(cta_res)) { 256 256 cs_log ("[videoguard12-reader] cmd D0B4 failed (%02X%02X)", cta_res[0], cta_res[1]); … … 259 259 260 260 unsigned char insBC[5] = { 0x48,0xBC,0x00,0x00,0x00 }; 261 l=do_cmd(reader, insBC, NULL,NULL,cta_res);261 l=do_cmd(reader,insBC,NULL,NULL,NULL,cta_res); 262 262 if(l<0) { 263 263 cs_log("[videoguard12-reader] cmd D0BC failed"); … … 266 266 267 267 unsigned char insBE[5] = { 0x48,0xBE,0x00,0x00,0x00 }; 268 l=do_cmd(reader, insBE, NULL,NULL,cta_res);268 l=do_cmd(reader,insBE,NULL,NULL,NULL,cta_res); 269 269 if(l<0) { 270 270 cs_log("[videoguard12-reader] cmd D3BE failed"); … … 273 273 274 274 unsigned char ins58a[5] = { 0x49,0x58,0x00,0x00,0x00 }; 275 l=do_cmd(reader, ins58a, NULL,NULL,cta_res);275 l=do_cmd(reader,ins58a,NULL,NULL,NULL,cta_res); 276 276 if(l<0) { 277 277 cs_log("[videoguard12-reader] cmd D158 failed"); … … 280 280 281 281 unsigned char ins4Ca[5] = { 0x49,0x4C,0x00,0x00,0x00 }; 282 l=do_cmd(reader, ins4Ca,payload4C,NULL,cta_res);282 l=do_cmd(reader,ins4Ca,payload4C,NULL,NULL,cta_res); 283 283 if(l<0 || !status_ok(cta_res)) { 284 284 cs_log("[videoguard12-reader] cmd D14Ca failed"); … … 305 305 unsigned char tbuff[264]; 306 306 tbuff[0]=0; 307 memcpy( &tbuff[1],&(er->ecm[posECMpart2+1]),lenECMpart2-1);307 memcpy(tbuff+1,er->ecm+posECMpart2+1,lenECMpart2-1); 308 308 ins40[4]=lenECMpart2; 309 309 int l; 310 l = do_cmd(reader, ins40,tbuff,NULL,cta_res);310 l = do_cmd(reader,ins40,tbuff,NULL,NULL,cta_res); 311 311 if(l>0 && status_ok(cta_res)) { 312 l = do_cmd(reader, ins54,NULL,NULL,cta_res);312 l = do_cmd(reader,ins54,NULL,NULL,er->cw,cta_res); 313 313 if(l>0 && status_ok(cta_res+l)) { 314 if (!cw_is_valid( CW1)) //sky cards report 90 00 = ok but send cw = 00 when channel not subscribed314 if (!cw_is_valid(er->cw+0,0)) //sky cards report 90 00 = ok but send cw = 00 when channel not subscribed 315 315 { 316 snprintf( er->msglog, MSGLOGSIZE, "9000 but cw=00 -> channel not subscribed " );316 cs_log("[reader-videoguard12] ins54 returned status 90 00 but cw=00 -> channel not subscribed " ); 317 317 return ERROR; 318 318 } 319 319 320 320 if(er->ecm[0]&1) { 321 memcpy(er->cw+8,CW1,8); 322 memcpy(er->cw+0,CW2,8); 323 } 324 else { 325 memcpy(er->cw+0,CW1,8); 326 memcpy(er->cw+8,CW2,8); 327 } 328 321 unsigned char tmpcw[8]; 322 memcpy(tmpcw,er->cw+8,8); 323 memcpy(er->cw+8,er->cw+0,8); 324 memcpy(er->cw+0,tmpcw,8); 325 } 329 326 330 327 //test for postprocessing marker … … 347 344 } 348 345 } 349 snprintf( er->msglog, MSGLOGSIZE, "(%d) status not ok %02x %02x",l, cta_res[0],cta_res[1] );346 cs_log("[reader-videoguard12] ins54 (%d) status not ok %02x %02x",l, cta_res[0],cta_res[1] ); 350 347 return ERROR; 351 348 } … … 552 549 while (payload) { 553 550 ins42[4]=*payload; 554 int l = do_cmd(reader, ins42,payload+1,NULL,cta_res);551 int l = do_cmd(reader,ins42,payload+1,NULL,NULL,cta_res); 555 552 if(l>0 && status_ok(cta_res)) { 556 553 rc=OK; -
trunk/reader-videoguard2.c
r3097 r3114 14 14 static const unsigned char ins2a[5] = { 0xD0,0x2a,0x00,0x00,0x00 }; 15 15 if(cmd_exists(ins2a)) { 16 l=do_cmd(reader, ins2a,NULL,NULL,cta_res);16 l=do_cmd(reader,ins2a,NULL,NULL,NULL,cta_res); 17 17 if(l<0 || !status_ok(cta_res+l)){ 18 cs_log ("[videoguard2-reader] insD02a: failed");18 cs_log ("[videoguard2-reader] classD0 ins2a: failed"); 19 19 return; 20 20 } … … 23 23 static unsigned char ins76007f[5] = { 0xD0,0x76,0x00,0x7f,0x02 }; 24 24 if(!write_cmd_vg(ins76007f,NULL) || !status_ok(cta_res+2)){ 25 cs_log ("[videoguard2-reader] insDO76007f: failed");25 cs_log ("[videoguard2-reader] classD0 ins76007f: failed"); 26 26 return; 27 27 } … … 36 36 for(i=0; i<num; i++) { 37 37 ins76[2]=i; 38 l=do_cmd(reader, ins76,NULL,NULL,cta_res);38 l=do_cmd(reader,ins76,NULL,NULL,NULL,cta_res); 39 39 if(l<0 || !status_ok(cta_res+l)) return; 40 40 if(cta_res[2]==0 && cta_res[3]==0) break; … … 49 49 int videoguard2_card_init(struct s_reader * reader, ATR newatr) 50 50 { 51 52 51 get_hist; 53 52 if ((hist_size < 7) || (hist[1] != 0xB0) || (hist[4] != 0xFF) || (hist[5] != 0x4A) || (hist[6] != 0x50)) … … 61 60 memcpy(reader->atr,atr,atr_size); 62 61 63 62 /* set information on the card stored in reader-videoguard-common.c */ 64 63 set_known_card_info(reader); 65 64 … … 88 87 ins7401[4]=l; 89 88 if(!write_cmd_vg(ins7401,NULL) || !status_ok(cta_res+l)) { 90 cs_log ("[videoguard2-reader] insD07401: failed - cmd list not read");89 cs_log ("[videoguard2-reader] classD0 ins7401: failed - cmd list not read"); 91 90 return ERROR; 92 91 } … … 97 96 98 97 unsigned char ins7416[5] = { 0xD0,0x74,0x16,0x00,0x00 }; 99 if(do_cmd(reader, ins7416, NULL,NULL,cta_res)<0) {100 cs_log ("[videoguard2-reader] insD07416: failed");98 if(do_cmd(reader,ins7416,NULL,NULL,NULL,cta_res)<0) { 99 cs_log ("[videoguard2-reader] classD0 ins7416: failed"); 101 100 return ERROR; 102 101 } … … 114 113 /* we can try to get the boxid from the card */ 115 114 int boxidOK=0; 116 l=do_cmd(reader, ins36, NULL, buff,cta_res);115 l=do_cmd(reader,ins36,NULL,buff,NULL,cta_res); 117 116 if(l<13) 118 cs_log("[videoguard2-reader] insD036: too short answer");119 else if (buff[7] > 0x0F) 120 cs_log("[videoguard2-reader] insD036: encrypted - can't parse");117 cs_log("[videoguard2-reader] classD0 ins36: too short answer"); 118 else if (buff[7] > 0x0F) 119 cs_log("[videoguard2-reader] classD0 ins36: encrypted - can't parse"); 121 120 else { 122 121 /* skipping the initial fixed fields: cmdecho (4) + length (1) + encr/rev++ (4) */ … … 141 140 break; 142 141 case 0xF3: /* boxID */ 143 memcpy( &boxID,&buff[i+1],sizeof(boxID));142 memcpy(boxID,buff+i+1,sizeof(boxID)); 144 143 boxidOK=1; 145 144 i+=5; … … 164 163 break; 165 164 default: /* default to assume a length byte */ 166 cs_log("[videoguard2-reader] insD036: returned unknown type=0x%02X - parsing may fail", buff[i]);165 cs_log("[videoguard2-reader] classD0 ins36: returned unknown type=0x%02X - parsing may fail", buff[i]); 167 166 i+=buff[i+1]+2; 168 167 } … … 180 179 memcpy(payload4C,boxID,4); 181 180 if(!write_cmd_vg(ins4C,payload4C) || !status_ok(cta_res+l)) { 182 cs_log("[videoguard2-reader] insD04C: failed - sending boxid failed"); 183 return ERROR; 184 } 181 cs_log("[videoguard2-reader] classD0 ins4C: failed - sending boxid failed"); 182 return ERROR; 183 } 184 185 185 // Start of suggested fix for 09ac cards 186 unsigned char Dimeno_Magic[0x10]={0xF9,0xFB,0xCD,0x5A,0x76,0xB5,0xC4,0x5C,0xC8,0x2E,0x1D,0xE1,0xCC,0x5B,0x6B,0x02}; 186 unsigned char Dimeno_Magic[0x10]={0xF9,0xFB,0xCD,0x5A,0x76,0xB5,0xC4,0x5C,0xC8,0x2E,0x1D,0xE1,0xCC,0x5B,0x6B,0x02}; 187 187 int a; 188 188 for(a=0; a<4; a++) … … 196 196 //short int SWIRDstatus = cta_res[1]; 197 197 unsigned char ins58[5] = { 0xD0,0x58,0x00,0x00,0x00 }; 198 l=do_cmd(reader, ins58, NULL, buff,cta_res);198 l=do_cmd(reader,ins58,NULL,buff,NULL,cta_res); 199 199 if(l<0) { 200 cs_log("[videoguard2-reader] insDO58: failed");200 cs_log("[videoguard2-reader] classD0 ins58: failed"); 201 201 return ERROR; 202 202 } … … 234 234 unsigned char tbuff[64]; 235 235 cCamCryptVG_GetCamKey(tbuff); 236 l=do_cmd(reader, insB4, tbuff,NULL,cta_res);236 l=do_cmd(reader,insB4,tbuff,NULL,NULL,cta_res); 237 237 if(l<0 || !status_ok(cta_res)) { 238 cs_log ("[videoguard2-reader] insD0B4: failed (%02X%02X)", cta_res[0], cta_res[1]);238 cs_log ("[videoguard2-reader] classD0 insB4: failed (%02X%02X)", cta_res[0], cta_res[1]); 239 239 return ERROR; 240 240 } 241 241 242 242 unsigned char insBC[5] = { 0xD0,0xBC,0x00,0x00,0x00 }; 243 l=do_cmd(reader, insBC, NULL,NULL,cta_res);243 l=do_cmd(reader,insBC,NULL,NULL,NULL,cta_res); 244 244 if(l<0) { 245 cs_log("[videoguard2-reader] insD0BC: failed");245 cs_log("[videoguard2-reader] classD0 insBC: failed"); 246 246 return ERROR; 247 247 } 248 248 249 249 unsigned char insBE[5] = { 0xD3,0xBE,0x00,0x00,0x00 }; 250 l=do_cmd(reader, insBE, NULL,NULL,cta_res);250 l=do_cmd(reader,insBE,NULL,NULL,NULL,cta_res); 251 251 if(l<0) { 252 cs_log("[videoguard2-reader] insD3BE: failed");252 cs_log("[videoguard2-reader] classD3 insBE: failed"); 253 253 return ERROR; 254 254 } 255 255 256 256 unsigned char ins58a[5] = { 0xD1,0x58,0x00,0x00,0x00 }; 257 l=do_cmd(reader, ins58a, NULL,NULL,cta_res);257 l=do_cmd(reader,ins58a,NULL,NULL,NULL,cta_res); 258 258 if(l<0) { 259 cs_log("[videoguard2-reader] insD158: failed");259 cs_log("[videoguard2-reader] classD1 ins58: failed"); 260 260 return ERROR; 261 261 } 262 262 263 263 unsigned char ins4Ca[5] = { 0xD1,0x4C,0x00,0x00,0x00 }; 264 l=do_cmd(reader, ins4Ca,payload4C,NULL,cta_res);264 l=do_cmd(reader,ins4Ca,payload4C,NULL,NULL,cta_res); 265 265 if(l<0 || !status_ok(cta_res)) { 266 cs_log("[videoguard2-reader] insD14Ca: failed");266 cs_log("[videoguard2-reader] classD1 ins4Ca: failed"); 267 267 return ERROR; 268 268 } … … 288 288 unsigned char tbuff[264]; 289 289 tbuff[0]=0; 290 memcpy( &tbuff[1],&(er->ecm[posECMpart2+1]),lenECMpart2-1);290 memcpy(tbuff+1,er->ecm+posECMpart2+1,lenECMpart2-1); 291 291 ins40[4]=lenECMpart2; 292 292 int l; 293 l = do_cmd(reader, ins40,tbuff,NULL,cta_res);293 l = do_cmd(reader,ins40,tbuff,NULL,NULL,cta_res); 294 294 if(l>0 && status_ok(cta_res)) { 295 l = do_cmd(reader, ins54,NULL,NULL,cta_res);295 l = do_cmd(reader,ins54,NULL,NULL,er->cw,cta_res); 296 296 if(l>0 && status_ok(cta_res+l)) { 297 if (!cw_is_valid( CW1)) //sky cards report 90 00 = ok but send cw = 00 when channel not subscribed297 if (!cw_is_valid(er->cw+0,0)) //sky cards report 90 00 = ok but send cw = 00 when channel not subscribed 298 298 { 299 snprintf( er->msglog, MSGLOGSIZE, "9000 but cw=00 -> channel not subscribed " );299 cs_log("[reader-videoguard2] classD3 ins54: status 90 00 but cw=00 -> channel not subscribed " ); 300 300 return ERROR; 301 301 } 302 302 303 303 if(er->ecm[0]&1) { 304 memcpy(er->cw+8,CW1,8); 305 memcpy(er->cw+0,CW2,8); 306 } 307 else { 308 memcpy(er->cw+0,CW1,8); 309 memcpy(er->cw+8,CW2,8); 310 } 311 304 unsigned char tmpcw[8]; 305 memcpy(tmpcw,er->cw+8,8); 306 memcpy(er->cw+8,er->cw+0,8); 307 memcpy(er->cw+0,tmpcw,8); 308 } 312 309 313 310 //test for postprocessing marker … … 330 327 } 331 328 } 332 snprintf( er->msglog, MSGLOGSIZE, "(%d) status not ok %02x %02x",l, cta_res[0],cta_res[1] );329 cs_log("[reader-videoguard2] classD3 ins54: (%d) status not ok %02x %02x",l, cta_res[0],cta_res[1] ); 333 330 return ERROR; 334 331 } … … 532 529 while (payload) { 533 530 ins42[4]=*payload; 534 int l = do_cmd(reader, ins42,payload+1,NULL,cta_res);531 int l = do_cmd(reader,ins42,payload+1,NULL,NULL,cta_res); 535 532 if(l>0 && status_ok(cta_res)) { 536 533 rc=OK;
Note:
See TracChangeset
for help on using the changeset viewer.