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,