Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2942384rwi; Tue, 11 Oct 2022 16:03:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57pq59WD1wlwftRZl3RWMvtSMZRf/4RHiMM3fkiB0GE22G51+qkyRn6RTissArG1Q1LZ5i X-Received: by 2002:a17:90a:c258:b0:20b:23d5:8eb2 with SMTP id d24-20020a17090ac25800b0020b23d58eb2mr1609185pjx.85.1665529387095; Tue, 11 Oct 2022 16:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665529387; cv=none; d=google.com; s=arc-20160816; b=rhflcye/tXWUTpwTb5Q6jDKOglPL1gdx8RLJff/daoRhxmGyGQaWRXsUe670k1yPPp fe6dLeCVEZRNqZeyOqo1K4AfHKdpAUPU0doNOQJyGtqCFY2eDSq+9z66TJtHoxtjZT0x WZkXSgNkkA986PXqg3Mu4N6BcPdG56PupujI+rLNjoS9reE2xRYIjV/Ar291IDLWVecl uGCABVJ4KWH1+UEgzEMbjOIkTRG8uT54YRA+VJzz6F50Hk0tBM93wXiACr5YjwxQHiMV oYxbf1N5/FsR4HJTYlBX4GG/D6M7QbwaSslwvOITGYsf5quGwOf4zlZWEj818U6A+SNb nwVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=VwPTXPyue1Iwyo3nMwIU0O5/kb5ACm9LWgfhy4EE16w=; b=dZ9w1QXvPegvEn3BLaMYUJi98hfxM6lcg+44h0aAt9qCTE0SyWrPw9ruBEaEuEuFHp W0T6Hd5HxH18SnobI4G9qgSTd/BttawEOLN2qZxcRiwEv1bdoWvNT3LPKZAnFX3okSiY 8jcMEnGps6+hGo8rZfIwuGVy4kTCHxM1shky4Xo6zACd3nWpzE3Hh6Z1eEUa18iCOd22 2qam8/+3zp3n2fXmYNk/07HRuf8uozpC8Dl+/ZfnFQoNOmt6WlqIy5yr2OobBSDnwIfY +q0FnGDal6/hxfUe7Ftz3E1sram4QUlLnOnfCf3lYEQRcXTGe04Fln+US3rY/KOTi9uK onRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AJFptayV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg10-20020a17090b1e0a00b00200919a55b1si244857pjb.180.2022.10.11.16.02.42; Tue, 11 Oct 2022 16:03:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AJFptayV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229595AbiJKXCA (ORCPT + 99 others); Tue, 11 Oct 2022 19:02:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbiJKXB5 (ORCPT ); Tue, 11 Oct 2022 19:01:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59A9B95E63; Tue, 11 Oct 2022 16:01:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5E2E8B817F6; Tue, 11 Oct 2022 23:01:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9723CC433D6; Tue, 11 Oct 2022 23:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665529308; bh=gCI+X2WOw4l6GrJak35sDaAf8gDE0fXgutS5wo82m0c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AJFptayVxOqteJVOLykn7hUdHTEFBSFYdPDnURZs6EbQ5lnc5EDwMPEWLIY2Zkc6k ToDJ69GFb03nJ1ZHa3Bu1XZh90AT8husNifCGxqExcBTtq73zRbzdbLGz1yV1PS0BR YgADbRNTz4kaxl1FPtL5h69IOLIEA3uAgLFu6LoZOj6vAhrzGGJogNzed4iTNoQ9kU RplOVmj/pT0WrloWUBcPNyJldLUtdrL9BReJJkpTFUke93m8zD4dIphjguaBr6M6BU xC/9Fc6Zmo9mtTlbNcRQZT+mur3mj5hpEnCkCHrxZUfVSrUfpxEhWQqxTOA+fraPtq COtQHCYR1WDtw== Date: Tue, 11 Oct 2022 16:01:44 -0700 From: Jakub Kicinski To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Andreas Noever , Andrew Morton , Andy Shevchenko , Borislav Petkov , Catalin Marinas , Christoph =?UTF-8?B?QsO2aG13YWxkZXI=?= , Christoph Hellwig , Christophe Leroy , Daniel Borkmann , Dave Airlie , Dave Hansen , "David S . Miller" , Eric Dumazet , Florian Westphal , Greg Kroah-Hartman , "H . Peter Anvin" , Heiko Carstens , Helge Deller , Herbert Xu , Huacai Chen , Hugh Dickins , "James E . J . Bottomley" , Jan Kara , Jason Gunthorpe , Jens Axboe , Johannes Berg , Jonathan Corbet , Jozsef Kadlecsik , KP Singh , Kees Cook , Marco Elver , Mauro Carvalho Chehab , Michael Ellerman , Pablo Neira Ayuso , Paolo Abeni , Peter Zijlstra , Richard Weinberger , Russell King , Theodore Ts'o , Thomas Bogendoerfer , Thomas Gleixner , Thomas Graf , Ulf Hansson , Vignesh Raghavendra , WANG Xuerui , Will Deacon , Yury Norov , dri-devel@lists.freedesktop.org, kasan-dev@googlegroups.com, kernel-janitors@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-crypto@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-media@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org, linux-parisc@vger.kernel.org, linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org, linux-um@lists.infradead.org, linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v6 0/7] treewide cleanup of random integer usage Message-ID: <20221011160144.1c0dc2af@kernel.org> In-Reply-To: <20221010230613.1076905-1-Jason@zx2c4.com> References: <20221010230613.1076905-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, 10 Oct 2022 17:06:06 -0600 Jason A. Donenfeld wrote: > - If you want a secure or an insecure random u64, use get_random_u64(). > - If you want a secure or an insecure random u32, use get_random_u32(). > * The old function prandom_u32() has been deprecated for a while now > and is just a wrapper around get_random_u32(). Same for > get_random_int(). > - If you want a secure or an insecure random u16, use get_random_u16(). > - If you want a secure or an insecure random u8, use get_random_u8(). > - If you want secure or insecure random bytes, use get_random_bytes(). > * The old function prandom_bytes() has been deprecated for a while now > and has long been a wrapper around get_random_bytes(). > - If you want a non-uniform random u32, u16, or u8 bounded by a certain > open interval maximum, use prandom_u32_max(). > * I say "non-uniform", because it doesn't do any rejection sampling or > divisions. Hence, it stays within the prandom_* namespace. Acked-by: Jakub Kicinski