From patchwork Mon Jul 11 21:57:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 9224331 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 7D7A660760 for ; Mon, 11 Jul 2016 21:57:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F90927E15 for ; Mon, 11 Jul 2016 21:57:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6414E27F0B; Mon, 11 Jul 2016 21:57:35 +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=-6.9 required=2.0 tests=BAYES_00,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 24CD427E15 for ; Mon, 11 Jul 2016 21:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752646AbcGKV5d (ORCPT ); Mon, 11 Jul 2016 17:57:33 -0400 Received: from mga09.intel.com ([134.134.136.24]:30424 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751880AbcGKV5d (ORCPT ); Mon, 11 Jul 2016 17:57:33 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP; 11 Jul 2016 14:57:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,348,1464678000"; d="scan'208";a="137460369" Received: from mjmartin-nuc01.wa.intel.com ([10.232.97.131]) by fmsmga004.fm.intel.com with ESMTP; 11 Jul 2016 14:57:32 -0700 From: Mat Martineau To: linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, dhowells@redhat.com Cc: Mat Martineau , petkan@mip-labs.com, zohar@linux.vnet.ibm.com Subject: [PATCH] KEYS: Do not trust certs with missing auth IDs Date: Mon, 11 Jul 2016 14:57:29 -0700 Message-Id: <20160711215729.18614-1-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.9.0 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP restrict_link_by_signature should return -ENOKEY (no matching parent certificate found) if the certificate being evaluated has no authority key identifiers, instead of bypassing signature checks and returning 0 (new certificate accepted). Reported-by: Petko Manolov Signed-off-by: Mat Martineau --- crypto/asymmetric_keys/restrict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/asymmetric_keys/restrict.c b/crypto/asymmetric_keys/restrict.c index ac4bddf..19d1afb9 100644 --- a/crypto/asymmetric_keys/restrict.c +++ b/crypto/asymmetric_keys/restrict.c @@ -87,7 +87,7 @@ int restrict_link_by_signature(struct key *trust_keyring, sig = payload->data[asym_auth]; if (!sig->auth_ids[0] && !sig->auth_ids[1]) - return 0; + return -ENOKEY; if (ca_keyid && !asymmetric_key_id_partial(sig->auth_ids[1], ca_keyid)) return -EPERM;