Subject: Re: pkg/32323
To: None <agc@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,>
From: Tyler Retzlaff <rtr@netbsd.org>
List: pkgsrc-bugs
Date: 01/21/2006 10:20:03
The following reply was made to PR pkg/32323; it has been noted by GNATS.
From: Tyler Retzlaff <rtr@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: pkg/32323
Date: Sat, 21 Jan 2006 21:18:22 +1100
Probably better to move the sha2_xxx typedefs to sha2.h so they can be used
by sha2hl.c and then use them in the SHAXXXData() functions instead.
Index: pkgtools/digest/files/sha2.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/digest/files/sha2.c,v
retrieving revision 1.4
diff -u -p -r1.4 sha2.c
--- pkgtools/digest/files/sha2.c 31 Jul 2005 22:45:24 -0000 1.4
+++ pkgtools/digest/files/sha2.c 21 Jan 2006 10:11:40 -0000
@@ -99,34 +99,6 @@
#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN
#endif
-/*
- * Define the followingsha2_* types to types of the correct length on
- * the native archtecture. Most BSD systems and Linux define u_intXX_t
- * types. Machines with very recent ANSI C headers, can use the
- * uintXX_t definintions from inttypes.h by defining USE_INTTYPES_H
- * during compile or in the sha.h header file.
- *
- * Machines that support neither u_intXX_t nor inttypes.h's uintXX_t
- * will need to define these three typedefs below (and the appropriate
- * ones in sha.h too) by hand according to their system architecture.
- *
- * Thank you, Jun-ichiro itojun Hagino, for suggesting using u_intXX_t
- * types and pointing out recent ANSI C support for uintXX_t in inttypes.h.
- */
-#ifdef USE_INTTYPES_H
-
-typedef uint8_t sha2_byte; /* Exactly 1 byte */
-typedef uint32_t sha2_word32; /* Exactly 4 bytes */
-typedef uint64_t sha2_word64; /* Exactly 8 bytes */
-
-#else /* USE_INTTYPES_H */
-
-typedef u_int8_t sha2_byte; /* Exactly 1 byte */
-typedef u_int32_t sha2_word32; /* Exactly 4 bytes */
-typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
-
-#endif /* USE_INTTYPES_H */
-
/*** SHA-256/384/512 Various Length Definitions ***********************/
/* NOTE: Most of these are in sha2.h */
Index: pkgtools/digest/files/sha2.h
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/digest/files/sha2.h,v
retrieving revision 1.2
diff -u -p -r1.2 sha2.h
--- pkgtools/digest/files/sha2.h 21 Dec 2002 04:06:15 -0000 1.2
+++ pkgtools/digest/files/sha2.h 21 Jan 2006 10:11:40 -0000
@@ -40,6 +40,33 @@
extern "C" {
#endif
+/*
+ * Define the followingsha2_* types to types of the correct length on
+ * the native archtecture. Most BSD systems and Linux define u_intXX_t
+ * types. Machines with very recent ANSI C headers, can use the
+ * uintXX_t definintions from inttypes.h by defining USE_INTTYPES_H
+ * during compile or in the sha.h header file.
+ *
+ * Machines that support neither u_intXX_t nor inttypes.h's uintXX_t
+ * will need to define these three typedefs below (and the appropriate
+ * ones in sha.h too) by hand according to their system architecture.
+ *
+ * Thank you, Jun-ichiro itojun Hagino, for suggesting using u_intXX_t
+ * types and pointing out recent ANSI C support for uintXX_t in inttypes.h.
+ */
+#ifdef USE_INTTYPES_H
+
+typedef uint8_t sha2_byte; /* Exactly 1 byte */
+typedef uint32_t sha2_word32; /* Exactly 4 bytes */
+typedef uint64_t sha2_word64; /* Exactly 8 bytes */
+
+#else /* USE_INTTYPES_H */
+
+typedef u_int8_t sha2_byte; /* Exactly 1 byte */
+typedef u_int32_t sha2_word32; /* Exactly 4 bytes */
+typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
+
+#endif /* USE_INTTYPES_H */
/*** SHA-256/384/512 Various Length Definitions ***********************/
#define SHA256_BLOCK_LENGTH 64
Index: pkgtools/digest/files/sha2hl.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/digest/files/sha2hl.c,v
retrieving revision 1.3
diff -u -p -r1.3 sha2hl.c
--- pkgtools/digest/files/sha2hl.c 21 Dec 2002 04:06:15 -0000 1.3
+++ pkgtools/digest/files/sha2hl.c 21 Jan 2006 10:11:40 -0000
@@ -132,7 +132,7 @@ SHA256_End(SHA256_CTX *ctx, u_char *buff
}
char *
-SHA256_Data(const u_char * data, size_t len, u_char *digest)
+SHA256_Data(const sha2_byte* data, size_t len, u_char *digest)
{
SHA256_CTX ctx;
@@ -192,7 +192,7 @@ SHA384_End(SHA384_CTX * ctx, char buffer
}
char *
-SHA384_Data(const u_char * data, size_t len, char
digest[SHA384_DIGEST_STRING_LENGTH])
+SHA384_Data(const sha2_byte* data, size_t len, char
digest[SHA384_DIGEST_STRING_LENGTH])
{
SHA384_CTX ctx;
@@ -252,7 +252,7 @@ SHA512_End(SHA512_CTX * ctx, char buffer
}
char *
-SHA512_Data(const u_char * data, size_t len, char *digest)
+SHA512_Data(const sha2_byte* data, size_t len, char *digest)
{
SHA512_CTX ctx;
--
Tyler R. Retzlaff <rtr@NetBSD.org> http://www.NetBSD.org