Running Nettle 3.0 tests on a powerpc64le RHEL 7.1 box shows the two failures below. The cause is in the second definition of the HAVE_NATIVE_64_BIT configuration macro:
$ grep HAVE_NATIVE_64_BIT config.* config.h:# define HAVE_NATIVE_64_BIT 1 config.h:# define HAVE_NATIVE_64_BIT (SIZEOF_LONG * CHAR_BIT >= 64)
The macro relies on the CHAR_BIT macro being defined at the point of its expansion. Uses of HAVE_NATIVE_64_BIT of the form
#if !HAVE_NATIVE_64_BIT
in files that don't include <limits.h> (and thus don't have the CHAR_BIT macro defined) end up compiling the conditional blocks that are intended to be included only when the target has no native support for 64 bit arithmetic. One such file that comes into play in the failing tests is camellia-absorb.c. Since powerpc64le obviously does have such support, the code is unnecessary and, as it turns out, introduces errors.
Once <limits.h> is included all of Nettle's tests pass even on powerpc64le-redhat-linux.
Martin
... Encrypt failed: Input: 0123456789abcdef fedcba9876543210
Output: df51fc645013f77c 25c472e2871f742a
Expected: 6767313854966973 0857065648eabe43
/src/nettle-3.0/run-tests: line 57: 46381 Aborted "$1" $testflags FAIL: camellia ... Assert failed: /src/nettle-3.0/testsuite/testutils.c:513: MEMEQ(digest->length, buffer, digest->data) /src/nettle-3.0/run-tests: line 57: 49811 Aborted "$1" $testflags FAIL: gcm ... ==================== 2 of 55 tests failed ====================