[libfko] handle endian detection on PPC (and other) systems

Blair Zajac contributed a patch to handle endian detection on PPC systems
and issue a compile time error if it cannot be determined.  This commit affects
the BYTEORDER macro.
This commit is contained in:
Michael Rash 2013-06-10 22:27:57 -04:00
parent 5c7f5f1b0b
commit ffeb285f7b
2 changed files with 22 additions and 2 deletions

View File

@ -140,3 +140,9 @@ hlein
- Suggested the ability to read a passphrase from STDIN and via a new --fd
command line argument (github #74) to allow things like:
$ gpg -d passphrasefile.pgp | fwknop -R -n myserver
Blair Zajac
- Contributed patches to handle endian issues on PPC systems.
- Reported an issue where strndup() is not available on some PPC systems
and the fix is to use the local lib/fko_util.c implementation similarly
to Windows builds.

View File

@ -100,9 +100,23 @@
#define BYTEORDER 4321
#elif defined(_LITTLE_ENDIAN)
#define BYTEORDER 1234
#else
#error unable to determine BYTEORDER
#endif
#elif defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__)
#if defined(__i386__) || defined(__ppc__)
#define BYTEORDER 4321
#elif defined(__x86_64__) || defined(__ppc64)
#define BYTEORDER 87654321
#endif
#elif defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__)
#if defined(__i386__) || defined(__ppc__)
#define BYTEORDER 1234
#elif defined(__x86_64__) || defined(__ppc64)
#define BYTEORDER 12345678
#endif
#endif
#ifndef BYTEORDER
#error unable to determine BYTEORDER
#endif
#ifdef WIN32