Changeset 3870
- Timestamp:
- 11/10/10 20:13:23 (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/csctapi/ifd_pcsc.c
r3855 r3870 110 110 //The pbRecvBuffer will receive the SW1 and SW2 status codes from the operation. 111 111 //The pcbRecvLength should be at least two and will be set to two upon return. 112 cs_debug("command = %02X %02X %02X %02X %02X", buf[0],buf[1],buf[2],buf[3],buf[4]);113 112 if(buf[4]) 114 113 dwSendLength = l; 115 114 else 116 115 dwSendLength = l-1; 117 cs_debug("sending %d bytes to PCSC ", dwSendLength);116 cs_debug("sending %d bytes to PCSC : %s", dwSendLength,cs_hexdump(1,buf,l)); 118 117 rv = SCardTransmit((SCARDHANDLE)(pcsc_reader->hCard), SCARD_PCI_T0, (LPCBYTE) buf, dwSendLength, &pioRecvPci, (LPBYTE) cta_res, (LPDWORD) &dwRecvLength); 119 118 *cta_lr=dwRecvLength; … … 121 120 else if(pcsc_reader->dwActiveProtocol == SCARD_PROTOCOL_T1) { 122 121 dwSendLength = l; 123 cs_debug("sending %d bytes to PCSC ", dwSendLength);122 cs_debug("sending %d bytes to PCSC : %s", dwSendLength,cs_hexdump(1,buf,l)); 124 123 rv = SCardTransmit((SCARDHANDLE)(pcsc_reader->hCard), SCARD_PCI_T1, (LPCBYTE) buf, dwSendLength, &pioRecvPci, (LPBYTE) cta_res, (LPDWORD) &dwRecvLength); 125 124 *cta_lr=dwRecvLength; … … 130 129 } 131 130 132 cs_debug("received %d bytes from PCSC with rv=%lx", *cta_lr, rv); 131 cs_debug("received %d bytes from PCSC with rv=%lx : %s", *cta_lr, rv,cs_hexdump(1,cta_res,*cta_lr)); 132 133 133 cs_debug("PCSC doapi (%lx ) (T=%d), %d", rv, ( pcsc_reader->dwActiveProtocol == SCARD_PROTOCOL_T0 ? 0 : 1), *cta_lr ); 134 134 -
trunk/globals.h
r3844 r3870 710 710 uchar geo[256]; 711 711 uchar geo_len; 712 int number_ecm; 712 713 }; 713 714 // for videoguard in s_reader -
trunk/module-monitor.c
r3848 r3870 277 277 sprintf(ltime, "%02d:%02d:%02d", lt->tm_hour, lt->tm_min, lt->tm_sec); 278 278 sprintf(sbuf, "[%c--CCC]%8lX|%c|%d|%s|%d|%d|%s|%d|%s|%s|%s|%d|%04X:%04X|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n", 279 id, cl->thread, cl->typ, cnr, usr, cau, cl->crypted,279 id, (unsigned long)cl->thread, cl->typ, cnr, usr, cau, cl->crypted, 280 280 cs_inet_ntoa(cl->ip), cl->port, monitor_get_proto(cl), 281 281 ldate, ltime, lsec, cl->last_caid, cl->last_srvid, -
trunk/reader-viaccess.c
r3828 r3870 162 162 static int viaccess_card_init(struct s_reader * reader, ATR newatr) 163 163 { 164 get_atr; 165 def_resp; 166 int i; 167 uchar buf[256]; 168 uchar insac[] = { 0xca, 0xac, 0x00, 0x00, 0x00 }; // select data 169 uchar insb8[] = { 0xca, 0xb8, 0x00, 0x00, 0x00 }; // read selected data 170 uchar insa4[] = { 0xca, 0xa4, 0x00, 0x00, 0x00 }; // select issuer 171 uchar insc0[] = { 0xca, 0xc0, 0x00, 0x00, 0x00 }; // read data item 172 173 static const uchar insFAC[] = { 0x87, 0x02, 0x00, 0x00, 0x03 }; // init FAC 174 static const uchar FacDat[] = { 0x00, 0x00, 0x28 }; 164 get_atr; 165 def_resp; 166 int i; 167 uchar buf[256]; 168 uchar insac[] = { 0xca, 0xac, 0x00, 0x00, 0x00 }; // select data 169 uchar insb8[] = { 0xca, 0xb8, 0x00, 0x00, 0x00 }; // read selected data 170 uchar insa4[] = { 0xca, 0xa4, 0x00, 0x00, 0x00 }; // select issuer 171 uchar insc0[] = { 0xca, 0xc0, 0x00, 0x00, 0x00 }; // read data item 172 static const uchar insFAC[] = { 0x87, 0x02, 0x00, 0x00, 0x03 }; // init FAC 173 static const uchar FacDat[] = { 0x00, 0x00, 0x28 }; 174 static unsigned char ins8702_data[] = { 0x00, 0x00, 0x11}; 175 static unsigned char ins8704[] = { 0x87, 0x04, 0x00, 0x00, 0x07 }; 176 static unsigned char ins8706[] = { 0x87, 0x06, 0x00, 0x00, 0x04 }; 177 175 178 176 179 if ((atr[0]!=0x3f) || (atr[1]!=0x77) || ((atr[2]!=0x18) && (atr[2]!=0x11) && (atr[2]!=0x19)) || (atr[9]!=0x68)) return ERROR; … … 230 233 cs_ri_log(reader, "providers: %d (%s)", reader->nprov, buf+1); 231 234 232 /* init the maybe existing aes key */ 233 aes_set_key((char *)reader->aes_key); 234 235 if (cfg->ulparent) 236 unlock_parental(reader); 237 238 cs_log("[viaccess-reader] ready for requests"); 239 memset(&reader->last_geo, 0, sizeof(reader->last_geo)); 240 return OK; 235 /* init the maybe existing aes key */ 236 aes_set_key((char *)reader->aes_key); 237 238 if (cfg->ulparent) 239 unlock_parental(reader); 240 241 if(card_write(reader, insFAC, ins8702_data, cta_res, &cta_lr) && 242 card_write(reader, ins8704, NULL, cta_res, &cta_lr) && 243 card_write(reader, ins8706, NULL, cta_res, &cta_lr) && 244 (cta_res[cta_lr-2]==0x90) && (cta_res[cta_lr-1]==0x00)) { 245 reader->last_geo.number_ecm =(cta_res[2]<<8) | (cta_res[3]); 246 cs_log("using ecm #%04x for long viaccess ecm",reader->last_geo.number_ecm); 247 } 248 else 249 reader->last_geo.number_ecm = 0; 250 251 cs_log("[viaccess-reader] ready for requests"); 252 memset(&reader->last_geo, 0, sizeof(reader->last_geo)); 253 return OK; 241 254 } 242 255 … … 275 288 uchar DE04[256]; 276 289 int D2KeyID=0; 290 int curnumber_ecm=0; 291 277 292 memset(DE04, 0, sizeof(DE04)); //fix dorcel de04 bug 278 293 … … 312 327 hasD2 = 0; 313 328 329 314 330 // 40 07 03 0b 00 -> nano 40, len =7 ident 030B00 (tntsat), key #0 <== we're pointing here 315 331 // 09 -> use key #9 … … 323 339 324 340 nanoLen=ecm88Data[1] + 2; 341 curnumber_ecm =(ecm88Data[6]<<8) | (ecm88Data[7]); 342 keynr=ecm88Data[4]&0x0F; 343 344 // 40 07 03 0b 00 -> nano 40, len =7 ident 030B00 (tntsat), key #0 <== we're pointing here 345 // 09 -> use key #9 346 if(nanoLen>5) { 347 if( reader->last_geo.number_ecm > 0 && reader->last_geo.number_ecm ==curnumber_ecm ) { 348 349 keyToUse=ecm88Data[5]; 350 keynr=keyToUse; 351 cs_debug("keyToUse = %d",keyToUse); 352 } 353 else 354 { 355 ecm88Data=nextEcm; 356 ecm88Len-=curEcm88len; 357 continue; //loop to next ecm 358 } 325 359 360 } 361 326 362 memcpy (ident, &ecm88Data[2], sizeof(ident)); 327 363 provid = b2i(3, ident); … … 335 371 } 336 372 337 keynr=ecm88Data[4]&0x0F;338 // 40 07 03 0b 00 -> nano 40, len =7 ident 030B00 (tntsat), key #0 <== we're pointing here339 // 09 -> use key #9340 if(nanoLen>5) {341 keyToUse=ecm88Data[5];342 keynr=keyToUse;343 cs_debug("keyToUse = %d",keyToUse);344 }345 373 346 374 if (!chk_prov(reader, ident, keynr))
Note:
See TracChangeset
for help on using the changeset viewer.