Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2283141imm; Sun, 5 Aug 2018 00:29:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfuLoSQnAPPldkPwK/y3jIvUr9snhDutXCH8Z9vtePiaz/Fe3yqKWg3x5AFgUYLKnB+Qpg+ X-Received: by 2002:a63:c742:: with SMTP id v2-v6mr9958238pgg.331.1533454194754; Sun, 05 Aug 2018 00:29:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533454194; cv=none; d=google.com; s=arc-20160816; b=ZLlosMyNKdQA6qpnE2Iqd/zDlqy/1GbK+TKzmnR0HS1MQMelKvekFsmyD7klO3o/rv Ea0/ITPcI/KAWOtxG2aX25Gtf9bt7Z1+WA1vgRzLhDJG9zGF3uvTDayPS7f699oT1UAS zbaHXrEnlo07gkCbBkGuhzGtEcsyZy8NkiCxgXEGqAoCjklFO/ojk+CDG65ycYFalm9k J29CarQljoDLUaz7ZJSe2PU5JoN5FgbXQLwjCyqxe28E/YKxYnOw0MWZusVwLQ4MVPjR fhWMMgVKgBHxn8cMWTxnuxI5l0/EmAAYTFsweK3fGVBN+3SMWFPmspRmes/3A6/geiHz OGDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=EIF20Yxq5hRyS5R3NOUjYQYl7NDR/6KnUlo/fxRG6nM=; b=RkJUkHDrIs/SvGcw6l2LIKlPKoFe/arsfjbFI0uOfqNAevWrbI+7o/53zNziL5vCc2 sjm9mtBsvUw9tDF+pCT6HVHodQya/4Q36h0m4CPqJLwtnf9qWWcRclID6+HfeNAD16/C 2ul1XQ3fnMaAcGxAKzXtqOc77azH48Z/GPKACItW1N5ibOKX9YjWv1NjwnPr4sneqclB jt6Bs4vdPpKQqEntOL4TycHBPVEjyKz77cawDz1GNf6KD5vhA+OcG9ZsQhl2+4xaY/6Y DsSWj4oSp8uPYTvnGWn9QnZb1WpJfnvMMtThBVbiTYFw6s/f3WFXjlqIaxJB6W1dOBzN ZOEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=akPuHJSN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y40-v6si7316880pla.229.2018.08.05.00.29.17; Sun, 05 Aug 2018 00:29:54 -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; dkim=pass header.i=@linaro.org header.s=google header.b=akPuHJSN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726258AbeHEJ3e (ORCPT + 99 others); Sun, 5 Aug 2018 05:29:34 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:38588 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726165AbeHEJ3d (ORCPT ); Sun, 5 Aug 2018 05:29:33 -0400 Received: by mail-it0-f66.google.com with SMTP id v71-v6so14076275itb.3 for ; Sun, 05 Aug 2018 00:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=EIF20Yxq5hRyS5R3NOUjYQYl7NDR/6KnUlo/fxRG6nM=; b=akPuHJSNwBFJ/u0QuAoFS+r4r6u7suFEx44F8erpBTICSvVZRZbO097wS60FjowCKX xuD/CWZ9WpexcxCaCKkkq6HiIJNpSPmlS0xNFBo60NRxO5XyGnDvzeV4FuheEqsAvER5 Q7KTFL2lW1A67Ywn6S+q7VTX+v3Rq+U2c/N5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=EIF20Yxq5hRyS5R3NOUjYQYl7NDR/6KnUlo/fxRG6nM=; b=KFiDLwmbWpXvICcj/xWz3stxGffxXwvaj3qEZsMKl1ojb/5Zz3cZBHe6o8XKk9vRWk fnYg5frjwO05yzwkYvGYKq6c6rQOlbJmrSjwPXGXSwJILMRAfoFegNVhxRAjyyiE8sip EJ3UEJbMhRLZBh12Xr0sFwlyEEH6KYG9fx4Vlwrh9E1ZKnQcP6sSPABNlFQdJEaDoFrY yioVziCzIjpgZUjZd8F/iZPndWIhOKqXcuKNDBzy6lk8I5N0PU4JsvXJcB9W1nOdpblb FiYXfXVH3D/NzmNbJUaQs28gtUW9rabyFU8KyAGU52LPe2xUDMlqt57/kmQjJkbxoFl/ +OQQ== X-Gm-Message-State: AOUpUlGoeNkDRYfzNVYhOBvViy7ykzbHK2HiGTvBrKoXkH0WxxLf7lRK YLRI35UsuX908wk9I7mm3V0lle4f/jXk+yGPZWf5Bg== X-Received: by 2002:a24:5242:: with SMTP id d63-v6mr11694411itb.138.1533453957479; Sun, 05 Aug 2018 00:25:57 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:ac05:0:0:0:0:0 with HTTP; Sun, 5 Aug 2018 00:25:56 -0700 (PDT) In-Reply-To: <20180805032119.20485-1-jlee@suse.com> References: <20180805032119.20485-1-jlee@suse.com> From: Ard Biesheuvel Date: Sun, 5 Aug 2018 09:25:56 +0200 Message-ID: Subject: Re: [PATCH 0/6][RFC] Add EFI secure key to key retention service To: "Lee, Chun-Yi" Cc: Linux Kernel Mailing List , linux-efi , "the arch/x86 maintainers" , keyrings@vger.kernel.org, linux-integrity , "Lee, Chun-Yi" , Kees Cook , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Pavel Machek , Chen Yu , Oliver Neukum , Ryan Chen , David Howells , Mimi Zohar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Chun,yi, On 5 August 2018 at 05:21, Lee, Chun-Yi wrote: > When secure boot is enabled, only signed EFI binary can access > EFI boot service variable before ExitBootService. Which means that > the EFI boot service variable is secure. > No it, isn't, and this is a very dangerous assumption to make. 'Secure' means different things to different people. 'Secure boot' is a misnomer, since it is too vague: it should be called 'authenticated boot', and the catch is that authentication using public-key crypto does not involve secrets at all. The UEFI variable store was not designed with confidentiality in mind, and assuming [given the reputation of EFI on the implementation side] that you can use it to keep secrets is rather unwise imho. > This patch set add functions to EFI boot stub to generate a 512-bit > random number that it can be used as a root key for encryption and > authentication. This root key will be kept in EFI boot service variable. > EFI boot stub will read and transfer ERK (efi root key) to kernel. > > At runtime, the ERK can be used to encrypted/authentication other > random number to generate EFI secure key. The EFI secure key can be > a new master key type for encrypted key. It's useful for hibernation > or evm. > > Here is the proof of concept for using EFI secure key in hibernation: > https://github.com/joeyli/linux-s4sign/commit/6311e97038974bc5de8121769fb4d34470009566 > > Cc: Kees Cook > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > Cc: "Rafael J. Wysocki" > Cc: Pavel Machek > Cc: Chen Yu > Cc: Oliver Neukum > Cc: Ryan Chen > Cc: Ard Biesheuvel > Cc: David Howells > Cc: Mimi Zohar > Signed-off-by: "Lee, Chun-Yi" > > Lee, Chun-Yi (6): > x86/KASLR: make getting random long number function public > efi: the function transfers status to string > efi: generate efi root key in EFI boot stub > key: add EFI secure key type > key: add EFI secure key as a master key type > key: enforce the secure boot checking when loading efi root key > > Documentation/admin-guide/kernel-parameters.txt | 6 + > arch/x86/boot/compressed/Makefile | 1 + > arch/x86/boot/compressed/cpuflags.c | 2 +- > arch/x86/boot/compressed/eboot.c | 2 + > arch/x86/boot/compressed/efi_root_key.c | 212 +++++++ > arch/x86/boot/compressed/kaslr.c | 21 - > arch/x86/boot/compressed/misc.c | 17 + > arch/x86/boot/compressed/misc.h | 12 +- > arch/x86/include/asm/efi.h | 13 + > arch/x86/include/uapi/asm/bootparam.h | 1 + > arch/x86/kernel/setup.c | 3 + > arch/x86/lib/kaslr.c | 61 +- > arch/x86/lib/random.c | 68 +++ > drivers/firmware/efi/Kconfig | 31 + > drivers/firmware/efi/Makefile | 1 + > drivers/firmware/efi/efi-secure-key.c | 748 ++++++++++++++++++++++++ > include/keys/efi-type.h | 57 ++ > include/linux/efi.h | 40 ++ > include/linux/kernel.h | 3 +- > kernel/panic.c | 1 + > security/keys/encrypted-keys/encrypted.c | 10 + > 21 files changed, 1226 insertions(+), 84 deletions(-) > create mode 100644 arch/x86/boot/compressed/efi_root_key.c > create mode 100644 arch/x86/lib/random.c > create mode 100644 drivers/firmware/efi/efi-secure-key.c > create mode 100644 include/keys/efi-type.h > > -- > 2.13.6 >