Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp4934065rwn; Mon, 12 Sep 2022 01:22:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR5N4njh1gqti3eo1fGOEW4qIjsANw61KOiyB4UtJprhvRy/nV6StZHtcLSWHX40tqlce9m1 X-Received: by 2002:a62:ce07:0:b0:540:da19:bf6d with SMTP id y7-20020a62ce07000000b00540da19bf6dmr16340406pfg.31.1662970963213; Mon, 12 Sep 2022 01:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662970963; cv=none; d=google.com; s=arc-20160816; b=wrtfI+/wEzb487ltXGwV3WDyowAu0z9ZA07RfB2PbQLo9qfqu2bs6X1qF9yR5XVokH UJ7AoY3oTXLcp8N8ZWULbleJJG4iHjTl/IubkoKxyrKSdw1AY/CjcbI0qaY1QxH6w6jZ +TGu7DmZ5IIfKxnHnFNsJpe38tg3L82esQq+zAO1UV68VMCQu1okTAS/NkKPmksTZE43 8m8fOzWHRVzI8VR+EyMVCWOBwZHJMQqL1gzKX/pnrosvQjjsDWVkmlv3+ZAaUJFYI7cU 7HvkxxcECaGOoPalAppdFfHedrOGba4nkhzBhqFGdIp7+HbA9Cb+OjHtwONu3lQG0E/C FO4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=CDUkufznVUcq+bGXOQSJ4qGZcu/ynfQLFY4lYzAs3OY=; b=aE5h8qyxs5p4n6U3bdTPzjyTY/RgHw19qgnf1upj5pSKHnUEOgXZZKTmMxXiyHwO1f sNdOzk4pwIZSx6xXOvbX/pPyFj4w5ZHFFcisyegDrKHG6gKT1xvKn3fyKLJr1tKKKN0u 2BPEEqpw4JRhS5E7vBd8iogaIRTgnJTdq4H1Gvuyn1na1Sxh5uYWVjOjVK9goe5evTBd jd+fpNPl5kp0nOPXCeNMenA+IOoL7vfRASvtIh7Iz8lLI580gMx/lPaGudWWVPKl2XFn djwM9sl7u51xyFLEgzhDvcil8oQzOjgXNtq8saZY95ezPIxwRB00z+RFu1ufKXHfTV7G Vg4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@thalesgroup.com header.s=xrt20181201 header.b=QctLluNf; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=thalesgroup.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l184-20020a6388c1000000b00438ac13d1c8si7798498pgd.410.2022.09.12.01.22.18; Mon, 12 Sep 2022 01:22:43 -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=@thalesgroup.com header.s=xrt20181201 header.b=QctLluNf; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=thalesgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229547AbiILIQV (ORCPT + 99 others); Mon, 12 Sep 2022 04:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiILIQU (ORCPT ); Mon, 12 Sep 2022 04:16:20 -0400 Received: from thsbbfxrt01p.thalesgroup.com (thsbbfxrt01p.thalesgroup.com [192.54.144.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC18725EAF for ; Mon, 12 Sep 2022 01:16:19 -0700 (PDT) Received: from thsbbfxrt01p.thalesgroup.com (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 4MQzvQ4XX8z45SX; Mon, 12 Sep 2022 10:16:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thalesgroup.com; s=xrt20181201; t=1662970578; bh=CDUkufznVUcq+bGXOQSJ4qGZcu/ynfQLFY4lYzAs3OY=; h=From:To:Subject:Date:Message-ID:Content-Transfer-Encoding: MIME-Version:From; b=QctLluNfVJNaQXZITj1bb/1CamUNagWus83RPU50JGivSqzClBk6U5znNTvWOXkpw ExsMEapftg0Zeeb6Kiye4SOwcQPX7IwNxnvfCsoxkY6s8rjG4u+8n0uLRor1bRmemf +0i2H0ej5E+NY8CHuWc0GR32/30CW3STn1pFAHW5XvQ0QN0Tc0lUf9k8Bo9SyID1M7 z6U8QaPnhsOCUTH6+ta3L60NPDLrxNKqpYbn4jTdHt3wR8F3UsFFDn5025E9CcRT/q QlTRS6c4jI3HUYyUAIVnNizrcxx4qEuTI/SSBrHUdXhn25PJYRz3RA9VrSOQ5Ur0j/ jma7khNwnAy3w== From: GROSSSCHARTNER Benjamin To: "linux-crypto@vger.kernel.org" CC: "smueller@chronox.de" Subject: drbg using jitterentropy_rng causes huge latencies Thread-Topic: drbg using jitterentropy_rng causes huge latencies Thread-Index: AdjGf84ksYXiKWw4SWePZkEAIXXeuQ== Date: Mon, 12 Sep 2022 08:16:17 +0000 Message-ID: Accept-Language: en-US, fr-FR Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-pmwin-version: 4.0.3, Antivirus-Engine: 3.85.1, Antivirus-Data: 5.95 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Hello! On an embedded board based on ARM iMX6UL we observed latencies of over 60ms= , during tests using IPsec (strongSwan), that are caused by drbg using jitter= entropy_rng. These latencies cause various problems for our system (watchdog is not trig= gered in time, loss of synchronization of our communication system,...). In the past, before commit https://github.com/torvalds/linux/commit/97f2650= e504033376e8813691cb6eccf73151676 the Jitter RNG was only used if get_random_bytes() did not have sufficient = entropy available. Before updating our kernel from 5.4.180 to 5.4.205 (but behavior of current= kernel 6.0-rc4 seems to be the same) we did not notice these latencies caused by the Jitter RNG, because it was = never actually used by our system (get_random_bytes() was always ready when seeding drbg). We need to disable the Jitter RNG, which is not possible because the config= option CRYPTO_JITTERENTROPY is selected by CRYPTO_DRBG. The usage of Jitter RNG in= drbg is only enforced in FIPS mode. So I propose to decouple these config options, as drbg does not need/enforc= e the usage of the Jitter RNG if not in FIPS mode. This would enable slower systems to use drbg without t= he latencies cause by Jitter RNG. We maintain our own set of kernel patches specific to our needs, but I thin= k that this change would also be useful for others to be able to use drbg on slower systems without jitteren= tropy_rng. Would there be any chance to get such a patch merged? Or could the Jitter RNG be optimized to not cause such latencies? Thanks, Benjamin