Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pZAlr-0000iB-4v for mharc-grub-devel@gnu.org; Mon, 06 Mar 2023 08:20:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZAln-0000hR-Vk for grub-devel@gnu.org; Mon, 06 Mar 2023 08:20:52 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZAlk-0005EZ-SH for grub-devel@gnu.org; Mon, 06 Mar 2023 08:20:51 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 326C0CBd001679; Mon, 6 Mar 2023 13:20:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : reply-to : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=PSv69SsLnFURij4B3qdWSyd3yCb3PGRSI3T6YD1TvP0=; b=h7/N5Mg/4YJ/dEMmR/aG/7xsdtuNcx9P+HbqjcNEmOUWwGGI46qWzkrGD0cHOn5Jsm5E lWAZbOmW2UKTJM3j0i9p0B9Bstg9rQkZgZlh64Bt5G7xXP92sxlIeQkmzF1bk7Mf2heB 8GUHE/eRitY1yxQd3cTBk9WnKxCFFGd4kENcqFj+gVGwL92u+lucfdQUmvTiu5POIqA3 Qqt3Gfi+m6bXraN/6GQa4C5A76yDhYXw70iFj1lg1xFgEaIEm1Z7NNFCDCFHEz/yNZug Nr2lnAa8IyvVAbeOh5UUarV3MuxIy3iuIOvTdFpgoBFz/8hnsAEDtK5CkUn9t/lcS/Up Tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3p507nv5tc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 13:20:45 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 326DJkxa008998; Mon, 6 Mar 2023 13:20:45 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3p507nv5sw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 13:20:45 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 326ASKdM017255; Mon, 6 Mar 2023 13:20:44 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([9.208.130.97]) by ppma04dal.us.ibm.com (PPS) with ESMTPS id 3p41ak8k3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 Mar 2023 13:20:44 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 326DKhcF44171830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Mar 2023 13:20:43 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EC9358062; Mon, 6 Mar 2023 13:20:43 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A817558059; Mon, 6 Mar 2023 13:20:41 +0000 (GMT) Received: from lingrow.int.hansenpartnership.com (unknown [9.163.79.233]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 6 Mar 2023 13:20:41 +0000 (GMT) Message-ID: Subject: Re: [PATCH 03/14] protectors: Add TPM2 Key Protector From: James Bottomley Reply-To: jejb@linux.ibm.com To: Gary Lin Cc: The development of GNU GRUB , "'Hernan Gatta '" , "'Daniel Kiper '" , shkhisti@microsoft.com, jaskaran.khurana@microsoft.com, christopher.co@microsoft.com, daniel.mihai@microsoft.com, rharwood@redhat.com, jaredz@redhat.com, development@efficientek.com, mchang@suse.com Date: Mon, 06 Mar 2023 08:20:39 -0500 In-Reply-To: <20230306065157.5nofz2enagwuxtiy@GaryLaptop> References: <20230222070054.5122-1-glin@suse.com> <20230222070054.5122-4-glin@suse.com> <20230306065157.5nofz2enagwuxtiy@GaryLaptop> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: UGiuubk5rINhgn2tSxFfnr2uvq7DWyod X-Proofpoint-ORIG-GUID: dlXQwHtQogBwRblWBlJGSVQPmJKnV-Hi Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-06_05,2023-03-06_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 adultscore=0 phishscore=0 mlxlogscore=867 bulkscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 impostorscore=0 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303060115 Received-SPF: pass client-ip=148.163.158.5; envelope-from=jejb@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2023 13:20:52 -0000 On Mon, 2023-03-06 at 14:51 +0800, Gary Lin wrote: > On Wed, Feb 22, 2023 at 07:41:38AM -0500, James Bottomley wrote: > > On Wed, 2023-02-22 at 15:00 +0800, Gary Lin via Grub-devel wrote: > > > +GRUB_MOD_INIT (tpm2) > > > +{ > > > +  grub_tpm2_protector_init_cmd = > > > +    grub_register_extcmd ("tpm2_key_protector_init", > > > +                         grub_tpm2_protector_init_cmd_handler, > > > 0, > > > +                         N_("[-m mode] " > > > +                            "[-p pcr_list] " > > > +                            "[-b pcr_bank] " > > > +                            "[-k sealed_key_file_path] " > > > +                            "[-s srk_handle] " > > > +                            "[-a asymmetric_key_type] " > > > +                            "[-n nv_index]"), > > > +                         N_("Initialize the TPM2 key > > > protector."), > > > +                         grub_tpm2_protector_init_cmd_options); > > > +  grub_tpm2_protector_clear_cmd = > > > +    grub_register_extcmd ("tpm2_key_protector_clear", > > > +                         grub_tpm2_protector_clear_cmd_handler, > > > 0, > > > NULL, > > > +                         N_("Clear the TPM2 key protector if > > > previously initialized."), > > > +                         NULL); > > > +  grub_key_protector_register (&grub_tpm2_key_protector); > > > Hi James, > > > Hang on, we've spend ages standardising the format of TPM key > > files: > > > > https://www.hansenpartnership.com/draft-bottomley-tpm2-keys.html > > > > Per the spec, the type OIDs are defined as the following: > >   id-tpmkey OBJECT IDENTIFIER ::= >     {joint-iso-itu-t(2) international-organizations(23) 133 10} > >   id-loadablekey OBJECT IDENTIFIER ::= >     {id-tpmkey 3} > >   id-importablekey OBJECT IDENTIFIER ::= >     {id-tpmkey 4} > >   id-sealedkey OBJECT IDENTIFIER ::= >     {id-tpmkey 5} > > Then I assume that the sealed key OID is 2.23.133.10.5. However, I > found > that the sealed key OID in openssl-tpm2-engine and linux kernel is > 2.23.133.10.1.5, and it doesn't match the tpm 2.0 key spec. > > Did I miss anything in the spec? Possibly not. We went around the houses for ages with the TCG guardian of OID allocations trying to agree on the numbers. It's probable the spec missed one of the iterations of the prefix. If you'd like to send a patch to fix it, the list is: openssl-tpm2-engine@groups.io The raw spec is in git here: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/openssl_tpm2_engine.git/tree/doc/draft-bottomley-tpm2-keys.xml James