Source-Changes-HG archive

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

[src/trunk]: src/tests/crypto/opencrypto Clean up the helper programs. Remov...



details:   https://anonhg.NetBSD.org/src/rev/2100f0d56c56
branches:  trunk
changeset: 792818:2100f0d56c56
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Jan 17 14:16:08 2014 +0000

description:
Clean up the helper programs.  Remove the code to print the results, and
make sure that all helpers actually check the results against the correct
values.

diffstat:

 tests/crypto/opencrypto/h_aesctr1.c  |  13 +++----------
 tests/crypto/opencrypto/h_aesctr2.c  |  13 +++----------
 tests/crypto/opencrypto/h_arc4.c     |  13 +++----------
 tests/crypto/opencrypto/h_camellia.c |  13 +++----------
 tests/crypto/opencrypto/h_cbcdes.c   |  13 +++----------
 tests/crypto/opencrypto/h_gcm.c      |  19 +++----------------
 tests/crypto/opencrypto/h_md5.c      |  13 +++----------
 tests/crypto/opencrypto/h_md5hmac.c  |  13 +++----------
 tests/crypto/opencrypto/h_null.c     |  13 +++----------
 9 files changed, 27 insertions(+), 96 deletions(-)

diffs (260 lines):

diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_aesctr1.c
--- a/tests/crypto/opencrypto/h_aesctr1.c       Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_aesctr1.c       Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_aesctr1.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_aesctr1.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -76,16 +76,9 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 1
+
        if (memcmp(co.dst, ciphertx, sizeof(ciphertx)))
                warnx("verification failed");
-#else
-       {
-               int i;
-               for (i = 0; i < sizeof(buf); i++)
-                       printf("%02x ", buf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }
diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_aesctr2.c
--- a/tests/crypto/opencrypto/h_aesctr2.c       Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_aesctr2.c       Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_aesctr2.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_aesctr2.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -89,16 +89,9 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 1
+
        if (memcmp((char *)co.dst + 8, plaintx, sizeof(plaintx)))
                warnx("verification failed");
-#else
-       {
-               int i;
-               for (i = 0; i < sizeof(ibuf); i++)
-                       printf("%02x ", ibuf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }
diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_arc4.c
--- a/tests/crypto/opencrypto/h_arc4.c  Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_arc4.c  Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_arc4.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_arc4.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -72,16 +72,9 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 1
+
        if (memcmp(co.dst, ciphertx, sizeof(ciphertx)))
                errx(1, "verification failed");
-#else
-       {
-               int i;
-               for (i = 0; i < sizeof(buf); i++)
-                       printf("%02x ", buf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }
diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_camellia.c
--- a/tests/crypto/opencrypto/h_camellia.c      Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_camellia.c      Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_camellia.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_camellia.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -78,16 +78,9 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 0
+
        if (memcmp(co.dst, ciphertx, sizeof(ciphertx)))
                warnx("verification failed");
-#else
-       {
-               unsigned int i;
-               for (i = 0; i < sizeof(buf); i++)
-                       printf("%02x ", buf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }
diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_cbcdes.c
--- a/tests/crypto/opencrypto/h_cbcdes.c        Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_cbcdes.c        Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_cbcdes.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_cbcdes.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -74,16 +74,9 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 1
+
        if (memcmp(co.dst, ciphertx, sizeof(ciphertx)))
                errx(1, "verification failed");
-#else
-       {
-               int i;
-               for (i = 0; i < sizeof(buf); i++)
-                       printf("%02x ", buf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }
diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_gcm.c
--- a/tests/crypto/opencrypto/h_gcm.c   Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_gcm.c   Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_gcm.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_gcm.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -116,24 +116,11 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 1
+
        if (memcmp(co.dst, plaintx, sizeof(plaintx)))
                errx(1, "verification failed");
        if (memcmp(macbuf, hash, sizeof(hash)))
                errx(1, "hash failed");
-#else
-       {
-               int i;
-               for (i = 0; i < sizeof(databuf2); i++)
-                       printf("%02x ", databuf2[i]);
-               printf("\n");
-       }
-       {
-               int i;
-               for (i = 0; i < sizeof(macbuf); i++)
-                       printf("%02x ", macbuf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }
diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_md5.c
--- a/tests/crypto/opencrypto/h_md5.c   Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_md5.c   Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_md5.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_md5.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -74,16 +74,9 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 0
+
        if (memcmp(co.dst, ciphertx, sizeof(ciphertx)))
                errx(1, "verification failed");
-#else
-       {
-               unsigned int i;
-               for (i = 0; i < sizeof(buf); i++)
-                       printf("%02x ", buf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }
diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_md5hmac.c
--- a/tests/crypto/opencrypto/h_md5hmac.c       Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_md5hmac.c       Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_md5hmac.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_md5hmac.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -75,16 +75,9 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 0
+
        if (memcmp(co.dst, ciphertx, sizeof(ciphertx)))
                errx(1, "verification failed");
-#else
-       {
-               unsigned int i;
-               for (i = 0; i < sizeof(buf); i++)
-                       printf("%02x ", buf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }
diff -r 5ca8769910ca -r 2100f0d56c56 tests/crypto/opencrypto/h_null.c
--- a/tests/crypto/opencrypto/h_null.c  Fri Jan 17 14:14:54 2014 +0000
+++ b/tests/crypto/opencrypto/h_null.c  Fri Jan 17 14:16:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_null.c,v 1.1 2014/01/14 17:51:39 pgoyette Exp $ */
+/* $NetBSD: h_null.c,v 1.2 2014/01/17 14:16:08 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -74,16 +74,9 @@
        res = ioctl(fd, CIOCCRYPT, &co);
        if (res < 0)
                err(1, "CIOCCRYPT");
-#if 0
+
        if (memcmp(co.dst, ciphertx, sizeof(ciphertx)))
                errx(1, "verification failed");
-#else
-       {
-               unsigned int i;
-               for (i = 0; i < sizeof(buf); i++)
-                       printf("%02x ", buf[i]);
-               printf("\n");
-       }
-#endif
+
        return 0;
 }



Home | Main Index | Thread Index | Old Index