Ticket #20866 (closed defect: fixed)
libgcrypt universal install is subtly broken
| Reported by: | wiml@… | Owned by: | sfiera@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | |
| Keywords: | gnutls universal | Cc: | jmr@… |
| Port: | libgcrypt |
Description
Building an i386+x86_64 version of libgcrypt seems to result in a broken libgcrypt. My guess is that either BYTES_PER_MPI_LIMB or SIZEOF_UNSIGNED_LONG is being defined inconsistently between configure and compile.
The result I noticed is that when gnutls is linked against this libgcrypt it fails miserably in 'make check'. The simplest test case is probably gnutls' "mpi" test, which fails because gcry_mpi_scan is broken:
|<9>| MPI: length: 60 rand:81ef2a9400000000a0f6204e00000000183844c00000000024b2a49a00000000e5c9036d0000000026327e4c000000004d31fc1900000000a92feb98
You'll notice that the random number isn't very random. Further investigation shows that mpi_read_from_buffer() (an internal libgcrypt function) is being passed a valid random buffer, but is returning an mpi with every other 32 bits omitted, as you see.
Libgcrypt does some screwy stuff in its headers, things like #defining SIZEOF_UNSIGNED_LONG to a constant instead of simply using sizeof(unsigned long), so I guess it's not surprising it doesn't cross-compile properly.

