From patchwork Mon Jul 5 15:48:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500854 X-Patchwork-Delegate: sjg@chromium.org 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=BN/YxEtu; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4GJVVx4z8sz9sX1 for ; Tue, 6 Jul 2021 01:49:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9318982C03; Mon, 5 Jul 2021 17:49: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="BN/YxEtu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5286682BE3; Mon, 5 Jul 2021 17:49:06 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) (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 48AC782BE8 for ; Mon, 5 Jul 2021 17:49:00 +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-x32d.google.com with SMTP id f12-20020a056830204cb029048bcf4c6bd9so6628675otp.8 for ; Mon, 05 Jul 2021 08:49:00 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=pyfc22tA02SWJI7WbsP/PWHIJrqC/p+0vqHEqfZdVro=; b=BN/YxEtuv8fDclF7LquwqSRyprh7kfOYg6Xs3M4DMsGDIp9yU63e3bCL4WU2vhSvNk bTSm80wz/Punt5+oz0ugqmbqF2JUlazKQ90yRrr0K6s/qNm8nz5G0K+nrasKexSjI3lx HYWUGa7NrCIqxFfXtObLeKSUfXZAnnxo2N3ZY= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=pyfc22tA02SWJI7WbsP/PWHIJrqC/p+0vqHEqfZdVro=; b=j325WPTfLQbPf9tvr4y/jgcG9mkgNkbBrDIOCdBrqq8K0y5dxphYiM5sey7bbeTa21 fQCDG35+944VF1DWhJFwpSB+Xi3FK1DDkuIuxLwUiZA94D+Vl+bZz5EQm6zOjxZlNe8h fDUQoCCo3nmizsORZVHmTRqzOpIinasxspVa5K/5W75QKmWaRCzWSfm1Vnf6jkEwixyH sKWzNNjXlw/ZMVt7cMVPCOVyMrDPjEMxWDaM5nBX2yhEjk+ed3bN89bqvo8izzrMtjtW 5PnPoVUrmnAcke7OFx3d1pA5sBg+GpoNQg+ARBiI6/AGoOV87B/nfn0lOBaQb8/+19dS UrSA== X-Gm-Message-State: AOAM533C1IE4ESn9VmzfdFoqicrs+Fqcf+l+z4kfrsiyAgBkk4AAkB3+ BfJE/kyiHYxdBGRHv7Yoh7RfiRD6etugkyMb X-Google-Smtp-Source: ABdhPJzhkBC4DniMe6dEIhfGnRr3RThbNr0zkq5skqpoAPdmIkbyvtydtQd2f5HFShM+DnHeAVHFEA== X-Received: by 2002:a9d:76d7:: with SMTP id p23mr11447029otl.145.1625500138741; Mon, 05 Jul 2021 08:48:58 -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 n65sm2652038ota.37.2021.07.05.08.48.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 08:48:58 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Thirupathaiah Annapureddy , Ilias Apalodimas , Simon Glass , Heinrich Schuchardt Subject: [PATCH 5/9] sandbox: tpm: Finish comments for struct sandbox_tpm2 Date: Mon, 5 Jul 2021 09:48:45 -0600 Message-Id: <20210705154849.2083972-6-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705154849.2083972-1-sjg@chromium.org> References: <20210705154849.2083972-1-sjg@chromium.org> MIME-Version: 1.0 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 Tidy up the missing comments for this struct. Signed-off-by: Simon Glass Acked-by: Ilias Apalodimas --- drivers/tpm/tpm2_tis_sandbox.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c index 24c804a5645..5e0bd304699 100644 --- a/drivers/tpm/tpm2_tis_sandbox.c +++ b/drivers/tpm/tpm2_tis_sandbox.c @@ -45,19 +45,31 @@ static const u8 sandbox_extended_once_pcr[] = { 0xea, 0x98, 0x31, 0xa9, 0x27, 0x59, 0xfb, 0x4b, }; +/* + * Information about our TPM emulation. This is preserved in the sandbox + * state file if enabled. + * + * @init_done: true if open() has been called + * @startup_done: true if TPM2_CC_STARTUP has been processed + * @tests_done: true if TPM2_CC_SELF_TEST has be processed + * @pw: TPM password per hierarchy + * @pw_sz: Size of each password in bytes + * @properties: TPM properties + * @pcr: TPM Platform Configuration Registers. Each of these holds a hash and + * can be 'extended' a number of times, meaning another hash is added into + * its value (initial value all zeroes) + * @pcr_extensions: Number of times each PCR has been extended (starts at 0) + * @nvdata: non-volatile data, used to store important things for the platform + */ struct sandbox_tpm2 { /* TPM internal states */ bool init_done; bool startup_done; bool tests_done; - /* TPM password per hierarchy */ char pw[TPM2_HIERARCHY_NB][TPM2_DIGEST_LEN + 1]; int pw_sz[TPM2_HIERARCHY_NB]; - /* TPM properties */ u32 properties[TPM2_PROPERTY_NB]; - /* TPM PCRs */ u8 pcr[SANDBOX_TPM_PCR_NB][TPM2_DIGEST_LEN]; - /* TPM PCR extensions */ u32 pcr_extensions[SANDBOX_TPM_PCR_NB]; };