Changeset 1951 for trunk/reader-irdeto.c
- Timestamp:
- 04/05/10 09:13:48 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/reader-irdeto.c
r1948 r1951 1 1 #include "globals.h" 2 2 #include "reader-common.h" 3 4 extern uchar cta_res[];5 extern ushort cta_lr;6 3 7 4 static const uchar CryptTable[256] = … … 139 136 } 140 137 141 static int irdeto_do_cmd(struct s_reader * reader, uchar *buf, ushort good )138 static int irdeto_do_cmd(struct s_reader * reader, uchar *buf, ushort good, uchar * cta_res, ushort * p_cta_lr) 142 139 { 143 140 int rc; 144 if( (rc=reader_cmd2icc(reader, buf, buf[4]+5 )) )141 if( (rc=reader_cmd2icc(reader, buf, buf[4]+5, cta_res, p_cta_lr)) ) 145 142 return(rc); // result may be 0 (success) or negative 146 if ( cta_lr<2)143 if (*p_cta_lr<2) 147 144 return(0x7F7F); // this should never happen 148 return(good!=b2i(2, cta_res+ cta_lr-2));145 return(good!=b2i(2, cta_res+*p_cta_lr-2)); 149 146 } 150 147 151 148 #define reader_chk_cmd(cmd, l) \ 152 149 { \ 153 if (reader_cmd2icc(reader, cmd, sizeof(cmd) )) return ERROR; \150 if (reader_cmd2icc(reader, cmd, sizeof(cmd), cta_res, &cta_lr)) return ERROR; \ 154 151 if (l && (cta_lr!=l)) return ERROR; } 155 152 156 153 static int irdeto_card_init_provider(struct s_reader * reader) 157 154 { 155 def_resp; 158 156 int i, p; 159 157 uchar buf[256]={0}; … … 192 190 int irdeto_card_init(struct s_reader * reader, ATR newatr) 193 191 { 192 def_resp; 194 193 get_atr; 195 194 int camkey=0; … … 276 275 int irdeto_do_ecm(struct s_reader * reader, ECM_REQUEST *er) 277 276 { 277 def_resp; cta_lr=0; //suppress compiler error 278 278 static const uchar sc_EcmCmd[] = { 0x05, 0x00, 0x00, 0x02, 0x00 }; 279 279 uchar cta_cmd[272]; … … 282 282 cta_cmd[4]=(er->ecm[2])-3; 283 283 memcpy(cta_cmd+sizeof(sc_EcmCmd), &er->ecm[6], cta_cmd[4]); 284 if (irdeto_do_cmd(reader, cta_cmd, 0x9D00 )) return ERROR;284 if (irdeto_do_cmd(reader, cta_cmd, 0x9D00, cta_res, &cta_lr)) return ERROR; 285 285 if (cta_lr<24) return ERROR; 286 286 ReverseSessionKeyCrypt(sc_CamKey, cta_res+6); … … 333 333 int irdeto_do_emm(struct s_reader * reader, EMM_PACKET *ep) 334 334 { 335 def_resp; 335 336 static const uchar sc_EmmCmd[] = { 0x01,0x00,0x00,0x00,0x00 }; 336 337 uchar cta_cmd[272]; … … 369 370 ptr+=ADDRLEN; emm+=l; 370 371 memcpy(ptr, &emm[2], dataLen); // copy emm bytes 371 return(irdeto_do_cmd(reader, cta_cmd, 0 ) ? 0 : 1);372 return(irdeto_do_cmd(reader, cta_cmd, 0, cta_res, &cta_lr) ? 0 : 1); 372 373 } 373 374 else … … 379 380 int irdeto_card_info(struct s_reader * reader) 380 381 { 382 def_resp; 381 383 int i, p; 382 384
Note:
See TracChangeset
for help on using the changeset viewer.