mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Now that core functionality is depending on autoconf's AC_C_BIGENDIAN to be
right, there seems precious little reason to have a pile of hand-maintained endianness definitions in src/include/port/*.h. Get rid of those, and make the couple of places that used them depend on WORDS_BIGENDIAN instead.
This commit is contained in:
@ -28,7 +28,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.13 2005/07/11 15:07:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.14 2007/04/06 05:36:50 tgl Exp $
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
@ -38,11 +38,6 @@
|
||||
#include "px.h"
|
||||
#include "md5.h"
|
||||
|
||||
/* sanity check */
|
||||
#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
|
||||
#endif
|
||||
|
||||
#define SHIFT(X, s) (((X) << (s)) | ((X) >> (32 - (s))))
|
||||
|
||||
#define F(X, Y, Z) (((X) & (Y)) | ((~X) & (Z)))
|
||||
@ -201,10 +196,9 @@ md5_pad(md5_ctxt * ctxt)
|
||||
}
|
||||
|
||||
/* 8 byte word */
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
memmove(&ctxt->md5_buf[56], &ctxt->md5_n8[0], 8);
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#else
|
||||
ctxt->md5_buf[56] = ctxt->md5_n8[7];
|
||||
ctxt->md5_buf[57] = ctxt->md5_n8[6];
|
||||
ctxt->md5_buf[58] = ctxt->md5_n8[5];
|
||||
@ -222,10 +216,9 @@ void
|
||||
md5_result(uint8 *digest, md5_ctxt * ctxt)
|
||||
{
|
||||
/* 4 byte words */
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
memmove(digest, &ctxt->md5_st8[0], 16);
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#else
|
||||
digest[0] = ctxt->md5_st8[3];
|
||||
digest[1] = ctxt->md5_st8[2];
|
||||
digest[2] = ctxt->md5_st8[1];
|
||||
@ -245,7 +238,7 @@ md5_result(uint8 *digest, md5_ctxt * ctxt)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
static uint32 X[16];
|
||||
#endif
|
||||
|
||||
@ -257,10 +250,9 @@ md5_calc(uint8 *b64, md5_ctxt * ctxt)
|
||||
uint32 C = ctxt->md5_stc;
|
||||
uint32 D = ctxt->md5_std;
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
uint32 *X = (uint32 *) b64;
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#else
|
||||
/* 4 byte words */
|
||||
/* what a brute force but fast! */
|
||||
uint8 *y = (uint8 *) X;
|
||||
|
Reference in New Issue
Block a user