From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757197AbcBCPqz (ORCPT ); Wed, 3 Feb 2016 10:46:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40142 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757063AbcBCPqy (ORCPT ); Wed, 3 Feb 2016 10:46:54 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <1453322001.9549.7.camel@linux.vnet.ibm.com> References: <1453322001.9549.7.camel@linux.vnet.ibm.com> <20160119113026.23238.4498.stgit@warthog.procyon.org.uk> <20160119113049.23238.92240.stgit@warthog.procyon.org.uk> To: Mimi Zohar Cc: dhowells@redhat.com, linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, petkan@mip-labs.com, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 03/20] X.509: Allow X.509 certs to be blacklisted [ver #2] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <25814.1454514412.1@warthog.procyon.org.uk> Date: Wed, 03 Feb 2016 15:46:52 +0000 Message-ID: <25815.1454514412@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mimi Zohar wrote: > > Allow X.509 certs to be blacklisted based on their TBS hash. > > What is the TBS hash? This doesn't seem to be the key identifier. It's the TBSCertificate hash (I'll change to calling it that in the patch description). "TBS" stands for "To Be Signed". This is what is hashed for the signature to be generated upon - so it's something we have to expend resources calculating anyway. The reason I'm using this is this is what UEFI puts into its blacklist. See: http://uefi.blogspot.co.uk/2013/09/uefi-24-review-part-13-hash-of.html To quote: Now, in the UEFI 2.4 specification, three new types of signatures for the black list were added. Specifically, the various recommended forms of the To-Be-Signed hash value (160, 256 and 512-bits) which are created during the creation of a certificate could be added to the black list instead of the certificate itself. > The cert associated with this key identifier is loaded onto the .ima > keyring. We could also check that. There's no requirement that we only check the TBS - but the TBS hash is something we must check. I wonder if I should mark the blacklist key as to what the value it holds should be checked against. There's a number of different things we could put in there: (1) TBSCertificate hash. (2) Subject Key Identifier content. (3) Authenticode Binary hash (for PE files). (4) PKCS#7 component digest. > eg: openssl x509 -in -inform DER -notext -out > > > > X509v3 extensions: > X509v3 Subject Key Identifier: > > 71:12:39:B3:AB:E6:8D:BF:70:E7:26:DE:C8:4A:3F:5F:17:EF:00:6C Note that this isn't a mandatory field and if it's not present, we have no way to calculate it as there's no one standard-defined method. David