summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2008-09-25 09:51:51 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2008-09-25 09:51:51 +0700
commit38b914d68e911cd10004bf7fc690e82f9e8f3f96 (patch)
treef8cd063f9458f4e38459b42dc9be290118b47b04
parent0cd14a8591c2ddb7fca5e576f6322a89097f5fc7 (diff)
downloadlibsha1-38b914d68e911cd10004bf7fc690e82f9e8f3f96.tar.gz
uint_32t type is replaced with uint32_t. uint_8/16/64t checks are removed as unused
-rw-r--r--brg_types.h16
-rw-r--r--config.h.in22
-rw-r--r--configure.ac3
-rw-r--r--sha1.c14
-rw-r--r--sha1.h6
5 files changed, 10 insertions, 51 deletions
diff --git a/brg_types.h b/brg_types.h
index 4738359..1f64ed1 100644
--- a/brg_types.h
+++ b/brg_types.h
@@ -26,17 +26,6 @@
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
- ---------------------------------------------------------------------------
- Issue 09/09/2006
-
- The unsigned integer types defined here are of the form uint_<nn>t where
- <nn> is the length of the type; for example, the unsigned 32-bit type is
- 'uint_32t'. These are NOT the same as the 'C99 integer types' that are
- defined in the inttypes.h and stdint.h headers since attempts to use these
- types have shown that support for them is still highly variable. However,
- since the latter are of the form uint<nn>_t, a regular expression search
- and replace (in VC++ search on 'uint_{:z}t' and replace with 'uint\1_t')
- can be used to convert the types used here to the C99 standard types.
*/
#ifndef BRG_TYPES_H
@@ -57,11 +46,6 @@ extern "C" {
# include <stdint.h>
#endif
-typedef uint8_t uint_8t;
-typedef uint16_t uint_16t;
-typedef uint32_t uint_32t;
-typedef uint64_t uint_64t;
-
#ifndef RETURN_VALUES
# define RETURN_VALUES
# if defined( DLL_EXPORT )
diff --git a/config.h.in b/config.h.in
index c1a0c5c..dfbef83 100644
--- a/config.h.in
+++ b/config.h.in
@@ -63,31 +63,9 @@
#define below would cause a syntax error. */
#undef _UINT32_T
-/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
- <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
- #define below would cause a syntax error. */
-#undef _UINT64_T
-
-/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
- <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
- #define below would cause a syntax error. */
-#undef _UINT8_T
-
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
-/* Define to the type of an unsigned integer type of width exactly 16 bits if
- such a type exists and the standard includes do not define it. */
-#undef uint16_t
-
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t
-
-/* Define to the type of an unsigned integer type of width exactly 64 bits if
- such a type exists and the standard includes do not define it. */
-#undef uint64_t
-
-/* Define to the type of an unsigned integer type of width exactly 8 bits if
- such a type exists and the standard includes do not define it. */
-#undef uint8_t
diff --git a/configure.ac b/configure.ac
index 3bde507..b9de82c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,10 +13,7 @@ AC_CHECK_HEADERS([stdint.h string.h])
AC_C_BIGENDIAN
AC_C_CONST
-AC_TYPE_UINT8_T
-AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
-AC_TYPE_UINT64_T
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/sha1.c b/sha1.c
index 0fbf05e..8aac426 100644
--- a/sha1.c
+++ b/sha1.c
@@ -67,7 +67,7 @@ extern "C"
#if defined(SWAP_BYTES)
#define bsw_32(p,n) \
- { int _i = (n); while(_i--) ((uint_32t*)p)[_i] = bswap_32(((uint_32t*)p)[_i]); }
+ { int _i = (n); while(_i--) ((uint32_t*)p)[_i] = bswap_32(((uint32_t*)p)[_i]); }
#else
#define bsw_32(p,n)
#endif
@@ -114,13 +114,13 @@ extern "C"
one_cycle(v, 1,2,3,4,0, f,k,hf(i+4))
VOID_RETURN sha1_compile(sha1_ctx ctx[1])
-{ uint_32t *w = ctx->wbuf;
+{ uint32_t *w = ctx->wbuf;
#ifdef ARRAY
- uint_32t v[5];
- memcpy(v, ctx->hash, 5 * sizeof(uint_32t));
+ uint32_t v[5];
+ memcpy(v, ctx->hash, 5 * sizeof(uint32_t));
#else
- uint_32t v0, v1, v2, v3, v4;
+ uint32_t v0, v1, v2, v3, v4;
v0 = ctx->hash[0]; v1 = ctx->hash[1];
v2 = ctx->hash[2]; v3 = ctx->hash[3];
v4 = ctx->hash[4];
@@ -183,7 +183,7 @@ VOID_RETURN sha1_begin(sha1_ctx ctx[1])
/* call the hash_compile function as required. */
VOID_RETURN sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ctx[1])
-{ uint_32t pos = (uint_32t)(ctx->count[0] & SHA1_MASK),
+{ uint32_t pos = (uint32_t)(ctx->count[0] & SHA1_MASK),
space = SHA1_BLOCK_SIZE - pos;
const unsigned char *sp = data;
@@ -204,7 +204,7 @@ VOID_RETURN sha1_hash(const unsigned char data[], unsigned long len, sha1_ctx ct
/* SHA1 final padding and digest calculation */
VOID_RETURN sha1_end(unsigned char hval[], sha1_ctx ctx[1])
-{ uint_32t i = (uint_32t)(ctx->count[0] & SHA1_MASK);
+{ uint32_t i = (uint32_t)(ctx->count[0] & SHA1_MASK);
/* put bytes in the buffer in an order in which references to */
/* 32-bit words will put bytes with lower addresses into the */
diff --git a/sha1.h b/sha1.h
index 951984c..bad2657 100644
--- a/sha1.h
+++ b/sha1.h
@@ -46,9 +46,9 @@ extern "C"
/* type to hold the SHA256 context */
typedef struct
-{ uint_32t count[2];
- uint_32t hash[5];
- uint_32t wbuf[16];
+{ uint32_t count[2];
+ uint32_t hash[5];
+ uint32_t wbuf[16];
} sha1_ctx;
/* Note that these prototypes are the same for both bit and */