[BACK]Return to cyberflex.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sectok

Diff for /src/usr.bin/sectok/Attic/cyberflex.c between version 1.6 and 1.7

version 1.6, 2001/07/17 15:16:46 version 1.7, 2001/07/17 17:10:44
Line 60 
Line 60 
 static unsigned char key_fid[] = {0x00, 0x11};  static unsigned char key_fid[] = {0x00, 0x11};
 static unsigned char DFLTATR[] = {0x81, 0x10, 0x06, 0x01};  static unsigned char DFLTATR[] = {0x81, 0x10, 0x06, 0x01};
 static unsigned char DFLTAUT0[] = {0xad, 0x9f, 0x61, 0xfe, 0xfa, 0x20, 0xce, 0x63};  static unsigned char DFLTAUT0[] = {0xad, 0x9f, 0x61, 0xfe, 0xfa, 0x20, 0xce, 0x63};
   static unsigned char AUT0[20];
   
 int aut0_vfyd;  int aut0_vfyd;
   
Line 128 
Line 129 
 int jlogin(int ac, char *av[])  int jlogin(int ac, char *av[])
 {  {
     int i, vflag = 0, sw;      int i, vflag = 0, sw;
     unsigned char AUT0[20];  
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
   
       cla = cyberflex_inq_class(fd);
       if (cla < 0) {
           printf("can't determine Cyberflex application class\n");
           return -1;
       }
   
     optind = optreset = 1;      optind = optreset = 1;
   
     while ((i = getopt(ac, av, "dvx:")) != -1) {      while ((i = getopt(ac, av, "dvx:")) != -1) {
Line 146 
Line 152 
     if (get_AUT0(ac, av, "Enter AUT0 passphrase: ", AUT0) < 0)      if (get_AUT0(ac, av, "Enter AUT0 passphrase: ", AUT0) < 0)
         return -1;          return -1;
   
     cla = cyberflex_inq_class(fd);  
   
     if (vflag) {      if (vflag) {
         printf("Class %02x\n", cla);          printf("Class %02x\n", cla);
         for (i = 0; i < 8; i++)          for (i = 0; i < 8; i++)
Line 188 
Line 192 
         }          }
     }      }
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
     if (!aut0_vfyd)      if (!aut0_vfyd)
         jaut(0, NULL);          jaut(0, NULL);
   
Line 207 
Line 211 
     unsigned char buf[64];      unsigned char buf[64];
     int n = 0, sw;      int n = 0, sw;
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
   
     buf[n++] = 0x90;      buf[n++] = 0x90;
     buf[n++] = 0x94;            /* TA1 */      buf[n++] = 0x94;            /* TA1 */
Line 237 
Line 241 
     unsigned char buf[32];      unsigned char buf[32];
     int i, sw;      int i, sw;
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
   
     sectok_apdu(fd, cla, 0xca, 0, 1, 0, NULL, 0x16, buf, &sw);      sectok_apdu(fd, cla, 0xca, 0, 1, 0, NULL, 0x16, buf, &sw);
     if (sectok_swOK(sw)) {      if (sectok_swOK(sw)) {
Line 268 
Line 272 
     char ftype[32], fname[6];      char ftype[32], fname[6];
     unsigned char buf[JDIRSIZE];      unsigned char buf[JDIRSIZE];
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
   
     for (p2 = 0; ; p2++) {      for (p2 = 0; ; p2++) {
         if (sectok_apdu(fd, cla, 0xa8, 0, p2, 0, NULL, JDIRSIZE, buf, &sw) < 0)          if (sectok_apdu(fd, cla, 0xa8, 0, p2, 0, NULL, JDIRSIZE, buf, &sw) < 0)
Line 311 
Line 315 
     sectok_parse_fname(av[1], fid);      sectok_parse_fname(av[1], fid);
     sscanf(av[2], "%d", &fsize);      sscanf(av[2], "%d", &fsize);
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
     if (!aut0_vfyd)      if (!aut0_vfyd)
         jaut(0, NULL);          jaut(0, NULL);
   
Line 336 
Line 340 
   
     sectok_parse_fname(av[1], fid);      sectok_parse_fname(av[1], fid);
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
     if (!aut0_vfyd)      if (!aut0_vfyd)
         jaut(0, NULL);          jaut(0, NULL);
   
Line 423 
Line 427 
     if (analyze_load_options(ac, av) < 0)      if (analyze_load_options(ac, av) < 0)
         return -1;          return -1;
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
     if (!aut0_vfyd)      if (!aut0_vfyd)
         jaut(0, NULL);          jaut(0, NULL);
   
Line 588 
Line 592 
     if (analyze_load_options(ac, av) < 0)      if (analyze_load_options(ac, av) < 0)
         return -1;          return -1;
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
     if (!aut0_vfyd)      if (!aut0_vfyd)
         jaut(0, NULL);          jaut(0, NULL);
   
Line 638 
Line 642 
     if (analyze_load_options(ac, av) < 0)      if (analyze_load_options(ac, av) < 0)
         return -1;          return -1;
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
   
     printf ("select applet\n");      printf ("select applet\n");
     printf ("AID                     ");      printf ("AID                     ");
Line 672 
Line 676 
 {  {
     int sw;      int sw;
   
     if (fd < 0)      if (fd < 0 && reset(0, NULL) < 0)
         reset(0, NULL);          return -1;
   
     sectok_apdu(fd, cla, 0xa4, 0x04, 0, 0, NULL, 0, NULL, &sw);      sectok_apdu(fd, cla, 0xa4, 0x04, 0, 0, NULL, 0, NULL, &sw);
     if (!sectok_swOK(sw)) {      if (!sectok_swOK(sw)) {
Line 732 
Line 736 
     /* Now let's do it. :) */      /* Now let's do it. :) */
   
     /* add the AUT0 */      /* add the AUT0 */
     cyberflex_fill_key_block (data, 0, 1, DFLTAUT0);      cyberflex_fill_key_block (data, 0, 1, AUT0);
   
     /* add the applet sign key */      /* add the applet sign key */
     cyberflex_fill_key_block (data+KEY_BLOCK_SIZE, 5, 0, app_key);      cyberflex_fill_key_block (data+KEY_BLOCK_SIZE, 5, 0, app_key);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7