[email protected] (Niels Möller) writes:

> In testsuite/Makefile.in, pss-mgf1-test.c is listed in
> TS_NETTLE_SOURCES. Should be moved to TS_HOGWEED_SOURCES, to not get
> link failured in builds without hogweed. Right? 

Moved now.

> Both pss_mgf1 and pss_encode_mgf1 allocate the hash context using
>
>   TMP_DECL(state, uint8_t, NETTLE_MAX_HASH_CONTEXT_SIZE);
>   ...
>   TMP_ALLOC(state, hash->context_size);
>
> That should work fine if we are using alloca, which provides suitable
> alignment, but if !HAVE_ALLOCA, we're only guaranteed uint8_t
> alignment.

It seems this currently doesn't work at all without alloca. If I delete
"#define HAVE_ALLOCA 1 " from config.h, compilation fails with

In file included from /home/nisse/hack/nettle/pss.c:48:0:
/home/nisse/hack/nettle/pss.c: In function ‘nettle_pss_encode_mgf1’:
/home/nisse/hack/nettle/nettle-internal.h:57:46: error: invalid application of 
‘sizeof’ to incomplete type ‘struct sha3_224_ctx’
 #define NETTLE_MAX_HASH_CONTEXT_SIZE (sizeof(struct sha3_224_ctx))
                                              ^
/home/nisse/hack/nettle/nettle-internal.h:49:46: note: in definition of macro 
‘TMP_DECL’
 # define TMP_DECL(name, type, max) type name[max]
                                              ^~~
/home/nisse/hack/nettle/pss.c:70:28: note: in expansion of macro 
‘NETTLE_MAX_HASH_CONTEXT_SIZE’
   TMP_DECL(state, uint8_t, NETTLE_MAX_HASH_CONTEXT_SIZE);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

For now, I think I'll fix this, and add a TMP_ALIGN_DECL,
TMP_ALIGN_ALLOC. I still wonder if support for compilers without alloca
is relevant?

Regards, 
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to