From patchwork Fri May 29 06:41:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 1300441 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=XQriE45d; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49YFNc02XJz9sPF for ; Fri, 29 May 2020 16:42:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 42DB8816D2; Fri, 29 May 2020 08:41:56 +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="XQriE45d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5CF4A81767; Fri, 29 May 2020 08:41:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 55289816A4 for ; Fri, 29 May 2020 08:41:51 +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-pf1-x442.google.com with SMTP id v2so799588pfv.7 for ; Thu, 28 May 2020 23:41:51 -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=AGXjKOLufxph+CXGGaNrMIwsKptuYL0ClyBrpdS+5CM=; b=XQriE45drpp74IMChF2WFou8GkpK9Yg2P4D2SC9zocw9outGRgSkKEFAd555d09uXt G9esUGusKvsAuBwoG+fQy3PA1G3o3Ufl3jpxnsWt5AmaydRQaMSER+5UrD54aF8TFujZ 0J6VmnbUTkQSsMRqU0zvrD5Hy+pjX8KmMjYIsufCmwW9JRBo2h3a1bZ7NydpiV52PBmt IckNPqREweiyuprb7FmAikBpRUILPWLlww6Vi9QWlmiMM6E5IH77xRiT7NxizSBY+I0z dgO8WFb6OIlneXjUNN6x/Snea7UQyS+dyn0UjuMRPej/C2Zow0yz6un1csIkgsMMIvHW n5wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AGXjKOLufxph+CXGGaNrMIwsKptuYL0ClyBrpdS+5CM=; b=SWCnGT28E750+SMdyb3oM34rSJ5crQPMxZr3q60QtbmJsaLolRoEg5q29uAu0nahqM vzsr170nKRn/YMiO9ezA4tvzGKL5no+V6GOzNeC96QNGmf9yYXsu5ULdTKcYCx5M2mP5 CgoaOM+gsujxQIBONMiNAKyLMSZJnPyo02rLrVhYft+YTMQ3bdbias5yBRUsDyEFcCmz 5g87yyX7YqpFL9qjreBOwbLuLj9AJew/tnjFdSTj2CQZTilCTv/bdujINy7SsJzSBWhD tehyon+O2Wvb1HIadrkAmKGySlU3i4S0daXbs9i86AHeKEesvJHyxWWHTrWKM46KnLjU 2Feg== X-Gm-Message-State: AOAM532hLhexL+JCSab9G1sg7/3y1Ku87vhCrjxUJIgf/O4L4+0sYBe4 xYYkcoLA5aZhZVwPIeNHNCDqyQ== X-Google-Smtp-Source: ABdhPJznvAzDS2x/O5TnI6RhziQqjUeVYunla+T5z+e7RT/TexsA3FcAmaK3fbT3C/6tl+3L6NEUFQ== X-Received: by 2002:a63:5961:: with SMTP id j33mr6882177pgm.372.1590734509218; Thu, 28 May 2020 23:41:49 -0700 (PDT) Received: from localhost.localdomain (pdb6272d5.tkyea130.ap.so-net.ne.jp. [219.98.114.213]) by smtp.gmail.com with ESMTPSA id q5sm6483128pfl.199.2020.05.28.23.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 May 2020 23:41:48 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: sughosh.ganu@linaro.org, mail@patrick-wildt.de, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH 00/13] efi_loader: rework/improve UEFI secure boot code Date: Fri, 29 May 2020 15:41:17 +0900 Message-Id: <20200529064130.28332-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.25.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean Summary ======= I'm currently working on reworking UEFI secure boot, aiming to add "intermediate certificates" support. In this effort, I found a couple of issues that should immediately be fixed or useful improvements even without intermediate certificates support. Each commit in this patch series has self-explained description of the issue to be addressed. While they are independent in terms of functionality, they are compiled in a set since the one may depend on the other in terms of code change overlap. All the changes can and should be merged at once for best convenience. I hope that I will post intermediate certificates support sometime in the next week. Patch structure =============== Patch#1,#5: rather preliminary patches Patch#2-#4,#6,#7: main commits Patch#8-#13: pytests Patch#11,#12 for Patch#6 Patch#13 for Patch#7 Test ==== - Travis CI is still running with the latest (it passed with the previous one, including new pytests added here) AKASHI Takahiro (13): efi_loader: signature: move efi_guid_cert_type_pkcs7 to efi_signature.c efi_loader: image_loader: add a check against certificate type of authenticode efi_loader: image_loader: retrieve authenticode only if it exists efi_loader: signature: fix a size check against revocation list efi_loader: signature: make efi_hash_regions more generic efi_loader: image_loader: verification for all signatures should pass efi_loader: image_loader: add digest-based verification for signed image test/py: efi_secboot: remove all "re.search" test/py: efi_secboot: fix test case 1g of test_authvar test/py: efi_secboot: split "signed image" test case-1 into two cases test/py: efi_secboot: add a test against certificate revocation test/py: efi_secboot: add a test for multiple signatures test/py: efi_secboot: add a test for verifying with digest of signed image include/efi_loader.h | 12 +- lib/efi_loader/efi_image_loader.c | 142 ++++-- lib/efi_loader/efi_signature.c | 426 ++++++++---------- lib/efi_loader/efi_variable.c | 1 - test/py/tests/test_efi_secboot/conftest.py | 20 +- .../py/tests/test_efi_secboot/test_authvar.py | 83 ++-- test/py/tests/test_efi_secboot/test_signed.py | 236 +++++++--- .../tests/test_efi_secboot/test_unsigned.py | 32 +- 8 files changed, 563 insertions(+), 389 deletions(-)