Module Name: src
Committed By: pgoyette
Date: Fri Jan 17 14:16:08 UTC 2014
Modified Files:
src/tests/crypto/opencrypto: h_aesctr1.c h_aesctr2.c h_arc4.c
h_camellia.c h_cbcdes.c h_gcm.c h_md5.c h_md5hmac.c h_null.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/crypto/opencrypto/h_aesctr1.c \
src/tests/crypto/opencrypto/h_aesctr2.c \
src/tests/crypto/opencrypto/h_arc4.c \
src/tests/crypto/opencrypto/h_camellia.c \
src/tests/crypto/opencrypto/h_cbcdes.c \
src/tests/crypto/opencrypto/h_gcm.c src/tests/crypto/opencrypto/h_md5.c \
src/tests/crypto/opencrypto/h_md5hmac.c \
src/tests/crypto/opencrypto/h_null.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/crypto/opencrypto/h_aesctr1.c
diff -u src/tests/crypto/opencrypto/h_aesctr1.c:1.1 src/tests/crypto/opencrypto/h_aesctr1.c:1.2
--- src/tests/crypto/opencrypto/h_aesctr1.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_aesctr1.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}
Index: src/tests/crypto/opencrypto/h_aesctr2.c
diff -u src/tests/crypto/opencrypto/h_aesctr2.c:1.1 src/tests/crypto/opencrypto/h_aesctr2.c:1.2
--- src/tests/crypto/opencrypto/h_aesctr2.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_aesctr2.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}
Index: src/tests/crypto/opencrypto/h_arc4.c
diff -u src/tests/crypto/opencrypto/h_arc4.c:1.1 src/tests/crypto/opencrypto/h_arc4.c:1.2
--- src/tests/crypto/opencrypto/h_arc4.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_arc4.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}
Index: src/tests/crypto/opencrypto/h_camellia.c
diff -u src/tests/crypto/opencrypto/h_camellia.c:1.1 src/tests/crypto/opencrypto/h_camellia.c:1.2
--- src/tests/crypto/opencrypto/h_camellia.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_camellia.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}
Index: src/tests/crypto/opencrypto/h_cbcdes.c
diff -u src/tests/crypto/opencrypto/h_cbcdes.c:1.1 src/tests/crypto/opencrypto/h_cbcdes.c:1.2
--- src/tests/crypto/opencrypto/h_cbcdes.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_cbcdes.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}
Index: src/tests/crypto/opencrypto/h_gcm.c
diff -u src/tests/crypto/opencrypto/h_gcm.c:1.1 src/tests/crypto/opencrypto/h_gcm.c:1.2
--- src/tests/crypto/opencrypto/h_gcm.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_gcm.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}
Index: src/tests/crypto/opencrypto/h_md5.c
diff -u src/tests/crypto/opencrypto/h_md5.c:1.1 src/tests/crypto/opencrypto/h_md5.c:1.2
--- src/tests/crypto/opencrypto/h_md5.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_md5.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}
Index: src/tests/crypto/opencrypto/h_md5hmac.c
diff -u src/tests/crypto/opencrypto/h_md5hmac.c:1.1 src/tests/crypto/opencrypto/h_md5hmac.c:1.2
--- src/tests/crypto/opencrypto/h_md5hmac.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_md5hmac.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}
Index: src/tests/crypto/opencrypto/h_null.c
diff -u src/tests/crypto/opencrypto/h_null.c:1.1 src/tests/crypto/opencrypto/h_null.c:1.2
--- src/tests/crypto/opencrypto/h_null.c:1.1 Tue Jan 14 17:51:39 2014
+++ src/tests/crypto/opencrypto/h_null.c Fri Jan 17 14:16:08 2014
@@ -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 @@ main(void)
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;
}