diff options
author | Brad King <brad.king@kitware.com> | 2011-11-16 01:18:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2011-11-16 15:15:44 (GMT) |
commit | c1856a33d46384307884ab6ba6db886a7bca0fd2 (patch) | |
tree | 4b7ed699dbb2741d9757c776ba0bc735b6bd29d6 /Source/cm_sha2.c | |
parent | fcc3ce5b0dc5bb8ef3447da189d04715f429d822 (diff) | |
download | CMake-c1856a33d46384307884ab6ba6db886a7bca0fd2.zip CMake-c1856a33d46384307884ab6ba6db886a7bca0fd2.tar.gz CMake-c1856a33d46384307884ab6ba6db886a7bca0fd2.tar.bz2 |
sha2: Use KWIML fixed-size integer types and endian-ness
These are more portable than those named in the original sha2 code.
Diffstat (limited to 'Source/cm_sha2.c')
-rw-r--r-- | Source/cm_sha2.c | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c index 855a5bb..0bf62f2 100644 --- a/Source/cm_sha2.c +++ b/Source/cm_sha2.c @@ -87,37 +87,20 @@ * made). */ #if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) -#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN +/* CMake modification: use byte order from cmIML. */ +# include "cmIML/ABI.h" +# undef BYTE_ORDER +# undef BIG_ENDIAN +# undef LITTLE_ENDIAN +# define BYTE_ORDER cmIML_ABI_ENDIAN_ID +# define BIG_ENDIAN cmIML_ABI_ENDIAN_ID_BIG +# define LITTLE_ENDIAN cmIML_ABI_ENDIAN_ID_LITTLE #endif -/* - * Define the following sha_* 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 SHA2_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 SHA2_USE_INTTYPES_H - -typedef uint8_t sha_byte; /* Exactly 1 byte */ -typedef uint32_t sha_word32; /* Exactly 4 bytes */ -typedef uint64_t sha_word64; /* Exactly 8 bytes */ - -#else /* SHA2_USE_INTTYPES_H */ - -typedef u_int8_t sha_byte; /* Exactly 1 byte */ -typedef u_int32_t sha_word32; /* Exactly 4 bytes */ -typedef u_int64_t sha_word64; /* Exactly 8 bytes */ - -#endif /* SHA2_USE_INTTYPES_H */ - +/* CMake modification: use types computed in header. */ +typedef cm_sha2_uint8_t sha_byte; /* Exactly 1 byte */ +typedef cm_sha2_uint32_t sha_word32; /* Exactly 4 bytes */ +typedef cm_sha2_uint64_t sha_word64; /* Exactly 8 bytes */ /*** ENDIAN REVERSAL MACROS *******************************************/ #if BYTE_ORDER == LITTLE_ENDIAN |