summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormiod <>2014-05-02 19:27:06 +0000
committermiod <>2014-05-02 19:27:06 +0000
commita928011ef8b6701a9f677f7a5f330726c9b7cc2f (patch)
treed2c462f66d0354ccb8a1024784291dc3dddcd76d
parent83c4562bf875f4ef85fddac8ce8fefc05dfa718d (diff)
downloadopenbsd-a928011ef8b6701a9f677f7a5f330726c9b7cc2f.tar.gz
openbsd-a928011ef8b6701a9f677f7a5f330726c9b7cc2f.tar.bz2
openbsd-a928011ef8b6701a9f677f7a5f330726c9b7cc2f.zip
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
-rw-r--r--src/regress/lib/libcrypto/Makefile5
-rw-r--r--src/regress/lib/libcrypto/sha2/Makefile42
2 files changed, 45 insertions, 2 deletions
diff --git a/src/regress/lib/libcrypto/Makefile b/src/regress/lib/libcrypto/Makefile
index 436fb12598..327eb5b12d 100644
--- a/src/regress/lib/libcrypto/Makefile
+++ b/src/regress/lib/libcrypto/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.5 2014/05/01 13:15:22 jsing Exp $ 1# $OpenBSD: Makefile,v 1.6 2014/05/02 19:27:04 miod Exp $
2 2
3SUBDIR= \ 3SUBDIR= \
4 aeswrap \ 4 aeswrap \
@@ -27,7 +27,8 @@ SUBDIR= \
27 rc4 \ 27 rc4 \
28 rmd \ 28 rmd \
29 sha \ 29 sha \
30 sha1 30 sha1 \
31 sha2
31 32
32install: 33install:
33 34
diff --git a/src/regress/lib/libcrypto/sha2/Makefile b/src/regress/lib/libcrypto/sha2/Makefile
new file mode 100644
index 0000000000..2edf10b0f4
--- /dev/null
+++ b/src/regress/lib/libcrypto/sha2/Makefile
@@ -0,0 +1,42 @@
1# $OpenBSD: Makefile,v 1.1 2014/05/02 19:27:06 miod Exp $
2
3REGRESS_TARGETS=regress-sha2
4OPENSSL=/usr/sbin/openssl
5
6HASHES= \
7 sha224 \
8 abc \
9 23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7 \
10 sha224 \
11 abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq \
12 75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525 \
13 sha256 \
14 abc \
15 ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad \
16 sha256 \
17 abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq \
18 248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1 \
19 sha384 \
20 abc \
21 cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7 \
22 sha384 \
23 abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu \
24 09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039 \
25 sha512 \
26 abc \
27 ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f \
28 sha512 \
29 abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu \
30 8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909
31
32regress-sha2:
33.for hash input output in ${HASHES}
34 @(echo -n ${input} | ${OPENSSL} sha -${hash} | (read a b; \
35 test $$b == ${output} || \
36 (echo wrong ${hash} hash of \"${input}\"; \
37 echo expected: ${output}; \
38 echo computed: $$b; \
39 false)))
40.endfor
41
42.include <bsd.regress.mk>