From 87d32bf48e79626b014e9b9afcd1cb193e8ef28e Mon Sep 17 00:00:00 2001 From: lteo Date: Fri, 9 Jan 2015 03:32:58 +0000 Subject: [PATCH] Add test suites for SHA-224 and SHA-384. Relevant lines from testsuite.sha224 were verified against the test vectors in RFC 3874, while testsuite.384 was verified against https://www.cosic.esat.kuleuven.be/nessie/testvectors/hash/sha/Sha-2-384.unverified.test-vectors ok millert@ --- regress/bin/md5/Makefile | 12 +++++++++--- regress/bin/md5/testsuite.sha224 | 10 ++++++++++ regress/bin/md5/testsuite.sha384 | 10 ++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 regress/bin/md5/testsuite.sha224 create mode 100644 regress/bin/md5/testsuite.sha384 diff --git a/regress/bin/md5/Makefile b/regress/bin/md5/Makefile index 54b9ff5e1e2..d210a9f2e62 100644 --- a/regress/bin/md5/Makefile +++ b/regress/bin/md5/Makefile @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile,v 1.6 2014/03/26 04:07:44 lteo Exp $ +# $OpenBSD: Makefile,v 1.7 2015/01/09 03:32:58 lteo Exp $ -REGRESS_TARGETS=cksum md5 sha1 sha256 sha512 md5_string_vs_files md5_pipe -REGRESS_TARGETS+=md5_pipe_vs_file md5_multiple_files +REGRESS_TARGETS=cksum md5 sha1 sha224 sha256 sha384 sha512 md5_string_vs_files +REGRESS_TARGETS+=md5_pipe md5_pipe_vs_file md5_multiple_files cksum: cksum -x | cmp -s ${.CURDIR}/testsuite.cksum /dev/stdin @@ -12,9 +12,15 @@ md5: sha1: sha1 -x | cmp -s ${.CURDIR}/testsuite.sha1 /dev/stdin +sha224: + cksum -a sha224 -x | cmp -s ${.CURDIR}/testsuite.sha224 /dev/stdin + sha256: sha256 -x | cmp -s ${.CURDIR}/testsuite.sha256 /dev/stdin +sha384: + cksum -a sha384 -x | cmp -s ${.CURDIR}/testsuite.sha384 /dev/stdin + sha512: sha512 -x | cmp -s ${.CURDIR}/testsuite.sha512 /dev/stdin diff --git a/regress/bin/md5/testsuite.sha224 b/regress/bin/md5/testsuite.sha224 new file mode 100644 index 00000000000..acae0a6ba92 --- /dev/null +++ b/regress/bin/md5/testsuite.sha224 @@ -0,0 +1,10 @@ +SHA224 test suite: +SHA224 ("") = d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f +SHA224 ("a") = abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5 +SHA224 ("abc") = 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 +SHA224 ("message digest") = 2cb21c83ae2f004de7e81c3c7019cbcb65b71ab656b22d6d0c39b8eb +SHA224 ("abcdefghijklmnopqrstuvwxyz") = 45a5f72c39c5cff2522eb3429799e49e5f44b356ef926bcf390dccc2 +SHA224 ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") = 75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 +SHA224 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = bff72b4fcb7d75e5632900ac5f90d219e05e97a7bde72e740db393d9 +SHA224 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e +SHA224 (one million 'a' characters) = 20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67 diff --git a/regress/bin/md5/testsuite.sha384 b/regress/bin/md5/testsuite.sha384 new file mode 100644 index 00000000000..894f1fff5d6 --- /dev/null +++ b/regress/bin/md5/testsuite.sha384 @@ -0,0 +1,10 @@ +SHA384 test suite: +SHA384 ("") = 38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b +SHA384 ("a") = 54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31 +SHA384 ("abc") = cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 +SHA384 ("message digest") = 473ed35167ec1f5d8e550368a3db39be54639f828868e9454c239fc8b52e3c61dbd0d8b4de1390c256dcbb5d5fd99cd5 +SHA384 ("abcdefghijklmnopqrstuvwxyz") = feb67349df3db6f5924815d6c3dc133f091809213731fe5c7b5f4999e463479ff2877f5f2936fa63bb43784b12f3ebb4 +SHA384 ("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq") = 3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b +SHA384 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") = 1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84 +SHA384 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = b12932b0627d1c060942f5447764155655bd4da0c9afa6dd9b9ef53129af1b8fb0195996d2de9ca0df9d821ffee67026 +SHA384 (one million 'a' characters) = 9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985 -- 2.20.1