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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 7B2D0ECAAA1 for ; Wed, 31 Aug 2022 03:06:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D702D849BA; Wed, 31 Aug 2022 05:06:05 +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="h34fSEiO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F1A93849C0; Wed, 31 Aug 2022 05:05:59 +0200 (CEST) Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) (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 AC067849AD for ; Wed, 31 Aug 2022 05:05:56 +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-oa1-x33.google.com with SMTP id 586e51a60fabf-11ee4649dfcso14909264fac.1 for ; Tue, 30 Aug 2022 20:05:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=r4z9zeDC84eZW5SFa4hTjNT6SIvmf+W3pCe2HemMewQ=; b=h34fSEiOnhdT6gTdJryFHQHTRfF0CR7WSYNN3p2xF3HVKykP+Z5rNaYcflho4UwWGY jBc6FSqO0nJd6uUDzfVLoZa0Wlu369Pj5cqUfV9JtlLN0TTvQyaCQJIMTqvZimDJj9Rw 2sdKUz+XY26pKEG6EyvW+oKxEtXv5YhSCBle4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=r4z9zeDC84eZW5SFa4hTjNT6SIvmf+W3pCe2HemMewQ=; b=jOXDgYXw2M83zN3GRIokug3B3rMJXKaHiT9YnEN+WhVNF3xC5z3GAI9v3UkiV4vlmB zfoafOzXMRJX9BoiCsD6ddSwGklOAB9wCA/i2gBFblmdE+iBGhzRnJDNtHAA1G1fHneQ ofQjrjI3om3pvxHP2MmLXJv4/qm+JNxNV6ZxWA8rplBLhQdG6ekCiwG6lSUMifeLeL8X v+Jx01Uu79mYCgPfghGjg+Xj+xjPH1rebcz6QaTACIg8qjgwzlk7wytdKwrfGwE+dNN5 ZKDBniRCbFNKCke2fWNZv+LDMJqi15uvymZzZ258/eMzhu0SJaQURVmD+NOugZ8/i0eB ibrw== X-Gm-Message-State: ACgBeo0wkHKsePJkbPdPkX2w6IL70keClbAB4+iPKjD6OFnuKrAy2Jai Z0nnJT159zwXC4Zb7bAaVlq3tTeQnEfS6g== X-Google-Smtp-Source: AA6agR5ds3x0Iwwav3gksRGDRxrP9s+EC93obIsvlU1+6wAI9XuJi1bAXgfMvlgQZ0t/BE62cD4ODw== X-Received: by 2002:a05:6870:79e:b0:11c:c216:4e42 with SMTP id en30-20020a056870079e00b0011cc2164e42mr517723oab.226.1661915155145; Tue, 30 Aug 2022 20:05:55 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id cp6-20020a056830660600b0063b34c35575sm2888129otb.42.2022.08.30.20.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 20:05:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Ilias Apalodimas Subject: [PATCH v5 2/7] tpm: Correct the permissions command in TPMv1 Date: Tue, 30 Aug 2022 21:05:33 -0600 Message-Id: <20220831030538.26742-3-sjg@chromium.org> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220831030538.26742-1-sjg@chromium.org> References: <20220831030538.26742-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean The offset here is incorrect. Fix it. Signed-off-by: Simon Glass Acked-by: Ilias Apalodimas --- (no changes since v1) lib/tpm-v1.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c index 22a769c5874..d0e3ab1b21d 100644 --- a/lib/tpm-v1.c +++ b/lib/tpm-v1.c @@ -456,12 +456,13 @@ u32 tpm1_get_permissions(struct udevice *dev, u32 index, u32 *perm) 0x0, 0x0, 0x0, 0x4, }; const size_t index_offset = 18; - const size_t perm_offset = 60; + const size_t perm_offset = 74; u8 buf[COMMAND_BUFFER_SIZE], response[COMMAND_BUFFER_SIZE]; size_t response_length = sizeof(response); u32 err; - if (pack_byte_string(buf, sizeof(buf), "d", 0, command, sizeof(command), + if (pack_byte_string(buf, sizeof(buf), "sd", + 0, command, sizeof(command), index_offset, index)) return TPM_LIB_ERROR; err = tpm_sendrecv_command(dev, buf, response, &response_length); -- 2.37.2.672.g94769d06f0-goog