summaryrefslogtreecommitdiffstats
path: root/Source/cm_sha2.c
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cm_sha2.c')
-rw-r--r--Source/cm_sha2.c41
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