From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Date: Mon, 06 Jan 2020 21:58:18 +0000 Subject: Re: [PATCH v4 5/9] security: keys: trusted: Make sealed key properly interoperable Message-Id: <482ad14deb25b1323c0079fb120fdf0ffd0724b3.camel@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit List-Id: References: <20191230173802.8731-1-James.Bottomley@HansenPartnership.com> <20191230173802.8731-6-James.Bottomley@HansenPartnership.com> In-Reply-To: <20191230173802.8731-6-James.Bottomley@HansenPartnership.com> To: James Bottomley , linux-integrity@vger.kernel.org Cc: Mimi Zohar , David Woodhouse , keyrings@vger.kernel.org On Mon, 2019-12-30 at 09:37 -0800, James Bottomley wrote: > The current implementation appends a migratable flag to the end of a > key, meaning the format isn't exactly interoperable because the using > party needs to know to strip this extra byte. However, all other > consumers of TPM sealed blobs expect the unseal to return exactly the > key. Since TPM2 keys have a key property flag that corresponds to > migratable, use that flag instead and make the actual key the only > sealed quantity. This is secure because the key properties are bound > to a hash in the private part, so if they're altered the key won't > load. > > Backwards compatibility is implemented by detecting whether we're > loading a new format key or not and correctly setting migratable from > the last byte of old format keys. > > Signed-off-by: James Bottomley I'll stop review here as I'm now quite confident that in high-level this going to right direction. For remaining patches: - Be more explict with the tools. That will also give a framework to easily test the patches. - Same remarks for the code formatting as I gave to earlier. /Jarkko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF043C33C8C for ; Mon, 6 Jan 2020 21:58:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B9502146E for ; Mon, 6 Jan 2020 21:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726998AbgAFV6W (ORCPT ); Mon, 6 Jan 2020 16:58:22 -0500 Received: from mga12.intel.com ([192.55.52.136]:47591 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbgAFV6V (ORCPT ); Mon, 6 Jan 2020 16:58:21 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jan 2020 13:58:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,403,1571727600"; d="scan'208";a="422263230" Received: from ryanchev-mobl.ger.corp.intel.com ([10.252.23.147]) by fmsmga006.fm.intel.com with ESMTP; 06 Jan 2020 13:58:19 -0800 Message-ID: <482ad14deb25b1323c0079fb120fdf0ffd0724b3.camel@linux.intel.com> Subject: Re: [PATCH v4 5/9] security: keys: trusted: Make sealed key properly interoperable From: Jarkko Sakkinen To: James Bottomley , linux-integrity@vger.kernel.org Cc: Mimi Zohar , David Woodhouse , keyrings@vger.kernel.org Date: Mon, 06 Jan 2020 23:58:18 +0200 In-Reply-To: <20191230173802.8731-6-James.Bottomley@HansenPartnership.com> References: <20191230173802.8731-1-James.Bottomley@HansenPartnership.com> <20191230173802.8731-6-James.Bottomley@HansenPartnership.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On Mon, 2019-12-30 at 09:37 -0800, James Bottomley wrote: > The current implementation appends a migratable flag to the end of a > key, meaning the format isn't exactly interoperable because the using > party needs to know to strip this extra byte. However, all other > consumers of TPM sealed blobs expect the unseal to return exactly the > key. Since TPM2 keys have a key property flag that corresponds to > migratable, use that flag instead and make the actual key the only > sealed quantity. This is secure because the key properties are bound > to a hash in the private part, so if they're altered the key won't > load. > > Backwards compatibility is implemented by detecting whether we're > loading a new format key or not and correctly setting migratable from > the last byte of old format keys. > > Signed-off-by: James Bottomley I'll stop review here as I'm now quite confident that in high-level this going to right direction. For remaining patches: - Be more explict with the tools. That will also give a framework to easily test the patches. - Same remarks for the code formatting as I gave to earlier. /Jarkko