lkml.org 
[lkml]   [2018]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2018-04-19 12:36    [W:0.356 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site