byteorder-fix.diff

text/plain

Filename: byteorder-fix.diff
Type: text/plain
Part: 1
Message: 4 pgcrypto regressions failures - 1 unsolved

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: context
File+
contrib/pgcrypto/md5.c 8 1
contrib/pgcrypto/rijndael.c 8 0
contrib/pgcrypto/sha1.c 5 9
contrib/pgcrypto/sha2.c 1 0
Index: pgsql/contrib/pgcrypto/md5.c
===================================================================
*** pgsql.orig/contrib/pgcrypto/md5.c
--- pgsql/contrib/pgcrypto/md5.c
***************
*** 30,40 ****
   * SUCH DAMAGE.
   */
  
! #include "postgres.h"
  #include "px.h"
  
  #include "md5.h"
  
  #define SHIFT(X, s) (((X) << (s)) | ((X) >> (32 - (s))))
  
  #define F(X, Y, Z) (((X) & (Y)) | ((~X) & (Z)))
--- 30,47 ----
   * SUCH DAMAGE.
   */
  
! #include <postgres.h>
! #include <sys/param.h>
! 
  #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)))
Index: pgsql/contrib/pgcrypto/rijndael.c
===================================================================
*** pgsql.orig/contrib/pgcrypto/rijndael.c
--- pgsql/contrib/pgcrypto/rijndael.c
*************** Mean:		   500 cycles =    51.2 mbits/sec
*** 39,48 ****
--- 39,56 ----
  */
  
  #include <postgres.h>
+ #include <sys/param.h>
+ 
  #include "px.h"
  
  #include "rijndael.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 PRE_CALC_TABLES
  #define LARGE_TABLES
  
Index: pgsql/contrib/pgcrypto/sha1.c
===================================================================
*** pgsql.orig/contrib/pgcrypto/sha1.c
--- pgsql/contrib/pgcrypto/sha1.c
***************
*** 35,53 ****
   * implemented by Jun-ichiro itojun Itoh <itojun@itojun.org>
   */
  
! #include "postgres.h"
! #include "px.h"
  
  #include "sha1.h"
  
  /* sanity check */
! #if BYTE_ORDER != BIG_ENDIAN
! #if BYTE_ORDER != LITTLE_ENDIAN
! #define unsupported 1
  #endif
- #endif
- 
- #ifndef unsupported
  
  /* constant table */
  static uint32 _K[] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6};
--- 35,50 ----
   * implemented by Jun-ichiro itojun Itoh <itojun@itojun.org>
   */
  
! #include <postgres.h>
! #include <sys/param.h>
  
+ #include "px.h"
  #include "sha1.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
  
  /* constant table */
  static uint32 _K[] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6};
*************** sha1_result(struct sha1_ctxt * ctxt, uin
*** 347,350 ****
  #endif
  }
  
- #endif   /* unsupported */
--- 344,346 ----
Index: pgsql/contrib/pgcrypto/sha2.c
===================================================================
*** pgsql.orig/contrib/pgcrypto/sha2.c
--- pgsql/contrib/pgcrypto/sha2.c
***************
*** 36,41 ****
--- 36,42 ----
   */
  
  #include <postgres.h>
+ #include <sys/param.h>
  
  #include "sha2.h"