Eli Zaretskii eliz@gnu.org writes:
It fails the ecc-dup and ecc-add tests, in this and similar asserts:
ASSERT (ecc->dup == ecc_dup_jj);
Here, the right hand side is a symbol from libhogweed-x.dll, and on the left hand side, ecc refers to a constant struct in the same dll.
Please tell more details, perhaps showing the code which obtains the values of these variables. In particular, I don't understand what do you mean by "symbol": this is C, and C doesn't have symbols as one of its data types.
The "ecc" variable is a local defined like
const struct ecc_curve *ecc = ecc_curves[i];
(where ecc_curves is the array quoted below). And ecc_dup_jj is a top-level function, declared as
void ecc_dup_jj (const struct ecc_curve *ecc, mp_limb_t *r, const mp_limb_t *p, mp_limb_t *scratch);
The implementation is in the dll, so it is resolved by the dynamic linker. I've found this stackoverflow question which also asks about pointer equality with dlls: https://stackoverflow.com/questions/20517589/function-pointer-values-inside-...
And by "symbol", I mean a name that is handled in the linking process.
And what is the purpose of this assertion?
To check that the ecc_curve points to an appropriate implementation of the point duplication function (different curves uses different functions). To get a clearer error than just unexpected output numbers if the wrong function is used.
But maybe value is quite small, I'll consider deleting the assert.
Somewhat related to this: The ecc pointer is taken from this array in testutils.c:
const struct ecc_curve * const ecc_curves[] = { &_nettle_secp_192r1, &_nettle_secp_224r1, &_nettle_secp_256r1, &_nettle_secp_384r1, &_nettle_secp_521r1, &_nettle_curve25519, &_nettle_curve448, &_nettle_gost_gc256b, &_nettle_gost_gc512a, NULL };
The entries are references to data objects in the dll. I'm a bit surprised that works at all, is it expected to work? I had the impression that dlls only exported functions.
No, DLLs can export variables as well, and programs linked against it can import them.
Thanks, that's good to know.
Regards, /Niels