summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/hash/hash_test.c
diff options
context:
space:
mode:
authortb <>2025-04-14 18:33:56 +0000
committertb <>2025-04-14 18:33:56 +0000
commit612af42285ca57d13d2a643f6a1dbd10fb1674f1 (patch)
tree748061a7ff771a43d8308a4e48ff301760e11078 /src/regress/lib/libc/hash/hash_test.c
parentdecd7327e16dd50a92021e1ffd8188ffd4508d08 (diff)
downloadopenbsd-master.tar.gz
openbsd-master.tar.bz2
openbsd-master.zip
Enable remaining tests with NULL, 0HEADmaster
Now that libc is fixed, we can do this also for md5, rmd160 and sha1.
Diffstat (limited to 'src/regress/lib/libc/hash/hash_test.c')
-rw-r--r--src/regress/lib/libc/hash/hash_test.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/regress/lib/libc/hash/hash_test.c b/src/regress/lib/libc/hash/hash_test.c
index 67b1f380ed..f9dc641186 100644
--- a/src/regress/lib/libc/hash/hash_test.c
+++ b/src/regress/lib/libc/hash/hash_test.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: hash_test.c,v 1.1.1.1 2025/04/14 17:32:05 tb Exp $ */ 1/* $OpenBSD: hash_test.c,v 1.2 2025/04/14 18:33:56 tb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2025 Theo Buehler <tb@openbsd.org>
@@ -25,8 +25,6 @@
25#include <stdio.h> 25#include <stdio.h>
26#include <string.h> 26#include <string.h>
27 27
28#define ALL_HASHES_ALLOW_NULL 0
29
30#define MAX_DIGEST_LENGTH SHA512_DIGEST_LENGTH 28#define MAX_DIGEST_LENGTH SHA512_DIGEST_LENGTH
31 29
32struct hash_test_case { 30struct hash_test_case {
@@ -48,14 +46,12 @@ enum {
48 46
49/* RFC 1321, Appendix A.5 */ 47/* RFC 1321, Appendix A.5 */
50static const struct hash_test_case md5_tests[] = { 48static const struct hash_test_case md5_tests[] = {
51#if ALL_HASHES_ALLOW_NULL
52 { 49 {
53 .out = { 50 .out = {
54 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 51 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
55 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e, 52 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e,
56 }, 53 },
57 }, 54 },
58#endif
59 { 55 {
60 .in = "", 56 .in = "",
61 .out = { 57 .out = {
@@ -131,7 +127,6 @@ md5_final(void *digest, void *ctx)
131 127
132/* https://homes.esat.kuleuven.be/~bosselae/ripemd160.html */ 128/* https://homes.esat.kuleuven.be/~bosselae/ripemd160.html */
133static const struct hash_test_case rmd160_tests[] = { 129static const struct hash_test_case rmd160_tests[] = {
134#if ALL_HASHES_ALLOW_NULL
135 { 130 {
136 .out = { 131 .out = {
137 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54, 132 0x9c, 0x11, 0x85, 0xa5, 0xc5, 0xe9, 0xfc, 0x54,
@@ -139,7 +134,6 @@ static const struct hash_test_case rmd160_tests[] = {
139 0xb2, 0x25, 0x8d, 0x31, 134 0xb2, 0x25, 0x8d, 0x31,
140 }, 135 },
141 }, 136 },
142#endif
143 { 137 {
144 .in = "", 138 .in = "",
145 .out = { 139 .out = {
@@ -231,7 +225,6 @@ rmd160_final(void *digest, void *ctx)
231 225
232/* RFC 3174 - Appendix A (plus two zero-length tests) */ 226/* RFC 3174 - Appendix A (plus two zero-length tests) */
233static const struct hash_test_case sha1_tests[] = { 227static const struct hash_test_case sha1_tests[] = {
234#if ALL_HASHES_ALLOW_NULL
235 { 228 {
236 .out = { 229 .out = {
237 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 230 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d,
@@ -239,7 +232,6 @@ static const struct hash_test_case sha1_tests[] = {
239 0xaf, 0xd8, 0x07, 0x09, 232 0xaf, 0xd8, 0x07, 0x09,
240 }, 233 },
241 }, 234 },
242#endif
243 { 235 {
244 .in = "", 236 .in = "",
245 .out = { 237 .out = {