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 D5924C433EF for ; Fri, 22 Oct 2021 11:23:28 +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 EB847610A1 for ; Fri, 22 Oct 2021 11:23:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EB847610A1 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 0B0BB834AA; Fri, 22 Oct 2021 13:23:26 +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="l3Vj72gj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6547F834B5; Fri, 22 Oct 2021 13:23:24 +0200 (CEST) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 43FF7833AE for ; Fri, 22 Oct 2021 13:23:20 +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=masahisa.kojima@linaro.org Received: by mail-pj1-x1031.google.com with SMTP id u6-20020a17090a3fc600b001a00250584aso5452218pjm.4 for ; Fri, 22 Oct 2021 04:23:20 -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=e7hXx220eRfdl1N4Fqbv8Hdm2FvUXagzoe7JjW9DXS8=; b=l3Vj72gjOfv0be06EZTktDXMv1sbwpkf2Yez1VlweR46BQdigPANvbxqTMI2BBNndu lWbu4UYnEuYnVWoVtDM5F15mUIhWWu6XmiU1Vf8NbYtxOIvzSlUA99T27UGTenPMAPAH XbvwW5bo4SLQXpBEQ3hVHW7pKTF0Hd8A/b0/DcezhKylB21Ad2WZCaNn3ohTnZXdqkTg WQdv8Ev2ExqR8qFMrhgQYi/yZo5fJe68Ei1OEC0/oT3gCdM377Ed08i9ldRFSnc6QpsZ ppdkRxpDz+QhUbYE0aJpspDRUO2/7lDs5ptYDRiyG+RNDyFBCQxBOlM46c/HPryE/S6F 0kxw== 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=e7hXx220eRfdl1N4Fqbv8Hdm2FvUXagzoe7JjW9DXS8=; b=c6GaDkQRCJX9tuLMt9B/5GAMowYR+wo/seR8ToDxI1zdKKmLeKz7y8Q2IT1QjbLKW9 T52KJcrR7g61N1VKeaBiMdq5w/yoU1Wo87ByxzMr0Y/iJti3/4+6Z4hIba/j/LH1HGrR Wv/Qu2cfdZBvuopMwPIL2Lp7HLjNHnLdd2KsIFCpS5n/TopzoCKZKk5QA4Voy9Z7cHO9 1W8djOjEnBzQTGfIhZfhEAyMzynBZdbDd+z6P0oH2O1HXyEdiahGlXNzuzFwXs4xafLH umLuNcHFFvpon+nNPMmVHaNgHjwJ09KYgx27+JuFbmUtws8dzfW37MFrAvZBlWQOx573 RMLw== X-Gm-Message-State: AOAM5308FQWdXYLq0yFo3QDB+9tK31Chsb0yNQSTjNp9hlWZN7fqqOat mewVp2tT7YVh3HTpQr2ZV0AxiVV5szJQiw== X-Google-Smtp-Source: ABdhPJylRiMOUvvB9Q7QGQwBv4zeZtzXtxQvo6GeieAENB1RbdZE4EMn3dT4ONMYVtfIsseUA0K1Fg== X-Received: by 2002:a17:90b:354:: with SMTP id fh20mr13976737pjb.188.1634901798715; Fri, 22 Oct 2021 04:23:18 -0700 (PDT) Received: from localhost.localdomain ([2400:2411:502:a100:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id m4sm1701908pjl.11.2021.10.22.04.23.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Oct 2021 04:23:18 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Masahisa Kojima Subject: [PATCH 0/2] add selftest for EFI_TCG2_PROTOCOL and Measured Boot Date: Fri, 22 Oct 2021 20:24:23 +0900 Message-Id: <20211022112426.25009-1-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 This patch series adds the selftest for the EFI_TCG2_PROTOCOL and Measured Boot flow. This selftest is verified on qemu with swtpm. This covers most of the functionalities, but there are some limitations and TODO items. [Limitation] - tcg2 selftest must run at the beginning of the efi_selftest because some measurement occurs in efi_tcg2_register() and boottime->image_load(). Need to configure the efi_selftest with "setenv efi_selftest tcg2; bootefi selftest" - Skip ExitBootService measurement test - EFI application can not read PCR after calling ExitBootService - Skip EventLog Validation - Measured Boot measures U-Boot version, so EventLog varies every build having different commit hash. - Skip PCR[0] validation - PCR[0] include U-Boot version measurement, this value varies every build having different commit hash. - Skip PCR[7] validation - Secure Boot Variables can not be updated through efi_selftest. - The initial PCR value of PCR[17 - 22] is all 0xff, I'm not sure it is expected or not. [TODO] - GPT measurement test - Secure Boot Variable test - Eventlog validation Masahisa Kojima (2): efi_loader: add missing const qualifier efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot include/efi_api.h | 2 +- lib/efi_loader/efi_boottime.c | 5 +- lib/efi_selftest/Makefile | 10 + .../efi_selftest_miniapp_measuredboot.c | 93 ++ lib/efi_selftest/efi_selftest_tcg2.c | 804 +++++++++++++++++- 5 files changed, 910 insertions(+), 4 deletions(-) create mode 100644 lib/efi_selftest/efi_selftest_miniapp_measuredboot.c -- 2.17.1