From patchwork Tue Nov 30 14:10:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolai Stange X-Patchwork-Id: 519434 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CE41C433FE for ; Tue, 30 Nov 2021 14:10:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231298AbhK3ONu (ORCPT ); Tue, 30 Nov 2021 09:13:50 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:44098 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbhK3ONt (ORCPT ); Tue, 30 Nov 2021 09:13:49 -0500 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-out2.suse.de (Postfix) with ESMTPS id D7BDC1FD59; Tue, 30 Nov 2021 14:10:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1638281429; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y13oGE/G5z9IyZ2aIbGAGGOs7EOkZYcay6xqoffhj9k=; b=xwteTzbwji8LovS9QRug0Hn7nY2hYXOS2DaA0+ix0XrIUehSuZdpHYZUHAnPSpC2LDZcBF oEZX32l6xuyuiIa56DkyRYtWU+JZP3eFzObIMDqgoxfKjqR1aRQRBjCHyKOyPZZGEBjqrf vR4gJfTSfxaKPz5wOWrKDEbZnFNrfSI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1638281429; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y13oGE/G5z9IyZ2aIbGAGGOs7EOkZYcay6xqoffhj9k=; b=mYR0lFWiDayu8FWGv+jdpECbqSBGLorZp2uFxQ53E6N0CekUSD0R5bsZF5GuPPg81iEWyx f/WO7TNnZypoRmBQ== 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 B7F6B13FAD; Tue, 30 Nov 2021 14:10:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RM3gK9UwpmFcLgAAMHmgww (envelope-from ); Tue, 30 Nov 2021 14:10:29 +0000 From: Nicolai Stange To: =?utf-8?q?Stephan_M=C3=BCller?= , Herbert Xu , "David S. Miller" Cc: Torsten Duwe , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolai Stange Subject: [PATCH 0/3] crypto: jitterentropy - bound collection loop Date: Tue, 30 Nov 2021 15:10:06 +0100 Message-Id: <20211130141009.6791-1-nstange@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi, the sampling loop in jent_gen_entropy() can potentially run indefinitely w/o making any forward progress, namely if only stuck samples are taken for whatever reason. There's a straight-forward way to make the entropy collection more robust, namely to terminate the loop and report an error if this happens. This patchset here implements that. Applies to herbert/cryptodev-2.6.git master. Thanks! Nicolai Nicolai Stange (3): crypto: drbg - ignore jitterentropy errors if not in FIPS mode crypto: jitter - don't limit ->health_failure check to FIPS mode crypto: jitter - quit sample collection loop upon RCT failure crypto/drbg.c | 7 +++++-- crypto/jitterentropy-kcapi.c | 6 ------ crypto/jitterentropy.c | 6 +----- crypto/jitterentropy.h | 1 - 4 files changed, 6 insertions(+), 14 deletions(-)