summaryrefslogtreecommitdiff
path: root/src/hash_SHA2.h
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-02-21 00:18:52 -0800
committerDwayne Litzenberger <dlitz@dlitz.net>2013-04-21 20:41:18 -0700
commit076560be889ef220c8fb10dd68635468939345ab (patch)
tree54588441b24ea4a2f3f7200d335d897037d99821 /src/hash_SHA2.h
parent6dbfccadecc55c203dd76f9e504c94ba042ec12f (diff)
downloadpycrypto-076560be889ef220c8fb10dd68635468939345ab.tar.gz
Include inttypes.h or sys/inttypes.h based on what autoconf tells us
This should fix compilation on HP-UX 11.31. Thanks Adam Woodbeck for reporting this.
Diffstat (limited to 'src/hash_SHA2.h')
-rw-r--r--src/hash_SHA2.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/hash_SHA2.h b/src/hash_SHA2.h
index 02991bd..caa1e84 100644
--- a/src/hash_SHA2.h
+++ b/src/hash_SHA2.h
@@ -27,6 +27,16 @@
#define __HASH_SHA2_H
#include "Python.h"
+#include "config.h"
+#if HAVE_STDINT_H
+# include <stdint.h>
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INTTYPES_H
+# include <sys/inttypes.h>
+#else
+# error "stdint.h and inttypes.h not found"
+#endif
/* check if implementation set the correct macros */
#ifndef MODULE_NAME
@@ -69,22 +79,10 @@
#define ROTR(x, n) (((x)>>((n)&(WORD_SIZE_BITS-1)))|((x)<<(WORD_SIZE_BITS-((n)&(WORD_SIZE_BITS-1)))))
#define SHR(x, n) ((x)>>(n))
-/* determine fixed size types */
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
-#include <stdint.h>
-typedef uint8_t U8;
-typedef uint32_t U32;
-typedef uint64_t U64;
-#elif defined(_MSC_VER)
-typedef unsigned char U8;
-typedef unsigned __int64 U64;
-typedef unsigned int U32;
-#elif defined(__sun) || defined(__sun__)
-#include <sys/inttypes.h>
+/* define fixed size types */
typedef uint8_t U8;
typedef uint32_t U32;
typedef uint64_t U64;
-#endif
/* typedef a sha2_word_t type of appropriate size */
#if (WORD_SIZE_BITS == 64)