Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp832050pxb; Wed, 27 Oct 2021 13:18:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPJZ7ub9Ucqva7O2PyOlUDbOqT88Xhy8yFt/WvW0u1zrbpqkEZPEO+KqhXEkXnId5OLH7Z X-Received: by 2002:a17:906:b85a:: with SMTP id ga26mr9006203ejb.232.1635365915421; Wed, 27 Oct 2021 13:18:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635365915; cv=none; d=google.com; s=arc-20160816; b=VRw6cFPjezSNYwJ6YR+n6D2sNeTRcHd4meY1V8Ej9R0GVNOPN+Th58ELC0Q8xvjkrl SdFh/tvNzBc8p7BPwFJn2k0DA3da4F9A+fxjywy9XcXeJxed/d9JAilVhN1cOFpleYhA BpB643+Tu+m1VgDET+xV+jrLS9NvaAK7fc1dMWHoCDUoycb6zk2LPrY82W+m9LS3JN32 MMQbyYOHldhXtUt1qrTUCd43zBOrezH4W2tLpm3DD5lLUYnW4KRJeUWMMVdl8VU6i2eU PGER6C0D7deRogIOpU/2LpDIp/MhmkQouY0M/2kGzFOa3PXx1LqeM3Jia10wWtVRhlEf GHgQ== 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 :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature:dkim-signature; bh=GMgN2A9bmbMdtRlwQcHYangnfGuiIHJ49tFSvs6PWNU=; b=l2TTESLyBKLyPZQf15uQoz6F2Vf7LWiCBLtOp+vvG52665RrZLcEtSgtM7DpOKJxUz S6xdMnoaBHNbyh9oRJwCTJA5QrxOmdTYrNsuFp8C+/5Kd7h58iK+NZvBw3G3x6ZCgIMO 4+DxRSauXzE3fU3lXHcFYB5zs9rpJOO3ih6f1sFXHlr+nP8JU+2yI0PRln9v7D23D1Ax Px59Jh1OXuyp0JIO2Toau5i/Vz9ghmJ/RuAUtJE1AYLvrYF4Bw5qiA9CHVyuZa3piUxD 0nhPeMNsb66ryy2UAaJMKUTlCFHTT3oV93G1FTWI9RsKUo2XD5PqykJFOht8Gfow2J4V 73Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="Jeb72/Mj"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=6HdkBqs9; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l5si1115823ejn.84.2021.10.27.13.18.08; Wed, 27 Oct 2021 13:18:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="Jeb72/Mj"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=6HdkBqs9; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239450AbhJ0Imk (ORCPT + 99 others); Wed, 27 Oct 2021 04:42:40 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:41484 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239439AbhJ0Imj (ORCPT ); Wed, 27 Oct 2021 04:42:39 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7F276218F0; Wed, 27 Oct 2021 08:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1635324013; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GMgN2A9bmbMdtRlwQcHYangnfGuiIHJ49tFSvs6PWNU=; b=Jeb72/Mj+bAi+4FBH876ysPMOc8EOW235meNyAYbu2TNosqxTWyPg8OvtWA/XuOIuWYC1h yxTsnV5s26nWKZZyia/D3TiEc4GtGUvKfLYbKRZMCp5X0mXyA6XYg8IqO8DLfOurwA0Vm9 /3M7xaE3cNxeLWlW+SUqt5Ll8brNAgg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1635324013; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GMgN2A9bmbMdtRlwQcHYangnfGuiIHJ49tFSvs6PWNU=; b=6HdkBqs9l+N0CGtaF0ZehpcbP7GX36GexBMXr06DOIB+2b6hoZEg4jOXUvcFBTiNsA+iNe s4eAooRPPMM159DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3806713A2C; Wed, 27 Oct 2021 08:40:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MUjTC20QeWEMFAAAMHmgww (envelope-from ); Wed, 27 Oct 2021 08:40:13 +0000 From: Nicolai Stange To: Stephan =?utf-8?Q?M=C3=BCller?= Cc: Herbert Xu , "David S. Miller" , Nicolai Stange , Torsten Duwe , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/6] crypto: DRBG - improve 'nopr' reseeding References: <20211025092525.12805-1-nstange@suse.de> <2120606.3HGXcN3vsr@positron.chronox.de> Date: Wed, 27 Oct 2021 10:40:12 +0200 In-Reply-To: <2120606.3HGXcN3vsr@positron.chronox.de> ("Stephan \=\?utf-8\?Q\?M\=C3\=BCller\=22's\?\= message of "Tue, 26 Oct 2021 10:33:05 +0200") Message-ID: <87zgqurhcj.fsf@suse.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Stephan, first of all, many thanks for your prompt review! Stephan M=C3=BCller writes: > Am Montag, 25. Oktober 2021, 11:25:19 CEST schrieb Nicolai Stange: > > >> - Replace the asynchronous random_ready_callback based DRBG reseeding >> logic with a synchronous solution leveraging rng_is_initialized(). > > Could you please help me why replacing an async method with a sync method= is=20 > helpful? Which problems do you see with the async method that are allevia= ted=20 > with the swtich to the sync method? In general, an async method is more=20 > powerful, though it requires a bit more code. There is no problem with the async method (*), I just don't see any advantage over the less complex approach of doing all reseeding work synchronously from drbg_generate(). Before the change, there had been two sites taking care of reseeding: the drbg_async_seed() work handler scheduled from the random_ready_callback and drbg_generate(). After the change, all reseeding is handled at a single place only, namely drbg_generate(), which, in my opinion, makes it easier to reason about. In particular, in preparation for patch 6/6 from this series introducing yet another condition for triggering a reseed... Thanks, Nicolai (*) Except for that a wait_for_random_bytes() issued by DRBG users won't give any guarantees with respect to a subsequent drbg_generate() operation, c.f. my other mail in reply to your review on 3/6 I'm about to write in a second. As of now, there aren't any DRBG users invoking wait_for_random_bytes(), but one might perhaps consider changing that in the future. >> This >> move simplifies the code IMO and, as a side-effect, would enable DRBG >> users to rely on wait_for_random_bytes() to sync properly with >> drbg_generate(), if desired. Implemented by patches 1-5/6. >> - Make the 'nopr' DRBGs to reseed themselves every 5min from >> get_random_bytes(). This achieves at least kind of a partial prediction >> resistance over the time domain at almost no extra cost. Implemented >> by patch 6/6, the preceding patches in this series are a prerequisite >> for this. --=20 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, G= ermany (HRB 36809, AG N=C3=BCrnberg), GF: Felix Imend=C3=B6rffer