Received: by 10.192.165.156 with SMTP id m28csp546274imm; Thu, 19 Apr 2018 03:37:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx49by91n0YQqauFuitUAfZm5cGCiu8l+wx2Mkp6RsHrHWtTwyIX1L0gr6G5l+YIQhqG4tZkf X-Received: by 10.98.210.134 with SMTP id c128mr1340586pfg.240.1524134225821; Thu, 19 Apr 2018 03:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524134225; cv=none; d=google.com; s=arc-20160816; b=EJg1PLc6/pjFyLSc+QN9Gv5/d37H9BeGt4aOP0dlxypavxt32ubJ+m5frZCF0RmPC/ aNHAGbIE/yRxNtqWet93Kz0Z39vD2uKZFAZbOJe3OFhfrF7eUbgsfdNzHUcEQzGBEJcW igXytnWtAn6nyce9eEltXNoCRM5WcjETT6DGnoca7BfkUvsFwfOw+837815MlrZa9xa0 2vkVW89XxaLJCWEeWIYVySPU7VSNkAZ3w4I8dRg5ZMMDLsWkee0kXiBkpsgyo33vh+mw HhUB5+vgGwrSOGSvmJDZIFs4CcMjY5WS16UcoEsECzNXRz/b0fOFQHLJHMGDfzOpJYyg 95aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=rMBI2IO9vqOANipbYntQNPI8IEtN3MVA0AI1Z5I3/7k=; b=uigh/vR0UQhPn6mj9URnpyZcYS91rbDjGBEIM5xVARJOhcaps4dq/90a1PKvV2LMus iYnHe1ZW/tJXEVJmtbndwS1XUlaBtCazN2iQdcsOuMiWhd71AocE48lZK7FvKkhhB8Wx MgQtirgTUj6W+0xloLRfCR8K8bGlQfBCVzjCwBUsTJJlV1tW59chtQam1yuYL0GkFsdS juhSegw0DeUVdDfo1UouW80JHqCCEXVDhR5aT5+RSLk2xWq48daOp4slz2lZcmpPn62H 29YviHJ9UtVcFDWmZ3f9wk3ndmEyD1oiguUm25HuveFqUzF9R0k6gnbtrCyp28WwmFO/ LxeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w69si3143997pfd.332.2018.04.19.03.36.51; Thu, 19 Apr 2018 03:37:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752160AbeDSKfq (ORCPT + 99 others); Thu, 19 Apr 2018 06:35:46 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39038 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751147AbeDSKfp (ORCPT ); Thu, 19 Apr 2018 06:35:45 -0400 Received: from static-242-42-24-46.ipcom.comunitel.net ([46.24.42.242] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1f96ud-0000gF-6W; Thu, 19 Apr 2018 12:35:35 +0200 Date: Thu, 19 Apr 2018 12:35:29 +0200 (CEST) From: Thomas Gleixner To: Kees Cook cc: Ingo Molnar , Joao Moreira , Kernel Hardening , LKML , X86 ML , Herbert Xu , "David S. Miller" , Ingo Molnar , "H. Peter Anvin" , Greg KH Subject: Re: [PATCH 1/4] x86/crypto: camellia: Fix function prototypes In-Reply-To: Message-ID: References: <20180415041542.5364-1-jmoreira@suse.de> <20180415041542.5364-2-jmoreira@suse.de> <20180416061044.z6eb4psw2sbszemb@gmail.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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