shishi-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shishi lib/cfg.c lib/crypto-des.c lib/crypto-rc...


From: shishi-commit
Subject: shishi lib/cfg.c lib/crypto-des.c lib/crypto-rc...
Date: Sat, 20 Sep 2003 07:06:10 -0400

CVSROOT:        /cvsroot/shishi
Module name:    shishi
Branch:         
Changes by:     Simon Josefsson <address@hidden>        03/09/20 07:06:10

Modified files:
        lib            : cfg.c crypto-des.c crypto-rc4.c crypto.c 
                         internal.h 
        src            : shishi.c 

Log message:
        Add "verbose-crypto-noice" cfg token, and use it where appropriate.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/lib/cfg.c.diff?tr1=1.36&tr2=1.37&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/lib/crypto-des.c.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/lib/crypto-rc4.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/lib/crypto.c.diff?tr1=1.88&tr2=1.89&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/lib/internal.h.diff?tr1=1.65&tr2=1.66&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/shishi/shishi/src/shishi.c.diff?tr1=1.66&tr2=1.67&r1=text&r2=text

Patches:
Index: shishi/lib/cfg.c
diff -u shishi/lib/cfg.c:1.36 shishi/lib/cfg.c:1.37
--- shishi/lib/cfg.c:1.36       Sat Sep  6 15:57:16 2003
+++ shishi/lib/cfg.c    Sat Sep 20 07:06:10 2003
@@ -32,6 +32,7 @@
   KDC_RETRIES_OPTION,
   TICKET_LIFE_OPTION,
   RENEW_LIFE_OPTION,
+  VERBOSE_CRYPTO_NOICE_OPTION,
   VERBOSE_CRYPTO_OPTION,
   VERBOSE_ASN1_OPTION,
   VERBOSE_NOICE_OPTION,
@@ -41,21 +42,22 @@
 };
 
 static char *const _shishi_opts[] = {
-  /* [DEFAULT_REALM_OPTION] =     */ "default-realm",
-  /* [DEFAULT_PRINCIPAL_OPTION] = */ "default-principal",
-  /* [CLIENT_KDC_ETYPES_OPTION] = */ "client-kdc-etypes",
-  /* [REALM_KDC_OPTION] =         */ "realm-kdc",
-  /* [SERVER_REALM_OPTION] =      */ "server-realm",
-  /* [KDC_TIMEOUT_OPTION] =       */ "kdc-timeout",
-  /* [KDC_RETRIES_OPTION] =       */ "kdc-retries",
-  /* [TICKET_LIFE_OPTION] =       */ "ticket-life",
-  /* [RENEW_LIFE_OPTION] =        */ "renew-life",
-  /* [VERBOSE_CRYPTO_OPTION] =    */ "verbose-crypto",
-  /* [VERBOSE_ASN1_OPTION] =      */ "verbose-asn1",
-  /* [VERBOSE_NOICE_OPTION] =     */ "verbose-noice",
-  /* [VERBOSE_OPTION] =           */ "verbose",
-  /* [STRINGPROCESS_OPTION] =     */ "stringprocess",
-  /* [THE_END] =                  */ NULL
+  /* [DEFAULT_REALM_OPTION] =        */ "default-realm",
+  /* [DEFAULT_PRINCIPAL_OPTION] =    */ "default-principal",
+  /* [CLIENT_KDC_ETYPES_OPTION] =    */ "client-kdc-etypes",
+  /* [REALM_KDC_OPTION] =            */ "realm-kdc",
+  /* [SERVER_REALM_OPTION] =         */ "server-realm",
+  /* [KDC_TIMEOUT_OPTION] =          */ "kdc-timeout",
+  /* [KDC_RETRIES_OPTION] =          */ "kdc-retries",
+  /* [TICKET_LIFE_OPTION] =          */ "ticket-life",
+  /* [RENEW_LIFE_OPTION] =           */ "renew-life",
+  /* [VERBOSE_CRYPTO_NOICE_OPTION] = */ "verbose-crypto-noice",
+  /* [VERBOSE_CRYPTO_OPTION] =       */ "verbose-crypto",
+  /* [VERBOSE_ASN1_OPTION] =         */ "verbose-asn1",
+  /* [VERBOSE_NOICE_OPTION] =        */ "verbose-noice",
+  /* [VERBOSE_OPTION] =              */ "verbose",
+  /* [STRINGPROCESS_OPTION] =        */ "stringprocess",
+  /* [THE_END] =                     */ NULL
 };
 
 int getsubopt (char **optionp, char *const *tokens, char **valuep);
@@ -224,6 +226,10 @@
        case VERBOSE_OPTION:
          handle->verbose = value && atoi (value) ? atoi (value) :
            ~0 & ~VERBOSES;
+         break;
+
+       case VERBOSE_CRYPTO_NOICE_OPTION:
+         handle->verbose |= SHISHI_VERBOSE_CRYPTO_NOICE;
          break;
 
        case VERBOSE_CRYPTO_OPTION:
Index: shishi/lib/crypto-des.c
diff -u shishi/lib/crypto-des.c:1.54 shishi/lib/crypto-des.c:1.55
--- shishi/lib/crypto-des.c:1.54        Sat Sep 20 05:50:08 2003
+++ shishi/lib/crypto-des.c     Sat Sep 20 07:06:10 2003
@@ -250,7 +250,7 @@
       return res;
     }
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("verify decrypted:");
       _shishi_escapeprint (*out, *outlen);
@@ -260,7 +260,7 @@
   memcpy (incoming, *out + 8, hlen);
   memset (*out + 8, 0, hlen);
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("cksum pt:");
       _shishi_hexprint (*out, *outlen);
@@ -286,7 +286,7 @@
       break;
     }
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("DES verify:");
       _shishi_hexprint (incoming, hlen);
@@ -416,7 +416,7 @@
   for (i = 0; i < 16; i++)
     if (memcmp (key, weak_des_keys[i], 8) == 0)
       {
-       if (VERBOSECRYPTO (handle))
+       if (VERBOSECRYPTONOICE (handle))
          printf ("\t ;; WEAK KEY (corrected)\n");
        key[7] ^= 0xF0;
        break;
@@ -471,6 +471,10 @@
       printf ("\t ;; Salt:\n");
       _shishi_escapeprint (salt, saltlen);
       _shishi_hexprint (salt, saltlen);
+    }
+
+  if (VERBOSECRYPTONOICE (handle))
+    {
       printf ("odd = 1;\n");
       printf ("s = string | salt;\n");
       printf ("tempstring = 0; /* 56-bit string */\n");
@@ -489,7 +493,7 @@
   memset (s + stringlen + saltlen, 0, n_s - stringlen - saltlen);
   memset (tempkey, 0, sizeof (tempkey));       /* tempkey = NULL; */
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       printf ("\t ;; s = pad(string|salt):\n");
       _shishi_escapeprint (s, n_s);
@@ -498,7 +502,7 @@
 
   for (i = 0; i < n_s / 8; i++)
     {
-      if (VERBOSECRYPTO (handle))
+      if (VERBOSECRYPTONOICE (handle))
        {
          printf ("for (8byteblock in s) {\n");
          printf ("\t ;; loop iteration %d\n", i);
@@ -512,7 +516,7 @@
       for (j = 0; j < 8; j++)
        s[i * 8 + j] = s[i * 8 + j] & ~0x80;
 
-      if (VERBOSECRYPTO (handle))
+      if (VERBOSECRYPTONOICE (handle))
        {
          printf ("\t ;; 56bitstring:\n");
          _shishi_bin7print (&s[i * 8], 8);
@@ -542,7 +546,7 @@
              s[i * 8 + j] = temp2;
              s[i * 8 + 7 - j] = temp;
            }
-         if (VERBOSECRYPTO (handle))
+         if (VERBOSECRYPTONOICE (handle))
            {
              printf ("reverse(56bitstring)\n");
              printf ("\t ;; 56bitstring after reverse\n");
@@ -552,7 +556,7 @@
 
       odd = !odd;
 
-      if (VERBOSECRYPTO (handle))
+      if (VERBOSECRYPTONOICE (handle))
        {
          printf ("odd = ! odd\n");
          printf ("tempstring = tempstring XOR 56bitstring;\n");
@@ -562,7 +566,7 @@
       for (j = 0; j < 8; j++)
        tempkey[j] ^= s[i * 8 + j];
 
-      if (VERBOSECRYPTO (handle))
+      if (VERBOSECRYPTONOICE (handle))
        {
          printf ("\t ;; tempstring\n");
          _shishi_bin7print (tempkey, 8);
@@ -572,7 +576,7 @@
   for (j = 0; j < 8; j++)
     tempkey[j] = tempkey[j] << 1;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       printf ("for (8byteblock in s) {\n");
       printf ("}\n");
@@ -588,7 +592,7 @@
   if (res != SHISHI_OK)
     return res;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       printf ("\t ;; tempkey\n");
       _shishi_escapeprint (tempkey, 8);
Index: shishi/lib/crypto-rc4.c
diff -u shishi/lib/crypto-rc4.c:1.10 shishi/lib/crypto-rc4.c:1.11
--- shishi/lib/crypto-rc4.c:1.10        Fri Sep 19 20:03:38 2003
+++ shishi/lib/crypto-rc4.c     Sat Sep 20 07:06:10 2003
@@ -121,7 +121,7 @@
   else
     offset = 10;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("k1pt");
       _shishi_hexprint (L40 + offset, 14 - offset);
@@ -133,7 +133,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("k1");
       _shishi_hexprint (K1, 16);
@@ -143,7 +143,7 @@
   if (export)
     memset (K1 + 7, 0xAB, 9);
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("k1");
       _shishi_hexprint (K1, 16);
@@ -174,7 +174,7 @@
     goto done;
   memcpy (pt + 8, in, inlen);
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("random"); _shishi_hexprint (pt, 8);
     }
@@ -183,7 +183,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("cksum"); _shishi_hexprint (cksum, 16);
     }
@@ -192,7 +192,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("k3");
       _shishi_hexprint (K3, 16);
@@ -202,7 +202,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("ct");
       _shishi_hexprint (ct, ptlen);
@@ -258,7 +258,7 @@
   else
     offset = 10;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("k1pt");
       _shishi_hexprint (L40 + offset, 14 - offset);
@@ -270,7 +270,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("k1");
       _shishi_hexprint (K1, 16);
@@ -280,7 +280,7 @@
   if (export)
     memset (K1 + 7, 0xAB, 9);
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("k1");
       _shishi_hexprint (K1, 16);
@@ -292,7 +292,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("k3");
       _shishi_hexprint (K3, 16);
@@ -302,7 +302,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("cksum pt"); _shishi_hexprint (pt, inlen - 16);
     }
@@ -311,7 +311,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("cksum"); _shishi_hexprint (cksum, 16);
       puts ("cksumin"); _shishi_hexprint (in, 16);
@@ -397,7 +397,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("Ksign"); _shishi_hexprint (Ksign, 16);
     }
@@ -407,7 +407,7 @@
   memcpy (pt, T, 4);
   memcpy (pt + 4, in, inlen);
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("pt"); _shishi_hexprint (pt, ptlen);
     }
@@ -416,7 +416,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("md"); _shishi_hexprint (tmp, 16);
     }
@@ -426,7 +426,7 @@
   if (err)
     goto done;
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       puts ("hmac"); _shishi_hexprint (*out, 16);
     }
Index: shishi/lib/crypto.c
diff -u shishi/lib/crypto.c:1.88 shishi/lib/crypto.c:1.89
--- shishi/lib/crypto.c:1.88    Sat Sep 20 06:10:10 2003
+++ shishi/lib/crypto.c Sat Sep 20 07:06:10 2003
@@ -40,7 +40,7 @@
 static void
 rot13 (Shishi * handle, char *in, char *out, int len)
 {
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       printf ("\t ;; rot 13 in:\n");
       _shishi_escapeprint (in, len);
@@ -80,7 +80,7 @@
       out[1] = (in[1] & ~(0xFF & (0xFF << 3))) | (0xFF & (last << 3));
     }
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       printf ("\t ;; rot13 out:\n");
       _shishi_escapeprint (out, len);
@@ -1769,7 +1769,7 @@
 
   lcmmn = lcm (m, n);
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       printf ("%d-fold (string)\n", n * 8);
       printf ("\t ;; string length %d bytes %d bits\n", m, m * 8);
@@ -1784,7 +1784,7 @@
   /* Replicate the input th the LCMMN length */
   for (i = 0; i < (lcmmn / m); i++)
     {
-      if (VERBOSECRYPTO (handle))
+      if (VERBOSECRYPTONOICE (handle))
        {
          printf ("\t ;; %d-th replication\n", i + 1);
          printf ("string = rot13(string)\n");
@@ -1796,7 +1796,7 @@
 
   memset (out, 0, n);          /* just in case */
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       printf ("\t ;; replicated string (length %d):\n", lcmmn);
       _shishi_hexprint (buf, lcmmn);
@@ -1811,7 +1811,7 @@
 
   for (i = 0; i < (lcmmn / n); i++)
     {
-      if (VERBOSECRYPTO (handle))
+      if (VERBOSECRYPTONOICE (handle))
        {
          printf ("\t ;; %d-th one's complement addition sum\n", i + 1);
          printf ("\t ;; sum:\n");
@@ -1825,7 +1825,7 @@
 
       ocadd (out, (char *) &buf[i * n], out, n);
 
-      if (VERBOSECRYPTO (handle))
+      if (VERBOSECRYPTONOICE (handle))
        {
          printf ("\t ;; sum:\n");
          _shishi_hexprint (out, n);
@@ -1833,7 +1833,7 @@
        }
     }
 
-  if (VERBOSECRYPTO (handle))
+  if (VERBOSECRYPTONOICE (handle))
     {
       printf ("\t ;; nfold\n");
       _shishi_hexprint (out, n);
Index: shishi/lib/internal.h
diff -u shishi/lib/internal.h:1.65 shishi/lib/internal.h:1.66
--- shishi/lib/internal.h:1.65  Sat Sep 13 07:31:07 2003
+++ shishi/lib/internal.h       Sat Sep 20 07:06:10 2003
@@ -146,19 +146,22 @@
 #define MAX_HASH_LEN 32
 #define MAX_CKSUM_LEN 32
 
-#define SHISHI_VERBOSE_CRYPTO  (1<<1)
-#define SHISHI_VERBOSE_ASN1    (1<<2)
-#define SHISHI_VERBOSE_NOICE   (1<<3)
+#define SHISHI_VERBOSE_NOICE           (1<<1)
+#define SHISHI_VERBOSE_ASN1            (1<<2)
+#define SHISHI_VERBOSE_CRYPTO          (1<<3)
+#define SHISHI_VERBOSE_CRYPTO_NOICE    (1<<4)
 
 #define KRBTGT "krbtgt"
 #define PRINCIPAL_DELIMITER "/"
 
+#define VERBOSENOICE(h) (h->verbose & SHISHI_VERBOSE_NOICE)
 #define VERBOSEASN1(h) (h->verbose & SHISHI_VERBOSE_ASN1)
 #define VERBOSECRYPTO(h) (h->verbose & SHISHI_VERBOSE_CRYPTO)
-#define VERBOSENOICE(h) (h->verbose & SHISHI_VERBOSE_NOICE)
+#define VERBOSECRYPTONOICE(h) (h->verbose & SHISHI_VERBOSE_CRYPTO_NOICE)
 #define VERBOSES (SHISHI_VERBOSE_ASN1 |                \
                  SHISHI_VERBOSE_CRYPTO |       \
-                 SHISHI_VERBOSE_NOICE)
+                 SHISHI_VERBOSE_NOICE |        \
+                 SHISHI_VERBOSE_CRYPTO_NOICE)
 #define VERBOSE(h) (h->verbose & ~VERBOSES)
 
 #ifndef HOST_NAME_MAX
Index: shishi/src/shishi.c
diff -u shishi/src/shishi.c:1.66 shishi/src/shishi.c:1.67
--- shishi/src/shishi.c:1.66    Thu Sep 18 17:54:09 2003
+++ shishi/src/shishi.c Sat Sep 20 07:06:10 2003
@@ -1008,6 +1008,14 @@
               shishi_strerror (rc));
     }
 
+  if (arg.verbose > 5)
+    {
+      rc = shishi_cfg (handle, "verbose-crypto-noice");
+      if (rc != SHISHI_OK)
+       error (1, 0, "Could not make library verbose: %s\n",
+              shishi_strerror (rc));
+    }
+
   if (!arg.starttime)
     arg.starttime = time (NULL);
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]