From 5aa9ab0cfdf3ea2e2f03c8ab5a1746eac444d158 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pavel=20Tvrd=C3=ADk?= Date: Wed, 13 May 2015 09:27:44 +0200 Subject: [PATCH] SHA & MD5 libs: changing headers --- lib/md5.c | 23 +++++++---------------- lib/md5.h | 13 ++++++++++--- lib/md5_test.c | 2 +- lib/sha1.c | 6 +++++- lib/sha1.h | 2 +- lib/sha1_test.c | 2 +- lib/sha256.c | 3 ++- lib/sha256.h | 3 ++- lib/sha256_test.c | 2 +- lib/sha512.c | 3 ++- lib/sha512.h | 3 ++- lib/sha512_test.c | 2 +- 12 files changed, 35 insertions(+), 29 deletions(-) diff --git a/lib/md5.c b/lib/md5.c index ad284f07f..0a354b872 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -1,22 +1,13 @@ /* - * This code implements the MD5 message-digest algorithm. - * The algorithm is due to Ron Rivest. This code was - * written by Colin Plumb in 1993, no copyright is claimed. - * This code is in the public domain; do with it what you wish. + * BIRD -- MD5 Hash Function and HMAC-MD5 Function * - * Equivalent code is available from RSA Data Security, Inc. - * This code has been tested against that, and is equivalent, - * except that you don't need to include two pages of legalese - * with every copy. + * (c) 2015 CZ.NIC z.s.p.o. * - * To compute the message digest of a chunk of bytes, declare an - * MD5Context structure, pass it to MD5Init, call MD5Update as - * needed on buffers full of bytes, and then call MD5Final, which - * will fill a supplied 16-byte array with the digest. - */ - -/* - * Adapted for BIRD by Martin Mares + * Adapted for BIRD by Martin Mares + * + * The code was written by Colin Plumb in 1993, no copyright is claimed. + * + * Can be freely distributed and used under the terms of the GNU GPL. */ #include "nest/bird.h" diff --git a/lib/md5.h b/lib/md5.h index 125863571..fbcd2bf4b 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -1,5 +1,12 @@ -#ifndef MD5_H -#define MD5_H +/* + * BIRD -- MD5 Hash Function and HMAC-MD5 Function + * + * (c) 2015 CZ.NIC z.s.p.o. + * + * Adapted for BIRD by Martin Mares + * + * Can be freely distributed and used under the terms of the GNU GPL. + */ struct MD5Context { u32 buf[4]; @@ -13,4 +20,4 @@ void MD5Update(struct MD5Context *context, unsigned char const *buf, void MD5Final(unsigned char digest[16], struct MD5Context *context); void MD5Transform(u32 buf[4], u32 const in[16]); -#endif /* !MD5_H */ +#endif /* _BIRD_MD5_H_ */ diff --git a/lib/md5_test.c b/lib/md5_test.c index 10da0c4d2..f95a62f93 100644 --- a/lib/md5_test.c +++ b/lib/md5_test.c @@ -1,5 +1,5 @@ /* - * BIRD Library -- MD5 message-digest algorithm Tests + * BIRD -- MD5 and HMAC-MD5 Tests * * (c) 2015 CZ.NIC z.s.p.o. * diff --git a/lib/sha1.c b/lib/sha1.c index fff37ff6f..2f10479d3 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -1,5 +1,5 @@ /* - * BIRD -- SHA-1 Hash Function (FIPS 180-1, RFC 3174) + * BIRD -- SHA-1 Hash Function (FIPS 180-1, RFC 3174) and HMAC-SHA-1 * * (c) 2015 CZ.NIC z.s.p.o. * @@ -267,6 +267,10 @@ sha1_final(sha1_context *hd) return hd->buf; } +/** + * SHA1-HMAC + */ + /* * Shortcut function which puts the hash value of the supplied buffer * into outbuf which must have a size of 20 bytes. diff --git a/lib/sha1.h b/lib/sha1.h index 78023b720..9600e61f4 100644 --- a/lib/sha1.h +++ b/lib/sha1.h @@ -1,5 +1,5 @@ /* - * BIRD -- SHA-1 Hash Function (FIPS 180-1, RFC 3174) + * BIRD -- SHA-1 Hash Function (FIPS 180-1, RFC 3174) and HMAC-SHA-1 * * (c) 2015 CZ.NIC z.s.p.o. * diff --git a/lib/sha1_test.c b/lib/sha1_test.c index d33c419f2..04b2daa34 100644 --- a/lib/sha1_test.c +++ b/lib/sha1_test.c @@ -1,5 +1,5 @@ /* - * BIRD Library -- SHA-1 Hash Function Tests + * BIRD -- SHA-1 and HMAC-SHA-1 Tests * * (c) 2015 CZ.NIC z.s.p.o. * diff --git a/lib/sha256.c b/lib/sha256.c index 84fcc737e..4025c6a0c 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -1,5 +1,6 @@ /* - * BIRD -- SHA256 and SHA224 Hash Functions + * BIRD -- SHA-256 and SHA-224 Hash Functions, + * HMAC-SHA-256 and HMAC-SHA-224 Functions * * (c) 2015 CZ.NIC z.s.p.o. * diff --git a/lib/sha256.h b/lib/sha256.h index 682cab13f..44e4a6d01 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -1,5 +1,6 @@ /* - * BIRD -- SHA256 and SHA224 Hash Functions + * BIRD -- SHA-256 and SHA-224 Hash Functions, + * HMAC-SHA-256 and HMAC-SHA-224 Functions * * (c) 2015 CZ.NIC z.s.p.o. * diff --git a/lib/sha256_test.c b/lib/sha256_test.c index 9ef2f8c3c..80047e469 100644 --- a/lib/sha256_test.c +++ b/lib/sha256_test.c @@ -1,5 +1,5 @@ /* - * BIRD Library -- SHA256 and SHA224 Hash Functions Tests + * BIRD -- SHA-256, SHA-224, HMAC-SHA-256 and HMAC-SHA224 Tests * * (c) 2015 CZ.NIC z.s.p.o. * diff --git a/lib/sha512.c b/lib/sha512.c index 69bcd0996..e917eb989 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -1,5 +1,6 @@ /* - * BIRD -- SHA512 and SHA384 Hash Functions + * BIRD -- SHA-512 and SHA-384 Hash Functions, + * HMAC-SHA-512 and HMAC-SHA-384 Functions * * (c) 2015 CZ.NIC z.s.p.o. * diff --git a/lib/sha512.h b/lib/sha512.h index 369d97b04..e37bbcb6a 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -1,5 +1,6 @@ /* - * BIRD -- SHA512 and SHA384 Hash Functions + * BIRD -- SHA-512 and SHA-384 Hash Functions, + * HMAC-SHA-512 and HMAC-SHA-384 Functions * * (c) 2015 CZ.NIC z.s.p.o. * diff --git a/lib/sha512_test.c b/lib/sha512_test.c index d0a5d9c53..b6a0fe5c3 100644 --- a/lib/sha512_test.c +++ b/lib/sha512_test.c @@ -1,5 +1,5 @@ /* - * BIRD Library -- SHA512 and SHA384 Hash Functions Tests + * BIRD -- SHA-512, SHA-384, HMAC-SHA-512 and HMAC-SHA-384 Tests * * (c) 2015 CZ.NIC z.s.p.o. * -- 2.47.2