From patchwork Wed Feb 7 01:10:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10204399 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 303306037E for ; Wed, 7 Feb 2018 01:16:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2288728D8B for ; Wed, 7 Feb 2018 01:16:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 176B328D98; Wed, 7 Feb 2018 01:16:16 +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 B18D128D8B for ; Wed, 7 Feb 2018 01:16:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932317AbeBGBQN (ORCPT ); Tue, 6 Feb 2018 20:16:13 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:35280 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932316AbeBGBQM (ORCPT ); Tue, 6 Feb 2018 20:16:12 -0500 Received: by mail-io0-f194.google.com with SMTP id m11so192075iob.2; Tue, 06 Feb 2018 17:16:11 -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=F6nHLiOpbgAEhk1Qtv/HEC4m/YkImLs2j26sYBcoWzc=; b=LuBHle/GTMvkJSrfcG+U8ab31hsB+t9wm7eS8aabHfduKYRbGKzId6cfjvnd+Q1NvD VzGouiciFAr1lvPEVj+KSAPea2JWbgbR8l4UTn2FmZetgdsPngKBPZnFUHN4w4OaaMMv qFI2TZnnvzSt+aRZQRzRPAxtdceqejMGjjtZT835pk9PNdzRq4mcZL55eKPTq6RSBfN9 w3J7y9P5Cuql2I4+e6wDUnQNfcz5WWSLasBpVFJzEJ4p2mhfdpOosn+Tok+JkZ4TftDn 1Q9bWArOi8yEWJVXsectA7qzCw6AUqG5qRs4XY8Bda90yPBTemKCmBfrazXb0BrnRp9i 3iWA== 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=F6nHLiOpbgAEhk1Qtv/HEC4m/YkImLs2j26sYBcoWzc=; b=peaI+6ALBqhQgasbLnT+PIhBl36+smyR5GVr4CTCGvnFe1joRFSMGBXI3sjYSsST6N mNb7YGJLkkxb/KMJshw+Ka7nEWWXLysHNJduQVrKE2vmLWMB9qfldvkHkz3Fbc+CraNk dBItBGB9xGfDWMowCSHKC8xef0IJpu5w8k25eGwP1vX0ctDAMO3I5CoO0m05Vye9cffX b2EPy5sl2qX5UhjgBpo+eoZahI54mKZB8ncAjc+KUhIMwO4EYm+ESTb7wh5sFPG7XxhR 8L8UnwLriKVQuok4n7LFi/DZ4RPuwE7Vpu4hgi4zQkYHADxvzv5S/RoUrUAVqzFlHyIh 9SVQ== X-Gm-Message-State: APf1xPA82tZGhlq3LcFaqgiDwXQ87tkaXX/KrLykN1K5N7eGynXghSIa dY4t7IHLH5IBoVxepD7nb68= X-Google-Smtp-Source: AH8x226Nt9th3SgiJjvqu1VItPAw2OM4P3nWI2wItfr8pFQFQH/hlQSox1WcV6u4X6dFbfKSkvPmjQ== X-Received: by 10.107.130.233 with SMTP id m102mr5279231ioi.304.1517966171210; Tue, 06 Feb 2018 17:16:11 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Feb 2018 17:16:10 -0800 (PST) From: Eric Biggers To: David Howells , keyrings@vger.kernel.org Cc: linux-crypto@vger.kernel.org, Michael Halcrow , Eric Biggers Subject: [PATCH 8/9] X.509: remove dead code that set ->unsupported_sig Date: Tue, 6 Feb 2018 17:10:11 -0800 Message-Id: <20180207011012.5928-9-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 X.509 parser is guaranteed to set cert->sig->pkey_algo and cert->sig->hash_algo, since x509_note_pkey_algo() is a mandatory action in the X.509 ASN.1 grammar, and it returns an error code if an unrecognized AlgorithmIdentifier is given rather than leaving the algorithms as NULL. Therefore, remove the dead code which handled these algorithm strings being NULL. Note that cert->unsupported_sig can still be set if the hash algorithm cannot be allocated from the crypto API. Signed-off-by: Eric Biggers --- crypto/asymmetric_keys/x509_public_key.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c index 514007932ec9..1a7c63003bc6 100644 --- a/crypto/asymmetric_keys/x509_public_key.c +++ b/crypto/asymmetric_keys/x509_public_key.c @@ -34,15 +34,6 @@ int x509_get_sig_params(struct x509_certificate *cert) pr_devel("==>%s()\n", __func__); - if (!sig->pkey_algo) - cert->unsupported_sig = true; - - /* We check the hash if we can - even if we can't then verify it */ - if (!sig->hash_algo) { - cert->unsupported_sig = true; - return 0; - } - sig->s = kmemdup(cert->raw_sig, cert->raw_sig_size, GFP_KERNEL); if (!sig->s) return -ENOMEM;