Changeset 5306


Ignore:
Timestamp:
May 28, 2011, 10:36:06 AM (8 years ago)
Author:
neoen
Message:

Seca ECMs using OP Key xE are sent to reader even if privider is expired

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/reader-seca.c

    r4994 r5306  
    142142}
    143143
    144 static int32_t get_prov_index(struct s_reader * rdr, char *provid)  //returns provider id or -1 if not found
     144static int32_t get_prov_index(struct s_reader * rdr, uint8_t *provid)   //returns provider id or -1 if not found
    145145{
    146146  int32_t prov;
     
    158158  unsigned char ins3a[] = { 0xc1,0x3a,0x00,0x00,0x10 }; // decoding cw
    159159  int32_t i;
    160   i=get_prov_index(reader, (char *) er->ecm+3);
    161   if ((i == -1) || (reader->availkeys[i][0] == 0)) //if provider not found or expired
     160
     161  if ((i = get_prov_index(reader, er->ecm+3)) == -1) // if provider not found
    162162  {
    163       if( i == -1 )
    164         snprintf( er->msglog, MSGLOGSIZE, "provider not found" );
    165       else
    166         snprintf( er->msglog, MSGLOGSIZE, "provider expired" );
    167 
    168     return ERROR;
     163     snprintf( er->msglog, MSGLOGSIZE, "provider not found" );
     164     return ERROR;
     165  }
     166
     167  if ((er->ecm[7] & 0x0F) != 0x0E && reader->availkeys[i][0] == 0) // if expired and not using OP Key 0E
     168  {
     169     snprintf( er->msglog, MSGLOGSIZE, "provider expired" );
     170     return ERROR;
    169171  }
    170172
     
    191193    }
    192194    if (ret)
    193       snprintf( er->msglog, MSGLOGSIZE, "%s ins3c card response: %02x %02x", reader->label, cta_res[0] , cta_res[1] );
     195      snprintf( er->msglog, MSGLOGSIZE, "%s ins3c card res: %02x %02x", reader->label, cta_res[0] , cta_res[1] );
    194196    try++;
    195197  } while ((try < 3) && (ret));
     
    220222            memset(ep->hexserial,0,8);
    221223            memcpy(ep->hexserial, ep->emm + 5, 3); //dont include custom byte; this way the network also knows SA
    222             i=get_prov_index(rdr, (char *) ep->emm+3);
     224            i=get_prov_index(rdr, ep->emm+3);
    223225            cs_debug_mask(D_EMM, "SECA EMM: SHARED, ep->hexserial = %s", cs_hexdump(1, ep->hexserial, 3));
    224226            if (i== -1) //provider not found on this card
     
    296298  int32_t i,ins40data_offset;
    297299  int32_t emm_length = ((ep->emm[1] & 0x0f) << 8) + ep->emm[2];
    298   char *prov_id_ptr;
     300  uint8_t *prov_id_ptr;
    299301
    300302  cs_ddump_mask (D_EMM, ep->emm, emm_length + 3, "EMM:");
     
    304306            ins40[4]= emm_length - 0x07;
    305307            ins40data_offset = 10;
    306             prov_id_ptr = (char *)ep->emm+3;
     308            prov_id_ptr = ep->emm+3;
    307309            break;
    308310
     
    311313            ins40[4]= emm_length - 0x0A;
    312314            ins40data_offset = 13;
    313             prov_id_ptr = (char *)ep->emm+9;
     315            prov_id_ptr = ep->emm+9;
    314316            break;
    315317
Note: See TracChangeset for help on using the changeset viewer.