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=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,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 9D94DC636C8 for ; Sun, 18 Jul 2021 20:19:07 +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 05C8661166 for ; Sun, 18 Jul 2021 20:19:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05C8661166 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 C50AB82C26; Sun, 18 Jul 2021 22:18:29 +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="GOOG2jvS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D06882B36; Sun, 18 Jul 2021 22:18:18 +0200 (CEST) Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) (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 39E71828EB for ; 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=sjg@chromium.org Received: by mail-oo1-xc30.google.com with SMTP id 128-20020a4a11860000b029024b19a4d98eso3931803ooc.5 for ; Sun, 18 Jul 2021 13:18:15 -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=cs4MItIPgA4ukq3dsj/zNUGD/tTksyNHNcJI6W3NxMY=; b=GOOG2jvSt5fryHYw0sZ3b2ynovqzV8MRNRB5pd3Ts4uCFuWX+9yYskBC/hxK0iKvmY Yizk/YidCrPeqajM0aqn7IzVt+fM2BxS9BV5jvB9SWyD5s8vJpeobYeyGfFIUnvU3mr1 wRH+abWzlX5uL+h3TVHsDXw31pXzff9DRSjNU= 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=cs4MItIPgA4ukq3dsj/zNUGD/tTksyNHNcJI6W3NxMY=; b=CAX6nUFukb9u+FIGOBda1wmS3BgjS43gKj+uUiEeILt1zodolZxre9s99PRrYZwKNL U74mQjXcjYN5cBC2oYmReq3E1ocoM7g4Ce8YLsf+Kva/j1hI/6rjNLUyK99ZVkBhIIgU Q1iIQqsD5uA1MVkQed/EpqVIoC0k4WoCbOc+KfPGZfMgzf916DHvXnech6g+yR2qL49f T+PTWRtpzAWsnkSlqbIqQ27bZFxv2xQGZ3jFPkAiTJMUIcAdZzJhslelSUksiZpbrtSP q6GRlx23EzxEQfnc+ugk3y+hJmgiMuWyVXW2VoVs8gFSv0cQ73Wjkclw0uX6H6llD8Ku EEUA== X-Gm-Message-State: AOAM533ynXHgvVEHcTuufKzuhy19Rph790h/wyrAksNCaZbwQEJFGOfT HCv2lsAMMzD8ma+aSQQb7ULn9rdA9nupwp9x X-Google-Smtp-Source: ABdhPJzMhKnzqkw3yNFaH3hBtAe4xHdMqHeTjISIQn1I1VoepsYmTKZ4/xSjseihIkoqDzzLVc6knQ== X-Received: by 2002:a4a:9b99:: with SMTP id x25mr15565089ooj.85.1626639493674; Sun, 18 Jul 2021 13:18:13 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Jul 2021 13:18:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Thirupathaiah Annapureddy , Simon Glass , Heinrich Schuchardt Subject: [PATCH v2 05/10] sandbox: tpm: Finish comments for struct sandbox_tpm2 Date: Sun, 18 Jul 2021 14:18:01 -0600 Message-Id: <20210718201806.761202-6-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.402.g57bb445576-goog In-Reply-To: <20210718201806.761202-1-sjg@chromium.org> References: <20210718201806.761202-1-sjg@chromium.org> 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 Tidy up the missing comments for this struct. Signed-off-by: Simon Glass --- (no changes since v1) 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]; }; -- 2.32.0.402.g57bb445576-goog