Received: by 10.192.165.156 with SMTP id m28csp2328565imm; Sat, 14 Apr 2018 21:17:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx490gyznTg9zZ8kBSr40ryG1Iw0JwWCYC6+3k8c1szNpSD3NqyFcOOi9Q2b+4T9OoaozROne X-Received: by 10.101.100.13 with SMTP id a13mr3669855pgv.360.1523765879159; Sat, 14 Apr 2018 21:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523765879; cv=none; d=google.com; s=arc-20160816; b=m3i9j62VbBKB3fSUoJWyqMwcS59sNaZsW8u0Muv5yxlSvhSrYxDS2NSPfnTc/l7m/h /tCgzTgXlOKFO18TCtzuQqdM8At/qUEA/ZYyxN32yn1IShCepXxg8jzDpxbmyAeBk08D 2Q3KRn7H2grn6HVKHw+CX4Pj/zHt7b2d2fQvXmBC6wYrmKN5Tt8sdecvmHDjvt5rF2H4 cs6wtUwg9M31ZPUZqqHukwH0mo+lFkQCYgitZteGeoyfHxNtVNWuU8/8nBaFI2T8/SNr uGhRdYHLcjWqutah4CwJ2HpABH6s1/ZqLpZk84flLN6MaTZTsyiHprjOmCHow/uXUV8g ra5A== 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=J9nll+MTAC8n6h3xzqiXGBYmpo6DYg0bFAcGfSuiGWk=; b=IfxoZ2Un1Qf+khGxALJvYQtzgoD3S3AWBdkU/hlaw0a+T6qQET3fzfnQF/L1ukFgNT ucP6RXuw7DWSoawb68Gb4mC85soVyB6QIE0anFCNmm0BwN8byrwVq8cp3zUaiPzXvpFQ dTXKHV1XQjbXUqPo1WtVcGxU8kY99TGzvnitLRJE/JyZ8Ln2SbHvXGhI+Cwa88TAQPic G9E5+ZOlyT9Jzy8TI3RTmBpm4+yZmcqQrL0u77U4CBNPzV+NrB2gm3WpOEE5KP9Pvmi/ r/tFeKIjBFnd7eplrBogfx0T/JgdekyPcsxJ0XoHfkNx1mTRvSLieSvsr3NXUGrkzfLu xEMA== 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 d17si7064175pgv.576.2018.04.14.21.17.45; Sat, 14 Apr 2018 21:17:59 -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 S1752584AbeDOEQ1 (ORCPT + 99 others); Sun, 15 Apr 2018 00:16:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:41971 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752449AbeDOEQC (ORCPT ); Sun, 15 Apr 2018 00:16:02 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3DCD2AEC4; Sun, 15 Apr 2018 04:16:01 +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 3/4] x86/crypto: serpent: Fix function prototypes Date: Sun, 15 Apr 2018 01:15:41 -0300 Message-Id: <20180415041542.5364-4-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 serpent_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 serpent_ctx *'. Signed-off-by: João Moreira --- arch/x86/crypto/serpent_avx2_glue.c | 14 ++++++-------- arch/x86/crypto/serpent_avx_glue.c | 19 ++++++++----------- arch/x86/include/asm/crypto/serpent-avx.h | 25 +++++++++++-------------- arch/x86/include/asm/crypto/serpent-sse2.h | 30 ++++++++++++------------------ 4 files changed, 37 insertions(+), 51 deletions(-) diff --git a/arch/x86/crypto/serpent_avx2_glue.c b/arch/x86/crypto/serpent_avx2_glue.c index 870f6d812a2d..17d89b4521ac 100644 --- a/arch/x86/crypto/serpent_avx2_glue.c +++ b/arch/x86/crypto/serpent_avx2_glue.c @@ -27,18 +27,16 @@ #define SERPENT_AVX2_PARALLEL_BLOCKS 16 /* 16-way AVX2 parallel cipher functions */ -asmlinkage void serpent_ecb_enc_16way(struct serpent_ctx *ctx, u8 *dst, - const u8 *src); -asmlinkage void serpent_ecb_dec_16way(struct serpent_ctx *ctx, u8 *dst, - const u8 *src); +asmlinkage void serpent_ecb_enc_16way(void *ctx, u8 *dst, const u8 *src); +asmlinkage void serpent_ecb_dec_16way(void *ctx, u8 *dst, const u8 *src); asmlinkage void serpent_cbc_dec_16way(void *ctx, u128 *dst, const u128 *src); asmlinkage void serpent_ctr_16way(void *ctx, u128 *dst, const u128 *src, le128 *iv); -asmlinkage void serpent_xts_enc_16way(struct serpent_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); -asmlinkage void serpent_xts_dec_16way(struct serpent_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); +asmlinkage void serpent_xts_enc_16way(void *ctx, u8 *dst, const u8 *src, + le128 *iv); +asmlinkage void serpent_xts_dec_16way(void *ctx, u8 *dst, const u8 *src, + le128 *iv); static const struct common_glue_ctx serpent_enc = { .num_funcs = 3, diff --git a/arch/x86/crypto/serpent_avx_glue.c b/arch/x86/crypto/serpent_avx_glue.c index 6f778d3daa22..0d234458a734 100644 --- a/arch/x86/crypto/serpent_avx_glue.c +++ b/arch/x86/crypto/serpent_avx_glue.c @@ -41,28 +41,25 @@ #include /* 8-way parallel cipher functions */ -asmlinkage void serpent_ecb_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src); +asmlinkage void serpent_ecb_enc_8way_avx(void *ctx, u8 *dst, const u8 *src); EXPORT_SYMBOL_GPL(serpent_ecb_enc_8way_avx); -asmlinkage void serpent_ecb_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src); +asmlinkage void serpent_ecb_dec_8way_avx(void *ctx, u8 *dst, const u8 *src); EXPORT_SYMBOL_GPL(serpent_ecb_dec_8way_avx); -asmlinkage void serpent_cbc_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src); +asmlinkage void serpent_cbc_dec_8way_avx(void *ctx, u8 *dst, const u8 *src); EXPORT_SYMBOL_GPL(serpent_cbc_dec_8way_avx); -asmlinkage void serpent_ctr_8way_avx(struct serpent_ctx *ctx, u8 *dst, +asmlinkage void serpent_ctr_8way_avx(void *ctx, u8 *dst, const u8 *src, le128 *iv); EXPORT_SYMBOL_GPL(serpent_ctr_8way_avx); -asmlinkage void serpent_xts_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); +asmlinkage void serpent_xts_enc_8way_avx(void *ctx, u8 *dst, const u8 *src, + le128 *iv); EXPORT_SYMBOL_GPL(serpent_xts_enc_8way_avx); -asmlinkage void serpent_xts_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); +asmlinkage void serpent_xts_dec_8way_avx(void *ctx, u8 *dst, const u8 *src, + le128 *iv); EXPORT_SYMBOL_GPL(serpent_xts_dec_8way_avx); void __serpent_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv) diff --git a/arch/x86/include/asm/crypto/serpent-avx.h b/arch/x86/include/asm/crypto/serpent-avx.h index c958b7bd0fcb..c92cb0cc1f8b 100644 --- a/arch/x86/include/asm/crypto/serpent-avx.h +++ b/arch/x86/include/asm/crypto/serpent-avx.h @@ -17,20 +17,17 @@ struct serpent_xts_ctx { struct serpent_ctx crypt_ctx; }; -asmlinkage void serpent_ecb_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src); -asmlinkage void serpent_ecb_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src); - -asmlinkage void serpent_cbc_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src); -asmlinkage void serpent_ctr_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); - -asmlinkage void serpent_xts_enc_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); -asmlinkage void serpent_xts_dec_8way_avx(struct serpent_ctx *ctx, u8 *dst, - const u8 *src, le128 *iv); +asmlinkage void serpent_ecb_enc_8way_avx(void *ctx, u8 *dst, const u8 *src); +asmlinkage void serpent_ecb_dec_8way_avx(void *ctx, u8 *dst, const u8 *src); + +asmlinkage void serpent_cbc_dec_8way_avx(void *ctx, u8 *dst, const u8 *src); +asmlinkage void serpent_ctr_8way_avx(void *ctx, u8 *dst, const u8 *src, + le128 *iv); + +asmlinkage void serpent_xts_enc_8way_avx(void *ctx, u8 *dst, const u8 *src, + le128 *iv); +asmlinkage void serpent_xts_dec_8way_avx(void *ctx, u8 *dst, const u8 *src, + le128 *iv); extern void __serpent_crypt_ctr(void *ctx, u128 *dst, const u128 *src, le128 *iv); diff --git a/arch/x86/include/asm/crypto/serpent-sse2.h b/arch/x86/include/asm/crypto/serpent-sse2.h index 1a345e8a7496..69b14fda1f4c 100644 --- a/arch/x86/include/asm/crypto/serpent-sse2.h +++ b/arch/x86/include/asm/crypto/serpent-sse2.h @@ -14,22 +14,19 @@ asmlinkage void __serpent_enc_blk_4way(struct serpent_ctx *ctx, u8 *dst, asmlinkage void serpent_dec_blk_4way(struct serpent_ctx *ctx, u8 *dst, const u8 *src); -static inline void serpent_enc_blk_xway(struct serpent_ctx *ctx, u8 *dst, - const u8 *src) +static inline void serpent_enc_blk_xway(void *ctx, u8 *dst, const u8 *src) { - __serpent_enc_blk_4way(ctx, dst, src, false); + __serpent_enc_blk_4way((struct serpent_ctx *) ctx, dst, src, false); } -static inline void serpent_enc_blk_xway_xor(struct serpent_ctx *ctx, u8 *dst, - const u8 *src) +static inline void serpent_enc_blk_xway_xor(void *ctx, u8 *dst, const u8 *src) { - __serpent_enc_blk_4way(ctx, dst, src, true); + __serpent_enc_blk_4way((struct serpent_ctx *) ctx, dst, src, true); } -static inline void serpent_dec_blk_xway(struct serpent_ctx *ctx, u8 *dst, - const u8 *src) +static inline void serpent_dec_blk_xway(void *ctx, u8 *dst, const u8 *src) { - serpent_dec_blk_4way(ctx, dst, src); + serpent_dec_blk_4way((struct serpent_ctx *) ctx, dst, src); } #else @@ -41,22 +38,19 @@ asmlinkage void __serpent_enc_blk_8way(struct serpent_ctx *ctx, u8 *dst, asmlinkage void serpent_dec_blk_8way(struct serpent_ctx *ctx, u8 *dst, const u8 *src); -static inline void serpent_enc_blk_xway(struct serpent_ctx *ctx, u8 *dst, - const u8 *src) +static inline void serpent_enc_blk_xway(void *ctx, u8 *dst, const u8 *src) { - __serpent_enc_blk_8way(ctx, dst, src, false); + __serpent_enc_blk_8way((struct serpent_ctx *) ctx, dst, src, false); } -static inline void serpent_enc_blk_xway_xor(struct serpent_ctx *ctx, u8 *dst, - const u8 *src) +static inline void serpent_enc_blk_xway_xor(void *ctx, u8 *dst, const u8 *src) { - __serpent_enc_blk_8way(ctx, dst, src, true); + __serpent_enc_blk_8way((struct serpent_ctx *) ctx, dst, src, true); } -static inline void serpent_dec_blk_xway(struct serpent_ctx *ctx, u8 *dst, - const u8 *src) +static inline void serpent_dec_blk_xway(void *ctx, u8 *dst, const u8 *src) { - serpent_dec_blk_8way(ctx, dst, src); + serpent_dec_blk_8way((struct serpent_ctx *) ctx, dst, src); } #endif -- 2.12.0