From patchwork Sun Oct 29 20:48:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri John Ledkov X-Patchwork-Id: 159414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1850267vqb; Sun, 29 Oct 2023 13:48:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIMGOAUC83vNxhs8zKW2ys4d+a7a+mjj+DUpN8VE31oreWz6stth0S4pY9HV+Ld2Eu/NDa X-Received: by 2002:a05:6808:aba:b0:3b2:ec37:da9e with SMTP id r26-20020a0568080aba00b003b2ec37da9emr9604036oij.55.1698612530476; Sun, 29 Oct 2023 13:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698612530; cv=none; d=google.com; s=arc-20160816; b=jfiDuvmDqgA6c/Z/HWPIR0eB4NhPYporVeqfEeBmiAxxNMPmLYyVZ/55L5shtaDyC6 bzcTIjkekYnGjs4zCYw/SRONkyGF/hHnPZI+n5QXS+6NMekoffWwfd+usZ6Re6qnKokO 0stl/C94XXe9zGkNMtlxuXIQKWwL6keUNyywl8O90gnXWcDutfgqdfsJCy+k1nfxTLGb EIDXZd76zsdbNy14WIuhiSR/9qlZL0VPE912yCGkWP/tRWNTn9h/8mfecD4KZ7BSSDJP dLFEipNFoSmultfSF+5JHL8M8NBWcvjU7f0pjk9/dya7vbWNuiphuPISygsSn3O3Cd8j Uh2Q== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=kX0qGSlIN+myPQHKGzUHfDf+7TPtp+Gi684hQoqwER0=; fh=GbauwlMJ5/XUYlmlVXsHUtFD6YE/+ncF76Wc5tNLmY0=; b=W56cECYq9rucrZcXqxqJOY27FBwsbeKR+FLONijo2NEm0G6X5zv/8+0Iimoh4bXaxk lmqDzDT3BT68YQexmK8qekvdEcM+kBu92vrWXervnTZ+e73Eb6yFfPLG4cxdtSS0Sga/ aINM083iCD5jysY+Sw0AaEz4MU7ogUMNnaTYv13xJtII1wob8eBceChVFTjzBGhSGYSU cvpvUizmh8xDDyh5EbCHHYfKvP1JQCk78YYbgVu4Sflur5QsWls0eO1Ky0B2miSvdrZX C0orv7g4zsEO1JE9ODsXJ6kz6+U1KcUxNKvgtCLIYnfSOMVkKFpRoclf+5aR3Z6W+1jG lawA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="lA1yE/m/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id c7-20020a056a00008700b006b7037ffaf7si3959991pfj.128.2023.10.29.13.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="lA1yE/m/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B6CD480A8B65; Sun, 29 Oct 2023 13:48:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230300AbjJ2Usl (ORCPT + 30 others); Sun, 29 Oct 2023 16:48:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230292AbjJ2Usi (ORCPT ); Sun, 29 Oct 2023 16:48:38 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9554AF for ; Sun, 29 Oct 2023 13:48:35 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id B2D533F36A for ; Sun, 29 Oct 2023 20:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1698612513; bh=kX0qGSlIN+myPQHKGzUHfDf+7TPtp+Gi684hQoqwER0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=lA1yE/m/IX92nKIvDWfudyyeKUxBo2Jk6w3EOgQkfIG4K6PmWel0488/KGUAv69zH 2mksmBH+EClxKsUF/IVZN8qpZqUR0Mg1o0hxzeHa/x0pKUBLM3ObtO0pTRuBZFTNIk GDLm4bKvddXH8STbKCpLK4Qm+MlDKG7SKE3ViKiMtitaYDronwY/7LwvUpEyh0B2ul vTt/JXhkaAXXuDbM/b57Uln44K1MeX8s+6AMm8xaCyNEUqb2Pz7p35lXEwfGY8Q1Rc eN7bTqyW567kukqt2+ysWYkdacEsoykIo+n0eOggEKqCTf31XE49/K8xD/kYVyRbqK N6vbshIn1m6qg== Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-32f7943913aso752499f8f.1 for ; Sun, 29 Oct 2023 13:48:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698612512; x=1699217312; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kX0qGSlIN+myPQHKGzUHfDf+7TPtp+Gi684hQoqwER0=; b=chuTyyszSF9s0Inwi65v8bIBh6kQf9I/GfcZsBb1zaf/K2nvaVLeSeZuwfRa5vIDlh 9KYGTZuntRh9SIhU1cLjjIkCn3qE5NGHrmBE2pmt8sPANY9djz99JMmHue66PnNWDOfa SZgcXkrTBAHiT4VuUhO1TaE4MdcLkH3ywcDJuvqnNXbBIfLQJ0XgbzdYxfpY3xqLm1Qr Ks9YNZ3Ey6DY8M+5h7wgOPuBt2RYB3k8frY0wfJO6fxkX9eFTnRJdP2H62/EyZVi5FvC d0zstDZelb7lWNmrkwdQza66zLvsXEiT18tYG+ZlJwWGGz4pLRGeqMcvgv6zemjR40XH Vl3w== X-Gm-Message-State: AOJu0Yxw4owpuSgvaVQG6QDqYCW6aLjxwnowZEUybZ9UzXxtsosoGOJG p1+/cCxeEy+u6Bl8YmTOjNupclvgbP1y96GuC7tqm/rQepyCO7p2AdJjqBMSpDKsl70fx5Gph8S v4XJEXoSiIbnOrpR7Al/DcrPpkxJK9Au3FqFaLOaJLHxMTwX26Kge+Ag= X-Received: by 2002:a5d:6051:0:b0:32d:a4c4:f700 with SMTP id j17-20020a5d6051000000b0032da4c4f700mr5575135wrt.38.1698612512450; Sun, 29 Oct 2023 13:48:32 -0700 (PDT) X-Received: by 2002:a5d:6051:0:b0:32d:a4c4:f700 with SMTP id j17-20020a5d6051000000b0032da4c4f700mr5575127wrt.38.1698612512143; Sun, 29 Oct 2023 13:48:32 -0700 (PDT) Received: from localhost ([2001:67c:1560:8007::aac:c15c]) by smtp.gmail.com with ESMTPSA id u9-20020a5d6ac9000000b0032d687fd9d0sm6599715wrw.19.2023.10.29.13.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:48:31 -0700 (PDT) From: Dimitri John Ledkov To: Herbert Xu , "David S. Miller" , Stephan Mueller Cc: simo@redhat.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] crypto: drbg - ensure most preferred type is FIPS health checked Date: Sun, 29 Oct 2023 22:48:20 +0200 Message-Id: <20231029204823.663930-1-dimitri.ledkov@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 29 Oct 2023 13:48:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781124332562268922 X-GMAIL-MSGID: 1781124332562268922 drbg supports multiple types of drbg, and multiple parameters of each. Health check sanity only checks one drbg of a single type. One can enable all three types of drbg. And instead of checking the most preferred algorithm (last one wins), it is currently checking first one instead. Update ifdef to ensure that healthcheck prefers HMAC, over HASH, over CTR, last one wins, like all other code and functions. Fixes: 541af946fe ("crypto: drbg - SP800-90A Deterministic Random Bit Generator") Signed-off-by: Dimitri John Ledkov Reviewed-by: Stephan Mueller --- crypto/drbg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index ff4ebbc68e..2cce18dcfc 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -2018,9 +2018,11 @@ static inline int __init drbg_healthcheck_sanity(void) #ifdef CONFIG_CRYPTO_DRBG_CTR drbg_convert_tfm_core("drbg_nopr_ctr_aes128", &coreref, &pr); -#elif defined CONFIG_CRYPTO_DRBG_HASH +#endif +#ifdef CONFIG_CRYPTO_DRBG_HASH drbg_convert_tfm_core("drbg_nopr_sha256", &coreref, &pr); -#else +#endif +#ifdef CONFIG_CRYPTO_DRBG_HMAC drbg_convert_tfm_core("drbg_nopr_hmac_sha256", &coreref, &pr); #endif From patchwork Sun Oct 29 20:48:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri John Ledkov X-Patchwork-Id: 159415 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1850341vqb; Sun, 29 Oct 2023 13:49:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtU33K9vZkcIKid5g8azCvuO5uBueH8D2sdjAql5heJnY3xUeu8DW+2tdLUJ3bW6gcOZ8p X-Received: by 2002:a05:6a20:6a10:b0:16b:d853:9a10 with SMTP id p16-20020a056a206a1000b0016bd8539a10mr11433684pzk.39.1698612551259; Sun, 29 Oct 2023 13:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698612551; cv=none; d=google.com; s=arc-20160816; b=szbONsV9mBB9RumSMSeJitZHuCkt+OO+NCH16Wb2A1PcHR636GoSnQ/6L0xc833uG6 JA414FCkwdUqxQn6tDnjSbftEkdMoQcJy9Oc/7TK4N/xlzCkxwE9hkocTyuLxj+1bVdq HLcswoxQWFEfGPOjiqNM+smuEXcMOyuYhofCXpaMEYoPB0fa8/rcHskUIbKJWwmWipkF 0Q+UukkCeb70NXfrSXEQGsActNAwiadGCYr6gwEEu1EdLBjJ5sQb724AMQVTy2JdHCCc Lh14X0irmil5SQmEalSTx66ZJYSmIpl58cfq++DAU88SytyZt5hX6D5sixgDuCAcvJhN aaFg== 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:date:subject:cc:to:from :dkim-signature; bh=SH87ZmKIdF7eMR0VODUq6DUDb+J0CZk1+c70eMvKp34=; fh=GbauwlMJ5/XUYlmlVXsHUtFD6YE/+ncF76Wc5tNLmY0=; b=O5p3jVcN5BZ3kkIxbWnqqXBAP65ypZKoZhCzGgXPw7KJqEUCx02cLdV58y8Cz+e5hw v2Y1/ezle/3E3P4nP5NTiKHnRTXwuoZpXW9/QHJj3AoKwsfHnbp40NfXKnP6ymnYpVBe J+Noc/cio078EvAEyg4ibnSe3JEo9ytqOlAEqMuUMPHVqMtxAOVcNgp5AbBMbOEp64qU YVtFUUYPq6mI9tv2A8mffWxvSpmXjiAJyYxWXV/gkJYHe8M2RFjVL8eLTTCxEHm5u6Ho Izqi2DEBq2/0bWExUsyPu1htE+b3j0angPJrslkD7pkzDaeSZByE2dohYOJmXthHPOPz tp8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=a4yP+dDL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id f22-20020a635556000000b005b81f21a25csi4013523pgm.830.2023.10.29.13.49.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=a4yP+dDL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 52635806302D; Sun, 29 Oct 2023 13:49:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230432AbjJ2Usw (ORCPT + 30 others); Sun, 29 Oct 2023 16:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbjJ2Uso (ORCPT ); Sun, 29 Oct 2023 16:48:44 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92071C4 for ; Sun, 29 Oct 2023 13:48:41 -0700 (PDT) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id F39D53F36A for ; Sun, 29 Oct 2023 20:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1698612517; bh=SH87ZmKIdF7eMR0VODUq6DUDb+J0CZk1+c70eMvKp34=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a4yP+dDLtTWpzjKncI0+02tYIy+9ovORaYZC7yn/dZiHSJI8pyewFc0b3SWN86oAA WfJK+kIrI7ePw8MbriTv2wlU5ZjyLhW0Jju3q7/4iwhVDfhUcwAkWrgJ/B/UFJc4NZ f7IL8pKQ0+2QxG7kwCXvS5UfxFIml4IV9KhTwTDbxppP7Nh+9MwzY249eCXfPf9dqP L3TLsHO/rRGdZ4yZ6sOKLiAteGDqGYwZ+trbrf0cO/htD3uKDoK08MU5XoTqtY3bNA CCMPZdt5wBNupdghX2pw1Bvi9D105hV7wPVECjgFTGmo+WUIAKSareyTYbRuq7S6HR t6CQxo4tDVl0Q== Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4083c9b426fso26809625e9.2 for ; Sun, 29 Oct 2023 13:48:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698612515; x=1699217315; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SH87ZmKIdF7eMR0VODUq6DUDb+J0CZk1+c70eMvKp34=; b=Wmix6XUPqzBk9a3j2Mhgj/7wiiHhw+hyVxZdJopGS7UgiV/eUnw46oTin/Tb6Dp+4L IUJjdv80xdfpy6FnYckC46BZ6/xw5l/CBx25zeT/Xui87ANZF0OkP+F8KfwWmwWqb8An D/RagP5q1NpD1vrGaPTMEjyxcn3Sanj83e77O6whUrNrqv5aw/xOV9xjFWysSSj9XcW6 /4PDdztxzaxX2D1WBAht6J6IrIGYpwSQlliCeCeMxZYnz47RdqazoRnwpuYe5KNTpTff 5ENWac4GmRrMYHlk0U4a/H9ZPWPbOrwQmJltIwsKDalGTObkYShwPF7lmAzXDNuzMJCd N+pA== X-Gm-Message-State: AOJu0YzJrclVDH6WuhkiylutWMumqDsEcHYiWXV7viQL3G+Us3TgTBk0 bfhC8uSXLRO5ZrWPzR8q1MmmyfNM8ZljQ85Vr/Zk4Els34WTrMZFObHrmP2frnZkX0RkTyshekE tyB+ra733A0RvN0w8tR3OHML0oYGqpL11GDUTa8bf8g== X-Received: by 2002:a05:600c:3ca4:b0:405:36d7:4582 with SMTP id bg36-20020a05600c3ca400b0040536d74582mr7000437wmb.15.1698612515193; Sun, 29 Oct 2023 13:48:35 -0700 (PDT) X-Received: by 2002:a05:600c:3ca4:b0:405:36d7:4582 with SMTP id bg36-20020a05600c3ca400b0040536d74582mr7000424wmb.15.1698612514721; Sun, 29 Oct 2023 13:48:34 -0700 (PDT) Received: from localhost ([2001:67c:1560:8007::aac:c15c]) by smtp.gmail.com with ESMTPSA id o13-20020a05600c510d00b003fe15ac0934sm4346423wms.1.2023.10.29.13.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:48:34 -0700 (PDT) From: Dimitri John Ledkov To: Herbert Xu , "David S. Miller" , Stephan Mueller Cc: simo@redhat.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] crypto: drbg - update FIPS CTR self-checks to aes256 Date: Sun, 29 Oct 2023 22:48:21 +0200 Message-Id: <20231029204823.663930-2-dimitri.ledkov@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231029204823.663930-1-dimitri.ledkov@canonical.com> References: <20231029204823.663930-1-dimitri.ledkov@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 29 Oct 2023 13:49:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781124354645458897 X-GMAIL-MSGID: 1781124354645458897 When originally drbg was introduced FIPS self-checks for all types but CTR were using the most preferred parameters for each type of DRBG. Update CTR self-check to use aes256. Fixes: 541af946fe ("crypto: drbg - SP800-90A Deterministic Random Bit Generator") Signed-off-by: Dimitri John Ledkov Reviewed-by: Stephan Mueller --- crypto/drbg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index 2cce18dcfc..b120e2866b 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1478,8 +1478,8 @@ static int drbg_generate(struct drbg_state *drbg, err = alg_test("drbg_pr_hmac_sha256", "drbg_pr_hmac_sha256", 0, 0); else if (drbg->core->flags & DRBG_CTR) - err = alg_test("drbg_pr_ctr_aes128", - "drbg_pr_ctr_aes128", 0, 0); + err = alg_test("drbg_pr_ctr_aes256", + "drbg_pr_ctr_aes256", 0, 0); else err = alg_test("drbg_pr_sha256", "drbg_pr_sha256", 0, 0); @@ -2017,7 +2017,7 @@ static inline int __init drbg_healthcheck_sanity(void) return 0; #ifdef CONFIG_CRYPTO_DRBG_CTR - drbg_convert_tfm_core("drbg_nopr_ctr_aes128", &coreref, &pr); + drbg_convert_tfm_core("drbg_nopr_ctr_aes256", &coreref, &pr); #endif #ifdef CONFIG_CRYPTO_DRBG_HASH drbg_convert_tfm_core("drbg_nopr_sha256", &coreref, &pr); From patchwork Sun Oct 29 20:48:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri John Ledkov X-Patchwork-Id: 159416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1850425vqb; Sun, 29 Oct 2023 13:49:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYb76zN13d+ji/oXNb0Gj7DB2PN/RmAWOXYjrE9o/rgjo/L+WhBB4EEFz0+bt6+D2aN2Y8 X-Received: by 2002:a05:6300:8083:b0:16b:9541:85e6 with SMTP id ap3-20020a056300808300b0016b954185e6mr9992789pzc.60.1698612570213; Sun, 29 Oct 2023 13:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698612570; cv=none; d=google.com; s=arc-20160816; b=kMYD/dlYsL3K4f+2OPGLzO24/ihOCZ9WbJ8ZpU+Snne5MpCVpqmm7qeV0OVVsO3ci+ g+9Kx4vzxMIXBbg1hGaNbDjiOa+8daCHVel75QsMcKvAHjtKB1R+ov7IsBtjUcfNGg/v DJuCT3r8ECqhrNWxzSyftS9OtE45ZD7j3pAh5MmqdQvfiE/s0AyI2SjRrWS8HXe6cMKs PQMFbn+Z4USnDBBmAw7P5iDkdWgusRREA/B+4xBM1l9DuohcUaFOxVQIfTFoac1EPBBa RYQj5n54/vaV+7YrHw0l68dqE9gg7tVq+ehwV+CR2FY2OTUQukeM8ZczC2jY+N1sucnk O2aA== 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:date:subject:cc:to:from :dkim-signature; bh=D+t9WK33ZVldEiPiicjGvkN9bUf9a57a5jRCbansvZI=; fh=vuLyyPVb2Mo4AAl5/uguxnQsONgP2iWW1OJKGUZe0Ck=; b=z1OUZD1veIRoNylOPTR24HlQhl/dR17ud2NnkCKJdoatRTbXOVFFD0nfxln8HGzJhK /jiXhSkAdaIeKcNSdoIukY3Z8p7OVxo9XJvxWWSs23ib544DsEJOjs6r5tcDDpU8Uisl i/v3c9j1iq+aqE9FvoZoUB/PrLrRwlbjw8AWaqWFWqfiGkkRFkAsQfk7QzjMM1aRd9F4 hgPnXAZ8vrKxnEYPq6b3ikLEootQW01kQkSVYuXhMg40dXByprStprXC6M2D/kv2gfU6 v56nc6/348lGWM+C3Lbdjv3sV0LikXZEu19oMEZ5Bfb+guK0XSPF6NBSJMtccemt8pZa 4+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="c07/edfi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id az1-20020a056a02004100b005ab6142f1b7si4063085pgb.785.2023.10.29.13.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:49:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b="c07/edfi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 0FF65808A34D; Sun, 29 Oct 2023 13:49:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230393AbjJ2Us6 (ORCPT + 30 others); Sun, 29 Oct 2023 16:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbjJ2Ust (ORCPT ); Sun, 29 Oct 2023 16:48:49 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEFBD3 for ; Sun, 29 Oct 2023 13:48:43 -0700 (PDT) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id EE2A13FB55 for ; Sun, 29 Oct 2023 20:48:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1698612519; bh=D+t9WK33ZVldEiPiicjGvkN9bUf9a57a5jRCbansvZI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=c07/edfiEaEi4fICDlTO2MFm46LEO1mbir3n97LwlBCLUS5ihJwoCCVMjzO+AChLK brh8ZIDE8WwqnpNHKg6svh8QH4SGzyeepgRgIPUYZaq6hDVGAb6PaT+m+/qPwPlDjM qKGcSSgJBiwoiQPdSwnbbxnx31A1iegL8cEwEO8NKIiym3sVuPlPCPHjqUKt4b46m/ lXUtPyn1ZHM1nXckMHk0cMU+h5ZUi8DUQhZDLk2oUQ1dAOdPGi2OvNmutmxseUz7ut AiXxo4tiNnQ63o6U7KNnk906R4EznoJXvTodatL2i3XK7Ziz2XJhdQukmdVLYBh5Yq KtQnG9jx8j2zQ== Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40920512cd3so27733725e9.1 for ; Sun, 29 Oct 2023 13:48:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698612517; x=1699217317; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D+t9WK33ZVldEiPiicjGvkN9bUf9a57a5jRCbansvZI=; b=ZvZmAFKzfbFJO6fdjpj+IiQbVvfK6YohlJTxkm1+FXAi/uD4XVlVjQPlsK0TJ9MAqM pg88tjUBCrzjhwj17qP4cAzH56xy5kbCrHPHh6/KWDPaFM8Tdt1R8BzPYTMckpOFLdtG ElirchjcHsRk2atiUAzG6lEthmU10mrQyDLqKpTjmbWCVTtYFucWApo5PzLiswzpSfCw HmjqvIIOcg1o9eLn+PVgZj6J+vEvlag+GdRboCHOAlmFLGNOCYeelBkuws+VQh3MzyTs PSNOuN+Y/ZQkpcDG4X5lJQSPb+48U7XA6jhXIdYgQzfPKuGkhe0Px5SM+54hkatywoKV XaUw== X-Gm-Message-State: AOJu0YwrVYtt52cgjFWEWJgciSipiOF5wfLsQJPsfPIbDBJhQ32Gug7i hQnK5YJ5bn9h3t2bhzYig/bNLD464HYkK78T5yq5lxmVlj1FW4b1OPySdhIyFOZNs+VjOqxUg2u nDi+iZSIQ/CclfL7RMlq0ySEFUXc8W5kbcKFnnPeADQ== X-Received: by 2002:a05:6000:186c:b0:32f:7c4a:4f28 with SMTP id d12-20020a056000186c00b0032f7c4a4f28mr3694528wri.65.1698612517404; Sun, 29 Oct 2023 13:48:37 -0700 (PDT) X-Received: by 2002:a05:6000:186c:b0:32f:7c4a:4f28 with SMTP id d12-20020a056000186c00b0032f7c4a4f28mr3694518wri.65.1698612517100; Sun, 29 Oct 2023 13:48:37 -0700 (PDT) Received: from localhost ([2001:67c:1560:8007::aac:c15c]) by smtp.gmail.com with ESMTPSA id y2-20020adffa42000000b0032f7f4089b7sm3382079wrr.43.2023.10.29.13.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:48:36 -0700 (PDT) From: Dimitri John Ledkov To: Herbert Xu , "David S. Miller" , simo Sorce , =?utf-8?q?Stephan_M=C3=BCller?= Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] crypto: drbg - ensure drbg hmac sha512 is used in FIPS selftests Date: Sun, 29 Oct 2023 22:48:22 +0200 Message-Id: <20231029204823.663930-3-dimitri.ledkov@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231029204823.663930-1-dimitri.ledkov@canonical.com> References: <20231029204823.663930-1-dimitri.ledkov@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 29 Oct 2023 13:49:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781124374786560088 X-GMAIL-MSGID: 1781124374786560088 Update code comment, self test & healthcheck to use HMAC SHA512, instead of HMAC SHA256. These changes are in dead-code, or FIPS enabled code-paths only and have not effect on usual kernel builds. On systems booting in FIPS mode that has the effect of switch sanity selftest to HMAC sha512 based (which has been the default DRBG). Fixes: 9b7b94683a ("crypto: DRBG - switch to HMAC SHA512 DRBG as default DRBG") Signed-off-by: Dimitri John Ledkov Reviewed-by: Stephan Mueller --- crypto/drbg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index b120e2866b..99666193d9 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -111,9 +111,9 @@ * as stdrng. Each DRBG receives an increasing cra_priority values the later * they are defined in this array (see drbg_fill_array). * - * HMAC DRBGs are favored over Hash DRBGs over CTR DRBGs, and - * the SHA256 / AES 256 over other ciphers. Thus, the favored - * DRBGs are the latest entries in this array. + * HMAC DRBGs are favored over Hash DRBGs over CTR DRBGs, and the + * HMAC-SHA512 / SHA256 / AES 256 over other ciphers. Thus, the + * favored DRBGs are the latest entries in this array. */ static const struct drbg_core drbg_cores[] = { #ifdef CONFIG_CRYPTO_DRBG_CTR @@ -1475,8 +1475,8 @@ static int drbg_generate(struct drbg_state *drbg, int err = 0; pr_devel("DRBG: start to perform self test\n"); if (drbg->core->flags & DRBG_HMAC) - err = alg_test("drbg_pr_hmac_sha256", - "drbg_pr_hmac_sha256", 0, 0); + err = alg_test("drbg_pr_hmac_sha512", + "drbg_pr_hmac_sha512", 0, 0); else if (drbg->core->flags & DRBG_CTR) err = alg_test("drbg_pr_ctr_aes256", "drbg_pr_ctr_aes256", 0, 0); @@ -2023,7 +2023,7 @@ static inline int __init drbg_healthcheck_sanity(void) drbg_convert_tfm_core("drbg_nopr_sha256", &coreref, &pr); #endif #ifdef CONFIG_CRYPTO_DRBG_HMAC - drbg_convert_tfm_core("drbg_nopr_hmac_sha256", &coreref, &pr); + drbg_convert_tfm_core("drbg_nopr_hmac_sha512", &coreref, &pr); #endif drbg = kzalloc(sizeof(struct drbg_state), GFP_KERNEL); From patchwork Sun Oct 29 20:48:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri John Ledkov X-Patchwork-Id: 159417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1850426vqb; Sun, 29 Oct 2023 13:49:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERskQcue9QwB+cdZ6Dahv+NX0WiXucEt/3Jk2XQS19LO+zGdoMCS5+fM60kYjwdk/XuJfl X-Received: by 2002:a05:6359:2c44:b0:168:e9e5:b407 with SMTP id qv4-20020a0563592c4400b00168e9e5b407mr7410444rwb.10.1698612570403; Sun, 29 Oct 2023 13:49:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698612570; cv=none; d=google.com; s=arc-20160816; b=OigA/djDcn+Td2eHwiugwshuRguKdQDuwEWD3Ot8Z10OvWAYObE/4X2yA0bn9OHZl5 AViZAd5FrMS6F2L2kIP/sUGwrT8BzjpkZBGPZQjmxcOKg1LRlZwqCxRL1bASe+97ycJ0 CSPUsOEHZC8l3xhNhf63hcwa5lBmXqrHZmBeTSEtsO7IMaQ7sVpnF4xN4NQJ2EzmjrPP SBqa3MQCKhetPLUyw6iUL1fzlTM69kaKG1IEJ+gWA6PKIncgA3KrSeS6xzq44KIWOqmA StoaY3tX6VA+LC1RyMYSGZ+X1vzt/t8bcqSwR94yZP0e1lrX7WoZVp8tFn9hGEmBoreG ZUdw== 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:date:subject:cc:to:from :dkim-signature; bh=CZ05zwSbIcchFahU+bSausQMNazT3la51HxfbHwy+5I=; fh=yNi5tEefWKQy/hclREs/lauyKy99OJ9RGdDQhrfBp/k=; b=oG9FDV4SMjfj6v4YYGgXvJv8cNgFefEcNq0wbLF5SDAlzX1oF+cMmhL90/77Obl2ZJ Fv0yg0AWVReKA57CGT0cPYkKBxatT+EFdK5+SK5HPfK0lxeljASiA3Iro9oKL3nFMjSc 6odeTimLnTEqbr3aM2X9K8QwqwhL5VmdHsGklj1pmZ9ddNK0efrFSV80kZcKUg3WSkUg AweiPqYOHfd2MUqUfxO7Y1wFEg1woR2L30mRv0BU1jyGfwPuh6bbspE6xqBDYMmIz0x4 G2uLxTSWEHAX0ThW2cgnzytZX+H7h/IGDhsafkgVpT/1/IE87YrLuIZyYUbctYSdgIX1 jitQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ier4G94A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h1-20020a17090a130100b002800c1493c5si3941506pja.29.2023.10.29.13.49.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:49:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=ier4G94A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id F15868059348; Sun, 29 Oct 2023 13:49:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbjJ2UtC (ORCPT + 30 others); Sun, 29 Oct 2023 16:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230360AbjJ2Ust (ORCPT ); Sun, 29 Oct 2023 16:48:49 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB4FD9 for ; Sun, 29 Oct 2023 13:48:43 -0700 (PDT) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 0A05F420BF for ; Sun, 29 Oct 2023 20:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1698612522; bh=CZ05zwSbIcchFahU+bSausQMNazT3la51HxfbHwy+5I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ier4G94AnYhfTlDAHRKNE2GKW7x+MPhU/zOeUXgPJQkWo5yRVEN9AytyXB6v64aWa n4I/kVvy98gGB78fYXJJfNfCUVO9oFC9hrk+8JlkmFZYdvYdIx83N7LJsTquKkh/V8 BDLWB9Gc+OYby84N5DaTBGvlDZ5h4G9Ap5i6DpYTMzgsPLeXPyW3Z+MVgUtkjWyp7b BmtQmW7Yq3QyNh7fqzmnm1VV/aRQWxIKzp7m3jC/bMmUec4h9YSaBJ/30B0IUW0b2a ybh2QproHXFsfwGQSSRGO/4EYbsV2FbvfOzuNKbiNmWq5t+KJAXIT1uGyuK5i4Gb4q VpqhB2q5VigtA== Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-30e4943ca7fso1805962f8f.3 for ; Sun, 29 Oct 2023 13:48:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698612520; x=1699217320; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CZ05zwSbIcchFahU+bSausQMNazT3la51HxfbHwy+5I=; b=IMK4Xwq9fesMgwhW9ElZS3TEbuMxmPhLAYgEcb1NsVZS3MdxRsF6qowugvlwm/PooN cO3W3KCMPu9li0VtttsN3W+YyNEZ+SEs8fwDukLc+6yO0dzmKnaPJLfCEyhZN+z7ivlN QaS3z7IxYnluIN2s7W0ItE65bZYbSZdx3GQI3Z+uUAWkNIJA0/xk7Aaj87BtiZwzkoCR jrdZ6CCEChJlbBKbcNHGYxK4l/Vkz4q2A+nKHeWJQf6dr4E3oC/WiiZs9uuDmjihB2AV usrkLSH3T+Q+fv6JxsOXmUB6Z6FvryWb2V0I44ASJqBIHja1kWiAjA/yCeq0zcliXONo lNiQ== X-Gm-Message-State: AOJu0YwT01lPIRWuDa5PzCjOEUa75v1Fnh3kS2itPdjr9DUC9sNsWZZV uOkTeDCWOy3vQC3A1lOu22T3zGmkFf8qFCn+D6+Mdwiyw/pcd0/wCFdEATUP4FcFaN2JrAgkdW6 2N3CqOiKr7uRmHEl8NDw1R0+pgK4F/0whqde3MqTDpQ== X-Received: by 2002:adf:e881:0:b0:32d:7162:7ffe with SMTP id d1-20020adfe881000000b0032d71627ffemr6439300wrm.69.1698612520289; Sun, 29 Oct 2023 13:48:40 -0700 (PDT) X-Received: by 2002:adf:e881:0:b0:32d:7162:7ffe with SMTP id d1-20020adfe881000000b0032d71627ffemr6439283wrm.69.1698612520054; Sun, 29 Oct 2023 13:48:40 -0700 (PDT) Received: from localhost ([2001:67c:1560:8007::aac:c15c]) by smtp.gmail.com with ESMTPSA id d2-20020adff842000000b0032d9a1f2ec3sm6661495wrq.27.2023.10.29.13.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:48:39 -0700 (PDT) From: Dimitri John Ledkov To: Herbert Xu , "David S. Miller" , Maxime Coquelin , Alexandre Torgue Cc: simo@redhat.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] crypto: drbg - Remove SHA1 from drbg Date: Sun, 29 Oct 2023 22:48:23 +0200 Message-Id: <20231029204823.663930-4-dimitri.ledkov@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231029204823.663930-1-dimitri.ledkov@canonical.com> References: <20231029204823.663930-1-dimitri.ledkov@canonical.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 29 Oct 2023 13:49:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781124374789271746 X-GMAIL-MSGID: 1781124374789271746 SP800-90C 3rd draft states that SHA-1 will be removed from all specifications, including drbg by end of 2030. Given kernels built today will be operating past that date, start complying with upcoming requirements. No functional change, as SHA-256 / SHA-512 based DRBG have always been the preferred ones. Signed-off-by: Dimitri John Ledkov Reviewed-by: Stephan Mueller --- crypto/drbg.c | 16 ---------------- crypto/testmgr.c | 25 ++++--------------------- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index 99666193d9..bccadaedcf 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -139,12 +139,6 @@ static const struct drbg_core drbg_cores[] = { #endif /* CONFIG_CRYPTO_DRBG_CTR */ #ifdef CONFIG_CRYPTO_DRBG_HASH { - .flags = DRBG_HASH | DRBG_STRENGTH128, - .statelen = 55, /* 440 bits */ - .blocklen_bytes = 20, - .cra_name = "sha1", - .backend_cra_name = "sha1", - }, { .flags = DRBG_HASH | DRBG_STRENGTH256, .statelen = 111, /* 888 bits */ .blocklen_bytes = 48, @@ -166,12 +160,6 @@ static const struct drbg_core drbg_cores[] = { #endif /* CONFIG_CRYPTO_DRBG_HASH */ #ifdef CONFIG_CRYPTO_DRBG_HMAC { - .flags = DRBG_HMAC | DRBG_STRENGTH128, - .statelen = 20, /* block length of cipher */ - .blocklen_bytes = 20, - .cra_name = "hmac_sha1", - .backend_cra_name = "hmac(sha1)", - }, { .flags = DRBG_HMAC | DRBG_STRENGTH256, .statelen = 48, /* block length of cipher */ .blocklen_bytes = 48, @@ -648,8 +636,6 @@ MODULE_ALIAS_CRYPTO("drbg_pr_hmac_sha384"); MODULE_ALIAS_CRYPTO("drbg_nopr_hmac_sha384"); MODULE_ALIAS_CRYPTO("drbg_pr_hmac_sha256"); MODULE_ALIAS_CRYPTO("drbg_nopr_hmac_sha256"); -MODULE_ALIAS_CRYPTO("drbg_pr_hmac_sha1"); -MODULE_ALIAS_CRYPTO("drbg_nopr_hmac_sha1"); /* update function of HMAC DRBG as defined in 10.1.2.2 */ static int drbg_hmac_update(struct drbg_state *drbg, struct list_head *seed, @@ -768,8 +754,6 @@ MODULE_ALIAS_CRYPTO("drbg_pr_sha384"); MODULE_ALIAS_CRYPTO("drbg_nopr_sha384"); MODULE_ALIAS_CRYPTO("drbg_pr_sha256"); MODULE_ALIAS_CRYPTO("drbg_nopr_sha256"); -MODULE_ALIAS_CRYPTO("drbg_pr_sha1"); -MODULE_ALIAS_CRYPTO("drbg_nopr_sha1"); /* * Increment buffer diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 216878c8bc..209b21ef79 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4849,14 +4849,6 @@ static const struct alg_test_desc alg_test_descs[] = { .suite = { .drbg = __VECS(drbg_nopr_ctr_aes256_tv_template) } - }, { - /* - * There is no need to specifically test the DRBG with every - * backend cipher -- covered by drbg_nopr_hmac_sha256 test - */ - .alg = "drbg_nopr_hmac_sha1", - .fips_allowed = 1, - .test = alg_test_null, }, { .alg = "drbg_nopr_hmac_sha256", .test = alg_test_drbg, @@ -4865,7 +4857,10 @@ static const struct alg_test_desc alg_test_descs[] = { .drbg = __VECS(drbg_nopr_hmac_sha256_tv_template) } }, { - /* covered by drbg_nopr_hmac_sha256 test */ + /* + * There is no need to specifically test the DRBG with every + * backend cipher -- covered by drbg_nopr_hmac_sha512 test + */ .alg = "drbg_nopr_hmac_sha384", .test = alg_test_null, }, { @@ -4875,10 +4870,6 @@ static const struct alg_test_desc alg_test_descs[] = { .suite = { .drbg = __VECS(drbg_nopr_hmac_sha512_tv_template) } - }, { - .alg = "drbg_nopr_sha1", - .fips_allowed = 1, - .test = alg_test_null, }, { .alg = "drbg_nopr_sha256", .test = alg_test_drbg, @@ -4910,10 +4901,6 @@ static const struct alg_test_desc alg_test_descs[] = { .alg = "drbg_pr_ctr_aes256", .fips_allowed = 1, .test = alg_test_null, - }, { - .alg = "drbg_pr_hmac_sha1", - .fips_allowed = 1, - .test = alg_test_null, }, { .alg = "drbg_pr_hmac_sha256", .test = alg_test_drbg, @@ -4929,10 +4916,6 @@ static const struct alg_test_desc alg_test_descs[] = { .alg = "drbg_pr_hmac_sha512", .test = alg_test_null, .fips_allowed = 1, - }, { - .alg = "drbg_pr_sha1", - .fips_allowed = 1, - .test = alg_test_null, }, { .alg = "drbg_pr_sha256", .test = alg_test_drbg,