bug-gnulib
[Top][All Lists]
Advanced

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

fixes for gc-md?-tests


From: Simon Josefsson
Subject: fixes for gc-md?-tests
Date: Wed, 19 Oct 2005 01:44:52 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Installed..

Btw, the GnuTLS self tests passes using Libgcrypt through GC.  I am
now working on making them work through the gnulib internal files too.

Index: ChangeLog
===================================================================
RCS file: /cvsroot/gnulib/gnulib/ChangeLog,v
retrieving revision 1.429
diff -u -p -r1.429 ChangeLog
--- ChangeLog   18 Oct 2005 23:35:52 -0000      1.429
+++ ChangeLog   18 Oct 2005 23:43:54 -0000
@@ -1,5 +1,10 @@
 2005-10-19  Simon Josefsson  <address@hidden>
 
+       * tests/test-gc-md4.c, tests/test-gc-md5.c: Test gc_hash_buffer
+       interface too.
+
+2005-10-19  Simon Josefsson  <address@hidden>
+
        * modules/gc-md4, modules/gc-md4-tests: New file.
 
        * tests/test-gc-md4.c: New file.
Index: tests/test-gc-md4.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/tests/test-gc-md4.c,v
retrieving revision 1.1
diff -u -p -r1.1 test-gc-md4.c
--- tests/test-gc-md4.c 18 Oct 2005 23:35:52 -0000      1.1
+++ tests/test-gc-md4.c 18 Oct 2005 23:43:54 -0000
@@ -66,6 +66,25 @@ main (int argc, char *argv[])
        printf ("\n");
        return 1;
       }
+
+    if (gc_hash_buffer (GC_MD4, in, inlen, out) != 0)
+      {
+       printf ("gc_hash_buffer(MD4) call failed\n");
+       return 1;
+      }
+
+    if (memcmp (out, expect, 16) != 0)
+      {
+       size_t i;
+       printf ("md4 1 missmatch. expected:\n");
+       for (i = 0; i < 16; i++)
+         printf ("%02x ", expect[i] & 0xFF);
+       printf ("\ncomputed:\n");
+       for (i = 0; i < 16; i++)
+         printf ("%02x ", out[i] & 0xFF);
+       printf ("\n");
+       return 1;
+      }
   }
 
   gc_done ();
Index: tests/test-gc-md5.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/tests/test-gc-md5.c,v
retrieving revision 1.1
diff -u -p -r1.1 test-gc-md5.c
--- tests/test-gc-md5.c 13 Oct 2005 08:06:07 -0000      1.1
+++ tests/test-gc-md5.c 18 Oct 2005 23:43:54 -0000
@@ -66,6 +66,25 @@ main (int argc, char *argv[])
        printf ("\n");
        return 1;
       }
+
+    if (gc_hash_buffer (GC_MD5, in, inlen, out) != 0)
+      {
+       printf ("gc_hash_buffer(MD5) call failed\n");
+       return 1;
+      }
+
+    if (memcmp (out, expect, 16) != 0)
+      {
+       size_t i;
+       printf ("md5 1 missmatch. expected:\n");
+       for (i = 0; i < 16; i++)
+         printf ("%02x ", expect[i] & 0xFF);
+       printf ("\ncomputed:\n");
+       for (i = 0; i < 16; i++)
+         printf ("%02x ", out[i] & 0xFF);
+       printf ("\n");
+       return 1;
+      }
   }
 
   gc_done ();




reply via email to

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