diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-05-02 19:27:07 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-05-02 19:27:07 +0000 |
commit | fba18e8930f0013e2d480c233d6947b90925354c (patch) | |
tree | 41602c1d2251abd4e1cf95018a5c41256c97e640 /regress/lib | |
parent | 7ee1a89be2ed29a31f70839bc071b4d28dbda48a (diff) |
Simple sha{224,256,384,512} test using the FIPS 180-2 test vectors available
from http://csrc.nist.gov/groups/ST/toolkit/examples.html
Diffstat (limited to 'regress/lib')
-rw-r--r-- | regress/lib/libcrypto/Makefile | 5 | ||||
-rw-r--r-- | regress/lib/libcrypto/sha2/Makefile | 42 |
2 files changed, 45 insertions, 2 deletions
diff --git a/regress/lib/libcrypto/Makefile b/regress/lib/libcrypto/Makefile index 436fb125981..327eb5b12d9 100644 --- a/regress/lib/libcrypto/Makefile +++ b/regress/lib/libcrypto/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.5 2014/05/01 13:15:22 jsing Exp $ +# $OpenBSD: Makefile,v 1.6 2014/05/02 19:27:04 miod Exp $ SUBDIR= \ aeswrap \ @@ -27,7 +27,8 @@ SUBDIR= \ rc4 \ rmd \ sha \ - sha1 + sha1 \ + sha2 install: diff --git a/regress/lib/libcrypto/sha2/Makefile b/regress/lib/libcrypto/sha2/Makefile new file mode 100644 index 00000000000..2edf10b0f49 --- /dev/null +++ b/regress/lib/libcrypto/sha2/Makefile @@ -0,0 +1,42 @@ +# $OpenBSD: Makefile,v 1.1 2014/05/02 19:27:06 miod Exp $ + +REGRESS_TARGETS=regress-sha2 +OPENSSL=/usr/sbin/openssl + +HASHES= \ + sha224 \ + abc \ + 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 \ + sha224 \ + abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq \ + 75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 \ + sha256 \ + abc \ + ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad \ + sha256 \ + abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq \ + 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 \ + sha384 \ + abc \ + cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 \ + sha384 \ + abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu \ + 09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039 \ + sha512 \ + abc \ + ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f \ + sha512 \ + abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu \ + 8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909 + +regress-sha2: +.for hash input output in ${HASHES} + @(echo -n ${input} | ${OPENSSL} sha -${hash} | (read a b; \ + test $$b == ${output} || \ + (echo wrong ${hash} hash of \"${input}\"; \ + echo expected: ${output}; \ + echo computed: $$b; \ + false))) +.endfor + +.include <bsd.regress.mk> |