Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8aa538c

Browse files
committed
* 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
1 parent 0556f7c commit 8aa538c

File tree

8 files changed

+21
-3
lines changed

8 files changed

+21
-3
lines changed

contrib/pgcrypto/blf.c

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
*/
4242

4343
#include <postgres.h>
44+
#include "px.h"
45+
4446
#include "blf.h"
4547

4648
#undef inline

contrib/pgcrypto/crypt-blowfish.c

+2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232

3333
#include "postgres.h"
3434

35+
#include "px.h"
3536
#include "px-crypt.h"
37+
3638
#define __set_errno(v)
3739

3840
#ifndef __set_errno

contrib/pgcrypto/crypt-des.c

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
#include "postgres.h"
6262

63+
#include "px.h"
6364
#include "px-crypt.h"
6465

6566
/* for ntohl/htonl */

contrib/pgcrypto/crypt-gensalt.c

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "postgres.h"
1414

15+
#include "px.h"
1516
#include "px-crypt.h"
1617

1718
#include <errno.h>

contrib/pgcrypto/md5.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: md5.c,v 1.8 2001/10/25 05:49:19 momjian Exp $ */
1+
/* $Id: md5.c,v 1.9 2001/11/29 19:40:37 momjian Exp $ */
22
/* $KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun Exp $ */
33

44
/*
@@ -31,6 +31,7 @@
3131
*/
3232

3333
#include "postgres.h"
34+
#include "px.h"
3435

3536
#include "md5.h"
3637

contrib/pgcrypto/px.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,21 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $Id: px.h,v 1.5 2001/11/20 15:50:53 momjian Exp $
29+
* $Id: px.h,v 1.6 2001/11/29 19:40:37 momjian Exp $
3030
*/
3131

3232
#ifndef __PX_H
3333
#define __PX_H
3434

35+
#ifdef HAVE_ENDIAN_H
36+
#include <endian.h>
37+
#endif
38+
39+
#ifndef BYTE_ORDER
40+
#error BYTE_ORDER must be defined as LITTLE_ENDIAN or BIG_ENDIAN
41+
#endif
42+
43+
3544
#if 1
3645

3746
#define px_alloc(s) palloc(s)

contrib/pgcrypto/rijndael.c

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Mean: 500 cycles = 51.2 mbits/sec
3939
*/
4040

4141
#include <postgres.h>
42+
#include "px.h"
4243

4344
#include "rijndael.h"
4445

contrib/pgcrypto/sha1.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Id: sha1.c,v 1.10 2001/11/05 17:46:23 momjian Exp $ */
1+
/* $Id: sha1.c,v 1.11 2001/11/29 19:40:37 momjian Exp $ */
22
/* $KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun Exp $ */
33

44
/*
@@ -36,6 +36,7 @@
3636
*/
3737

3838
#include "postgres.h"
39+
#include "px.h"
3940

4041
#include "sha1.h"
4142

0 commit comments

Comments
 (0)