Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1pUjCv-0002lF-FX for mharc-grub-devel@gnu.org; Wed, 22 Feb 2023 02:06:29 -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 1pUjCe-0002cT-Ok for grub-devel@gnu.org; Wed, 22 Feb 2023 02:06:20 -0500 Received: from mail-vi1eur05on20614.outbound.protection.outlook.com ([2a01:111:f400:7d00::614] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUjCa-0007UX-Pp for grub-devel@gnu.org; Wed, 22 Feb 2023 02:06:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gt4gbWRSuneteQvTrjQXSe1/Hcajf91fHnED58mvJY1fmHPFCU8ZY0CNMgZfkXECz7AhdVNzq4sm/ywqbmczy7rRjhh67TnXuaxoejJUciBWeiZMLVa/RqplMkYHRA2QDMwgrFR0XPMOYtTGIowkn9qbzJCtHGoUlTReNPW0/FgHZxJq6KBTKerV1AFXUBxlCFToH/PZT6zkZzXPKzIfQ7plzpZTexnFAAvZe6ddrJ96KOFW4ELbTOZwy8dyKvKHtzSL2L+tl6Ulo48Yh7dDA2BHg6srd6zQKBP7t6mIH3OfLvYxKVDTC2WLXl09KhUM9af8VF4thBYqoIH3o4Pnbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UGtpMdd9EK/elyWkiEyslFLDv35NvRytJx8tUlku4Js=; b=cUiLYkR2ZfMCsbCvg8CXv1VNhAKvOUVxWL4znKlOAe5Ff9Y8sV7tEarY9cZHoIvx4w7OBBXQypzyjNLNtU/3LFsjCRSuta1z/yFDfMx/3jofpcNo+1WRkfFp+64gf3UpymUwoMd4tZltO8xtPEzJgCCT8mckFSDn0Bw1QS9Ls96ub6xH9qDeE15cgue1+BWUkAQoSiOL4OLdjUc+YI7dgb/yuJRhEcGOj2io3D0NncqiezYfBgGKR3lpl8fvTerYnbM+SwiGgVI5XC3jwWP2f/Wp1wwM090KJIIDDOH8SmF/gTYA0iOy6lHzKKQjyI8OCugh4gtQga5hKSWJ19m9Bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UGtpMdd9EK/elyWkiEyslFLDv35NvRytJx8tUlku4Js=; b=RwKu+naHZ/JM/vzEBOKh3cgAIAATfPzfyIQzlyUxWyCF9QoRgf1Dak0cG28P2kixYFzJ2+M5tgVJcktAm0Wl/h9OTnGV2e+YEIRjkJgAJ16ZRz5I94cY2GucplPmN97AREFtFBiF7QKQbMXcPXfQOOPAvuDNw6z8cffljh4mPaXvsmoFI4zkX44xEeTXe99jLKRRB9qIBO7ZskAO+9bnmlLD0cmX/axGi7QIvFFp0hkJtrNz/10QCqsjQn9bjMqJQTbfpZaX47dY+SalAYv7uTXNFB9gO2UjWBnFgk9S8TDunLep4Sl/z6GCdBP0gNrp/FM63DJ7wkgjkCRH2haIPQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from DBBPR04MB6140.eurprd04.prod.outlook.com (2603:10a6:10:c7::18) by DBBPR04MB7980.eurprd04.prod.outlook.com (2603:10a6:10:1f0::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.19; Wed, 22 Feb 2023 07:00:59 +0000 Received: from DBBPR04MB6140.eurprd04.prod.outlook.com ([fe80::688f:bc10:59e2:772a]) by DBBPR04MB6140.eurprd04.prod.outlook.com ([fe80::688f:bc10:59e2:772a%6]) with mapi id 15.20.6111.021; Wed, 22 Feb 2023 07:00:59 +0000 From: Gary Lin To: grub-devel@gnu.org Cc: '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, jejb@linux.ibm.com, mchang@suse.com Subject: [PATCH 00/14] Automatic Disk Unlock with TPM2 Date: Wed, 22 Feb 2023 15:00:40 +0800 Message-Id: <20230222070054.5122-1-glin@suse.com> X-Mailer: git-send-email 2.35.3 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: FR3P281CA0140.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:95::12) To DBBPR04MB6140.eurprd04.prod.outlook.com (2603:10a6:10:c7::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DBBPR04MB6140:EE_|DBBPR04MB7980:EE_ X-MS-Office365-Filtering-Correlation-Id: 4149583a-439d-489c-34ca-08db14a28d38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fcrwaE60Oe8TBwo4r54Y1gecmk988EMAcB049vbbdBmpdQ9WmZo8V4SLgSHzR0bbwlhMbVKWuCogPg6OO6ZrupmmAHJ3O4ooTHiSjNoeXEeEP0x9chJ0eYiCgzEZGSRNoaMhbqYnh+QHf5LpBXxPgymy+TqJ1LRu7RBrA0p8U/wNpPd947Clk8YGfkLqEpe4fRl1XEGtL03otFZf//oz/vZKLgpp+Q7KGRx0Kw6zf1NIBMUdSYARDhvmPqHzXicDBadq1ghzjyFBMDqWZ7WLOiZfUSWmZ1vJhyPZkvo2jKr5GA7jMKHrVwHUmlkQdVTtzWjnAOWOZ2jvm1gM0x6xisFtArS9djMyIYmnOkqH5/HVd8JdIIjE5kQQJw73i4/adH9FbIw4rt7gbrKvbA/+H+deDL6p7sKGKeGX4DJfm2W8HuW1Eq+nlQx/kVJKotk1jpuvqMUJvNOaT8NsC2y5+0mOK2QBPEUsUvLoW1IgLiJqkkQZ2EupX6MSYiwp706efmKZQXh9PN0/FBhHTtGECaPz47OZdj466m/FCi+BQIrZK6j/+mq/I8y1JyJQHVXWbipAd3ofP/elAbdhz1APwr5fXIHOprkMnc/Z50++b8ecQzhKMSVtgZ1eXHoUG6ncxLyGYe2qF4P4WBuHf154hgCFHZXcDQYr9/KXjy3ajwk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR04MB6140.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(376002)(396003)(346002)(366004)(39860400002)(136003)(451199018)(316002)(83380400001)(54906003)(478600001)(38100700002)(36756003)(2906002)(86362001)(66946007)(66556008)(66476007)(6916009)(4326008)(8676002)(41300700001)(8936002)(5660300002)(7416002)(2616005)(966005)(6486002)(26005)(186003)(6512007)(6506007)(1076003)(107886003)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+wltbPE8WDlzs2lLyoBb4U+obOhVVRwvR6ru8QXeHYQVo+3J8CxauJfmT5ju?= =?us-ascii?Q?2+C3QAu/649p3tY85VtGmkxEcIIPsNpdWzYL8E/5SRLO+JvltgMdfDXnjzEg?= =?us-ascii?Q?UNyxCd06usH+dehuL2UYnzm2STJ2iwXn6w5PrSqq6e6qN5EuSw1gDvbCKXmS?= =?us-ascii?Q?uvYQH9XTq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?= =?us-ascii?Q?m+mRNMtWHKwvlSLXbthEnLCgDKiItN7vj8RoGUZrEKycYK+wOKRYj3k68F5I?= =?us-ascii?Q?MvTYkVDOKUpQEst+BfRF61DMG12cDT+oS1Jy1UI9ZoidGMEwVoQq5/gXNzNx?= =?us-ascii?Q?HBcmtPTg+OvIYoBdDXaTbX8A0F5drkigV710dT2m9lnBw07U7WmTUcOSDG6P?= =?us-ascii?Q?dtbUcvy3OxVND9qjvLGIa+lGSHNkYkUXBSpiEevh7bT3QjoLPEjaqQjnubke?= =?us-ascii?Q?7q3or/SafAHui9TWrhW45ht65n4MFc6cYiofhgMfp/hWT//RVnNgCUtUx/V8?= =?us-ascii?Q?x0NfWOSLY5V+3rOWyiSjSPUB4XMnZeRUVegH7QihjNnHtfFRyesUuzYEd855?= =?us-ascii?Q?VUfkDhQ5GO0vwanRxZ/E1+crHzYOjatYbkOOej0OBZ3Nlrygj1akeCcjK5qX?= =?us-ascii?Q?dfMabqHLF4HY4BBZAX/vEBCYPaQX2oIBcVAm7gb0CgIJKi7TdHeB+EXstovx?= =?us-ascii?Q?8BRvWt8B1sREUuJsnxV1W8EcNB95gkui8idnimWe?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4149583a-439d-489c-34ca-08db14a28d38 X-MS-Exchange-CrossTenant-AuthSource: DBBPR04MB6140.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2023 07:00:59.3804 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: f9GOoE3VMAjsi+JajbrcKQx+OPHsnmXRpZTwKr2f9KTsVubZ3MWSakKaSLDQKJXw X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7980 Received-SPF: pass client-ip=2a01:111:f400:7d00::614; envelope-from=GLin@suse.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-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 07:06:27 -0000 The patch series "Automatic TPM Disk Unlock" posted by Hernan Gatta introduces the key protector framework and TPM2 stack to GRUB2, and it's a useful feature for the systems to implement full disk encryption. However, it seems the development was stalled for a while, and I'd like to push it forward. Patch 1~5 are Hernan Gatta's patch series(*) with a few modifications: - Converting 8 spaces into 1 tab - Merging the minor build fix from Michael Chang - Replacing "lu" with "PRIuGRUB_SIZE" for grub_dprintf - Adding "enable = efi" to the tpm2 module in grub-core/Makefile.core.def - Rebasing "cryptodisk: Support key protectors" to the git master To minimize the changes to Patch 1~5, the follow-up fixes (Patch 6~14) from my colleagues and me are committed separately. Those patches fix the problems we found while testing the original patchset. Quote from Hernan Gatta's cover letter: " Updates since v1: 1. One key can unlock multiple disks: It is now possible to use key protectors with cryptomount's -a and -b options. 2. No passphrase prompt on error if key protector(s) specified: cryptomount no longer prompts for a passphrase if key protectors are specified but fail to provide a working unlock key seeing as the user explicitly requested unlocking via key protectors. 3. Key protector parameterization is separate: Previously, one would parameterize a key protector via a colon-separated argument list nested within a cryptomount argument. Now, key protectors are expected to provide an initialization function, if necessary. As such, instead of: cryptomount -k tpm2:mode=srk:keyfile=KEYFILE:pcrs=7,11... one now writes: tpm2_key_protector_init --mode=srk --keyfile=KEYFILE --pcrs=7,11 ... cryptomount -k tpm2 Additionally, one may write: cryptomount -k protector_1 -k protector_2 ... where cryptomount will try each in order on failure. 4. Standard argument parsing: The TPM2 key protector now uses 'struct grub_arg_option' and the grub-protect tool uses 'struct argp_option'. Additionally, common argument parsing functionality is now shared between the module and the tool. 5. More useful messages: Both the TPM2 module and the grub-protect tool now provide more useful messages to help the user learn how to use their functionality (--help and --usage) as well as to determine what is wrong, if anything. Furthermore, the module now prints additional debug output to help diagnose problems. I forgot to mention last time that this patch series intends to address: https://bugzilla.redhat.com/show_bug.cgi?id=1854177 Previous series: https://lists.gnu.org/archive/html/grub-devel/2022-01/msg00125.html " (*) https://lists.gnu.org/archive/html/grub-devel/2022-02/msg00006.html Gary Lin (8): tpm2: Don't measure the sealed key tpm2: adjust the input parameters of TPM2_EvictControl tpm2: declare the input arguments of TPM2 functions as const tpm2: resend the command on TPM_RC_RETRY tpm2: check the command parameters of TPM2 commands tpm2: pack the missing authorization command for TPM2_PCR_Read tpm2: allow some command parameters to be NULL tpm2: remove the unnecessary variables Hernan Gatta (5): protectors: Add key protectors framework tpm2: Add TPM Software Stack (TSS) protectors: Add TPM2 Key Protector cryptodisk: Support key protectors util/grub-protect: Add new tool Michael Chang (1): crytodisk: fix cryptodisk module looking up .gitignore | 1 + Makefile.util.def | 19 + configure.ac | 1 + grub-core/Makefile.am | 1 + grub-core/Makefile.core.def | 12 + grub-core/disk/cryptodisk.c | 176 +++- grub-core/kern/protectors.c | 75 ++ grub-core/tpm2/args.c | 129 +++ grub-core/tpm2/buffer.c | 145 +++ grub-core/tpm2/module.c | 710 +++++++++++++ grub-core/tpm2/mu.c | 807 +++++++++++++++ grub-core/tpm2/tcg2.c | 143 +++ grub-core/tpm2/tpm2.c | 761 ++++++++++++++ include/grub/cryptodisk.h | 14 + include/grub/protector.h | 48 + include/grub/tpm2/buffer.h | 65 ++ include/grub/tpm2/internal/args.h | 39 + include/grub/tpm2/internal/functions.h | 117 +++ include/grub/tpm2/internal/structs.h | 675 ++++++++++++ include/grub/tpm2/internal/types.h | 372 +++++++ include/grub/tpm2/mu.h | 292 ++++++ include/grub/tpm2/tcg2.h | 34 + include/grub/tpm2/tpm2.h | 38 + util/grub-protect.c | 1314 ++++++++++++++++++++++++ 24 files changed, 5955 insertions(+), 33 deletions(-) create mode 100644 grub-core/kern/protectors.c create mode 100644 grub-core/tpm2/args.c create mode 100644 grub-core/tpm2/buffer.c create mode 100644 grub-core/tpm2/module.c create mode 100644 grub-core/tpm2/mu.c create mode 100644 grub-core/tpm2/tcg2.c create mode 100644 grub-core/tpm2/tpm2.c create mode 100644 include/grub/protector.h create mode 100644 include/grub/tpm2/buffer.h create mode 100644 include/grub/tpm2/internal/args.h create mode 100644 include/grub/tpm2/internal/functions.h create mode 100644 include/grub/tpm2/internal/structs.h create mode 100644 include/grub/tpm2/internal/types.h create mode 100644 include/grub/tpm2/mu.h create mode 100644 include/grub/tpm2/tcg2.h create mode 100644 include/grub/tpm2/tpm2.h create mode 100644 util/grub-protect.c -- 2.35.3