Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp607556img; Fri, 22 Mar 2019 05:04:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3Nyv7I6nYXNO3ZpgJNbGB8p954m6uvqNtR7gvCUOuqozLvq5lPzOunJSUcvt+I62NFKG0 X-Received: by 2002:a17:902:aa92:: with SMTP id d18mr8801324plr.278.1553256270180; Fri, 22 Mar 2019 05:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553256270; cv=none; d=google.com; s=arc-20160816; b=qAmfJBLlynwWG/r14pU0inLZ4Omh73We8fgjPoh+3x3v0v6RJI1dRszN0kydg5Z2F8 CY1dq8WA62L+V7105y+lhA6YTJq7LVkguABzahR4tQvZyCMAL+P5aAR5YuA2eMXSGmNu hhUeXJuK8Vp40wIkcCLnDnM4JmBg+KNB7eo/fWxEqR7m1WbNwNoybqWNg8GE/5wgnkYs vaaRgjvj9GmQmtMxF5rGCmSdmBaDhqI7rdbNsfAjKmAx++D7c1303Iygk07jnIBlASTt Tn7vZSJUJHbK308EKeB3SiAerk3PAIMBZlNmtDGblAOLRpUtkl+UCnEGdA6B4pEkH3QY liYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6jOLPudtWmRR58rF1/mXG+AJTA88OOB2eu82VlvimM4=; b=dGBNoPFMMOYB7a2XN1WlHEw5NbEad0/18LvWUCBM5D/vtBjzAalJxLdFOJAOTRwtzx Ue6Qx/Z7LwUdMJhxxY3Amh23SVvgfbTRih7JbMvH/2XzCfwlKPwrw1AunyqUtLbbz0m4 2EDbJpOf0ofk3jtQNWVKi4xF3v/AAjggw29Kt+Z860tK7Kv6474trOZGYleKxVC+FR02 eV51rIWr65s56JkIhk0/UePda1dZX/stqLwOrgBqOXrjIzCD9u6rJWtQvNvuUPTWGTRV 08utXCuaXRo/+bb91QmcCzkhmbg5RPHlWKe1MC3MxtVXxDxwmcMPMenNiRP01ZsWFA2S WOGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HlG1E5J+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f40si7304289plb.339.2019.03.22.05.04.14; Fri, 22 Mar 2019 05:04:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HlG1E5J+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388048AbfCVMC5 (ORCPT + 99 others); Fri, 22 Mar 2019 08:02:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:41222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388124AbfCVMC4 (ORCPT ); Fri, 22 Mar 2019 08:02:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0940B204FD; Fri, 22 Mar 2019 12:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553256175; bh=oHrfIO7Oo8zUZHRHEswT/b2HUYERA8VpXw78MHvOXR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HlG1E5J+ygx8QEC+420swfEzbmdJjWnW7Ib8hj883oyMid6We8LPr7bIvtOcONkgo +gDJNsWUO18HTWk5ShOs9s6ek4qdCrCT5vvKVsKgAVsISB8DVdUKfecOftys8M6C1u S5m8NpKLQpQZDB89E44QrSS/xA2mWBf5wdq4WG5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Herbert Xu Subject: [PATCH 4.19 131/280] crypto: testmgr - skip crc32c context test for ahash algorithms Date: Fri, 22 Mar 2019 12:14:44 +0100 Message-Id: <20190322111316.692405274@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111306.356185024@linuxfoundation.org> References: <20190322111306.356185024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Biggers commit eb5e6730db98fcc4b51148b4a819fa4bf864ae54 upstream. Instantiating "cryptd(crc32c)" causes a crypto self-test failure because the crypto_alloc_shash() in alg_test_crc32c() fails. This is because cryptd(crc32c) is an ahash algorithm, not a shash algorithm; so it can only be accessed through the ahash API, unlike shash algorithms which can be accessed through both the ahash and shash APIs. As the test is testing the shash descriptor format which is only applicable to shash algorithms, skip it for ahash algorithms. (Note that it's still important to fix crypto self-test failures even for weird algorithm instantiations like cryptd(crc32c) that no one would really use; in fips_enabled mode unprivileged users can use them to panic the kernel, and also they prevent treating a crypto self-test failure as a bug when fuzzing the kernel.) Fixes: 8e3ee85e68c5 ("crypto: crc32c - Test descriptor context format") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- crypto/testmgr.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1894,14 +1894,21 @@ static int alg_test_crc32c(const struct err = alg_test_hash(desc, driver, type, mask); if (err) - goto out; + return err; tfm = crypto_alloc_shash(driver, type, mask); if (IS_ERR(tfm)) { + if (PTR_ERR(tfm) == -ENOENT) { + /* + * This crc32c implementation is only available through + * ahash API, not the shash API, so the remaining part + * of the test is not applicable to it. + */ + return 0; + } printk(KERN_ERR "alg: crc32c: Failed to load transform for %s: " "%ld\n", driver, PTR_ERR(tfm)); - err = PTR_ERR(tfm); - goto out; + return PTR_ERR(tfm); } do { @@ -1928,7 +1935,6 @@ static int alg_test_crc32c(const struct crypto_free_shash(tfm); -out: return err; }