Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ffPee-0000FB-Oz for mharc-grub-devel@gnu.org; Tue, 17 Jul 2018 09:04:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ffPeY-0000EK-0A for grub-devel@gnu.org; Tue, 17 Jul 2018 09:04:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ffPeT-0001XY-Ez for grub-devel@gnu.org; Tue, 17 Jul 2018 09:04:29 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:41290) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ffPeT-0001WH-3y for grub-devel@gnu.org; Tue, 17 Jul 2018 09:04:25 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6HD4NS6018202; Tue, 17 Jul 2018 13:04:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=L3S4IFuMb4raXUKgSTwYwM40CdScNs0VLET0aeBAy6E=; b=CZV2GuTDjl06SXwo4BIn6S7S5uKgQexAk5KYasZhIy674l7jxb8xPHt00JoBGX7CVEfE tWuicdm3+Jg9TqmYf4gB5wNAtyoCMMSBa0UlLPBMZzh9ahDO56gs6R0sFaG7kJRsUeZZ AHpz/rBWCDYgLnupWj8o5A2eRfJXaXb2NVJECRRquPZCTzKmWb6uCHyEP/hB7mMTDLAY mTXDkTX9aSiv79WZKbfZvH5O/tJ3b6kUsn+fRyzvdJnbE0Y45S4fdcIAkiyEPx0ZIDxO 2ch/1Pyq2kS7teU5MROz1knQRU0QvfxV76V71SO5P96pQzqkOkd+lN74VMvy7iP1Anj6 Qw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2k7a340j1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jul 2018 13:04:22 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6HD4KOQ030101 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Jul 2018 13:04:20 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w6HD4HTg009224; Tue, 17 Jul 2018 13:04:18 GMT Received: from olila.local.net-space.pl (/10.175.168.136) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Jul 2018 06:04:17 -0700 Date: Tue, 17 Jul 2018 15:04:11 +0200 From: Daniel Kiper To: "Daniel P. Smith" Cc: Daniel Kiper , eric.snowberg@oracle.com, javierm@redhat.com, jonmccune@google.com, kanth.ghatraju@oracle.com, keng-yu.lin@hpe.com, konrad.wilk@oracle.com, leif.lindholm@linaro.org, mjg59@srcf.ucam.org, phcoder@gmail.com, philip.b.tricca@intel.com, ross.philipson@oracle.com, grub-devel@gnu.org Subject: Re: TPM support within Grub2 Message-ID: <20180717130411.GH26572@olila.local.net-space.pl> References: <20180702163508.GC1111@router-fw-old.local.net-space.pl> <20180716120612.GA12081@router-fw-old.local.net-space.pl> <671c05e8-b260-82a0-b54f-6da84f3d403b@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <671c05e8-b260-82a0-b54f-6da84f3d403b@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8956 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807170137 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 141.146.126.78 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2018 13:04:35 -0000 On Mon, Jul 16, 2018 at 12:33:42PM -0400, Daniel P. Smith wrote: > On 07/16/2018 08:06 AM, Daniel Kiper wrote: > > On Mon, Jul 02, 2018 at 06:35:08PM +0200, Daniel Kiper wrote: > >> Hi Daniel, > >> > >> On Sun, Jul 01, 2018 at 07:09:30PM -0400, Daniel P. Smith wrote: > >>> Greetings, > >>> > >>> I have a measured boot implementation I have been working on that > >>> introduces a DRTM relocator that I would like to eventually upstream. > >>> This work does rely on the ability to access a TPM 1.2 chip from within > >>> Grub2. I am aware of Matthew Garrett's pending patch to add core TPM > >>> support[1] but that is limited to UEFI environments. My target > >>> environment uses Coreboot with the TCG BIOS payload to launch the > >>> environment. For TPM support I am using code picked out of the > >>> TrustedGRUB2 fork[2]. As a precursor to upstreaming my DRTM relocator, I > >>> would like to see if I could find a way to generically introduce TPM > >>> support into Grub2 that support's Matthew's UEFI backend, TrustedGrub2's > >>> TPM 1.2 raw I/O, as well as leave a path for TPM2 raw I/O. In both > >>> implementations TPM support is include as an x86 device when in fact > >>> they can also be found in ARM devices, which is on my wish list of > >>> future devices I would like to support. With all of this in mind, I > >>> wanted to open a discussion on the best way to implement generic TPM > >>> support. In Matthew's approach TPM is implemented under > >>> grub-core/commands while TrustedGRUB2 is split between grub-core/kern > >>> and grub-core/tpm. IMHO TPM functionality should be divided into HW > >>> interfaces, TPM command processing, and higher order TPM operations. If > >>> the logic was segmented in this manner, what are other's opinions on > >>> where segments of logic should reside within the Grub2 source tree? > >>> > >>> > >>> [1] http://lists.gnu.org/archive/html/grub-devel/2017-07/msg00005.html > >>> [2] https://github.com/Rohde-Schwarz-Cybersecurity/TrustedGRUB2 > > > > In general I am not against reorganization you are mentioning above. > > Though I think that then you should rearange Matthew code and repost > > it. Of course if Matthew does not object. > > I can align Matthew's code or if he would like, he is more than welcome > to collaborate on the solution. Both options work for me. > > Another thing is the verifiers framework. It would be nice if you could > > hook your work there. Though you have to remember about other users like > > UEFI secure boot (https://lists.xen.org/archives/html/xen-devel/2017-07/msg00985.html; > > I am going to revive work on this patch) or GPG signatures. So, please > > take a look at that code at git://git.savannah.gnu.org/grub.git, > > phcoder/verifiers branch. If it works for you I will post the patches, > > with minor fixes and improvements which are worth doing, for review (of > > course if Vladimir does not object). If you discover any issues with the > > verifiers framework just drop me a line and then we will try to fix them. > > Yes, I figured I would be using the verifier framework. The only Great! > suggestion I would have based on my work is that I am going to have to > establish a TPM event log since I will be doing raw IO with the TPM. I > think it would be useful if the verifier framework had an event log > component that verifier modules could log events that they want to have > passed to the OS kernel being booted. For an example of how to pass the If you need that may I ask you to add this functionality on top of existing verifiers framework? I think that you can start your work with the branch which I posted earlier. In a week or two I will post its updated version on the list for review. > log along to the OS kernel, for TrenchBoot the plan is to pass via the > setup data boot protocol field of Linux. For mutliboot kernels, the log OK. > could easily be passed as a mb module. Let me know what you think. If you consider a module then I would like to ask you to add a header at the beginning of the log which clearly identifies its type. This way the OS boot will not depend on the module order or something like that. If that does not work for you then you can add a tag similar to module but with an extra member identifying the type of provided data. By the way, I think that we should focus on Multiboot2 protocol only. > > And another thing... Could not we reuse Philip TPM 2.0 work in GRUB2 somehow? > > Phil's work is dealing with the TSS/TIS software layers which provide > higher abstractions over the TPM. For TPM2 in the absence of or distrust > in the EFI firmware, it is possible to do a raw IO interface directly > with the TPM. An example of doing that can be seen in tboot, which if > you look is a bit more complex than the TPM 1.2 interface. OK but IIRC there were also low level drivers in it. If it is true then we could steal them. WRT EFI and TPM. I think that by default TPM (2.0) GRUB2 drivers should use EFI infrastructure to control the TPM. Though there should be an option to skip the EFI stuff and drive the TPM directly. Daniel