* 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
This commit is contained in:
Bruce Momjian 2001-11-29 19:40:37 +00:00
parent 0556f7ca87
commit 8aa538cfd5
8 changed files with 21 additions and 3 deletions

View File

@ -41,6 +41,8 @@
*/
#include <postgres.h>
#include "px.h"
#include "blf.h"
#undef inline

View File

@ -32,7 +32,9 @@
#include "postgres.h"
#include "px.h"
#include "px-crypt.h"
#define __set_errno(v)
#ifndef __set_errno

View File

@ -60,6 +60,7 @@
#include "postgres.h"
#include "px.h"
#include "px-crypt.h"
/* for ntohl/htonl */

View File

@ -12,6 +12,7 @@
#include "postgres.h"
#include "px.h"
#include "px-crypt.h"
#include <errno.h>

View File

@ -1,4 +1,4 @@
/* $Id: md5.c,v 1.8 2001/10/25 05:49:19 momjian Exp $ */
/* $Id: md5.c,v 1.9 2001/11/29 19:40:37 momjian Exp $ */
/* $KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun Exp $ */
/*
@ -31,6 +31,7 @@
*/
#include "postgres.h"
#include "px.h"
#include "md5.h"

View File

@ -26,12 +26,21 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: px.h,v 1.5 2001/11/20 15:50:53 momjian Exp $
* $Id: px.h,v 1.6 2001/11/29 19:40:37 momjian Exp $
*/
#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)

View File

@ -39,6 +39,7 @@ Mean: 500 cycles = 51.2 mbits/sec
*/
#include <postgres.h>
#include "px.h"
#include "rijndael.h"

View File

@ -1,4 +1,4 @@
/* $Id: sha1.c,v 1.10 2001/11/05 17:46:23 momjian Exp $ */
/* $Id: sha1.c,v 1.11 2001/11/29 19:40:37 momjian Exp $ */
/* $KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun Exp $ */
/*
@ -36,6 +36,7 @@
*/
#include "postgres.h"
#include "px.h"
#include "sha1.h"