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 B77FDC32771 for ; Fri, 19 Aug 2022 13:47:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F3A984B5F; Fri, 19 Aug 2022 15:47:20 +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="IyDa5/R0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9A4DD84B68; Fri, 19 Aug 2022 15:47:18 +0200 (CEST) Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) (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 A3AE284B63 for ; Fri, 19 Aug 2022 15:47:14 +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-x32a.google.com with SMTP id a14-20020a0568300b8e00b0061c4e3eb52aso3111036otv.3 for ; Fri, 19 Aug 2022 06:47:14 -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; bh=ETlvf4FLEWeUZk4l3rDhFKVhOFpY1ThwApO7rQEFZjI=; b=IyDa5/R0xJj/OYzWZO/TCc90ybHxu5ALTH0oIoepF2Eidsq45laT9N/Pf+HQE93NDU SJXfCB10jbexcopUJ7lPZ06D+wZfxdV/XAynkgJcR/pFeGdeik1X+gU0ZEfpqus23coK 6t3VkujEYxuobo32IjqIITYRxjwxhbpBs5gmg= 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; bh=ETlvf4FLEWeUZk4l3rDhFKVhOFpY1ThwApO7rQEFZjI=; b=BbPPrv1V9KPndrD+7YOO+L2EXgsq4LlDKK7Oq3dNlmRIKb+HMDp4T1pzgZtl3bCx1e evqTpc8Sogjfq4ifz5Ihn+qnK3HjeuWytyZ+sVDSd8dk9Ha9KPzfhcwHuWzmUlXAXkYY ZRPapk/6cp4kw8N6wezYv+8DpNwXyX2Tl44b7TxdfiXuOHidocrqbagwwnIq1sk3dCKK 4HwrVjeq3grs6rMfbYjvAze2ct63AWQ5hPr3RybsX37l0bew/cA8i3f6s0SLtu3kf1in ru/0/mzRWd+z+LsfVzXrHLL9O9DmGH1xpJxemcOvgTIwgGrOfgr1BasiYQBrYyioUmZF NDHw== X-Gm-Message-State: ACgBeo33O/JWEPAEDzJ1PLB/5nbq21fLzimGgfrDFqfZt+MZWe5q13Ff 0qi0OWNJWyavv/sQaBea7lNMfYO+NDI+UQ== X-Google-Smtp-Source: AA6agR6MHzflr5hxFTPvZeTziDjVF+MJhPkGD6gQzN1rAsNQpH03SXjBpsvKDayfp8ffwTq+1KC/bw== X-Received: by 2002:a05:6830:6384:b0:639:94c:cb62 with SMTP id ch4-20020a056830638400b00639094ccb62mr726602otb.370.1660916833052; Fri, 19 Aug 2022 06:47:13 -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 z36-20020a056870d6a400b0011856117469sm1309429oap.10.2022.08.19.06.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 06:47:12 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Ilias Apalodimas , Mathew McBride Subject: [PATCH v3 2/7] tpm: Correct the permissions command in TPMv1 Date: Fri, 19 Aug 2022 07:46:42 -0600 Message-Id: <20220819134647.269563-3-sjg@chromium.org> X-Mailer: git-send-email 2.37.1.595.g718a3a8f04-goog In-Reply-To: <20220819134647.269563-1-sjg@chromium.org> References: <20220819134647.269563-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 --- (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.1.595.g718a3a8f04-goog