Messages in this thread | | | Date | Thu, 19 Apr 2018 12:35:29 +0200 (CEST) | From | Thomas Gleixner <> | Subject | Re: [PATCH 1/4] x86/crypto: camellia: Fix function prototypes |
| |
On Wed, 18 Apr 2018, Kees Cook wrote: > So, instead of the original series, how about something like this: > > Switch function pointers to not use the function cast, and define a > new GLUE_FUNC macro that kinda looks like the tricks used for > syscalls: > > static const struct common_glue_ctx camellia_enc = { > ... > .funcs = { { > ... > .num_blocks = 1, > .fn_u = { .ecb = camellia_enc_blk } > } } > }; > > #define GLUE_FUNC(func, context) \ > static inline void func(void *ctx, u8 *dst, const u8 *src) \ > { __##func((context)ctx, dst, src); } \ > __##func(context ctx, u8 *dst, const u8 *src) > > GLUE_FUNC(camellia_enc_blk, struct camellia_ctx *) > { > ...original function... > }
I was about to suggest this before I read to the end of the mail. Yes, that is much more palatable.
Thanks,
tglx
| |