shishi-commit
[Top][All Lists]
Advanced

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

CVS shishi/tests


From: shishi-commit
Subject: CVS shishi/tests
Date: Fri, 10 Sep 2004 11:04:17 +0200

Update of /home/cvs/shishi/tests
In directory dopio:/tmp/cvs-serv19534/tests

Modified Files:
        authenticator.c priv.c safe.c ticketset.c 
Log Message:
ASN.1 cleanup.


--- /home/cvs/shishi/tests/authenticator.c      2004/04/18 13:36:46     1.15
+++ /home/cvs/shishi/tests/authenticator.c      2004/09/10 09:04:17     1.16
@@ -54,7 +54,7 @@
   Shishi_asn1 a;
   char buffer[BUFSIZ];
   char buffer2[BUFSIZ];
-  char *p;
+  char *p, *buf, *buf2;
   int res;
   size_t n, m;
   int32_t t;
@@ -199,13 +199,12 @@
   else
     fail ("shishi_authenticator_remove_cksum() failed\n");
 
-  /* shishi_a2d */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, a, buffer, &n);
+  /* shishi_asn1_to_der */
+  res = shishi_asn1_to_der (handle, a, &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
 
   /* shishi_authenticator_to_file */
   res = shishi_authenticator_to_file (handle, a, SHISHI_FILETYPE_TEXT,
@@ -239,20 +238,22 @@
        fail ("shishi_authenticator_print() failed\n");
     }
 
-  /* shishi_a2d */
-  m = sizeof (buffer2);
-  res = shishi_a2d (handle, a, buffer2, &m);
+  /* shishi_asn1_to_der */
+  res = shishi_asn1_to_der (handle, a, &buf2, &m);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
 
   /* Compare DER encodings of authenticators */
-  if (n > 0 && m > 0 && n == m && memcmp (buffer, buffer2, n) == 0)
+  if (n > 0 && m > 0 && n == m && memcmp (buf, buf2, n) == 0)
     success ("DER comparison OK\n");
   else
     fail ("DER comparison failed\n");
 
+  free (buf);
+  free (buf2);
+
   /* shishi_authenticator_cusec_set */
   res = shishi_authenticator_cusec_set (handle, a, 4711);
   if (res == SHISHI_OK)
@@ -285,27 +286,28 @@
   else
     fail ("shishi_authenticator_ctime() failed\n");
 
-  /* shishi_a2d */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, a, buffer, &n);
+  /* shishi_asn1_to_der */
+  res = shishi_asn1_to_der (handle, a, &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
   if (debug)
     {
       shishi_authenticator_print (handle, stdout, a);
-      hexprint (buffer, n);
+      hexprint (buf, n);
       puts ("");
       hexprint (authenticator, sizeof (authenticator));
       puts ("");
     }
   if (n == sizeof (authenticator) &&
-      n == AUTHENTICATOR_LEN && memcmp (authenticator, buffer, n) == 0)
+      n == AUTHENTICATOR_LEN && memcmp (authenticator, buf, n) == 0)
     success ("DER comparison OK\n");
   else
     fail ("DER comparison failed\n");
 
+  free (buf);
+
   /* shishi_authenticator_clear_authorizationdata */
   res = shishi_authenticator_clear_authorizationdata (handle, a);
   if (res == SHISHI_OK)
@@ -313,27 +315,28 @@
   else
     fail ("shishi_authenticator_clear_authorizationdata() failed\n");
 
-  /* shishi_a2d */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, a, buffer, &n);
+  /* shishi_asn1_to_der */
+  res = shishi_asn1_to_der (handle, a, &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
   if (debug)
     {
       shishi_authenticator_print (handle, stdout, a);
-      hexprint (buffer, n);
+      hexprint (buf, n);
       puts ("");
       hexprint (authenticator2, sizeof (authenticator2));
       puts ("");
     }
   if (n == sizeof (authenticator2) &&
-      n == AUTHENTICATOR2_LEN && memcmp (authenticator2, buffer, n) == 0)
+      n == AUTHENTICATOR2_LEN && memcmp (authenticator2, buf, n) == 0)
     success ("DER comparison OK\n");
   else
     fail ("DER comparison failed\n");
 
+  free (buf);
+
   /* unlink */
   res = unlink ("authenticator.tmp");
   if (res == 0)
--- /home/cvs/shishi/tests/priv.c       2003/12/02 16:23:58     1.3
+++ /home/cvs/shishi/tests/priv.c       2004/09/10 09:04:17     1.4
@@ -142,12 +142,12 @@
        fail ("shishi_priv_print() failed\n");
     }
 
-  /* shishi_a2d() */
-  res = shishi_new_a2d (handle, asn1priv, &q, &m);
+  /* shishi_asn1_to_der() */
+  res = shishi_asn1_to_der (handle, asn1priv, &q, &m);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    fail ("shishi_a2d() failed\n");
+    fail ("shishi_asn1_to_der() failed\n");
 
   /* Compare DER encodings of authenticators */
   if (l > 0 && m > 0 && l == m && memcmp (p, q, l) == 0)
--- /home/cvs/shishi/tests/safe.c       2003/12/02 16:23:58     1.6
+++ /home/cvs/shishi/tests/safe.c       2004/09/10 09:04:17     1.7
@@ -151,12 +151,12 @@
        fail ("shishi_safe_print() failed\n");
     }
 
-  /* shishi_a2d() */
-  res = shishi_new_a2d (handle, asn1safe, &q, &m);
+  /* shishi_asn1_to_der() */
+  res = shishi_asn1_to_der (handle, asn1safe, &q, &m);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    fail ("shishi_a2d() failed\n");
+    fail ("shishi_asn1_to_der() failed\n");
 
   /* Compare DER encodings of authenticators */
   if (l > 0 && m > 0 && l == m && memcmp (p, q, l) == 0)
--- /home/cvs/shishi/tests/ticketset.c  2003/12/02 16:23:58     1.18
+++ /home/cvs/shishi/tests/ticketset.c  2004/09/10 09:04:17     1.19
@@ -1,5 +1,5 @@
 /* ticketset.c Shishi ticketset self tests.
- * Copyright (C) 2002, 2003  Simon Josefsson
+ * Copyright (C) 2002, 2003, 2004  Simon Josefsson
  *
  * This file is part of Shishi.
  *
@@ -88,6 +88,7 @@
   Shishi_asn1 n1, n2, n3;
   char buffer[BUFSIZ];
   char buffer2[BUFSIZ];
+  char *buf, *buf2;
   char *p, *q;
   size_t n;
   int res;
@@ -496,14 +497,14 @@
     fail ("shishi_tkts_nth() failed\n");
 
   /* DER encode and compare tkt1 ticket */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, shishi_tkt_ticket (t1), buffer, &n);
+  res = shishi_asn1_to_der (handle, shishi_tkt_ticket (t1), &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
 
-  base64_to (buffer2, buffer, n, BUFSIZ);
+  base64_to (buffer2, buf, n, BUFSIZ);
+  free (buf);
   if (strlen (buffer2) == strlen (tkt1ticketb64) &&
       memcmp (buffer2, tkt1ticketb64, strlen (tkt1ticketb64)) == 0)
     success ("Ticket read OK\n");
@@ -511,14 +512,14 @@
     fail ("Ticket read failed\n");
 
   /* DER encode and compare tkt1 enckdcreppart */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, shishi_tkt_enckdcreppart (t1), buffer, &n);
+  res = shishi_asn1_to_der (handle, shishi_tkt_enckdcreppart (t1), &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
 
-  base64_to (buffer2, buffer, n, BUFSIZ);
+  base64_to (buffer2, buf, n, BUFSIZ);
+  free (buf);
   if (strlen (buffer2) == strlen (tkt1enckdcreppartb64) &&
       memcmp (buffer2, tkt1enckdcreppartb64,
              strlen (tkt1enckdcreppartb64)) == 0)
@@ -527,14 +528,14 @@
     fail ("EncKDCRepPart read failed\n");
 
   /* DER encode and compare tkt1 kdcrep */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, shishi_tkt_kdcrep (t1), buffer, &n);
+  res = shishi_asn1_to_der (handle, shishi_tkt_kdcrep (t1), &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
 
-  base64_to (buffer2, buffer, n, BUFSIZ);
+  base64_to (buffer2, buf, n, BUFSIZ);
+  free (buf);
   if (strlen (buffer2) == strlen (tkt1kdcrepb64) &&
       memcmp (buffer2, tkt1kdcrepb64, strlen (tkt1kdcrepb64)) == 0)
     success ("KDC-REP read OK\n");
@@ -542,14 +543,14 @@
     fail ("KDC-REP read failed\n");
 
   /* DER encode and compare tkt2 ticket */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, shishi_tkt_ticket (t2), buffer, &n);
+  res = shishi_asn1_to_der (handle, shishi_tkt_ticket (t2), &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
 
-  base64_to (buffer2, buffer, n, BUFSIZ);
+  base64_to (buffer2, buf, n, BUFSIZ);
+  free (buf);
   if (strlen (buffer2) == strlen (tkt2ticketb64) &&
       memcmp (buffer2, tkt2ticketb64, strlen (tkt2ticketb64)) == 0)
     success ("Ticket 2 read OK\n");
@@ -557,14 +558,14 @@
     fail ("Ticket 2 read failed\n");
 
   /* DER encode and compare tkt2 enckdcreppart */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, shishi_tkt_enckdcreppart (t2), buffer, &n);
+  res = shishi_asn1_to_der (handle, shishi_tkt_enckdcreppart (t2), &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
 
-  base64_to (buffer2, buffer, n, BUFSIZ);
+  base64_to (buffer2, buf, n, BUFSIZ);
+  free (buf);
   if (strlen (buffer2) == strlen (tkt2enckdcreppartb64) &&
       memcmp (buffer2, tkt2enckdcreppartb64,
              strlen (tkt2enckdcreppartb64)) == 0)
@@ -573,14 +574,14 @@
     fail ("EncKDCRepPart 2 read failed\n");
 
   /* DER encode and compare tkt2 kdcrep */
-  n = sizeof (buffer);
-  res = shishi_a2d (handle, shishi_tkt_kdcrep (t2), buffer, &n);
+  res = shishi_asn1_to_der (handle, shishi_tkt_kdcrep (t2), &buf, &n);
   if (res == SHISHI_OK)
-    success ("shishi_a2d() OK\n");
+    success ("shishi_asn1_to_der() OK\n");
   else
-    n = 0, fail ("shishi_a2d() failed\n");
+    n = 0, fail ("shishi_asn1_to_der() failed\n");
 
-  base64_to (buffer2, buffer, n, BUFSIZ);
+  base64_to (buffer2, buf, n, BUFSIZ);
+  free (buf);
   if (strlen (buffer2) == strlen (tkt2kdcrepb64) &&
       memcmp (buffer2, tkt2kdcrepb64, strlen (tkt2kdcrepb64)) == 0)
     success ("KDC-REP 2 read OK\n");





reply via email to

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