From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97127C433F5 for ; Thu, 28 Oct 2021 06:24:53 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BE1FF61038 for ; Thu, 28 Oct 2021 06:24:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BE1FF61038 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B2413831B4; Thu, 28 Oct 2021 08:24:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="uyNCHwst"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3317F8319C; Thu, 28 Oct 2021 08:24:47 +0200 (CEST) Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 56D1B82F33 for ; Thu, 28 Oct 2021 08:24:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x52a.google.com with SMTP id h193so5442888pgc.1 for ; Wed, 27 Oct 2021 23:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/pYecWNJCf1NZ0XawIw2OiWh0zWtKL2AcDH8MP5aB1g=; b=uyNCHwstryoH7cibNc3gqoZQRlCUflrOYsY5zVMbpwyT9Q15XfBk640WsUsWHOMVc9 9/qes2xyc6yGvK9VJi6+xTTTgsdO2U+EZkdwAQqDhxBQrWng+ILpP//zcynEFEovxcH8 rO+k5H9eFsOjpqcUKu1Yah1scgRdjG81jIISmCACmIqNTTRzl55jLHaZhBc4zsjeG6vv Lk0zIYw4Bp7zmWa4o7lIlV8pP39hdI+NP43q3K+CNKA8Xjvrs1SiI34VhXxQTLxm7ar+ mXYy4o6S+SonfGguysptfkGAc+5bukeaDd8xAtwNeUC+w7OJOXiiPVVjTyXxGU/ig/QE Fr4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/pYecWNJCf1NZ0XawIw2OiWh0zWtKL2AcDH8MP5aB1g=; b=tW3tpRTAP0zjX5bOWK9sClu2RpIo/x1Nh6blNV+IOtlT76b/nOhDMumQHoY00/fJ9m j1wCY5YS7fbOjdegU2MzigOVnb6Rwu9qyE7zwP04Rw7SZ0bRi5KjpT+S+1C7czVkOMEo zWnlwVJHbIgR2JiX+5rbWbnTsc5TJCz03urD76moqcNxHZxwVkKqz/SDjeTX2hcZm0x8 ZmaeMaAbg9DFWrPSk2DCqofxdX0tfPwyF/rxiEU/Nk2VR3XNzDKMYjIyr7ISdkQqSId0 EQa/3vhGHryLQRCaiJ1aWuYeG6Mn4C4OqttAcv1tKpe5fIfcZ4kydZdT3ixeRamgfPeA 8gdQ== X-Gm-Message-State: AOAM5307FMAos0E/K8z1vUjKYGUuGScA28N1qJlqZklJG6wiKa8sk7m6 elbDVlO3m/mGuTdsaRwhqjhvjw== X-Google-Smtp-Source: ABdhPJxtFsNeZd8D7lbK30Bn0vbGqSTRyGQn+u7Y4J45XyDlBJTSmdLiFNDtEtRt2agGm9D8hqxKkg== X-Received: by 2002:a63:8541:: with SMTP id u62mr1866176pgd.248.1635402280530; Wed, 27 Oct 2021 23:24:40 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:394a:97ee:bbbb:462e]) by smtp.gmail.com with ESMTPSA id p16sm1582018pgd.78.2021.10.27.23.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 23:24:39 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v5 00/11] efi_loader: capsule: improve capsule authentication support Date: Thu, 28 Oct 2021 15:23:45 +0900 Message-Id: <20211028062356.98224-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean As I proposed and discussed in [1] and [2], I have made a couple of improvements on the current implementation of capsule update in this patch set. * add signing feature to mkeficapsule * add "--guid" option to mkeficapsule * add man page of mkeficapsule * update uefi document regarding capsule update * revise pytests * (as RFC) add CONFIG_EFI_CAPSULE_KEY_PATH # We have had some discussion about fdtsig.sh. # So RFCs (patch#10,#11) are still included for further discussion # if they are useful or not. # For smooth merge, the rest (patch#1-9) should work without them. [1] https://lists.denx.de/pipermail/u-boot/2021-April/447918.html [2] https://lists.denx.de/pipermail/u-boot/2021-July/455292.html Prerequisite patches ==================== None Test ==== * locally passed the pytest which is included in this patch series on sandbox built. (CONFIG_EFI_CAPSULE_AUTHENTICATE should explicitly be turned on in order to exercise the authentication code.) Changes ======= v5 (Oct 27, 2021) * rebased on pre-v2022.01-rc1 (WIP/26Oct2021) * drop already-merged patches * drop __weak from efi_get_public_key_data() (patch#1) * describe the format of public key node in device tree (patch#4) * re-order patches by grouping closely-related patches (patch#6-8) * modify pytest to make the test results correctly verified either with or without CONFIG_EFI_CAPSULE_AUTHENTICATE (patch#9) * add RFCs for embedding public keys during the build process (patch#10,11) v4 (Oct 7, 2021) * rebased on v2021.10 * align with "Revert "efi_capsule: Move signature from DTB to .rodata"" * add more missing *revert* commits (patch#1,#2,#3) * add fdtsig.sh, replacing dtb support in mkeficapsule (patch#4) * update/revise the man/uefi doc (patch#6,#7) * fix a bug in parsing guid string (patch#8) * add a test for "--guid" option (patch#10) * use dtb-based authentication test as done in v1 (patch#11) v3 (Aug 31, 2021) * rebased on v2021.10-rc3 * remove pytest-related patches * add function descriptions in mkeficapsule.c * correct format specifiers in printf() * let main() return 0 or -1 only * update doc/develop/uefi/uefi.rst for syntax change of mkeficapsule v2 (July 28, 2021) * rebased on v2021.10-rc* * removed dependency on target's configuration * removed fdtsig.sh and others * add man page * update the UEFI document * add dedicate defconfig for testing on sandbox * add gitlab CI support * add "--guid" option to mkeficapsule (yet rather RFC) Initial release (May 12, 2021) * based on v2021.07-rc2 AKASHI Takahiro (11): efi_loader: capsule: drop __weak from efi_get_public_key_data() tools: mkeficapsule: add firmwware image signing tools: mkeficapsule: add man page doc: update UEFI document for usage of mkeficapsule test/py: efi_capsule: add image authentication test tools: mkeficapsule: allow for specifying GUID explicitly test/py: efi_capsule: align with the syntax change of mkeficapsule test/py: efi_capsule: add a test for "--guid" option test/py: efi_capsule: check the results in case of CAPSULE_AUTHENTICATE (RFC) tools: add fdtsig.sh (RFC) efi_loader, dts: add public keys for capsules to device tree MAINTAINERS | 2 + doc/develop/uefi/uefi.rst | 143 +++-- doc/mkeficapsule.1 | 107 ++++ dts/Makefile | 23 +- lib/efi_loader/Kconfig | 7 + lib/efi_loader/efi_capsule.c | 2 +- .../py/tests/test_efi_capsule/capsule_defs.py | 5 + test/py/tests/test_efi_capsule/conftest.py | 42 +- test/py/tests/test_efi_capsule/signature.dts | 10 + .../test_efi_capsule/test_capsule_firmware.py | 91 +++- .../test_capsule_firmware_signed.py | 233 ++++++++ tools/Kconfig | 8 + tools/Makefile | 8 +- tools/fdtsig.sh | 40 ++ tools/mkeficapsule.c | 503 ++++++++++++++++-- 15 files changed, 1092 insertions(+), 132 deletions(-) create mode 100644 doc/mkeficapsule.1 create mode 100644 test/py/tests/test_efi_capsule/signature.dts create mode 100644 test/py/tests/test_efi_capsule/test_capsule_firmware_signed.py create mode 100755 tools/fdtsig.sh -- 2.33.0