Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp571757imm; Wed, 23 May 2018 01:46:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpowUdeNerXtx5ASwpP7x7noU2IMeE4Kgj8ybUk8MPsVHP2QL9AyGtuxwL/iEn7x+J/f0vW X-Received: by 2002:a63:62c7:: with SMTP id w190-v6mr1333425pgb.104.1527065212305; Wed, 23 May 2018 01:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527065212; cv=none; d=google.com; s=arc-20160816; b=cXkTgJdeygVIYbG6wuEQnLX1Bi2f5Gm18k8xueI8rzg8dVWp43mfLcQdmkpC4UU412 iFGlVSYOAaYvL0XGUs0Js/Hnns8Pkal7LLvYP/4zviPtLXvdADuqw8srbCexKk2Ifxbc ueF3W8hjW9v4UTmhKeRqlMNNkbPx9hE5Y7j1CV7+jXAItbfEsIFujq7riL1njrWh3fZN SwsI1HGp7XJPriYnDOvKbk3JOT9IKAG8KgZ2aPrYPDDsQkJ4bvB+p1oKqx2U2u6aN1hI aBs+t2dotI9EDiwSMYWVSnRYqTAK/4ZI36w7XakPFv+vXkmaEHjMKitv7d3ldz9G6qZv Ppjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=458Rqy4byRwhqKadMzyhENGy66w1xQ4BGrWVCLQb0jY=; b=UbDW2q2Bv2Shamr4X6b5dJLdyqW5fwZdWpE/Q5cedNZu75SZJV05M1j3xScXv50VK3 qSvSIMETyWFaCkuMsOKzhsJuaiGMt4xo7MMOmS2mBhfKPK1dg2Y5rdtfZtGmQvdfu7GI lnfWgNuTtflm4rJisz5JZM5yBGA7yNIdwVJaYghca9b8Ebi5B4ucsKNek/w/QqCTHZ8C OOgFPakYirSBDfU1x8yO2+1R1Sh3H5tOk51ut42Vw4BWcg6vHhc5yjojaEqT4nFodKAM l4sapNPKgVW/iCnZ8Tgg8/4U2GfYZewzLtRn4dezJNea41SM1P4JkaxfqurFzdwtga80 FrzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6-v6si14123126pgu.692.2018.05.23.01.46.37; Wed, 23 May 2018 01:46:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754550AbeEWIqT (ORCPT + 99 others); Wed, 23 May 2018 04:46:19 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:59284 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754340AbeEWIqO (ORCPT ); Wed, 23 May 2018 04:46:14 -0400 Received: from linux-l9pv.suse (unknown.telstraglobal.net [134.159.103.118]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Wed, 23 May 2018 10:46:08 +0200 Date: Wed, 23 May 2018 16:46:03 +0800 From: joeyli To: Jiri Kosina Cc: Pavel Machek , David Howells , Linus Torvalds , linux-man@vger.kernel.org, linux-api@vger.kernel.org, jmorris@namei.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH 07/24] hibernate: Disable when the kernel is locked down Message-ID: <20180523084603.GD7474@linux-l9pv.suse> References: <20180413202234.GA4484@amd> <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> <152346392521.4030.5108539377959227838.stgit@warthog.procyon.org.uk> <27926.1524148733@warthog.procyon.org.uk> <20180426072646.GA31822@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi experts, Sorry for I missed this discussion... On Thu, Apr 26, 2018 at 10:20:29AM +0200, Jiri Kosina wrote: > On Thu, 26 Apr 2018, Pavel Machek wrote: > > > That's not how the crypto needs to work. Talk to Jiri Kosina, ok? > > Yeah, Joey Lee (adding to CC) implemented it here: > > https://lkml.org/lkml/2015/8/11/47 > > I think there have been more respins, Joey definitely knows more details > and status quo. > > The design is specifically tailored for secure-boot environments though. > I am working on the next version of hibernation encryption and authentication: https://github.com/joeyli/linux-s4sign/wiki My plan is: - Hibernation encryption: There is a draft patch to encrypt image by ctr(aes). This patch works with the first version of hibernation verification: https://github.com/joeyli/linux-s4sign/commit/6a9a0113bb221c036ebd0f6321b7191283fe4929 - Adapt hibernation to key retention service: - Using the encrypted key to derive encrypt key and auth key to encrypt and hmac snapshot image. Put the encrypted key in the image header of snapshot. - The encrypted key will be encrypted by KMK (kernel master key). Either trusted key(sealed by TPM) or EFI key (explain in later) can be the KMK. If there have appropriate UI support in initrd, user key can also be the KMK. - Similar with the enrolling EVM key, but more earler: The systemd and dracut must be changed for enrolling kernel master key before the swap partition be mounted. - EFI key: - A new master key type to key retention service. - It can be a new option beyond trusted key(TPM) and user key. - EFI stub generates a random key and stores in EFI boot service variable: - This random key in boot variable can be called ERK (EFI Root Key) - The ERK is secure when secure boot enabled. - User must aware and enable secure boot by themself if they want. - ERK can be a secret to encrypt a random number for generate a EFI key - The EFI key can be used by hibernation encryption/authentication. - The EFI key can be a master key to generate a encrypted key for EVM. - Rescue mechanism for ERK: - The ERK may be regenerated after the old ERK be erased by firmware update or firmware recovery. - Current idea is using the public key in first/second trusted keyring to encrypt the ERK for backup. User can enroll the EFI key with old ERK to request kernel to re-encrypt the EFI key with new ERK. Thanks a lot! Joey Lee