source: trunk/reader-cryptoworks.c@ 3168

Last change on this file since 3168 was 3168, checked in by _network, 10 years ago

merge modular branch with trunk

File size: 16.8 KB
Line 
1#include "globals.h"
2#include "reader-common.h"
3
4#define CMD_LEN 5
5
6static void RotateBytes1(unsigned char *out, unsigned char *in, int n)
7{
8 // loop is executed atleast once, so it's not a good idea to
9 // call with n=0 !!
10 out+=n;
11 do { *(--out)=*(in++); } while(--n);
12}
13
14static void RotateBytes2(unsigned char *in, int n)
15{
16 // loop is executed atleast once, so it's not a good idea to
17 // call with n=0 !!
18 unsigned char *e=in+n-1;
19 do
20 {
21 unsigned char temp=*in;
22 *in++=*e;
23 *e-- =temp;
24 } while(in<e);
25}
26
27static int Input(BIGNUM *d, unsigned char *in, int n, int LE)
28{
29 if (LE)
30 {
31 unsigned char tmp[n];
32 RotateBytes1(tmp,in,n);
33 return(BN_bin2bn(tmp,n,d)!=0);
34 }
35 else
36 return(BN_bin2bn(in,n,d)!=0);
37}
38
39static int Output(unsigned char *out, int n, BIGNUM *r, int LE)
40{
41 int s=BN_num_bytes(r);
42 if (s>n)
43 {
44 unsigned char buff[s];
45 cs_debug("[cryptoworks-reader] rsa: RSA len %d > %d, truncating", s, n);
46 BN_bn2bin(r,buff);
47 memcpy(out,buff+s-n,n);
48 }
49 else if (s<n)
50 {
51 int l=n-s;
52 cs_debug("[cryptoworks-reader] rsa: RSA len %d < %d, padding", s, n);
53 memset(out,0,l);
54 BN_bn2bin(r,out+l);
55 }
56 else
57 BN_bn2bin(r,out);
58 if (LE)
59 RotateBytes2(out,n);
60 return(s);
61}
62
63static int RSA(unsigned char *out, unsigned char *in, int n, BIGNUM *exp, BIGNUM *mod, int LE)
64{
65 int rc=0;
66 BN_CTX *ctx;
67 BIGNUM *r, *d;
68 ctx=BN_CTX_new();
69 r=BN_new();
70 d=BN_new();
71 if (Input(d,in,n,LE))
72 {
73 if(BN_mod_exp(r,d,exp,mod,ctx))
74 rc=Output(out,n,r,LE);
75 else
76 cs_log("[cryptoworks-reader] rsa: mod-exp failed");
77 }
78 BN_CTX_free(ctx);
79 BN_free(d);
80 BN_free(r);
81 return(rc);
82}
83
84static char *chid_date(uchar *ptr, char *buf, int l)
85{
86 if (buf)
87 {
88 snprintf(buf, l, "%04d/%02d/%02d",
89 1990+(ptr[0]>>1), ((ptr[0]&1)<<3)|(ptr[1]>>5), ptr[1]&0x1f);
90 }
91 return(buf);
92}
93
94static int select_file(struct s_reader * reader, uchar f1, uchar f2, uchar * cta_res, ushort * p_cta_lr)
95{
96 ushort cta_lr;
97 uchar insA4[] = {0xA4, 0xA4, 0x00, 0x00, 0x02, 0x00, 0x00};
98 insA4[5]=f1;
99 insA4[6]=f2;
100 write_cmd(insA4, insA4+5); // select file
101 *p_cta_lr = cta_lr;
102 return((cta_res[0]==0x9f)&&(cta_res[1]==0x11));
103}
104
105static int read_record(struct s_reader * reader, uchar rec, uchar * cta_res)
106{
107 ushort cta_lr;
108 uchar insA2[] = {0xA4, 0xA2, 0x00, 0x00, 0x01, 0x00};
109 uchar insB2[] = {0xA4, 0xB2, 0x00, 0x00, 0x00};
110
111 insA2[5]=rec;
112 write_cmd(insA2, insA2+5); // select record
113 if (cta_res[0]!=0x9f)
114 return(-1);
115 insB2[4]=cta_res[1]; // get len
116 write_cmd(insB2, NULL); // read record
117 if ((cta_res[cta_lr-2]!=0x90) || (cta_res[cta_lr-1]))
118 return(-1);
119 return(cta_lr-2);
120}
121
122/*
123int cryptoworks_send_pin(struct s_reader * reader)
124{
125 unsigned char insPIN[] = { 0xA4, 0x20, 0x00, 0x00, 0x04, 0x00,0x00,0x00,0x00 }; //Verify PIN
126
127 if(reader->pincode[0] && (reader->pincode[0]&0xF0)==0x30)
128 {
129 memcpy(insPIN+5,reader->pincode,4);
130
131 write_cmd(insPIN, insPIN+5);
132 cs_ri_log (reader, "sending pincode to card");
133 if((cta_res[0]==0x98)&&(cta_res[1]==0x04)) cs_ri_log (reader, "bad pincode");
134
135 return OK;
136 }
137
138 return(0);
139}
140*/
141
142static int cryptoworks_disable_pin(struct s_reader * reader)
143{
144 def_resp;
145 unsigned char insPIN[] = { 0xA4, 0x26, 0x00, 0x00, 0x04, 0x00,0x00,0x00,0x00 }; //disable PIN
146
147 if(reader->pincode[0] && (reader->pincode[0]&0xF0)==0x30)
148 {
149 memcpy(insPIN+5,reader->pincode,4);
150
151 write_cmd(insPIN, insPIN+5);
152 cs_ri_log (reader, "disable pincode to card");
153 if((cta_res[0]==0x98)&&(cta_res[1]==0x04)) cs_ri_log (reader, "bad pincode");
154 return ERROR;
155 }
156 return OK;
157}
158
159int cryptoworks_card_init(struct s_reader * reader, ATR newatr)
160{
161 get_atr;
162 def_resp;
163 int i;
164 unsigned int mfid=0x3F20;
165 static const uchar cwexp[] = { 1, 0 , 1};
166 uchar insA4C[]= {0xA4, 0xC0, 0x00, 0x00, 0x11};
167 uchar insB8[] = {0xA4, 0xB8, 0x00, 0x00, 0x0c};
168 uchar issuerid=0;
169 char issuer[20]={0};
170 char *unknown="unknown", *pin=unknown, ptxt[CS_MAXPROV<<2]={0};
171
172 if ((atr[6]!=0xC4) || (atr[9]!=0x8F) || (atr[10]!=0xF1)) return ERROR;
173
174 cs_log("[cryptoworks-reader] card detected");
175 cs_log("[cryptoworks-reader] type: CryptoWorks");
176
177 reader->caid[0]=0xD00;
178 reader->nprov=0;
179 reader->ucpk_valid = 0;
180 memset(reader->prid, 0, sizeof(reader->prid));
181
182 write_cmd(insA4C, NULL); // read masterfile-ID
183 if ((cta_res[0]==0xDF) && (cta_res[1]>=6))
184 mfid=(cta_res[6]<<8)|cta_res[7];
185
186 select_file(reader, 0x3f, 0x20, cta_res, &cta_lr);
187 insB8[2]=insB8[3]=0; // first
188 for(cta_res[0]=0xdf; cta_res[0]==0xdf;)
189 {
190 write_cmd(insB8, NULL); // read provider id's
191 if (cta_res[0]!=0xdf) break;
192 if (((cta_res[4]&0x1f)==0x1f) && (reader->nprov<CS_MAXPROV))
193 {
194 sprintf(ptxt+strlen(ptxt), ",%02X", cta_res[5]);
195 reader->prid[reader->nprov++][3]=cta_res[5];
196 }
197 insB8[2]=insB8[3]=0xff; // next
198 }
199 for (i=reader->nprov; i<CS_MAXPROV; i++)
200 memset(&reader->prid[i][0], 0xff, 4);
201
202 select_file(reader, 0x2f, 0x01, cta_res, &cta_lr); // read caid
203 if (read_record(reader, 0xD1, cta_res)>=4)
204 reader->caid[0]=(cta_res[2]<<8)|cta_res[3];
205
206 if (read_record(reader, 0x80, cta_res)>=7) // read serial
207 memcpy(reader->hexserial, cta_res+2, 5);
208 cs_ri_log (reader, "type: CryptoWorks, caid: %04X, ascii serial: %llu, hex serial: %s",
209 reader->caid[0], b2ll(5, reader->hexserial),cs_hexdump(0, reader->hexserial, 5));
210
211 if (read_record(reader, 0x9E, cta_res)>=66) // read ISK
212 {
213 uchar keybuf[256];
214 BIGNUM *ipk;
215 if (search_boxkey(reader->caid[0], (char *)keybuf))
216 {
217 ipk=BN_new();
218 BN_bin2bn(cwexp, sizeof(cwexp), &reader->exp);
219 BN_bin2bn(keybuf, 64, ipk);
220 RSA(cta_res+2, cta_res+2, 0x40, &reader->exp, ipk, 0);
221 BN_free(ipk);
222 reader->ucpk_valid =(cta_res[2]==((mfid & 0xFF)>>1));
223 if (reader->ucpk_valid)
224 {
225 cta_res[2]|=0x80;
226 BN_bin2bn(cta_res+2, 0x40, &reader->ucpk);
227 cs_ddump(cta_res+2, 0x40, "IPK available -> session-key:");
228 }
229 else
230 {
231 reader->ucpk_valid =(keybuf[0]==(((mfid & 0xFF)>>1)|0x80));
232 if (reader->ucpk_valid)
233 {
234 BN_bin2bn(keybuf, 0x40, &reader->ucpk);
235 cs_ddump(keybuf, 0x40, "session-key found:");
236 }
237 else
238 cs_log("[cryptoworks-reader] invalid IPK or session-key for CAID %04X !", reader->caid[0]);
239 }
240 }
241 }
242 if (read_record(reader, 0x9F, cta_res)>=3)
243 issuerid=cta_res[2];
244 if (read_record(reader, 0xC0, cta_res)>=16)
245 {
246 cs_strncpy(issuer, (const char *)cta_res+2, sizeof(issuer));
247 trim(issuer);
248 }
249 else
250 strcpy(issuer, unknown);
251
252 select_file(reader, 0x3f, 0x20, cta_res, &cta_lr);
253 select_file(reader, 0x2f, 0x11, cta_res, &cta_lr); // read pin
254 if (read_record(reader, atr[8], cta_res)>=7)
255 {
256 cta_res[6]=0;
257 pin=(char *)cta_res+2;
258 }
259 cs_ri_log (reader, "issuer: %s, id: %02X, bios: v%d, pin: %s, mfid: %04X", issuer, issuerid, atr[7], pin, mfid);
260 cs_ri_log (reader, "providers: %d (%s)", reader->nprov, ptxt+1);
261
262 cryptoworks_disable_pin(reader);
263
264 return OK;
265}
266
267int cryptoworks_do_ecm(struct s_reader * reader, ECM_REQUEST *er)
268{
269 def_resp;
270 int r=0;
271 unsigned char ins4C[] = { 0xA4,0x4C,0x00,0x00,0x00 };
272 unsigned char insC0[] = { 0xA4,0xC0,0x00,0x00,0x1C };
273 unsigned char nanoD4[10];
274 int secLen=check_sct_len(er->ecm,-5+(reader->ucpk_valid ? sizeof(nanoD4):0));
275
276 if(secLen>5)
277 {
278 int i;
279 uchar *ecm=er->ecm;
280 uchar buff[MAX_LEN];
281
282 if(reader->ucpk_valid)
283 {
284 memcpy(buff,er->ecm,secLen);
285 nanoD4[0]=0xD4;
286 nanoD4[1]=0x08;
287 for (i=2; i<(int)sizeof(nanoD4); i++)
288 nanoD4[i]=rand();
289 memcpy(&buff[secLen], nanoD4, sizeof(nanoD4));
290 ecm=buff;
291 secLen+=sizeof(nanoD4);
292 }
293
294 ins4C[3]=reader->ucpk_valid ? 2 : 0;
295 ins4C[4]=secLen-5;
296 write_cmd(ins4C, ecm+5);
297 if (cta_res[cta_lr-2]==0x9f)
298 {
299 insC0[4]=cta_res[cta_lr-1];
300 write_cmd(insC0, NULL);
301 for(i=0; i<secLen && r<2; )
302 {
303 int n=cta_res[i+1];
304 switch(cta_res[i])
305 {
306 case 0x80:
307 cs_debug("[cryptoworks-reader] nano 80 (serial)");
308 break;
309 case 0xD4:
310 cs_debug("[cryptoworks-reader] nano D4 (rand)");
311 if(n<8 || memcmp(&cta_res[i],nanoD4,sizeof(nanoD4)))
312 cs_debug("[cryptoworks-reader] random data check failed after decrypt");
313 break;
314 case 0xDB: // CW
315 cs_debug("[cryptoworks-reader] nano DB (cw)");
316 if(n==0x10)
317 {
318 memcpy(er->cw, &cta_res[i+2], 16);
319 r|=1;
320 }
321 break;
322 case 0xDF: // signature
323 cs_debug("[cryptoworks-reader] nano DF %02x (sig)", n);
324 if (n==0x08)
325 {
326 if((cta_res[i+2]&0x50)==0x50 && !(cta_res[i+3]&0x01) && (cta_res[i+5]&0x80))
327 r|=2;
328 }
329 else if (n==0x40) // camcrypt
330 {
331 if(reader->ucpk_valid)
332 {
333 RSA(&cta_res[i+2],&cta_res[i+2], n, &reader->exp, &reader->ucpk, 0);
334 cs_debug("[cryptoworks-reader] after camcrypt ");
335 r=0; secLen=n-4; n=4;
336 }
337 else
338 {
339 cs_log("[cryptoworks-reader] valid UCPK needed for camcrypt!");
340 return ERROR;
341 }
342 }
343 break;
344 default:
345 cs_debug("[cryptoworks-reader] nano %02x (unhandled)",cta_res[i]);
346 break;
347 }
348 i+=n+2;
349 }
350 }
351
352/*
353#ifdef LALL
354 if ((cta_res[cta_lr-2]==0x9f)&&(cta_res[cta_lr-1]==0x1c))
355 {
356 write_cmd(insC0, NULL);
357 if ((cta_lr>26)&&(cta_res[cta_lr-2]==0x90)&&(cta_res[cta_lr-1]==0))
358 {
359 if (rc=(((cta_res[20]&0x50)==0x50) &&
360 (!(cta_res[21]&0x01)) &&
361 (cta_res[23]&0x80)))
362 memcpy(er->cw, cta_res+2, 16);
363 }
364 }
365#endif
366*/
367 }
368 //return(rc ? 1 : 0);
369 return((r==3) ? 1 : 0);
370}
371
372int cryptoworks_get_emm_type(EMM_PACKET *ep, struct s_reader * rdr)
373{
374 char dumprdrserial[18];
375
376 cs_debug_mask(D_EMM, "Entered cryptoworks_get_emm_type ep->emm[0]=%02x",ep->emm[0]);
377 switch (ep->emm[0]) {
378 case 0x82:
379 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[13]==0x80 && ep->emm[14]==0x05) {
380 ep->type = UNIQUE;
381 memset(ep->hexserial, 0, 8);
382 memcpy(ep->hexserial, ep->emm + 5, 5);
383 strcpy(dumprdrserial, cs_hexdump(1, rdr->hexserial, 5));
384 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: UNIQUE, ep = %s rdr = %s",
385 cs_hexdump(1, ep->hexserial, 5), dumprdrserial);
386 return (!memcmp(ep->emm + 5, rdr->hexserial, 5)); // check for serial
387 }
388
389 case 0x84:
390 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[12]==0x80 && ep->emm[13]==0x04) {
391 ep->type = SHARED;
392 memset(ep->hexserial, 0, 8);
393 memcpy(ep->hexserial, ep->emm + 5, 4);
394 strcpy(dumprdrserial, cs_hexdump(1, rdr->hexserial, 4));
395 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: SHARED, ep = %s rdr = %s",
396 cs_hexdump(1, ep->hexserial, 4), dumprdrserial);
397 return (!memcmp(ep->emm + 5, rdr->hexserial, 4)); // check for SA
398 }
399
400 case 0x86:
401 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[5]==0x83
402 && ep->emm[6]==0x01 && ep->emm[8]==0x85) {
403 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: GLOBAL");
404 ep->type = GLOBAL;
405 return TRUE;
406 }
407
408 case 0x88:
409 case 0x89:
410 if(ep->emm[3]==0xA9 && ep->emm[4]==0xFF && ep->emm[8]==0x83 && ep->emm[9]==0x01) {
411 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: GLOBAL");
412 ep->type = GLOBAL;
413 return TRUE;
414 }
415
416 /* FIXME: Dont know how to handle camd3 cryptoworks emms correct */
417 case 0x8F:
418 ep->type = UNKNOWN;
419 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: UNKNOWN 0x8F via camd3");
420 return TRUE;
421
422 /* FIXME: Seems to be that all other EMM types are rejected by the card */
423 default:
424 ep->type = UNKNOWN;
425 cs_debug_mask(D_EMM, "CRYPTOWORKS EMM: UNKNOWN");
426 return FALSE; // skip emm
427 }
428}
429
430void cryptoworks_get_emm_filter(struct s_reader * rdr, uchar *filter)
431{
432 filter[0]=0xFF;
433 filter[1]=4;
434
435 filter[2]=GLOBAL;
436 filter[3]=0;
437
438 filter[4+0] = 0x89;
439 filter[4+0+16] = 0xFF;
440 filter[4+1] = 0xA9;
441 filter[4+1+16] = 0xFF;
442 filter[4+2] = 0xFF;
443 filter[4+2+16] = 0xFF;
444 filter[4+6] = 0x83;
445 filter[4+6+16] = 0xFF;
446 filter[4+7] = 0x01;
447 filter[4+7+16] = 0xFF;
448
449 filter[36]=SHARED;
450 filter[37]=0;
451
452 filter[38+0] = 0x84;
453 filter[38+0+16] = 0xFF;
454 filter[38+1] = 0xA9;
455 filter[38+1+16] = 0xFF;
456 filter[38+2] = 0xFF;
457 filter[38+2+16] = 0xFF;
458 memcpy(filter+38+3, rdr->hexserial, 4);
459 memset(filter+38+3+16, 0xFF, 4);
460 filter[38+10] = 0x80;
461 filter[38+10+16] = 0xFF;
462 filter[38+11] = 0x04;
463 filter[38+11+16] = 0xFF;
464
465 filter[70]=UNIQUE;
466 filter[71]=0;
467
468 filter[72+0] = 0x82;
469 filter[72+0+16] = 0xFF;
470 filter[72+1] = 0xA9;
471 filter[72+1+16] = 0xFF;
472 filter[72+2] = 0xFF;
473 filter[72+2+16] = 0xFF;
474 memcpy(filter+72+3, rdr->hexserial, 5);
475 memset(filter+72+3+16, 0xFF, 5);
476 filter[72+11] = 0x80;
477 filter[72+11+16] = 0xFF;
478 filter[72+12] = 0x05;
479 filter[72+12+16] = 0xFF;
480
481 filter[104]=GLOBAL;
482 filter[105]=0;
483
484 filter[106+0] = 0x86;
485 filter[106+16] = 0xFF;
486 filter[106+6] = 0x84;
487 filter[106+6+16] = 0xFF;
488
489 return;
490}
491
492int cryptoworks_do_emm(struct s_reader * reader, EMM_PACKET *ep)
493{
494 def_resp;
495 uchar insEMM_GA[] = {0xA4, 0x44, 0x00, 0x00, 0x00};
496 uchar insEMM_SA[] = {0xA4, 0x48, 0x00, 0x00, 0x00};
497 uchar insEMM_UA[] = {0xA4, 0x42, 0x00, 0x00, 0x00};
498 int rc=0;
499 uchar *emm=ep->emm;
500
501 /* FIXME: this is the original code how to deal with camd3 EMM's
502 if ((emm[0]==0x8f) && (emm[3]==0xa4)) // emm via camd3.5x
503 {
504 ep->type=emm[4];
505 write_cmd(emm+3, emm+3+CMD_LEN);
506 if ((cta_lr==2) && (cta_res[0]==0x90) && (cta_res[1]==0))
507 rc=1;
508 }
509 */
510
511 switch(ep->type)
512 {
513 // emm via camd3.5x
514 case UNKNOWN:
515 if(emm[3]==0xA4)
516 {
517 write_cmd(emm+3, emm+3+CMD_LEN);
518 rc=((cta_res[0]==0x90)&&(cta_res[1]==0x00));
519 }
520 break;
521
522 //GA
523 case GLOBAL:
524 insEMM_GA[4]=ep->emm[2]-2;
525 if(emm[7]==insEMM_GA[4]-3)
526 {
527 write_cmd(insEMM_GA, emm+5);
528 rc=((cta_res[0]==0x90)&&(cta_res[1]==0x00));
529 }
530 break;
531
532 //SA
533 case SHARED:
534 insEMM_SA[4]=ep->emm[2]-6;
535 //if(emm[11]==insEMM_SA[4]-3)
536 //{
537 write_cmd(insEMM_SA, emm+9);
538 rc=((cta_res[0]==0x90)&&(cta_res[1]==0x00));
539 //}
540 break;
541
542 //UA
543 case UNIQUE:
544 insEMM_UA[4]=ep->emm[2]-7;
545 if(emm[12]==insEMM_UA[4]-3)
546 {
547 //cryptoworks_send_pin(); //?? may be
548 write_cmd(insEMM_UA, emm+10);
549 rc=((cta_res[0]==0x90)&&(cta_res[1]==0x00));
550 }
551 break;
552 }
553
554 return(rc);
555}
556
557int cryptoworks_card_info(struct s_reader * reader)
558{
559 def_resp;
560 int i;
561 uchar insA21[]= {0xA4, 0xA2, 0x01, 0x00, 0x05, 0x8C, 0x00, 0x00, 0x00, 0x00};
562 uchar insB2[] = {0xA4, 0xB2, 0x00, 0x00, 0x00};
563 char l_name[20+8]=", name: ";
564
565 for (i=0; i<reader->nprov; i++)
566 {
567 l_name[8]=0;
568 select_file(reader, 0x1f, reader->prid[i][3], cta_res, &cta_lr); // select provider
569 select_file(reader, 0x0e, 0x11, cta_res, &cta_lr); // read provider name
570 if (read_record(reader, 0xD6, cta_res)>=16)
571 {
572 cs_strncpy(l_name+8, (const char *)cta_res+2, sizeof(l_name)-9);
573 l_name[sizeof(l_name)-1]=0;
574 trim(l_name+8);
575 }
576 l_name[0]=(l_name[8]) ? ',' : 0;
577 cs_ri_log (reader, "provider: %d, id: %02X%s", i+1, reader->prid[i][3], l_name);
578 select_file(reader, 0x0f, 0x20, cta_res, &cta_lr); // select provider class
579 write_cmd(insA21, insA21+5);
580 if (cta_res[0]==0x9f)
581 {
582 insB2[4]=cta_res[1];
583 for(insB2[3]=0; (cta_res[0]!=0x94)||(cta_res[1]!=0x2); insB2[3]=1)
584 {
585 write_cmd(insB2, NULL); // read chid
586 if (cta_res[0]!=0x94)
587 {
588 char ds[16], de[16];
589 chid_date(cta_res+28, ds, sizeof(ds)-1);
590 chid_date(cta_res+30, de, sizeof(de)-1);
591 cs_ri_log (reader, "chid: %02X%02X, date: %s - %s, name: %s",
592 cta_res[6], cta_res[7], ds, de, trim((char *) cta_res+10));
593 }
594 }
595 }
596
597 select_file(reader, 0x0f, 0x00, cta_res, &cta_lr); // select provider channel
598 write_cmd(insA21, insA21+5);
599 if (cta_res[0]==0x9f)
600 {
601 insB2[4]=cta_res[1];
602 for(insB2[3]=0; (cta_res[0]!=0x94)||(cta_res[1]!=0x2); insB2[3]=1)
603 {
604 write_cmd(insB2, NULL); // read chid
605 if (cta_res[0]!=0x94)
606 {
607 char ds[16], de[16];
608 chid_date(cta_res+28, ds, sizeof(ds)-1);
609 chid_date(cta_res+30, de, sizeof(de)-1);
610 cta_res[27]=0;
611 cs_ri_log (reader, "chid: %02X%02X, date: %s - %s, name: %s",
612 cta_res[6], cta_res[7], ds, de, trim((char *)cta_res+10));
613 }
614 }
615 }
616 }
617 cs_log("[cryptoworks-reader] ready for requests");
618 return OK;
619}
620
621void reader_cryptoworks(struct s_cardsystem *ph)
622{
623 ph->do_emm=cryptoworks_do_emm;
624 ph->do_ecm=cryptoworks_do_ecm;
625 ph->card_info=cryptoworks_card_info;
626 ph->card_init=cryptoworks_card_init;
627 ph->get_emm_type=cryptoworks_get_emm_type;
628 ph->caids[0]=0x0D;
629}
Note: See TracBrowser for help on using the repository browser.