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 F383CC32789 for ; Tue, 23 Aug 2022 17:13:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 691A18483A; Tue, 23 Aug 2022 19:13:06 +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="WqQ0eg7Y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B8E4B8025C; Tue, 23 Aug 2022 19:13:00 +0200 (CEST) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 8BEC483AC3 for ; Tue, 23 Aug 2022 19:12:57 +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-pj1-x102d.google.com with SMTP id c16-20020a17090aa61000b001fb3286d9f7so1640122pjq.1 for ; Tue, 23 Aug 2022 10:12:57 -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=E4LaXpF3gTpJ55bxs4EBbg1IDETZI4ft1Qefya66e5U=; b=WqQ0eg7YvytBqquQ8fGNoNayrA5LbihZhcnr7I44QxrAzfnkB1yfyeDCnI6Vff1o/M zxCMc25C/TDQk1sIcfsxYuYqu4QFw21KqPC+lsehAq2NwOGbXmjF4ARHwjfiLxgV+NoN bwduy7EySjqOZzO5oC4gzxoezI+/MwSR4Zgyg= 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=E4LaXpF3gTpJ55bxs4EBbg1IDETZI4ft1Qefya66e5U=; b=oM9YC4VM0coyr33yd30JWC3itp/D223bks1qBe6ePJafAdLFKtrviNcIMdw6FzEMVA JV6V4y3LKbnU1is3qdqO2yqT4W+WeTE/5Wj3F+D4KDDf35XNpmAKSNQiMteHjPfDwwCU sZqlY/M0blAvqaVf70Z3CZcJGew8WaRSgODmRg/ve1JRZKGMrqvfi27oCh1ohXe1xyu7 pVVDNklPHPbZiPfeyDASPOYyJXSGocFDzkQVzw2DJoj0S3dLROnGFCN1t0FF04iXD8WW 5WBJUQPOdzBHPOa29MwkX8/bHNfZ7/cTOQ0l7t5lBr7x6yo+e99hJTDXOL0t8a6xRbA2 0tjQ== X-Gm-Message-State: ACgBeo149AVzwF5O4Jnwu4g6AFpdH5M4R61oQFX/j6a6H/kjlrpOF9/i bx1Ju2BVXt+Jb6v25hke/qWsm3EyG7VJjTyh X-Google-Smtp-Source: AA6agR6CkMXvEagUGahmilryILjLuMl4oKTxI8hEJd8tf39f2jiysr2pr2i93DjBpB7uezbFl2wtIA== X-Received: by 2002:a17:902:da8f:b0:16f:e43:efda with SMTP id j15-20020a170902da8f00b0016f0e43efdamr24811462plx.164.1661274775674; Tue, 23 Aug 2022 10:12:55 -0700 (PDT) Received: from sjg1.corp.google.com ([2620:0:1000:2514:4cd7:64:5174:de80]) by smtp.gmail.com with ESMTPSA id x3-20020a170902a38300b0016f154c8910sm10759441pla.204.2022.08.23.10.12.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 10:12:55 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Ilias Apalodimas , Mathew McBride Subject: [PATCH v4 2/7] tpm: Correct the permissions command in TPMv1 Date: Tue, 23 Aug 2022 10:12:35 -0700 Message-Id: <20220823171240.386269-3-sjg@chromium.org> X-Mailer: git-send-email 2.37.2.609.g9ff673ca1a-goog In-Reply-To: <20220823171240.386269-1-sjg@chromium.org> References: <20220823171240.386269-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.2.609.g9ff673ca1a-goog