changeset 29986:ff6a63286245

sha256.h: correct definition on SHA224_DIGEST_SIZE * lib/sha256.h (SHA224_DIGEST_SIZE): Define to 28, not 24. Reported by Paulie Pena IV <paulie4@gmail.com>. Define as 224 / 8, rather than as a literal. (SHA256_DIGEST_SIZE): Define as 256/8 rather than equivalent literal. * lib/sha512.h (SHA384_DIGEST_SIZE): Likewise, define as equiv: 384/8. (SHA512_DIGEST_SIZE): Likewise, define as equivalent quotient: 512/8.
author Jim Meyering <meyering@redhat.com>
date Thu, 31 Jul 2008 15:35:25 +0200
parents 56798a7611c0
children 7bf583f1e789
files ChangeLog lib/sha256.h lib/sha512.h
diffstat 3 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Jul 31 12:04:14 2008 +0200
+++ b/ChangeLog	Thu Jul 31 15:35:25 2008 +0200
@@ -1,3 +1,13 @@
+2008-07-31  Jim Meyering  <meyering@redhat.com>
+
+	sha256.h: correct definition of SHA224_DIGEST_SIZE
+	* lib/sha256.h (SHA224_DIGEST_SIZE): Define to 28, not 24.
+	Reported by Paulie Pena IV <paulie4@gmail.com>.
+	Define as 224 / 8, rather than as a literal.
+	(SHA256_DIGEST_SIZE): Define as 256/8 rather than equivalent literal.
+	* lib/sha512.h (SHA384_DIGEST_SIZE): Likewise, define as equiv: 384/8.
+	(SHA512_DIGEST_SIZE): Likewise, define as equivalent quotient: 512/8.
+
 2008-07-31  Bruno Haible  <bruno@clisp.org>
 
 	* lib/regex_internal.h (BITSET_WORD_BITS): Make first conditional work
--- a/lib/sha256.h	Thu Jul 31 12:04:14 2008 +0200
+++ b/lib/sha256.h	Thu Jul 31 15:35:25 2008 +0200
@@ -31,8 +31,8 @@
   uint32_t buffer[32];
 };
 
-enum { SHA224_DIGEST_SIZE = 24 };
-enum { SHA256_DIGEST_SIZE = 32 };
+enum { SHA224_DIGEST_SIZE = 224 / 8 };
+enum { SHA256_DIGEST_SIZE = 256 / 8 };
 
 /* Initialize structure containing state of computation. */
 extern void sha256_init_ctx (struct sha256_ctx *ctx);
--- a/lib/sha512.h	Thu Jul 31 12:04:14 2008 +0200
+++ b/lib/sha512.h	Thu Jul 31 15:35:25 2008 +0200
@@ -32,8 +32,8 @@
   u64 buffer[32];
 };
 
-enum { SHA384_DIGEST_SIZE = 48 };
-enum { SHA512_DIGEST_SIZE = 64 };
+enum { SHA384_DIGEST_SIZE = 384 / 8 };
+enum { SHA512_DIGEST_SIZE = 512 / 8 };
 
 /* Initialize structure containing state of computation. */
 extern void sha512_init_ctx (struct sha512_ctx *ctx);