Changeset 1196


Ignore:
Timestamp:
01/12/10 19:56:09 (12 years ago)
Author:
nightmann
Message:
  1. simplifiy tiger sessionkey negotiation. Patch by hexalot
  2. make rsa key config more global. Probably we can use this var again in other situations like irdeto camkey data.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/globals.h

    r1181 r1196  
    387387  ulong     boxid;
    388388  uchar     nagra_boxkey[16]; //n3 boxkey 8byte  or tiger idea key 16byte
    389   int       nagra_native;
     389  int       has_rsa;
    390390  uchar     aes_key[16];
    391391  uchar     rsa_mod[120]; //rsa modulus for nagra cards.
  • trunk/oscam-config.c

    r1181 r1196  
    11311131    return;
    11321132  }
    1133   if (!strcmp(token, "n3_rsakey"))
    1134   {
    1135     rdr->nagra_native=1;
     1133  if ((!strcmp(token, "n3_rsakey")) || (!strcmp(token, "rsakey")) )
     1134  {
     1135    rdr->has_rsa=1;
    11361136    if (key_atob_l(value, rdr->rsa_mod, 128))
    11371137    {
     
    11431143  if (!strcmp(token, "tiger_rsakey"))
    11441144  {
    1145     rdr->nagra_native=1;
    11461145    if (key_atob_l(value, rdr->rsa_mod, 240))
    11471146    {
     
    11511150    return;
    11521151  }
    1153   if (!strcmp(token, "n3_boxkey"))
     1152  if ((!strcmp(token, "n3_boxkey")) || (!strcmp(token, "boxkey")))
    11541153  {
    11551154    if (key_atob_l(value, rdr->nagra_boxkey, 16))
  • trunk/reader-nagra.c

    r1167 r1196  
    192192    unsigned char d2_data[88];
    193193    unsigned char sign1[8];
    194     unsigned char sessi1[8];
    195     unsigned char sessi2[8];
     194    unsigned char sk[16];
    196195    unsigned char tmp[104];
    197     unsigned char tmp1[8];
    198196    unsigned char idea_sig[16];
    199     unsigned char random[88] = {0x51,0xd0,0xcc,0x4a,0x51,0xbc,0x4f,0xa4,0x7d,0x44,0xa9,0xa8,0x97,0x13,0x01,0x63,
    200                 0x8f,0xaf,0x86,0x60,0x7c,0xe3,0xee,0x29,0xca,0x13,0x09,0x44,0x83,0x48,0x17,0x8b,
    201                 0x88,0xa6,0x64,0x20,0x22,0x2b,0x04,0x50,0xd8,0x15,0x9c,0x50,0x09,0x7c,0x6a,0x5d,
    202                 0xa0,0xb3,0xb0,0x11,0xa2,0x15,0x00,0x58,0xae,0x4b,0xe7,0xb0,0x06,0xa0,0x1d,0xe0,
    203                 0x53,0x58,0x6a,0xf0,0x60,0x51,0x71,0xdb,0xe7,0x7c,0xf7,0x1b,0x37,0x9d,0x20,0xf8,
    204                 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
     197    unsigned char random[88];
    205198                     
    206199    if(!do_cmd(0xd1,0x02,0x51,0xd2,NULL))
     
    264257    reader[ridx].prid[0][3]=parte_variable[74];
    265258    reader[ridx].caid[0] =(SYSTEM_NAGRA|parte_variable[76]);
    266     memcpy(sessi1,&parte_variable[79],8);
     259    memcpy(sk,&parte_variable[79],8);                                                                           
     260    memcpy(sk+8,&parte_variable[79],8);
    267261        cs_ri_log("[nagra-reader] CAID: %04X, IRD ID: %s",reader[ridx].caid[0], cs_hexdump (1,irdId,4));
    268262        cs_ri_log("[nagra-reader] ProviderID: %s",cs_hexdump (1,reader[ridx].prid[0],4));
    269        
    270     memcpy(sessi2,&random[72], 8);
    271     memset(tmp1,0,8);
    272     memcpy(tmp1, random+72,8);
    273     ReverseMem(tmp1, 8); //byteflop last 8 bytes of random data
    274     memcpy(random+72, tmp1,8); // insert back the byteflop data
    275    
    276     memset(tmp1,0,8);
    277     memcpy(tmp1, sessi1,8);
    278     ReverseMem(tmp1, 8); // byteflop sessi1 one from rsa variabled part
    279     memcpy(random+80,tmp1,8); // and attach him to random data
     263
     264    memcpy(random, sk,16);
     265    ReverseMem(random, 88);
    280266   
    281267   
     
    302288    if (cta_res[2] == 0x00)
    303289    {
    304         memcpy(sessi,sessi1,8); memcpy(sessi+8,sessi2,8);
     290        memcpy(sessi,sk,16);
    305291        IDEA_KEY_SCHEDULE ks;
    306292        idea_set_encrypt_key(sessi,&ks);
     
    608594    {
    609595        cs_ri_log("[nagra-reader] detect Irdeto tunneled nagra card");
    610         if(!reader[ridx].nagra_native) return 0;
     596        if(!reader[ridx].has_rsa) return 0;
    611597        cs_ri_log("[nagra-reader] using nagra mode");
    612598        is_pure_nagra=1;
Note: See TracChangeset for help on using the changeset viewer.