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

Diff for /src/usr.bin/bdes/Attic/bdes.c between version 1.11 and 1.12

version 1.11, 2003/06/10 22:20:45 version 1.12, 2003/07/02 21:04:09
Line 90 
Line 90 
 #include <string.h>  #include <string.h>
   
 typedef char Desbuf[8];  typedef char Desbuf[8];
 int     tobinhexi(char, int);  int     tobinhex(char, int);
 void    cvtkey(char *, char *);  void    cvtkey(char *, char *);
 int     setbits(char *, int);  int     setbits(char *, int);
 void    makekey(Desbuf);  void    makekey(Desbuf);
Line 213 
Line 213 
         /* process the argument list */          /* process the argument list */
         kflag = 0;          kflag = 0;
         while ((i = getopt(argc, argv, "abdF:f:k:m:o:pv:")) != -1)          while ((i = getopt(argc, argv, "abdF:f:k:m:o:pv:")) != -1)
                 switch(i) {                  switch (i) {
                 case 'a':               /* key is ASCII */                  case 'a':               /* key is ASCII */
                         keybase = KEY_ASCII;                          keybase = KEY_ASCII;
                         break;                          break;
Line 281 
Line 281 
         makekey(msgbuf);          makekey(msgbuf);
         inverse = (alg == ALG_CBC || alg == ALG_ECB) && mode == MODE_DECRYPT;          inverse = (alg == ALG_CBC || alg == ALG_ECB) && mode == MODE_DECRYPT;
   
         switch(alg) {          switch (alg) {
         case ALG_CBC:          case ALG_CBC:
                 switch(mode) {                  switch (mode) {
                 case MODE_AUTHENTICATE: /* authenticate using CBC mode */                  case MODE_AUTHENTICATE: /* authenticate using CBC mode */
                         cbcauth();                          cbcauth();
                         break;                          break;
Line 296 
Line 296 
                 }                  }
                 break;                  break;
         case ALG_CFB:          case ALG_CFB:
                 switch(mode) {                  switch (mode) {
                 case MODE_AUTHENTICATE: /* authenticate using CFB mode */                  case MODE_AUTHENTICATE: /* authenticate using CFB mode */
                         cfbauth();                          cfbauth();
                         break;                          break;
Line 309 
Line 309 
                 }                  }
                 break;                  break;
         case ALG_CFBA:          case ALG_CFBA:
                 switch(mode) {                  switch (mode) {
                 case MODE_AUTHENTICATE: /* authenticate using CFBA mode */                  case MODE_AUTHENTICATE: /* authenticate using CFBA mode */
                         err(1, "can't authenticate with CFBA mode");                          err(1, "can't authenticate with CFBA mode");
                         break;                          break;
Line 322 
Line 322 
                 }                  }
                 break;                  break;
         case ALG_ECB:          case ALG_ECB:
                 switch(mode) {                  switch (mode) {
                 case MODE_AUTHENTICATE: /* authenticate using ECB mode */                  case MODE_AUTHENTICATE: /* authenticate using ECB mode */
                         err(1, "can't authenticate with ECB mode");                          err(1, "can't authenticate with ECB mode");
                         break;                          break;
Line 335 
Line 335 
                 }                  }
                 break;                  break;
         case ALG_OFB:          case ALG_OFB:
                 switch(mode) {                  switch (mode) {
                 case MODE_AUTHENTICATE: /* authenticate using OFB mode */                  case MODE_AUTHENTICATE: /* authenticate using OFB mode */
                         err(1, "can't authenticate with OFB mode");                          err(1, "can't authenticate with OFB mode");
                         break;                          break;
Line 357 
Line 357 
 int  int
 tobinhex(char c, int radix)  tobinhex(char c, int radix)
 {  {
         switch(c) {          switch (c) {
         case '0':               return(0x0);          case '0':               return(0x0);
         case '1':               return(0x1);          case '1':               return(0x1);
         case '2':               return(radix > 2 ? 0x2 : -1);          case '2':               return(radix > 2 ? 0x2 : -1);
Line 393 
Line 393 
         /*          /*
          * just switch on the key base           * just switch on the key base
          */           */
         switch(keybase) {          switch (keybase) {
         case KEY_ASCII:                 /* ASCII to integer */          case KEY_ASCII:                 /* ASCII to integer */
                 (void)strncpy(obuf, ibuf, 8);                  (void)strncpy(obuf, ibuf, 8);
                 return;                  return;

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12