From patchwork Fri Jan 10 14:54:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327515 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B760F921 for ; Fri, 10 Jan 2020 14:54:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CCAC208E4 for ; Fri, 10 Jan 2020 14:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668071; bh=OapWlM0NT2oWFg9ccevrJMFxMg+uoR7Qv4AhxUgzBaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gwu57ZG2+/o/04y8ifkqAur7QjvVSxaa3qVCdyP0N83rcD3BLVJZEZgMwgndxap2t /W+X80s4waG5yfBpWg1fMuDs4WrVzHH+s6ZAjZt4LaAJaiknRANhqDqJbvHqMOeMo0 XvvOsI4Sd7tkLZmDh1QYL8oTF2qzp2vRkDFibOzI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728184AbgAJOya (ORCPT ); Fri, 10 Jan 2020 09:54:30 -0500 Received: from foss.arm.com ([217.140.110.172]:45786 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728239AbgAJOya (ORCPT ); Fri, 10 Jan 2020 09:54:30 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DD80BDA7; Fri, 10 Jan 2020 06:54:29 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 680B73F6C4; Fri, 10 Jan 2020 06:54:29 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Richard Henderson , Mark Brown Subject: [PATCH v2 01/10] x86: Remove arch_has_random, arch_has_random_seed Date: Fri, 10 Jan 2020 14:54:13 +0000 Message-Id: <20200110145422.49141-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson Use the expansion of these macros directly in arch_get_random_*. These symbols are currently part of the generic archrandom.h interface, but are currently unused and can be removed. Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- arch/x86/include/asm/archrandom.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/archrandom.h b/arch/x86/include/asm/archrandom.h index af45e1452f09..feb59461046c 100644 --- a/arch/x86/include/asm/archrandom.h +++ b/arch/x86/include/asm/archrandom.h @@ -73,10 +73,6 @@ static inline bool rdseed_int(unsigned int *v) return ok; } -/* Conditional execution based on CPU type */ -#define arch_has_random() static_cpu_has(X86_FEATURE_RDRAND) -#define arch_has_random_seed() static_cpu_has(X86_FEATURE_RDSEED) - /* * These are the generic interfaces; they must not be declared if the * stubs in are to be invoked, @@ -86,22 +82,22 @@ static inline bool rdseed_int(unsigned int *v) static inline bool arch_get_random_long(unsigned long *v) { - return arch_has_random() ? rdrand_long(v) : false; + return static_cpu_has(X86_FEATURE_RDRAND) ? rdrand_long(v) : false; } static inline bool arch_get_random_int(unsigned int *v) { - return arch_has_random() ? rdrand_int(v) : false; + return static_cpu_has(X86_FEATURE_RDRAND) ? rdrand_int(v) : false; } static inline bool arch_get_random_seed_long(unsigned long *v) { - return arch_has_random_seed() ? rdseed_long(v) : false; + return static_cpu_has(X86_FEATURE_RDSEED) ? rdseed_long(v) : false; } static inline bool arch_get_random_seed_int(unsigned int *v) { - return arch_has_random_seed() ? rdseed_int(v) : false; + return static_cpu_has(X86_FEATURE_RDSEED) ? rdseed_int(v) : false; } extern void x86_init_rdrand(struct cpuinfo_x86 *c); From patchwork Fri Jan 10 14:54:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327517 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E0556C1 for ; Fri, 10 Jan 2020 14:54:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1380C20880 for ; Fri, 10 Jan 2020 14:54:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668074; bh=/jsajZNOWeSDY/g9QWa169FaWCLDFCqOyxId+l59GWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ISsag30YW/CTLvck4fludhSQNv2ZVJGaCwHrz6hREV492jYAdtop9axgyedjAdIOS 8XVl1o87xGSxvvmCBkB7QS2KPPZ6qsTa5P74H5B1RrejKTRMIiGEfk8U8mCG4NAUgg 3snAfiM3bVWU8QOmUC9C5xQj1a1tS0ZMOvHSyhVs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728270AbgAJOyd (ORCPT ); Fri, 10 Jan 2020 09:54:33 -0500 Received: from foss.arm.com ([217.140.110.172]:45806 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728137AbgAJOyc (ORCPT ); Fri, 10 Jan 2020 09:54:32 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 02DCD1063; Fri, 10 Jan 2020 06:54:32 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 81E6F3F6C4; Fri, 10 Jan 2020 06:54:31 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Richard Henderson , Mark Brown Subject: [PATCH v2 02/10] powerpc: Remove arch_has_random, arch_has_random_seed Date: Fri, 10 Jan 2020 14:54:14 +0000 Message-Id: <20200110145422.49141-3-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson These symbols are currently part of the generic archrandom.h interface, but are currently unused and can be removed. Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- arch/powerpc/include/asm/archrandom.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h index a09595f00cab..2fa7cdfbba24 100644 --- a/arch/powerpc/include/asm/archrandom.h +++ b/arch/powerpc/include/asm/archrandom.h @@ -34,16 +34,6 @@ static inline int arch_get_random_seed_int(unsigned int *v) return rc; } - -static inline int arch_has_random(void) -{ - return 0; -} - -static inline int arch_has_random_seed(void) -{ - return !!ppc_md.get_random_seed; -} #endif /* CONFIG_ARCH_RANDOM */ #ifdef CONFIG_PPC_POWERNV From patchwork Fri Jan 10 14:54:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327521 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BFC1921 for ; Fri, 10 Jan 2020 14:54:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21979208E4 for ; Fri, 10 Jan 2020 14:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668076; bh=KzaQYbV/8zJ3VSV4vQSDYaZ90AXgub98Uz3z1rO75Sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=w2wzlFCtbR+ZOiBVPemevk4ZT7NYj0lcUIIxeRC3aFou141T7bNcH0ZH6MXozjVO2 IlsiJ7gSPdxci60OeOEQdQyr+hADIgRrwfEmXxOlTec8G7GPWxT3v1G1YGsA7DwV72 Lkjy0KeLVCvdqDthFO+cpYZKl+mRNyQMKEx4JJkE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728264AbgAJOyf (ORCPT ); Fri, 10 Jan 2020 09:54:35 -0500 Received: from foss.arm.com ([217.140.110.172]:45824 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728121AbgAJOye (ORCPT ); Fri, 10 Jan 2020 09:54:34 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1B2F9106F; Fri, 10 Jan 2020 06:54:34 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 99FF03F6C4; Fri, 10 Jan 2020 06:54:33 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Richard Henderson , Mark Brown Subject: [PATCH v2 03/10] s390: Remove arch_has_random, arch_has_random_seed Date: Fri, 10 Jan 2020 14:54:15 +0000 Message-Id: <20200110145422.49141-4-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson These symbols are currently part of the generic archrandom.h interface, but are currently unused and can be removed. Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- arch/s390/include/asm/archrandom.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/arch/s390/include/asm/archrandom.h b/arch/s390/include/asm/archrandom.h index c67b82dfa558..9a6835137a16 100644 --- a/arch/s390/include/asm/archrandom.h +++ b/arch/s390/include/asm/archrandom.h @@ -21,18 +21,6 @@ extern atomic64_t s390_arch_random_counter; bool s390_arch_random_generate(u8 *buf, unsigned int nbytes); -static inline bool arch_has_random(void) -{ - return false; -} - -static inline bool arch_has_random_seed(void) -{ - if (static_branch_likely(&s390_arch_random_available)) - return true; - return false; -} - static inline bool arch_get_random_long(unsigned long *v) { return false; From patchwork Fri Jan 10 14:54:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327523 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC2DA921 for ; Fri, 10 Jan 2020 14:54:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90E802146E for ; Fri, 10 Jan 2020 14:54:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668077; bh=ViOktEQfPeyL9ULZ7ZNFDRBnZeCYxoWxar371Wbv7Rw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zyUwFjVzDwNMyADfLO1UHpEbz28CygpVqnMOEctMUzcfYyVfPNGuzpwCnXT83dDIP M+vt8VaVKdW1AmrUBSCYhOmOpJTasqvM3CgJN2E7g9kgL3oTyRBijTQC67ns+a+D3l HzCn1TBTi2I/Bz/OksWH2gdsBm+eMDOjQC4hD1Ro= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728290AbgAJOyg (ORCPT ); Fri, 10 Jan 2020 09:54:36 -0500 Received: from foss.arm.com ([217.140.110.172]:45844 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728239AbgAJOyg (ORCPT ); Fri, 10 Jan 2020 09:54:36 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 36B5930E; Fri, 10 Jan 2020 06:54:36 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B58393F6C4; Fri, 10 Jan 2020 06:54:35 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Richard Henderson , Mark Brown Subject: [PATCH v2 04/10] linux/random.h: Remove arch_has_random, arch_has_random_seed Date: Fri, 10 Jan 2020 14:54:16 +0000 Message-Id: <20200110145422.49141-5-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson The arm64 version of archrandom.h will need to be able to test for support and read the random number without preemption, so a separate query predicate is not practical. Since this part of the generic interface is unused, remove it. Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- include/linux/random.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/linux/random.h b/include/linux/random.h index f189c927fdea..7fd0360908d2 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -175,10 +175,6 @@ static inline bool arch_get_random_int(unsigned int *v) { return 0; } -static inline bool arch_has_random(void) -{ - return 0; -} static inline bool arch_get_random_seed_long(unsigned long *v) { return 0; @@ -187,10 +183,6 @@ static inline bool arch_get_random_seed_int(unsigned int *v) { return 0; } -static inline bool arch_has_random_seed(void) -{ - return 0; -} #endif /* Pseudo random number generator from numerical recipes. */ From patchwork Fri Jan 10 14:54:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327545 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D92C6C1 for ; Fri, 10 Jan 2020 14:54:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7264F2087F for ; Fri, 10 Jan 2020 14:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668096; bh=yE3X7yiSJVPul5S39YxaKBL1oHAWWRlJFIqiGlCzp1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=128BVP8/t9pCZBlSJtYQNOUOg8LIX2ukPzVcoRt5c3DSotIuc//tSyEjM9BX9mr7S s51/ZB5ABB4gM8qOA30U1hxBZPOeRUVBNq/+VBO38c4d+qQyNVs0bgdKyGTF1yHW/5 t3FJpbaR0rgoaZLW3zlJh8fW8PZtxG2daVzWm9vs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728331AbgAJOyj (ORCPT ); Fri, 10 Jan 2020 09:54:39 -0500 Received: from foss.arm.com ([217.140.110.172]:45862 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727993AbgAJOyi (ORCPT ); Fri, 10 Jan 2020 09:54:38 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 506BD11B3; Fri, 10 Jan 2020 06:54:38 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D0A1B3F6C4; Fri, 10 Jan 2020 06:54:37 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Richard Henderson , Mark Brown Subject: [PATCH v2 05/10] linux/random.h: Use false with bool Date: Fri, 10 Jan 2020 14:54:17 +0000 Message-Id: <20200110145422.49141-6-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson Keep the generic fallback versions in sync with the other architecture specific implementations and use the proper name for false. Suggested-by: Ard Biesheuvel Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- include/linux/random.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/random.h b/include/linux/random.h index 7fd0360908d2..ea0e2f5f1ec5 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -169,19 +169,19 @@ static inline void prandom_seed_state(struct rnd_state *state, u64 seed) #else static inline bool arch_get_random_long(unsigned long *v) { - return 0; + return false; } static inline bool arch_get_random_int(unsigned int *v) { - return 0; + return false; } static inline bool arch_get_random_seed_long(unsigned long *v) { - return 0; + return false; } static inline bool arch_get_random_seed_int(unsigned int *v) { - return 0; + return false; } #endif From patchwork Fri Jan 10 14:54:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327527 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E4236C1 for ; Fri, 10 Jan 2020 14:54:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D1B02080D for ; Fri, 10 Jan 2020 14:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668083; bh=3cKwbEURD9AamSw8fdKJHapl/5iEIprR7s4ixPws5kE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=s2bB6k8XozqYqCwhP7HuFgTx6EAQdADtW6lDkuiNGUwQ70/tAE1rJyLnZ9QFE1bNX j9Z10Uvw/7p2GGd9vGTdx2ENBY2O5KuDRsRVErpjY+6d/B5cfsPPyCj09UqenZ1HB5 7Dfb3H3JRp1rqVV192rCp4mUXzRVsLEf6YVV9tCY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728362AbgAJOyl (ORCPT ); Fri, 10 Jan 2020 09:54:41 -0500 Received: from foss.arm.com ([217.140.110.172]:45888 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728358AbgAJOyl (ORCPT ); Fri, 10 Jan 2020 09:54:41 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D516413D5; Fri, 10 Jan 2020 06:54:40 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DBB33F6C4; Fri, 10 Jan 2020 06:54:40 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Richard Henderson , Mark Brown Subject: [PATCH v2 06/10] linux/random.h: Mark CONFIG_ARCH_RANDOM functions __must_check Date: Fri, 10 Jan 2020 14:54:18 +0000 Message-Id: <20200110145422.49141-7-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson We must not use the pointer output without validating the success of the random read. Reviewed-by: Ard Biesheuvel Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- include/linux/random.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/random.h b/include/linux/random.h index ea0e2f5f1ec5..d319f9a1e429 100644 --- a/include/linux/random.h +++ b/include/linux/random.h @@ -167,19 +167,19 @@ static inline void prandom_seed_state(struct rnd_state *state, u64 seed) #ifdef CONFIG_ARCH_RANDOM # include #else -static inline bool arch_get_random_long(unsigned long *v) +static inline bool __must_check arch_get_random_long(unsigned long *v) { return false; } -static inline bool arch_get_random_int(unsigned int *v) +static inline bool __must_check arch_get_random_int(unsigned int *v) { return false; } -static inline bool arch_get_random_seed_long(unsigned long *v) +static inline bool __must_check arch_get_random_seed_long(unsigned long *v) { return false; } -static inline bool arch_get_random_seed_int(unsigned int *v) +static inline bool __must_check arch_get_random_seed_int(unsigned int *v) { return false; } From patchwork Fri Jan 10 14:54:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327529 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C8B5921 for ; Fri, 10 Jan 2020 14:54:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B6182084D for ; Fri, 10 Jan 2020 14:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668086; bh=aMwJZ686WU+COYac3SkKSQr+JAT9g3lOGRCy09JPsSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KJVDhY9ZmrSdjMPNSG+8fOXM8mTqahfn9nSP1Cg4GTqCnSbrL1lu8L7ltykLeZLm6 TAYonUdCJAYDHncOV3BZKxsbWy7Ff6Cz8yZILqtDBku0KKMvVwH6PBYp2MxSjoQtRi USpIBFxUcgImXaWmFAnZzsfEQebcKuNc7wPNk7Lw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728378AbgAJOyp (ORCPT ); Fri, 10 Jan 2020 09:54:45 -0500 Received: from foss.arm.com ([217.140.110.172]:45914 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728374AbgAJOyn (ORCPT ); Fri, 10 Jan 2020 09:54:43 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EAF47DA7; Fri, 10 Jan 2020 06:54:42 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 762A83F6C4; Fri, 10 Jan 2020 06:54:42 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Richard Henderson , Mark Brown Subject: [PATCH v2 07/10] x86: Mark archrandom.h functions __must_check Date: Fri, 10 Jan 2020 14:54:19 +0000 Message-Id: <20200110145422.49141-8-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson We must not use the pointer output without validating the success of the random read. Reviewed-by: Ard Biesheuvel Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- arch/x86/include/asm/archrandom.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/archrandom.h b/arch/x86/include/asm/archrandom.h index feb59461046c..7a4bb1bd4bdb 100644 --- a/arch/x86/include/asm/archrandom.h +++ b/arch/x86/include/asm/archrandom.h @@ -27,7 +27,7 @@ /* Unconditional execution of RDRAND and RDSEED */ -static inline bool rdrand_long(unsigned long *v) +static inline bool __must_check rdrand_long(unsigned long *v) { bool ok; unsigned int retry = RDRAND_RETRY_LOOPS; @@ -41,7 +41,7 @@ static inline bool rdrand_long(unsigned long *v) return false; } -static inline bool rdrand_int(unsigned int *v) +static inline bool __must_check rdrand_int(unsigned int *v) { bool ok; unsigned int retry = RDRAND_RETRY_LOOPS; @@ -55,7 +55,7 @@ static inline bool rdrand_int(unsigned int *v) return false; } -static inline bool rdseed_long(unsigned long *v) +static inline bool __must_check rdseed_long(unsigned long *v) { bool ok; asm volatile(RDSEED_LONG @@ -64,7 +64,7 @@ static inline bool rdseed_long(unsigned long *v) return ok; } -static inline bool rdseed_int(unsigned int *v) +static inline bool __must_check rdseed_int(unsigned int *v) { bool ok; asm volatile(RDSEED_INT @@ -80,22 +80,22 @@ static inline bool rdseed_int(unsigned int *v) */ #ifdef CONFIG_ARCH_RANDOM -static inline bool arch_get_random_long(unsigned long *v) +static inline bool __must_check arch_get_random_long(unsigned long *v) { return static_cpu_has(X86_FEATURE_RDRAND) ? rdrand_long(v) : false; } -static inline bool arch_get_random_int(unsigned int *v) +static inline bool __must_check arch_get_random_int(unsigned int *v) { return static_cpu_has(X86_FEATURE_RDRAND) ? rdrand_int(v) : false; } -static inline bool arch_get_random_seed_long(unsigned long *v) +static inline bool __must_check arch_get_random_seed_long(unsigned long *v) { return static_cpu_has(X86_FEATURE_RDSEED) ? rdseed_long(v) : false; } -static inline bool arch_get_random_seed_int(unsigned int *v) +static inline bool __must_check arch_get_random_seed_int(unsigned int *v) { return static_cpu_has(X86_FEATURE_RDSEED) ? rdseed_int(v) : false; } From patchwork Fri Jan 10 14:54:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327539 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDA256C1 for ; Fri, 10 Jan 2020 14:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B332F2080D for ; Fri, 10 Jan 2020 14:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668092; bh=3fZXe01M1DES1nCJzaQ2syzPGlGt6/Fcr4JJpAfV2kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BggAk8yX+x9ytgJp2xEPmzi0CqmCtG2WlKUyiQxgqYQ28Z5UMIm8dTKghf8/Y+Uqn wHG1/UMQrV1nNRjXytYT3Qt1EWhILN6hGnLf74kbjNZ1LeySymDe07okMQs+cX1JAH iASCivP+vM7++sF9tyg9RM+iglRtMNZGot94tv/s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728384AbgAJOyu (ORCPT ); Fri, 10 Jan 2020 09:54:50 -0500 Received: from foss.arm.com ([217.140.110.172]:45932 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728370AbgAJOyp (ORCPT ); Fri, 10 Jan 2020 09:54:45 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0FA23142F; Fri, 10 Jan 2020 06:54:45 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8D1A53F6C4; Fri, 10 Jan 2020 06:54:44 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Richard Henderson , Mark Brown Subject: [PATCH v2 08/10] powerpc: Use bool in archrandom.h Date: Fri, 10 Jan 2020 14:54:20 +0000 Message-Id: <20200110145422.49141-9-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson The generic interface uses bool not int; match that. Reviewed-by: Ard Biesheuvel Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- arch/powerpc/include/asm/archrandom.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h index 2fa7cdfbba24..f0f16b4fc5ea 100644 --- a/arch/powerpc/include/asm/archrandom.h +++ b/arch/powerpc/include/asm/archrandom.h @@ -6,27 +6,28 @@ #include -static inline int arch_get_random_long(unsigned long *v) +static inline bool arch_get_random_long(unsigned long *v) { - return 0; + return false; } -static inline int arch_get_random_int(unsigned int *v) +static inline bool arch_get_random_int(unsigned int *v) { - return 0; + return false; } -static inline int arch_get_random_seed_long(unsigned long *v) +static inline bool arch_get_random_seed_long(unsigned long *v) { if (ppc_md.get_random_seed) return ppc_md.get_random_seed(v); - return 0; + return false; } -static inline int arch_get_random_seed_int(unsigned int *v) + +static inline bool arch_get_random_seed_int(unsigned int *v) { unsigned long val; - int rc; + bool rc; rc = arch_get_random_seed_long(&val); if (rc) From patchwork Fri Jan 10 14:54:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327541 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 63EFB6C1 for ; Fri, 10 Jan 2020 14:54:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 431DE20721 for ; Fri, 10 Jan 2020 14:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668095; bh=NnO8LD80BLQ6NMe8Vcq34YRLsH8jn+4NOHXtIyTJHKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=h4vt81KyJtG6YKYMM+jfGDmJvIlUQhXsKsoXb9xPFC5dqHQm4lyN67o1TWflXcfEN ebKTONmXcccX8a1Euu0kh0KBd90er3sH6ohEG9ZJWLGyBotDijRMRksdliwC5EVm/X dyBwoRxQ6c7sa2dgigS4Zk/uv6bTpu+AtvrZDIYw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728317AbgAJOyu (ORCPT ); Fri, 10 Jan 2020 09:54:50 -0500 Received: from foss.arm.com ([217.140.110.172]:45952 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728381AbgAJOyr (ORCPT ); Fri, 10 Jan 2020 09:54:47 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2B5271063; Fri, 10 Jan 2020 06:54:47 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A9E913F6C4; Fri, 10 Jan 2020 06:54:46 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Michael Ellerman , Ard Biesheuvel , Richard Henderson , Mark Brown Subject: [PATCH v2 09/10] powerpc: Mark archrandom.h functions __must_check Date: Fri, 10 Jan 2020 14:54:21 +0000 Message-Id: <20200110145422.49141-10-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson We must not use the pointer output without validating the success of the random read. Acked-by: Michael Ellerman Reviewed-by: Ard Biesheuvel Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- arch/powerpc/include/asm/archrandom.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/asm/archrandom.h index f0f16b4fc5ea..9a53e29680f4 100644 --- a/arch/powerpc/include/asm/archrandom.h +++ b/arch/powerpc/include/asm/archrandom.h @@ -6,17 +6,17 @@ #include -static inline bool arch_get_random_long(unsigned long *v) +static inline bool __must_check arch_get_random_long(unsigned long *v) { return false; } -static inline bool arch_get_random_int(unsigned int *v) +static inline bool __must_check arch_get_random_int(unsigned int *v) { return false; } -static inline bool arch_get_random_seed_long(unsigned long *v) +static inline bool __must_check arch_get_random_seed_long(unsigned long *v) { if (ppc_md.get_random_seed) return ppc_md.get_random_seed(v); @@ -24,7 +24,7 @@ static inline bool arch_get_random_seed_long(unsigned long *v) return false; } -static inline bool arch_get_random_seed_int(unsigned int *v) +static inline bool __must_check arch_get_random_seed_int(unsigned int *v) { unsigned long val; bool rc; From patchwork Fri Jan 10 14:54:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 11327535 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6956F921 for ; Fri, 10 Jan 2020 14:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BC3820721 for ; Fri, 10 Jan 2020 14:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578668091; bh=i1gdtXo9+DyaFORNsps4ObFPn5D/HfkaqpeoNPgfARs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZdoaAa9iXcVhHFVG4cLTepMUZEgIuoADNItfBSFJLNx70IN+yRM0LLPJ/Zy0gaYbu X8i4izJCOeVVIeGtwEBcqaFGX+Tzgl1BXnyYBQxf5ljKWepUUyBiiFm7PWlycA8mKX 4gaLvoyYwVTFjB9G+i+xxsBaFyw+qK2eeSLBCKW4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728389AbgAJOyu (ORCPT ); Fri, 10 Jan 2020 09:54:50 -0500 Received: from foss.arm.com ([217.140.110.172]:45970 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728385AbgAJOyt (ORCPT ); Fri, 10 Jan 2020 09:54:49 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 722F2106F; Fri, 10 Jan 2020 06:54:49 -0800 (PST) Received: from localhost (unknown [10.37.6.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C26D83F6C4; Fri, 10 Jan 2020 06:54:48 -0800 (PST) From: Mark Brown To: linux-arch@vger.kernel.org Cc: Richard Henderson , Borislav Petkov , linux-s390@vger.kernel.org, herbert@gondor.apana.org.au, x86@kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, Harald Freudenberger , Ard Biesheuvel , Richard Henderson , Mark Brown Subject: [PATCH v2 10/10] s390x: Mark archrandom.h functions __must_check Date: Fri, 10 Jan 2020 14:54:22 +0000 Message-Id: <20200110145422.49141-11-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200110145422.49141-1-broonie@kernel.org> References: <20200110145422.49141-1-broonie@kernel.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Richard Henderson We must not use the pointer output without validating the success of the random read. Reviewed-by: Harald Freudenberger Reviewed-by: Ard Biesheuvel Signed-off-by: Richard Henderson Signed-off-by: Mark Brown --- arch/s390/include/asm/archrandom.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/s390/include/asm/archrandom.h b/arch/s390/include/asm/archrandom.h index 9a6835137a16..de61ce562052 100644 --- a/arch/s390/include/asm/archrandom.h +++ b/arch/s390/include/asm/archrandom.h @@ -21,17 +21,17 @@ extern atomic64_t s390_arch_random_counter; bool s390_arch_random_generate(u8 *buf, unsigned int nbytes); -static inline bool arch_get_random_long(unsigned long *v) +static inline bool __must_check arch_get_random_long(unsigned long *v) { return false; } -static inline bool arch_get_random_int(unsigned int *v) +static inline bool __must_check arch_get_random_int(unsigned int *v) { return false; } -static inline bool arch_get_random_seed_long(unsigned long *v) +static inline bool __must_check arch_get_random_seed_long(unsigned long *v) { if (static_branch_likely(&s390_arch_random_available)) { return s390_arch_random_generate((u8 *)v, sizeof(*v)); @@ -39,7 +39,7 @@ static inline bool arch_get_random_seed_long(unsigned long *v) return false; } -static inline bool arch_get_random_seed_int(unsigned int *v) +static inline bool __must_check arch_get_random_seed_int(unsigned int *v) { if (static_branch_likely(&s390_arch_random_available)) { return s390_arch_random_generate((u8 *)v, sizeof(*v));