aboutsummaryrefslogtreecommitdiff
path: root/lib/libmd/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libmd/Makefile')
-rw-r--r--lib/libmd/Makefile37
1 files changed, 33 insertions, 4 deletions
diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile
index bde4fb5c0a9e..111a9f433b45 100644
--- a/lib/libmd/Makefile
+++ b/lib/libmd/Makefile
@@ -9,8 +9,8 @@ SRCS= md4c.c md5c.c md4hl.c md5hl.c \
sha0c.c sha0hl.c sha1c.c sha1hl.c \
sha256c.c sha256hl.c \
sha384hl.c \
- sha512c.c sha512hl.c
-INCS= md4.h md5.h ripemd.h sha.h sha256.h sha384.h sha512.h
+ sha512c.c sha512hl.c sha512thl.c
+INCS= md4.h md5.h ripemd.h sha.h sha256.h sha384.h sha512.h sha512t.h
WARNS?= 0
@@ -43,11 +43,15 @@ MLINKS+=sha512.3 SHA512_Init.3 sha512.3 SHA512_Update.3
MLINKS+=sha512.3 SHA512_Final.3 sha512.3 SHA512_End.3
MLINKS+=sha512.3 SHA512_File.3 sha512.3 SHA512_FileChunk.3
MLINKS+=sha512.3 SHA512_Data.3
+MLINKS+=sha512.3 SHA512_256_Init.3 sha512.3 SHA512_256_Update.3
+MLINKS+=sha512.3 SHA512_256_Final.3 sha512.3 SHA512_256_End.3
+MLINKS+=sha512.3 SHA512_256_File.3 sha512.3 SHA512_256_FileChunk.3
+MLINKS+=sha512.3 SHA512_256_Data.3
CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \
rmd160.ref rmd160hl.c rmddriver \
sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \
sha256.ref sha256hl.c sha384hl.c sha384.ref \
- sha512.ref sha512hl.c
+ sha512.ref sha512hl.c sha512t256.ref sha512thl.c
# Define WEAK_REFS to provide weak aliases for libmd symbols
#
@@ -107,6 +111,13 @@ sha512hl.c: mdXhl.c
-e 's/SHA512__/SHA512_/g' \
${.ALLSRC}) > ${.TARGET}
+sha512thl.c: mdXhl.c
+ (echo '#define LENGTH 32'; \
+ sed -e 's/mdX/sha512t/g' -e 's/MDX/SHA512_256_/g' \
+ -e 's/SHA512_256__/SHA512_256_/g' \
+ -e 's/SHA512_256_CTX/SHA512_CTX/g' \
+ ${.ALLSRC}) > ${.TARGET}
+
rmd160hl.c: mdXhl.c
(echo '#define LENGTH 20'; \
sed -e 's/mdX/ripemd/g' -e 's/MDX/RIPEMD160_/g' \
@@ -211,6 +222,21 @@ sha512.ref:
@echo 'SHA-512 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \
'72ec1ef1124a45b047e8b7c75a932195135bb61de24ec0d1914042246e0aec3a2354e093d76f3048b456764346900cb130d2a4fd5dd16abb5e30bcb850dee843' >> ${.TARGET}
+sha512t256.ref:
+ echo 'SHA-512256 test suite:' > ${.TARGET}
+ @echo 'SHA-512256 ("") =' \
+ 'c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a' >> ${.TARGET}
+ @echo 'SHA-512256 ("abc") =' \
+ '53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23' >> ${.TARGET}
+ @echo 'SHA-512256 ("message digest") =' \
+ '0cf471fd17ed69d990daf3433c89b16d63dec1bb9cb42a6094604ee5d7b4e9fb' >> ${.TARGET}
+ @echo 'SHA-512256 ("abcdefghijklmnopqrstuvwxyz") =' \
+ 'fc3189443f9c268f626aea08a756abe7b726b05f701cb08222312ccfd6710a26' >> ${.TARGET}
+ @echo 'SHA-512256 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =' \
+ 'cdf1cc0effe26ecc0c13758f7b4a48e000615df241284185c39eb05d355bb9c8' >> ${.TARGET}
+ @echo 'SHA-512256 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") =' \
+ '2c9fdbc0c90bdd87612ee8455474f9044850241dc105b1e8b94b8ddf5fac9148' >> ${.TARGET}
+
rmd160.ref:
echo 'RIPEMD160 test suite:' > ${.TARGET}
@echo 'RIPEMD160 ("") = 9c1185a5c5e9fc54612808977ee8f548b2258d31' >> ${.TARGET}
@@ -225,7 +251,7 @@ rmd160.ref:
'9b752e45573d4b39f4dbd3323cab82bf63326bfb' >> ${.TARGET}
test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha384.ref \
- sha512.ref
+ sha512.ref sha512t256.ref
@${ECHO} if any of these test fail, the code produces wrong results
@${ECHO} and should NOT be used.
${CC} ${CFLAGS} ${LDFLAGS} -DMD=4 -o mddriver ${.CURDIR}/mddriver.c libmd.a
@@ -254,6 +280,9 @@ test: md4.ref md5.ref sha0.ref rmd160.ref sha1.ref sha256.ref sha384.ref \
${CC} ${CFLAGS} ${LDFLAGS} -DSHA=512 -o shadriver ${.CURDIR}/shadriver.c libmd.a
./shadriver | cmp sha512.ref -
@${ECHO} SHA-512 passed test
+ ${CC} ${CFLAGS} ${LDFLAGS} -DSHA=512256 -o shadriver ${.CURDIR}/shadriver.c libmd.a
+ ./shadriver | cmp sha512t256.ref -
+ @${ECHO} SHA-512t256 passed test
-rm -f shadriver
.include <bsd.lib.mk>