Received: by 10.192.165.156 with SMTP id m28csp2328344imm; Sat, 14 Apr 2018 21:17:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4837g/4PxwZ2u1o/zxFFlUFEyjDtv/wNWNx1BKkmxGhXLcD2I6y18ztvHUTf8vCL7GMsTbC X-Received: by 10.99.126.71 with SMTP id o7mr8750137pgn.366.1523765851133; Sat, 14 Apr 2018 21:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523765851; cv=none; d=google.com; s=arc-20160816; b=KlQflVLnCUEF8vLVJ8E6aQ49o+e8/sMlv70o/nlhWXouzb/wicO6BR9xw5O+vm+zgA 49ThBdk+XnqoUycWc/PMSwIh4X18uMjZUNsY/9XwqkBm8hWKLxOpIvchdT60u6mMDV3I F2QcBn1tz4wqkWHIgbnM+c2dHsXU/ATG4BUkoEU1HvlfoSrGySGj1Kwd0XJ6r3qSbEGY C3hYMotSln+u90MWfE3fPVpsEvI4P/m/bdA+qByNkWvsTdRpiz+HU/P4N88uO3NV3tBb hWbcLDP2U8keSaBRNRsnVlpTuR7B6XLVWvAiJak9Fm5IAhoIbzy+dI/uVXHtndP7vZZu vcqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9YVxwBIlHGKLw1GOc+0/mNMJgNqwaHghqaoeXG7AimE=; b=O1QoBNqtEMdTPmmErgNgY5gm4E6MZtci8qCccZNsXWzde+q+syS4o9o+Fpmpx9DFP/ eoRW1xE/iMr1jyptngwd2HPz6v0t5Mscq7aHbStQDNaWoSOD8UZekCllpL6cykHgH4xL ngq99mGqmPSZvlflsAoQuTNmValOvMwrTwJc2OSy0yQ7fmL02CRabSbDf6mLdG/VteQd CyjHqPfJZm05vmO2O0jCqQaVElbCS2e1wq5rEbFBZ2Dp/4nEbm1PwfUyfhcyLNhDr/DD BsEFbD1zh0uaWMHSqvpZEatMC3sYAnNlKo4unbNd9EEi5PikFh7wBxhoqFG8ZCPouRyw GpuA== 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 v12si7689595pff.119.2018.04.14.21.17.17; Sat, 14 Apr 2018 21:17:31 -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 S1752557AbeDOEQI (ORCPT + 99 others); Sun, 15 Apr 2018 00:16:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:41990 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752371AbeDOEQF (ORCPT ); Sun, 15 Apr 2018 00:16:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5D2CAAEC5; Sun, 15 Apr 2018 04:16:04 +0000 (UTC) From: Joao Moreira To: kernel-hardening@lists.openwall.com Cc: linux-kernel@vger.kernel.org, x86@kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, gregkh@linuxfoundation.org, keescook@chromium.org Subject: [PATCH 4/4] x86/crypto: twofish: Fix function prototypes Date: Sun, 15 Apr 2018 01:15:42 -0300 Message-Id: <20180415041542.5364-5-jmoreira@suse.de> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180415041542.5364-1-jmoreira@suse.de> References: <20180415041542.5364-1-jmoreira@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert the use of 'struct twofish_ctx *' to 'void *' in prototypes of functions which are referenced through 'struct common_glue_func_entry', making their prototypes match those of this struct and, consequently, turning them compatible with CFI requirements. Whenever needed, cast 'void *' to 'struct twofish_ctx *'. Signed-off-by: João Moreira --- arch/x86/crypto/twofish_avx_glue.c | 30 +++++++++++++----------------- arch/x86/crypto/twofish_glue.c | 7 +++---- arch/x86/crypto/twofish_glue_3way.c | 10 ++++------ arch/x86/include/asm/crypto/twofish.h | 9 +++------ 4 files changed, 23 insertions(+), 33 deletions(-) diff --git a/arch/x86/crypto/twofish_avx_glue.c b/arch/x86/crypto/twofish_avx_glue.c index b7a3904b953c..916a4904fa25 100644 --- a/arch/x86/crypto/twofish_avx_glue.c +++ b/arch/x86/crypto/twofish_avx_glue.c @@ -46,25 +46,21 @@ #define TWOFISH_PARALLEL_BLOCKS 8 /* 8-way parallel cipher functions */ -asmlinkage void twofish_ecb_enc_8way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src); -asmlinkage void twofish_ecb_dec_8way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src); - -asmlinkage void twofish_cbc_dec_8way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src); -asmlinkage void twofish_ctr_8way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); - -asmlinkage void twofish_xts_enc_8way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); -asmlinkage void twofish_xts_dec_8way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); - -static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst, +asmlinkage void twofish_ecb_enc_8way(void *ctx, u8 *dst, const u8 *src); +asmlinkage void twofish_ecb_dec_8way(void *ctx, u8 *dst, const u8 *src); + +asmlinkage void twofish_cbc_dec_8way(void *ctx, u8 *dst, const u8 *src); +asmlinkage void twofish_ctr_8way(void *ctx, u8 *dst, const u8 *src, le128 *iv); + +asmlinkage void twofish_xts_enc_8way(void *ctx, u8 *dst, const u8 *src, + le128 *iv); +asmlinkage void twofish_xts_dec_8way(void *ctx, u8 *dst, const u8 *src, + le128 *iv); + +static inline void twofish_enc_blk_3way(void *ctx, u8 *dst, const u8 *src) { - __twofish_enc_blk_3way(ctx, dst, src, false); + __twofish_enc_blk_3way((struct twofish_ctx *) ctx, dst, src, false); } static void twofish_xts_enc(void *ctx, u128 *dst, const u128 *src, le128 *iv) diff --git a/arch/x86/crypto/twofish_glue.c b/arch/x86/crypto/twofish_glue.c index 77e06c2da83d..3dee618c2dd2 100644 --- a/arch/x86/crypto/twofish_glue.c +++ b/arch/x86/crypto/twofish_glue.c @@ -44,11 +44,10 @@ #include #include -asmlinkage void twofish_enc_blk(struct twofish_ctx *ctx, u8 *dst, - const u8 *src); +asmlinkage void twofish_enc_blk(void *ctx, u8 *dst, const u8 *src); EXPORT_SYMBOL_GPL(twofish_enc_blk); -asmlinkage void twofish_dec_blk(struct twofish_ctx *ctx, u8 *dst, - const u8 *src); + +asmlinkage void twofish_dec_blk(void *ctx, u8 *dst, const u8 *src); EXPORT_SYMBOL_GPL(twofish_dec_blk); static void twofish_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) diff --git a/arch/x86/crypto/twofish_glue_3way.c b/arch/x86/crypto/twofish_glue_3way.c index 243e90a4b5d9..ce25be1bc260 100644 --- a/arch/x86/crypto/twofish_glue_3way.c +++ b/arch/x86/crypto/twofish_glue_3way.c @@ -36,16 +36,14 @@ EXPORT_SYMBOL_GPL(__twofish_enc_blk_3way); EXPORT_SYMBOL_GPL(twofish_dec_blk_3way); -static inline void twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src) +static inline void twofish_enc_blk_3way(void *ctx, u8 *dst, const u8 *src) { - __twofish_enc_blk_3way(ctx, dst, src, false); + __twofish_enc_blk_3way((struct twofish_ctx *) ctx, dst, src, false); } -static inline void twofish_enc_blk_xor_3way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src) +static inline void twofish_enc_blk_xor_3way(void *ctx, u8 *dst, const u8 *src) { - __twofish_enc_blk_3way(ctx, dst, src, true); + __twofish_enc_blk_3way((struct twofish_ctx *) ctx, dst, src, true); } void twofish_dec_blk_cbc_3way(void *ctx, u128 *dst, const u128 *src) diff --git a/arch/x86/include/asm/crypto/twofish.h b/arch/x86/include/asm/crypto/twofish.h index 65bb80adba3e..871eaa7bacdc 100644 --- a/arch/x86/include/asm/crypto/twofish.h +++ b/arch/x86/include/asm/crypto/twofish.h @@ -18,16 +18,13 @@ struct twofish_xts_ctx { }; /* regular block cipher functions from twofish_x86_64 module */ -asmlinkage void twofish_enc_blk(struct twofish_ctx *ctx, u8 *dst, - const u8 *src); -asmlinkage void twofish_dec_blk(struct twofish_ctx *ctx, u8 *dst, - const u8 *src); +asmlinkage void twofish_enc_blk(void *ctx, u8 *dst, const u8 *src); +asmlinkage void twofish_dec_blk(void *ctx, u8 *dst, const u8 *src); /* 3-way parallel cipher functions */ asmlinkage void __twofish_enc_blk_3way(struct twofish_ctx *ctx, u8 *dst, const u8 *src, bool xor); -asmlinkage void twofish_dec_blk_3way(struct twofish_ctx *ctx, u8 *dst, - const u8 *src); +asmlinkage void twofish_dec_blk_3way(void *ctx, u8 *dst, const u8 *src); /* helpers from twofish_x86_64-3way module */ extern void twofish_dec_blk_cbc_3way(void *ctx, u128 *dst, const u128 *src); -- 2.12.0