From patchwork Wed Feb 7 01:10:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10204395 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8CFC96037E for ; Wed, 7 Feb 2018 01:16:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F53B28D8B for ; Wed, 7 Feb 2018 01:16:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7416828D98; Wed, 7 Feb 2018 01:16:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BAAE28D8B for ; Wed, 7 Feb 2018 01:16:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932310AbeBGBQK (ORCPT ); Tue, 6 Feb 2018 20:16:10 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:34584 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932307AbeBGBQI (ORCPT ); Tue, 6 Feb 2018 20:16:08 -0500 Received: by mail-io0-f194.google.com with SMTP id c17so194543iod.1; Tue, 06 Feb 2018 17:16:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EK7srI64ZRFb1qp6HR2acCLNjtEBiMT5v3Q9p02Sqsw=; b=bPm0gasKerA8oQzFayRc6pnKkJSekSsASuLhWgJes2iq+93m3EBI0k7vObySYgNZPH uXZpqBhZy/Pk0Ghil8oMEbo/hPUQ/sh+sSdLGcjraRx/mu8PdcVcPSR0EYRgbThpOIGS XfyMLVKh8l/2NO1sKwWmvgWFoH20aPJXNDUXA2GpfR5DsSuHpJ1WgO0YG5ukpYEmuIWQ GpFEneTa5QTMmar0+9DeJ9TcvzjL5zu853rEYpNpoyDsAAMASfKwV/QmyPyBwkOlv4qD +x0zMYEKobFsjVLZ4P18lClmurP9IMbnXZydf7rpVp/50qgF1VQgIi9bJzEOqScsKK6B iiWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EK7srI64ZRFb1qp6HR2acCLNjtEBiMT5v3Q9p02Sqsw=; b=knB9GAmfENZDCqVzjQaDrOn9ipAOue6hn9BRF3VicVow1f+wDM8HRaTDfAK+DRdVtD bG43Ginjx2GgLF4ycEIfsc/YwoFsjiFH4ZboIh0ROM+ccQSV5qv5QijHcLOI/2dGuavE Wb3OhTqfLVVjnslCPKgUl82cMXP5SdV3820S/FfnrZrCug4vUb09uIM6S/BAqXk5oWKp q5b9vc2O9obNpbbpn+lrjjqbUyarK8SBgmhZuWGnKIl/H9wy8supGDoIIbljjtlW5Kaz H+/iHDAoN3kVlkjtrF8I67xY/DFRk+Y7YkMzCAdg6CfhRd0NwgCMKmlRpdTZrCB50Yjv J+hQ== X-Gm-Message-State: APf1xPC2cQ7Uohhw0hURcLOKm45J6YWnqxknhB4PpEK40kISqkoCj6KJ JLiDWan/GAu2exLBWe9XW4k= X-Google-Smtp-Source: AH8x224XSPpvHR+1ACb8bqpqC40G8Z2ucz2t61ujqLA9BFAZVyB9Fz5lqgB1MSRhshH3h7dWCavnmQ== X-Received: by 10.107.7.203 with SMTP id g72mr5389326ioi.149.1517966167652; Tue, 06 Feb 2018 17:16:07 -0800 (PST) Received: from ebiggers-linuxstation.kir.corp.google.com ([2620:15c:17:3:dc28:5c82:b905:e8a8]) by smtp.gmail.com with ESMTPSA id c9sm186364iod.5.2018.02.06.17.16.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 17:16:07 -0800 (PST) From: Eric Biggers To: David Howells , keyrings@vger.kernel.org Cc: linux-crypto@vger.kernel.org, Michael Halcrow , Eric Biggers Subject: [PATCH 6/9] PKCS#7: remove unnecessary check for NULL sinfo->sig->hash_algo Date: Tue, 6 Feb 2018 17:10:09 -0800 Message-Id: <20180207011012.5928-7-ebiggers3@gmail.com> X-Mailer: git-send-email 2.16.0.rc1.238.g530d649a79-goog In-Reply-To: <20180207011012.5928-1-ebiggers3@gmail.com> References: <20180207011012.5928-1-ebiggers3@gmail.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers The PKCS#7 parser is guaranteed to set ->sig->hash_algo for every SignerInfo, since pkcs7_sig_note_digest_algo() is a mandatory action in the PKCS#7 ASN.1 grammar, and it returns an error code if an unrecognized DigestAlgorithmIdentifier is given rather than leaving the algorithm as NULL. Therefore, remove the unnecessary NULL check. Signed-off-by: Eric Biggers --- crypto/asymmetric_keys/pkcs7_verify.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c index 97c77f66b20d..a9e03f5c52e7 100644 --- a/crypto/asymmetric_keys/pkcs7_verify.c +++ b/crypto/asymmetric_keys/pkcs7_verify.c @@ -33,9 +33,6 @@ static int pkcs7_digest(struct pkcs7_message *pkcs7, kenter(",%u,%s", sinfo->index, sinfo->sig->hash_algo); - if (!sinfo->sig->hash_algo) - return -ENOPKG; - /* Allocate the hashing algorithm we're going to need and find out how * big the hash operational data will be. */