Nikos Mavrogiannopoulos <[email protected]> writes: > What is the purpose of the cast? Isn't the macro supposed to have a > function pointer input?
It's supposed to get a function pointer, but not necessarily of exactly the type nettle_cipher_func. The idea is that applications should be able to do struct GCM_CTX(struct aes128_ctx) ctx; ... GCM_ENCRYPT(&ctx, aes128_encrypt, ...) without compiler warnings and without manually casting aes128_encrypt to (nettle_cipher_func *). The main purpose of these convenience macros is to do the needed cast to (nettle_cipher_func *), and bundle that cast together with a little extra typechecking. >> Question is, does that solve a real problem? > > What do you mean by that? If one prefers to not have that cast, one can call always call gcm_encrypt directly; GCM_ENCRYPT is an optional feature. So my question is, do you think it would make your code easier to read and debug, if nettle provided a simple non-magic wrapper macro around gcm_encrypt (in addition to the current GCM_ENCRYPT macro which you find questionable), or would it be clearer to call gcm_encrypt directly? Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26. Internet email is subject to wholesale government surveillance. _______________________________________________ nettle-bugs mailing list [email protected] http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs
