Use upstream way to fix.

This commit is contained in:
obache 2014-01-13 11:44:27 +00:00
parent ac6dd5f621
commit 0948c5551e
2 changed files with 47 additions and 14 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.45 2014/01/11 10:49:14 ryoon Exp $
$NetBSD: distinfo,v 1.46 2014/01/13 11:44:27 obache Exp $
SHA1 (libgcrypt-1.6.0.tar.bz2) = 43283c0b41c41e3d3bc13c2d8f937dfe2aaa1a77
RMD160 (libgcrypt-1.6.0.tar.bz2) = 33e4e45116a64999c4cd0d132a4a968612057f40
@ -8,7 +8,7 @@ SHA1 (patch-ab) = 6fac21daa26b7de3b13839d076f78a74400efce7
SHA1 (patch-ad) = 19345b7d164521d526a44eb3f1a465ff09d8266c
SHA1 (patch-cipher_Makefile.am) = 90ec53aaba6b7efcbdaac95eefeccdbd1ed0356b
SHA1 (patch-cipher_Makefile.in) = c9c98052e061df3556d660f40a6e602e1fb724c6
SHA1 (patch-cipher_bithelp.h) = 41cd581d84b7f767435cd3305f4a64772cb86ff3
SHA1 (patch-cipher_bithelp.h) = d624c33777ad3367cd527f4c141bcbede310df2b
SHA1 (patch-cipher_blowfish-arm.S) = ec81170eb3a45bc160394a5835de0171c24b95ea
SHA1 (patch-cipher_serpent-armv7-neon.S) = 6941ec8dda48785961f4cb05a64724ff7298dd7b
SHA1 (patch-configure) = c4e10bdb7e00a44d507f5b964f3e71a63828cd0a

View file

@ -1,25 +1,58 @@
$NetBSD: patch-cipher_bithelp.h,v 1.3 2014/01/08 09:39:45 obache Exp $
$NetBSD: patch-cipher_bithelp.h,v 1.4 2014/01/13 11:44:27 obache Exp $
* NetBSD has bswap32 and bswap64 as macros.
https://bugs.g10code.com/gnupg/issue1600
--- cipher/bithelp.h.orig 2013-12-09 07:48:50.000000000 +0000
+++ cipher/bithelp.h
@@ -40,7 +40,7 @@ static inline u32 ror(u32 x, int n)
@@ -39,9 +39,10 @@ static inline u32 ror(u32 x, int n)
/* Byte swap for 32-bit and 64-bit integers. If available, use compiler
provided helpers. */
#ifdef HAVE_BUILTIN_BSWAP32
# define bswap32 __builtin_bswap32
-#else
+#elif !defined(__NetBSD__) && !defined(bswap32)
static inline u32 bswap32(u32 x)
-# define bswap32 __builtin_bswap32
+# define _gcry_bswap32 __builtin_bswap32
#else
-static inline u32 bswap32(u32 x)
+static inline u32
+_gcry_bswap32(u32 x)
{
return ((rol(x, 8) & 0x00ff00ffL) | (ror(x, 8) & 0xff00ff00L));
@@ -50,7 +50,7 @@ static inline u32 bswap32(u32 x)
}
@@ -49,29 +50,30 @@ static inline u32 bswap32(u32 x)
#ifdef HAVE_U64_TYPEDEF
# ifdef HAVE_BUILTIN_BSWAP64
# define bswap64 __builtin_bswap64
-# else
+# elif !defined(__NetBSD__) && !defined(bswap64)
static inline u64 bswap64(u64 x)
-# define bswap64 __builtin_bswap64
+# define _gcry_bswap64 __builtin_bswap64
# else
-static inline u64 bswap64(u64 x)
+static inline u64
+_gcry_bswap64(u64 x)
{
return ((u64)bswap32(x) << 32) | (bswap32(x >> 32));
- return ((u64)bswap32(x) << 32) | (bswap32(x >> 32));
+ return ((u64)_gcry_bswap32(x) << 32) | (_gcry_bswap32(x >> 32));
}
# endif
#endif
/* Endian dependent byte swap operations. */
#ifdef WORDS_BIGENDIAN
-# define le_bswap32(x) bswap32(x)
+# define le_bswap32(x) _gcry_bswap32(x)
# define be_bswap32(x) ((u32)(x))
# ifdef HAVE_U64_TYPEDEF
-# define le_bswap64(x) bswap64(x)
+# define le_bswap64(x) _gcry_bswap64(x)
# define be_bswap64(x) ((u64)(x))
# endif
#else
# define le_bswap32(x) ((u32)(x))
-# define be_bswap32(x) bswap32(x)
+# define be_bswap32(x) _gcry_bswap32(x)
# ifdef HAVE_U64_TYPEDEF
# define le_bswap64(x) ((u64)(x))
-# define be_bswap64(x) bswap64(x)
+# define be_bswap64(x) _gcry_bswap64(x)
# endif
#endif