Tim Rühsen tim.ruehsen@gmx.de writes:
commit 57e304262262b0f483d76f9981bb4b99b8ec2869 breaks certain builds (likely those with --disable-shared). As a side effect, the oss-fuzz build for Wget2 fails.
Example:
../libhogweed.a(mini-gmp.o): In function `mpn_zero_p': /usr/oms/src/nettle/mini-gmp.c:391: multiple definition of `mpn_zero_p' testutils.o:/usr/oms/src/nettle/testsuite/testutils.c:612: first defined here
I see. Problem is, we can't use mpn_zero_p unconditionally (unless we want to require gmp-6.1.0 or later). And it was added to mini-gmp in the update of that commit.
The below patch to the testutils.h #ifdef:ery seems to fix the problem for me. Not sure if there's any prettier way to deal with it. (There's a corresponding #ifdef mpn_zero_p in the testutils.c file, which we don't need to touch if we do it this way).
Thanks for the bug report, /Niels
--- a/testsuite/testutils.h +++ b/testsuite/testutils.h @@ -163,13 +163,6 @@ test_armor(const struct nettle_armor *armor, const char *ascii);
#if WITH_HOGWEED -#ifndef mpn_zero_p -int -mpn_zero_p (mp_srcptr ap, mp_size_t n); -#endif - -void -mpn_out_str (FILE *f, int base, const mp_limb_t *xp, mp_size_t xn);
#if NETTLE_USE_MINI_GMP typedef struct knuth_lfib_ctx gmp_randstate_t[1]; @@ -180,8 +173,20 @@ void mpz_urandomb (mpz_t r, struct knuth_lfib_ctx *ctx, mp_bitcnt_t bits); /* This is cheating */ #define mpz_rrandomb mpz_urandomb
+/* mini-gmp defines this function (in the GMP library, it was added in + gmp in version 6.1.0). */ +#define mpn_zero_p mpn_zero_p + #endif /* NETTLE_USE_MINI_GMP */
+#ifndef mpn_zero_p +int +mpn_zero_p (mp_srcptr ap, mp_size_t n); +#endif + +void +mpn_out_str (FILE *f, int base, const mp_limb_t *xp, mp_size_t xn); + mp_limb_t * xalloc_limbs (mp_size_t n);