summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2001-11-29 19:40:37 +0000
committerBruce Momjian2001-11-29 19:40:37 +0000
commitc672c2d2a5dba8e84fa555bc241de694e1bcf0c6 (patch)
tree4a91db038275c8ab2bf6c6cf4d50010d9e662595
parent770a14df69602f8e0a84634719bed9c70ff5c834 (diff)
* When postgres.h does not define BYTE_ENDIAN pgcrypto
produces garbage. I learned the hard way that #if UNDEFINED_1 == UNDEFINED_2 #error "gcc is idiot" #endif prints "gcc is idiot" ... Affected are MD5/SHA1 in internal library, and also HMAC-MD5/HMAC-SHA1/ crypt-md5 which use them. Blowfish is ok, also Rijndael on at least x86. Big thanks to Daniel Holtzman who send me a build log which contained warning: md5.c:246: warning: `X' defined but not used Yes, gcc is that helpful... Please apply this. -- marko
-rw-r--r--contrib/pgcrypto/blf.c2
-rw-r--r--contrib/pgcrypto/crypt-blowfish.c2
-rw-r--r--contrib/pgcrypto/crypt-des.c1
-rw-r--r--contrib/pgcrypto/crypt-gensalt.c1
-rw-r--r--contrib/pgcrypto/md5.c1
-rw-r--r--contrib/pgcrypto/px.h9
-rw-r--r--contrib/pgcrypto/rijndael.c1
-rw-r--r--contrib/pgcrypto/sha1.c1
8 files changed, 18 insertions, 0 deletions
diff --git a/contrib/pgcrypto/blf.c b/contrib/pgcrypto/blf.c
index efba19055f..0caa33d4e3 100644
--- a/contrib/pgcrypto/blf.c
+++ b/contrib/pgcrypto/blf.c
@@ -41,6 +41,8 @@
*/
#include <postgres.h>
+#include "px.h"
+
#include "blf.h"
#undef inline
diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c
index 8ec2b188e0..8e41771be9 100644
--- a/contrib/pgcrypto/crypt-blowfish.c
+++ b/contrib/pgcrypto/crypt-blowfish.c
@@ -32,7 +32,9 @@
#include "postgres.h"
+#include "px.h"
#include "px-crypt.h"
+
#define __set_errno(v)
#ifndef __set_errno
diff --git a/contrib/pgcrypto/crypt-des.c b/contrib/pgcrypto/crypt-des.c
index 53df2a19fb..bcb6b5b5c7 100644
--- a/contrib/pgcrypto/crypt-des.c
+++ b/contrib/pgcrypto/crypt-des.c
@@ -60,6 +60,7 @@
#include "postgres.h"
+#include "px.h"
#include "px-crypt.h"
/* for ntohl/htonl */
diff --git a/contrib/pgcrypto/crypt-gensalt.c b/contrib/pgcrypto/crypt-gensalt.c
index 9c017b0e4d..c58e794789 100644
--- a/contrib/pgcrypto/crypt-gensalt.c
+++ b/contrib/pgcrypto/crypt-gensalt.c
@@ -12,6 +12,7 @@
#include "postgres.h"
+#include "px.h"
#include "px-crypt.h"
#include <errno.h>
diff --git a/contrib/pgcrypto/md5.c b/contrib/pgcrypto/md5.c
index 6a37f2f8ec..e66e21a6ed 100644
--- a/contrib/pgcrypto/md5.c
+++ b/contrib/pgcrypto/md5.c
@@ -31,6 +31,7 @@
*/
#include "postgres.h"
+#include "px.h"
#include "md5.h"
diff --git a/contrib/pgcrypto/px.h b/contrib/pgcrypto/px.h
index d8252a5a91..4e22245d3e 100644
--- a/contrib/pgcrypto/px.h
+++ b/contrib/pgcrypto/px.h
@@ -32,6 +32,15 @@
#ifndef __PX_H
#define __PX_H
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#endif
+
+#ifndef BYTE_ORDER
+#error BYTE_ORDER must be defined as LITTLE_ENDIAN or BIG_ENDIAN
+#endif
+
+
#if 1
#define px_alloc(s) palloc(s)
diff --git a/contrib/pgcrypto/rijndael.c b/contrib/pgcrypto/rijndael.c
index c534f58cd8..094f4a8fa5 100644
--- a/contrib/pgcrypto/rijndael.c
+++ b/contrib/pgcrypto/rijndael.c
@@ -39,6 +39,7 @@ Mean: 500 cycles = 51.2 mbits/sec
*/
#include <postgres.h>
+#include "px.h"
#include "rijndael.h"
diff --git a/contrib/pgcrypto/sha1.c b/contrib/pgcrypto/sha1.c
index 1c1a1d5f90..5be954d769 100644
--- a/contrib/pgcrypto/sha1.c
+++ b/contrib/pgcrypto/sha1.c
@@ -36,6 +36,7 @@
*/
#include "postgres.h"
+#include "px.h"
#include "sha1.h"