Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1826467pxb; Wed, 2 Feb 2022 13:26:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJypaZGSU9foo9MOjotGbhE85SJX9XO08CV9UNAJ0talkhTkG8Pnuz8bmvayQY2Mv5z1jEOZ X-Received: by 2002:aa7:9566:: with SMTP id x6mr31422442pfq.21.1643837169369; Wed, 02 Feb 2022 13:26:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643837169; cv=none; d=google.com; s=arc-20160816; b=x74Ssa8RZBVljnOMzTWT/OGYbYdSxOJni6jNfnF6AlKYbm+t8mCpqAPf/ymD8Wdd+B yq4ohI88N2yaD0ii0iQusyU7DUir329pyT4n51ZjTjN99nP4yUR5yfmJNvG1KgUkTwdv Ctr7QWLpj6pALtVwrN90KVhXwm9yTQbvHvE2DGpdGZZ80wimgCfGBTOiWcWPFPvHQ1xS V9nFCYdr5N5qInAuLD84u0/+hX+Ak30pg3OegLX1Ia6Mi8Me5U3vu+/QNOVpmF+y9R3W nl5hsURN9PRWdudRUZfsXkozMFjurSXHgOnIWCR7q3bZa9iiSbVSnkRUW+Lmb25R5+j8 oAqQ== 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=6JCjciFJ6jd3Md6jXeMSjhZSDTkzmsyBTrCQq/76wSo=; b=RpxhVOnDWWSPAxc1JZEInRUmDW6rdRxuFEjEBUQFCZUcV7v0C7PpD8usJHeiiXzRnA thZOGeP7Xw6SFcVlSpEaTKRpmacCaIbzO+V9llUpYz048zpnJYo59Jcoux1Yn207XJ1d rz3GPriUJP4wsuipXuVKBjPUVkV9YRXhStUzdkFezVj/7gyKDJ0/OJiZJY11D6tOWvMr Zrc+YTeHmLPK3eUglwoL9dIWm/FOWKmwaxlwVjsBwiiIJpXvI94Ywuu6ET6RVq4fA4kG kZUBYXfTwyNKqydOgB/5TkYIh7NGLaKAmj9izMKkDvyeZuFkheDjCAGg8AsngmzkQ0w8 xxog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chronox.de header.s=strato-dkim-0002 header.b=tUBCgigb; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi13si7221465pjb.58.2022.02.02.13.25.26; Wed, 02 Feb 2022 13:26:09 -0800 (PST) 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=@chronox.de header.s=strato-dkim-0002 header.b=tUBCgigb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231712AbiBAImL (ORCPT + 99 others); Tue, 1 Feb 2022 03:42:11 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([81.169.146.165]:41631 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234940AbiBAImL (ORCPT ); Tue, 1 Feb 2022 03:42:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1643704926; s=strato-dkim-0002; d=chronox.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Cc:Date: From:Subject:Sender; bh=6JCjciFJ6jd3Md6jXeMSjhZSDTkzmsyBTrCQq/76wSo=; b=tUBCgigbOg34TWuqEm8g6utHDTFlAcD3R6gLY4xxZyPSYbir4+uvkQ71fwa/OB7XNq 2unrp7RWOB8ieV1KHNp6c0azpXxjDXrNWSvebhvXVXSprqebhDyui4kYOZ3MU/i1LIw8 p6ZQLAYcxK6eDtSVXMkadUrhbZdK6axURiAG4xHwE9BMH57D69PORi+KMCL5hFN8xoXc Ai6tRy41JRoj+qKR9e7QgFVyxJSEVRhxxMLaCoLmPBAIwce6D4DoNWACd13J5S46yqxB z6joThGh1hPA9e8FFvUPAXAqW2daaEOnLxa43QWEebVid9si8giSdKoU2vBXdmcvU/B9 p1Lw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P2ERcEykfu11Y98lp/T7+hdri+uKZK8TKWEqNyiHySGSa9k9zW8BKRp5UFiyGZZ4jof7Xg==" X-RZG-CLASS-ID: mo00 Received: from positron.chronox.de by smtp.strato.de (RZmta 47.39.0 AUTH) with ESMTPSA id z28df7y118g63Jq (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 1 Feb 2022 09:42:06 +0100 (CET) From: Stephan =?ISO-8859-1?Q?M=FCller?= To: Herbert Xu Cc: linux-crypto@vger.kernel.org, Niolai Stange , Simo Sorce Subject: [PATCH v2 1/2] crypto: HMAC - add fips_skip support Date: Tue, 01 Feb 2022 09:40:58 +0100 Message-ID: <2682841.vuYhMxLoTh@positron.chronox.de> In-Reply-To: <4609802.vXUDI8C0e8@positron.chronox.de> References: <2075651.9o76ZdvQCi@positron.chronox.de> <4609802.vXUDI8C0e8@positron.chronox.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org By adding the support for the flag fips_skip, hash / HMAC test vectors may be marked to be not applicable in FIPS mode. Such vectors are silently skipped in FIPS mode. Signed-off-by: Stephan Mueller --- crypto/testmgr.c | 3 +++ crypto/testmgr.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 5831d4bbc64f..26674570ea72 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1854,6 +1854,9 @@ static int __alg_test_hash(const struct hash_testvec *vecs, } for (i = 0; i < num_vecs; i++) { + if (fips_enabled && vecs[i].fips_skip) + continue; + err = test_hash_vec(&vecs[i], i, req, desc, tsgl, hashstate); if (err) goto out; diff --git a/crypto/testmgr.h b/crypto/testmgr.h index a253d66ba1c1..17b37525f289 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -33,6 +33,7 @@ * @ksize: Length of @key in bytes (0 if no key) * @setkey_error: Expected error from setkey() * @digest_error: Expected error from digest() + * @fips_skip: Skip the test vector in FIPS mode */ struct hash_testvec { const char *key; @@ -42,6 +43,7 @@ struct hash_testvec { unsigned short ksize; int setkey_error; int digest_error; + bool fips_skip; }; /* -- 2.33.1