Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 010C1C636C8 for ; Sun, 18 Jul 2021 20:18:17 +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 3A2F761166 for ; Sun, 18 Jul 2021 20:18:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A2F761166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6C31380615; Sun, 18 Jul 2021 22:18:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="IJF8YemV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B83F680563; Sun, 18 Jul 2021 22:18:13 +0200 (CEST) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (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 0BE7480563 for ; Sun, 18 Jul 2021 22:18:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-ot1-x32f.google.com with SMTP id b18-20020a0568303112b02904cf73f54f4bso2468270ots.2 for ; Sun, 18 Jul 2021 13:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yl+N2yGPh824THSXQ53GfSw9Xz5K0txkbkmDSvvZUK4=; b=IJF8YemV8rb/OfNG31rB3VoA9msuN7vu8hlt9GBXdqyah9A8zqI+lXPMVKcm2aBOS1 uIpQFMLRKB8Wr/Ad2NsT/rNvBHDe9sccM/G3n/6TgsDgpQM2VoHrp9hQb4rEPuATQZEw Gy51v46+jrHKNFnVJ18TsrEBgxyc+6xjwSUuI= 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=yl+N2yGPh824THSXQ53GfSw9Xz5K0txkbkmDSvvZUK4=; b=tRec5SPs7OsWRUGJjw9eVkQV2PIHG2x4DarTMh24PGJ/1u0vSTsrali5InrBwIkXO0 YUmUS3AFxoilhhLk/W7GlzJEfU6+qMbD5dexXlBgIzzi3d4Zu59Sf6dQ8Er0S0dJBp7G ErDiklOzxW+vlNLvIc1hPmeIfmVJWWshizFPH5XzBadDrBdsAD6wlhiQzQlB//WCqAVo AJiiQYfIfKozX/dNbbBWeG0qfLy+bFqGN6Ml4IUVZwuA1Fx21FgNUG+SGoAfEPWRik4/ 9b7S7XbRivHDPHj+yM/YBz9BInUac4A1cWRCOmEH/0USU5r/1J0zGfQRvUvgxIHiw5RQ Mb9Q== X-Gm-Message-State: AOAM531lx9wxMViDL6CQIHgpkdf7ZMsJj7iuOHORJR47I5O94m5o8Rxt aHE2zNQ7ybIhPnnlkTMpc4SWKd+2aQem4LqA X-Google-Smtp-Source: ABdhPJyWuDDxWlGtPcKjUKbjlP8GvVpip4sab7ngJBT/FdqNdpsW+OOd9B8J6ZjoET5hGZuNhxvUxQ== X-Received: by 2002:a9d:7999:: with SMTP id h25mr16995563otm.9.1626639489405; Sun, 18 Jul 2021 13:18:09 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id g1sm3031606ooi.34.2021.07.18.13.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 13:18:09 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Thirupathaiah Annapureddy , Simon Glass , Heinrich Schuchardt , Masahisa Kojima Subject: [PATCH v2 00/10] tpm: Enhance sandbox tpm2 emulation Date: Sun, 18 Jul 2021 14:17:56 -0600 Message-Id: <20210718201806.761202-1-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog 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 At present the TPM2 emulator lacks the ability to load and save the state. This means it cannot be used for verify-boot flow that includes multiple phases (e.g. VPL and SPL). It also lacks support for non-volatile data storage. This series adds these features to the TPM2 emulator, with some code from TPM1 moving into a common file. A few other clean-ups are included to make the two emulators more similar. Changes in v2: - Add new patch to correct handling of SANDBOX_TPM_PCR_NB - Drop the constant sandbox_extended_once_pcr since we can calculate it - Update the commit message to explain that there is only one PCR Simon Glass (10): sandbox: tpm: Split out common nvdata code sandbox: tpm: Tidy up reading and writing of device state sandbox: tpm: Support the define-space command sandbox: tpm: Correct handling of get-capability sandbox: tpm: Finish comments for struct sandbox_tpm2 sandbox: tpm: Track whether the state is valid sandbox: tpm: Support nvdata in TPM2 sandbox: tpm: Support storing device state in tpm2 sandbox: tpm: Correct handling of SANDBOX_TPM_PCR_NB sandbox: tpm: Support extending a PCR multiple times drivers/tpm/Makefile | 4 +- drivers/tpm/sandbox_common.c | 77 +++++++++ drivers/tpm/sandbox_common.h | 108 +++++++++++++ drivers/tpm/tpm2_tis_sandbox.c | 283 +++++++++++++++++++++++++++++---- drivers/tpm/tpm_tis_sandbox.c | 171 ++++++-------------- include/tpm-v2.h | 2 + test/py/tests/test_tpm2.py | 18 ++- 7 files changed, 505 insertions(+), 158 deletions(-) create mode 100644 drivers/tpm/sandbox_common.c create mode 100644 drivers/tpm/sandbox_common.h -- 2.32.0.402.g57bb445576-goog