Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pUoRX-0006qP-3S for mharc-grub-devel@gnu.org; Wed, 22 Feb 2023 07:41: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 1pUoRS-0006mK-EI for grub-devel@gnu.org; Wed, 22 Feb 2023 07:41:50 -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 1pUoRP-0007Dm-Rh for grub-devel@gnu.org; Wed, 22 Feb 2023 07:41:49 -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 31MBi3uo005069; Wed, 22 Feb 2023 12:41:44 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=K+kxOf0kAiOFAWPjxZ70CFpioZz4qEMYK+UtA1vxXxo=; b=NWoAZA6QdaMK3kiovyTIchqbvi/vA4/DNXVWytQKx6D762PYlxHvB38Z1KPiXuWUXU4f tyhMw2DG86xjrNN5GD3fs3fM8gAvg9UPL6i960GYH5rfCI6TdAu1Nybln2EuSHZMhM5y B3DUMVvqEso+Lj6bVjp398U1TvjLzpDimrCgYi2GmwOzMyPXCzPFXQTKzgxfQ41K9WES YAZ/8WOMYiGd3SPAVvPEzHVtpMWf4xGmPALp3LHeX3NxRxLZjsBZWvxShyaCxfVJ7BdA gRYgLv1Pu2rooM3WCk6Jli2+CbQx0QTgom3YLUxPyWh7aM3Lv/ZkqKE6b/eCzFE93LnV 2A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nwje8shwm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Feb 2023 12:41:44 +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 31MCaWiC006396; Wed, 22 Feb 2023 12:41:43 GMT Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nwje8shwf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Feb 2023 12:41:43 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 31M9VGRE015801; Wed, 22 Feb 2023 12:41:42 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([9.208.129.113]) by ppma01wdc.us.ibm.com (PPS) with ESMTPS id 3ntpa708eh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Feb 2023 12:41:42 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 31MCffKL42860950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Feb 2023 12:41:41 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74BB358057; Wed, 22 Feb 2023 12:41:41 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1398F58059; Wed, 22 Feb 2023 12:41:40 +0000 (GMT) Received: from lingrow.int.hansenpartnership.com (unknown [9.163.9.72]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 22 Feb 2023 12:41:39 +0000 (GMT) Message-ID: Subject: Re: [PATCH 03/14] protectors: Add TPM2 Key Protector From: James Bottomley Reply-To: jejb@linux.ibm.com To: The development of GNU GRUB Cc: Gary Lin , "'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: Wed, 22 Feb 2023 07:41:38 -0500 In-Reply-To: <20230222070054.5122-4-glin@suse.com> References: <20230222070054.5122-1-glin@suse.com> <20230222070054.5122-4-glin@suse.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: MxvGS7lyYCvncWHXxrOR2tHsOKCQs_Lw X-Proofpoint-ORIG-GUID: W8z7MLNPaWkwua-CKRMKzYGUaQ1Im1HH 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.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-22_05,2023-02-22_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1011 lowpriorityscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxlogscore=795 impostorscore=0 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302220111 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: Wed, 22 Feb 2023 12:41:50 -0000 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); Hang on, we've spend ages standardising the format of TPM key files: https://www.hansenpartnership.com/draft-bottomley-tpm2-keys.html And every major TPM based key system uses this format, so a key file created by any TPM2 cryptosystem can be read by any other (meaning you can use any crypotosystem tools to manage the key). What you're doing here just reinvents a non-standard format and creates a load of parameters that the user needs to know here, but are part of the key format standard, so you not only need to remember a load of information not in your key file, but you have to have a non-standard tool to create the key in the first place. Even if you want to keep your own tool to create keys, what about interoperability with the kernel? The kernel's TPM key subsystem (trusted keys) also speaks the above format https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/security/keys/trusted-keys/tpm2key.asn1 so you wouldn't be able to send this key down to day dm-crypt as a trusted key, you'd have to create two separate key files to do that. James